pdf.worker.mjs 2.1 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * JavaScript code in this page
  4. *
  5. * Copyright 2024 Mozilla Foundation
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. *
  19. * @licend The above is the entire license notice for the
  20. * JavaScript code in this page
  21. */
  22. /******/ // The require scope
  23. /******/ var __webpack_require__ = {};
  24. /******/
  25. /************************************************************************/
  26. /******/ /* webpack/runtime/define property getters */
  27. /******/ (() => {
  28. /******/ // define getter functions for harmony exports
  29. /******/ __webpack_require__.d = (exports, definition) => {
  30. /******/ for(var key in definition) {
  31. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  32. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  33. /******/ }
  34. /******/ }
  35. /******/ };
  36. /******/ })();
  37. /******/
  38. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  39. /******/ (() => {
  40. /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  41. /******/ })();
  42. /******/
  43. /************************************************************************/
  44. var __webpack_exports__ = globalThis.pdfjsWorker = {};
  45. // EXPORTS
  46. __webpack_require__.d(__webpack_exports__, {
  47. WorkerMessageHandler: () => (/* reexport */ WorkerMessageHandler)
  48. });
  49. ;// ./src/shared/util.js
  50. const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
  51. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  52. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  53. const MAX_IMAGE_SIZE_TO_CACHE = 10e6;
  54. const LINE_FACTOR = 1.35;
  55. const LINE_DESCENT_FACTOR = 0.35;
  56. const BASELINE_FACTOR = LINE_DESCENT_FACTOR / LINE_FACTOR;
  57. const RenderingIntentFlag = {
  58. ANY: 0x01,
  59. DISPLAY: 0x02,
  60. PRINT: 0x04,
  61. SAVE: 0x08,
  62. ANNOTATIONS_FORMS: 0x10,
  63. ANNOTATIONS_STORAGE: 0x20,
  64. ANNOTATIONS_DISABLE: 0x40,
  65. IS_EDITING: 0x80,
  66. OPLIST: 0x100
  67. };
  68. const AnnotationMode = {
  69. DISABLE: 0,
  70. ENABLE: 1,
  71. ENABLE_FORMS: 2,
  72. ENABLE_STORAGE: 3
  73. };
  74. const AnnotationEditorPrefix = "pdfjs_internal_editor_";
  75. const AnnotationEditorType = {
  76. DISABLE: -1,
  77. NONE: 0,
  78. FREETEXT: 3,
  79. HIGHLIGHT: 9,
  80. STAMP: 13,
  81. INK: 15
  82. };
  83. const AnnotationEditorParamsType = {
  84. RESIZE: 1,
  85. CREATE: 2,
  86. FREETEXT_SIZE: 11,
  87. FREETEXT_COLOR: 12,
  88. FREETEXT_OPACITY: 13,
  89. INK_COLOR: 21,
  90. INK_THICKNESS: 22,
  91. INK_OPACITY: 23,
  92. HIGHLIGHT_COLOR: 31,
  93. HIGHLIGHT_DEFAULT_COLOR: 32,
  94. HIGHLIGHT_THICKNESS: 33,
  95. HIGHLIGHT_FREE: 34,
  96. HIGHLIGHT_SHOW_ALL: 35
  97. };
  98. const PermissionFlag = {
  99. PRINT: 0x04,
  100. MODIFY_CONTENTS: 0x08,
  101. COPY: 0x10,
  102. MODIFY_ANNOTATIONS: 0x20,
  103. FILL_INTERACTIVE_FORMS: 0x100,
  104. COPY_FOR_ACCESSIBILITY: 0x200,
  105. ASSEMBLE: 0x400,
  106. PRINT_HIGH_QUALITY: 0x800
  107. };
  108. const TextRenderingMode = {
  109. FILL: 0,
  110. STROKE: 1,
  111. FILL_STROKE: 2,
  112. INVISIBLE: 3,
  113. FILL_ADD_TO_PATH: 4,
  114. STROKE_ADD_TO_PATH: 5,
  115. FILL_STROKE_ADD_TO_PATH: 6,
  116. ADD_TO_PATH: 7,
  117. FILL_STROKE_MASK: 3,
  118. ADD_TO_PATH_FLAG: 4
  119. };
  120. const ImageKind = {
  121. GRAYSCALE_1BPP: 1,
  122. RGB_24BPP: 2,
  123. RGBA_32BPP: 3
  124. };
  125. const AnnotationType = {
  126. TEXT: 1,
  127. LINK: 2,
  128. FREETEXT: 3,
  129. LINE: 4,
  130. SQUARE: 5,
  131. CIRCLE: 6,
  132. POLYGON: 7,
  133. POLYLINE: 8,
  134. HIGHLIGHT: 9,
  135. UNDERLINE: 10,
  136. SQUIGGLY: 11,
  137. STRIKEOUT: 12,
  138. STAMP: 13,
  139. CARET: 14,
  140. INK: 15,
  141. POPUP: 16,
  142. FILEATTACHMENT: 17,
  143. SOUND: 18,
  144. MOVIE: 19,
  145. WIDGET: 20,
  146. SCREEN: 21,
  147. PRINTERMARK: 22,
  148. TRAPNET: 23,
  149. WATERMARK: 24,
  150. THREED: 25,
  151. REDACT: 26
  152. };
  153. const AnnotationReplyType = {
  154. GROUP: "Group",
  155. REPLY: "R"
  156. };
  157. const AnnotationFlag = {
  158. INVISIBLE: 0x01,
  159. HIDDEN: 0x02,
  160. PRINT: 0x04,
  161. NOZOOM: 0x08,
  162. NOROTATE: 0x10,
  163. NOVIEW: 0x20,
  164. READONLY: 0x40,
  165. LOCKED: 0x80,
  166. TOGGLENOVIEW: 0x100,
  167. LOCKEDCONTENTS: 0x200
  168. };
  169. const AnnotationFieldFlag = {
  170. READONLY: 0x0000001,
  171. REQUIRED: 0x0000002,
  172. NOEXPORT: 0x0000004,
  173. MULTILINE: 0x0001000,
  174. PASSWORD: 0x0002000,
  175. NOTOGGLETOOFF: 0x0004000,
  176. RADIO: 0x0008000,
  177. PUSHBUTTON: 0x0010000,
  178. COMBO: 0x0020000,
  179. EDIT: 0x0040000,
  180. SORT: 0x0080000,
  181. FILESELECT: 0x0100000,
  182. MULTISELECT: 0x0200000,
  183. DONOTSPELLCHECK: 0x0400000,
  184. DONOTSCROLL: 0x0800000,
  185. COMB: 0x1000000,
  186. RICHTEXT: 0x2000000,
  187. RADIOSINUNISON: 0x2000000,
  188. COMMITONSELCHANGE: 0x4000000
  189. };
  190. const AnnotationBorderStyleType = {
  191. SOLID: 1,
  192. DASHED: 2,
  193. BEVELED: 3,
  194. INSET: 4,
  195. UNDERLINE: 5
  196. };
  197. const AnnotationActionEventType = {
  198. E: "Mouse Enter",
  199. X: "Mouse Exit",
  200. D: "Mouse Down",
  201. U: "Mouse Up",
  202. Fo: "Focus",
  203. Bl: "Blur",
  204. PO: "PageOpen",
  205. PC: "PageClose",
  206. PV: "PageVisible",
  207. PI: "PageInvisible",
  208. K: "Keystroke",
  209. F: "Format",
  210. V: "Validate",
  211. C: "Calculate"
  212. };
  213. const DocumentActionEventType = {
  214. WC: "WillClose",
  215. WS: "WillSave",
  216. DS: "DidSave",
  217. WP: "WillPrint",
  218. DP: "DidPrint"
  219. };
  220. const PageActionEventType = {
  221. O: "PageOpen",
  222. C: "PageClose"
  223. };
  224. const VerbosityLevel = {
  225. ERRORS: 0,
  226. WARNINGS: 1,
  227. INFOS: 5
  228. };
  229. const OPS = {
  230. dependency: 1,
  231. setLineWidth: 2,
  232. setLineCap: 3,
  233. setLineJoin: 4,
  234. setMiterLimit: 5,
  235. setDash: 6,
  236. setRenderingIntent: 7,
  237. setFlatness: 8,
  238. setGState: 9,
  239. save: 10,
  240. restore: 11,
  241. transform: 12,
  242. moveTo: 13,
  243. lineTo: 14,
  244. curveTo: 15,
  245. curveTo2: 16,
  246. curveTo3: 17,
  247. closePath: 18,
  248. rectangle: 19,
  249. stroke: 20,
  250. closeStroke: 21,
  251. fill: 22,
  252. eoFill: 23,
  253. fillStroke: 24,
  254. eoFillStroke: 25,
  255. closeFillStroke: 26,
  256. closeEOFillStroke: 27,
  257. endPath: 28,
  258. clip: 29,
  259. eoClip: 30,
  260. beginText: 31,
  261. endText: 32,
  262. setCharSpacing: 33,
  263. setWordSpacing: 34,
  264. setHScale: 35,
  265. setLeading: 36,
  266. setFont: 37,
  267. setTextRenderingMode: 38,
  268. setTextRise: 39,
  269. moveText: 40,
  270. setLeadingMoveText: 41,
  271. setTextMatrix: 42,
  272. nextLine: 43,
  273. showText: 44,
  274. showSpacedText: 45,
  275. nextLineShowText: 46,
  276. nextLineSetSpacingShowText: 47,
  277. setCharWidth: 48,
  278. setCharWidthAndBounds: 49,
  279. setStrokeColorSpace: 50,
  280. setFillColorSpace: 51,
  281. setStrokeColor: 52,
  282. setStrokeColorN: 53,
  283. setFillColor: 54,
  284. setFillColorN: 55,
  285. setStrokeGray: 56,
  286. setFillGray: 57,
  287. setStrokeRGBColor: 58,
  288. setFillRGBColor: 59,
  289. setStrokeCMYKColor: 60,
  290. setFillCMYKColor: 61,
  291. shadingFill: 62,
  292. beginInlineImage: 63,
  293. beginImageData: 64,
  294. endInlineImage: 65,
  295. paintXObject: 66,
  296. markPoint: 67,
  297. markPointProps: 68,
  298. beginMarkedContent: 69,
  299. beginMarkedContentProps: 70,
  300. endMarkedContent: 71,
  301. beginCompat: 72,
  302. endCompat: 73,
  303. paintFormXObjectBegin: 74,
  304. paintFormXObjectEnd: 75,
  305. beginGroup: 76,
  306. endGroup: 77,
  307. beginAnnotation: 80,
  308. endAnnotation: 81,
  309. paintImageMaskXObject: 83,
  310. paintImageMaskXObjectGroup: 84,
  311. paintImageXObject: 85,
  312. paintInlineImageXObject: 86,
  313. paintInlineImageXObjectGroup: 87,
  314. paintImageXObjectRepeat: 88,
  315. paintImageMaskXObjectRepeat: 89,
  316. paintSolidColorImageMask: 90,
  317. constructPath: 91,
  318. setStrokeTransparent: 92,
  319. setFillTransparent: 93
  320. };
  321. const PasswordResponses = {
  322. NEED_PASSWORD: 1,
  323. INCORRECT_PASSWORD: 2
  324. };
  325. let verbosity = VerbosityLevel.WARNINGS;
  326. function setVerbosityLevel(level) {
  327. if (Number.isInteger(level)) {
  328. verbosity = level;
  329. }
  330. }
  331. function getVerbosityLevel() {
  332. return verbosity;
  333. }
  334. function info(msg) {
  335. if (verbosity >= VerbosityLevel.INFOS) {
  336. console.log(`Info: ${msg}`);
  337. }
  338. }
  339. function warn(msg) {
  340. if (verbosity >= VerbosityLevel.WARNINGS) {
  341. console.log(`Warning: ${msg}`);
  342. }
  343. }
  344. function unreachable(msg) {
  345. throw new Error(msg);
  346. }
  347. function assert(cond, msg) {
  348. if (!cond) {
  349. unreachable(msg);
  350. }
  351. }
  352. function _isValidProtocol(url) {
  353. switch (url?.protocol) {
  354. case "http:":
  355. case "https:":
  356. case "ftp:":
  357. case "mailto:":
  358. case "tel:":
  359. return true;
  360. default:
  361. return false;
  362. }
  363. }
  364. function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
  365. if (!url) {
  366. return null;
  367. }
  368. try {
  369. if (options && typeof url === "string") {
  370. if (options.addDefaultProtocol && url.startsWith("www.")) {
  371. const dots = url.match(/\./g);
  372. if (dots?.length >= 2) {
  373. url = `http://${url}`;
  374. }
  375. }
  376. if (options.tryConvertEncoding) {
  377. try {
  378. url = stringToUTF8String(url);
  379. } catch {}
  380. }
  381. }
  382. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  383. if (_isValidProtocol(absoluteUrl)) {
  384. return absoluteUrl;
  385. }
  386. } catch {}
  387. return null;
  388. }
  389. function shadow(obj, prop, value, nonSerializable = false) {
  390. Object.defineProperty(obj, prop, {
  391. value,
  392. enumerable: !nonSerializable,
  393. configurable: true,
  394. writable: false
  395. });
  396. return value;
  397. }
  398. const BaseException = function BaseExceptionClosure() {
  399. function BaseException(message, name) {
  400. this.message = message;
  401. this.name = name;
  402. }
  403. BaseException.prototype = new Error();
  404. BaseException.constructor = BaseException;
  405. return BaseException;
  406. }();
  407. class PasswordException extends BaseException {
  408. constructor(msg, code) {
  409. super(msg, "PasswordException");
  410. this.code = code;
  411. }
  412. }
  413. class UnknownErrorException extends BaseException {
  414. constructor(msg, details) {
  415. super(msg, "UnknownErrorException");
  416. this.details = details;
  417. }
  418. }
  419. class InvalidPDFException extends BaseException {
  420. constructor(msg) {
  421. super(msg, "InvalidPDFException");
  422. }
  423. }
  424. class MissingPDFException extends BaseException {
  425. constructor(msg) {
  426. super(msg, "MissingPDFException");
  427. }
  428. }
  429. class UnexpectedResponseException extends BaseException {
  430. constructor(msg, status) {
  431. super(msg, "UnexpectedResponseException");
  432. this.status = status;
  433. }
  434. }
  435. class FormatError extends BaseException {
  436. constructor(msg) {
  437. super(msg, "FormatError");
  438. }
  439. }
  440. class AbortException extends BaseException {
  441. constructor(msg) {
  442. super(msg, "AbortException");
  443. }
  444. }
  445. function bytesToString(bytes) {
  446. if (typeof bytes !== "object" || bytes?.length === undefined) {
  447. unreachable("Invalid argument for bytesToString");
  448. }
  449. const length = bytes.length;
  450. const MAX_ARGUMENT_COUNT = 8192;
  451. if (length < MAX_ARGUMENT_COUNT) {
  452. return String.fromCharCode.apply(null, bytes);
  453. }
  454. const strBuf = [];
  455. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  456. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  457. const chunk = bytes.subarray(i, chunkEnd);
  458. strBuf.push(String.fromCharCode.apply(null, chunk));
  459. }
  460. return strBuf.join("");
  461. }
  462. function stringToBytes(str) {
  463. if (typeof str !== "string") {
  464. unreachable("Invalid argument for stringToBytes");
  465. }
  466. const length = str.length;
  467. const bytes = new Uint8Array(length);
  468. for (let i = 0; i < length; ++i) {
  469. bytes[i] = str.charCodeAt(i) & 0xff;
  470. }
  471. return bytes;
  472. }
  473. function string32(value) {
  474. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  475. }
  476. function objectSize(obj) {
  477. return Object.keys(obj).length;
  478. }
  479. function objectFromMap(map) {
  480. const obj = Object.create(null);
  481. for (const [key, value] of map) {
  482. obj[key] = value;
  483. }
  484. return obj;
  485. }
  486. function isLittleEndian() {
  487. const buffer8 = new Uint8Array(4);
  488. buffer8[0] = 1;
  489. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  490. return view32[0] === 1;
  491. }
  492. function isEvalSupported() {
  493. try {
  494. new Function("");
  495. return true;
  496. } catch {
  497. return false;
  498. }
  499. }
  500. class FeatureTest {
  501. static get isLittleEndian() {
  502. return shadow(this, "isLittleEndian", isLittleEndian());
  503. }
  504. static get isEvalSupported() {
  505. return shadow(this, "isEvalSupported", isEvalSupported());
  506. }
  507. static get isOffscreenCanvasSupported() {
  508. return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
  509. }
  510. static get platform() {
  511. if (typeof navigator !== "undefined" && typeof navigator?.platform === "string") {
  512. return shadow(this, "platform", {
  513. isMac: navigator.platform.includes("Mac"),
  514. isWindows: navigator.platform.includes("Win"),
  515. isFirefox: typeof navigator?.userAgent === "string" && navigator.userAgent.includes("Firefox")
  516. });
  517. }
  518. return shadow(this, "platform", {
  519. isMac: false,
  520. isWindows: false,
  521. isFirefox: false
  522. });
  523. }
  524. static get isCSSRoundSupported() {
  525. return shadow(this, "isCSSRoundSupported", globalThis.CSS?.supports?.("width: round(1.5px, 1px)"));
  526. }
  527. }
  528. const hexNumbers = Array.from(Array(256).keys(), n => n.toString(16).padStart(2, "0"));
  529. class Util {
  530. static makeHexColor(r, g, b) {
  531. return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
  532. }
  533. static scaleMinMax(transform, minMax) {
  534. let temp;
  535. if (transform[0]) {
  536. if (transform[0] < 0) {
  537. temp = minMax[0];
  538. minMax[0] = minMax[2];
  539. minMax[2] = temp;
  540. }
  541. minMax[0] *= transform[0];
  542. minMax[2] *= transform[0];
  543. if (transform[3] < 0) {
  544. temp = minMax[1];
  545. minMax[1] = minMax[3];
  546. minMax[3] = temp;
  547. }
  548. minMax[1] *= transform[3];
  549. minMax[3] *= transform[3];
  550. } else {
  551. temp = minMax[0];
  552. minMax[0] = minMax[1];
  553. minMax[1] = temp;
  554. temp = minMax[2];
  555. minMax[2] = minMax[3];
  556. minMax[3] = temp;
  557. if (transform[1] < 0) {
  558. temp = minMax[1];
  559. minMax[1] = minMax[3];
  560. minMax[3] = temp;
  561. }
  562. minMax[1] *= transform[1];
  563. minMax[3] *= transform[1];
  564. if (transform[2] < 0) {
  565. temp = minMax[0];
  566. minMax[0] = minMax[2];
  567. minMax[2] = temp;
  568. }
  569. minMax[0] *= transform[2];
  570. minMax[2] *= transform[2];
  571. }
  572. minMax[0] += transform[4];
  573. minMax[1] += transform[5];
  574. minMax[2] += transform[4];
  575. minMax[3] += transform[5];
  576. }
  577. static transform(m1, m2) {
  578. return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]];
  579. }
  580. static applyTransform(p, m) {
  581. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  582. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  583. return [xt, yt];
  584. }
  585. static applyInverseTransform(p, m) {
  586. const d = m[0] * m[3] - m[1] * m[2];
  587. const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  588. const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  589. return [xt, yt];
  590. }
  591. static getAxialAlignedBoundingBox(r, m) {
  592. const p1 = this.applyTransform(r, m);
  593. const p2 = this.applyTransform(r.slice(2, 4), m);
  594. const p3 = this.applyTransform([r[0], r[3]], m);
  595. const p4 = this.applyTransform([r[2], r[1]], m);
  596. return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])];
  597. }
  598. static inverseTransform(m) {
  599. const d = m[0] * m[3] - m[1] * m[2];
  600. return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d];
  601. }
  602. static singularValueDecompose2dScale(m) {
  603. const transpose = [m[0], m[2], m[1], m[3]];
  604. const a = m[0] * transpose[0] + m[1] * transpose[2];
  605. const b = m[0] * transpose[1] + m[1] * transpose[3];
  606. const c = m[2] * transpose[0] + m[3] * transpose[2];
  607. const d = m[2] * transpose[1] + m[3] * transpose[3];
  608. const first = (a + d) / 2;
  609. const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
  610. const sx = first + second || 1;
  611. const sy = first - second || 1;
  612. return [Math.sqrt(sx), Math.sqrt(sy)];
  613. }
  614. static normalizeRect(rect) {
  615. const r = rect.slice(0);
  616. if (rect[0] > rect[2]) {
  617. r[0] = rect[2];
  618. r[2] = rect[0];
  619. }
  620. if (rect[1] > rect[3]) {
  621. r[1] = rect[3];
  622. r[3] = rect[1];
  623. }
  624. return r;
  625. }
  626. static intersect(rect1, rect2) {
  627. const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2]));
  628. const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2]));
  629. if (xLow > xHigh) {
  630. return null;
  631. }
  632. const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3]));
  633. const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3]));
  634. if (yLow > yHigh) {
  635. return null;
  636. }
  637. return [xLow, yLow, xHigh, yHigh];
  638. }
  639. static #getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, t, minMax) {
  640. if (t <= 0 || t >= 1) {
  641. return;
  642. }
  643. const mt = 1 - t;
  644. const tt = t * t;
  645. const ttt = tt * t;
  646. const x = mt * (mt * (mt * x0 + 3 * t * x1) + 3 * tt * x2) + ttt * x3;
  647. const y = mt * (mt * (mt * y0 + 3 * t * y1) + 3 * tt * y2) + ttt * y3;
  648. minMax[0] = Math.min(minMax[0], x);
  649. minMax[1] = Math.min(minMax[1], y);
  650. minMax[2] = Math.max(minMax[2], x);
  651. minMax[3] = Math.max(minMax[3], y);
  652. }
  653. static #getExtremum(x0, x1, x2, x3, y0, y1, y2, y3, a, b, c, minMax) {
  654. if (Math.abs(a) < 1e-12) {
  655. if (Math.abs(b) >= 1e-12) {
  656. this.#getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, -c / b, minMax);
  657. }
  658. return;
  659. }
  660. const delta = b ** 2 - 4 * c * a;
  661. if (delta < 0) {
  662. return;
  663. }
  664. const sqrtDelta = Math.sqrt(delta);
  665. const a2 = 2 * a;
  666. this.#getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, (-b + sqrtDelta) / a2, minMax);
  667. this.#getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, (-b - sqrtDelta) / a2, minMax);
  668. }
  669. static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3, minMax) {
  670. if (minMax) {
  671. minMax[0] = Math.min(minMax[0], x0, x3);
  672. minMax[1] = Math.min(minMax[1], y0, y3);
  673. minMax[2] = Math.max(minMax[2], x0, x3);
  674. minMax[3] = Math.max(minMax[3], y0, y3);
  675. } else {
  676. minMax = [Math.min(x0, x3), Math.min(y0, y3), Math.max(x0, x3), Math.max(y0, y3)];
  677. }
  678. this.#getExtremum(x0, x1, x2, x3, y0, y1, y2, y3, 3 * (-x0 + 3 * (x1 - x2) + x3), 6 * (x0 - 2 * x1 + x2), 3 * (x1 - x0), minMax);
  679. this.#getExtremum(x0, x1, x2, x3, y0, y1, y2, y3, 3 * (-y0 + 3 * (y1 - y2) + y3), 6 * (y0 - 2 * y1 + y2), 3 * (y1 - y0), minMax);
  680. return minMax;
  681. }
  682. }
  683. const PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2d8, 0x2c7, 0x2c6, 0x2d9, 0x2dd, 0x2db, 0x2da, 0x2dc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203a, 0x2212, 0x2030, 0x201e, 0x201c, 0x201d, 0x2018, 0x2019, 0x201a, 0x2122, 0xfb01, 0xfb02, 0x141, 0x152, 0x160, 0x178, 0x17d, 0x131, 0x142, 0x153, 0x161, 0x17e, 0, 0x20ac];
  684. function stringToPDFString(str) {
  685. if (str[0] >= "\xEF") {
  686. let encoding;
  687. if (str[0] === "\xFE" && str[1] === "\xFF") {
  688. encoding = "utf-16be";
  689. if (str.length % 2 === 1) {
  690. str = str.slice(0, -1);
  691. }
  692. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  693. encoding = "utf-16le";
  694. if (str.length % 2 === 1) {
  695. str = str.slice(0, -1);
  696. }
  697. } else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") {
  698. encoding = "utf-8";
  699. }
  700. if (encoding) {
  701. try {
  702. const decoder = new TextDecoder(encoding, {
  703. fatal: true
  704. });
  705. const buffer = stringToBytes(str);
  706. const decoded = decoder.decode(buffer);
  707. if (!decoded.includes("\x1b")) {
  708. return decoded;
  709. }
  710. return decoded.replaceAll(/\x1b[^\x1b]*(?:\x1b|$)/g, "");
  711. } catch (ex) {
  712. warn(`stringToPDFString: "${ex}".`);
  713. }
  714. }
  715. }
  716. const strBuf = [];
  717. for (let i = 0, ii = str.length; i < ii; i++) {
  718. const charCode = str.charCodeAt(i);
  719. if (charCode === 0x1b) {
  720. while (++i < ii && str.charCodeAt(i) !== 0x1b) {}
  721. continue;
  722. }
  723. const code = PDFStringTranslateTable[charCode];
  724. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  725. }
  726. return strBuf.join("");
  727. }
  728. function stringToUTF8String(str) {
  729. return decodeURIComponent(escape(str));
  730. }
  731. function utf8StringToString(str) {
  732. return unescape(encodeURIComponent(str));
  733. }
  734. function isArrayEqual(arr1, arr2) {
  735. if (arr1.length !== arr2.length) {
  736. return false;
  737. }
  738. for (let i = 0, ii = arr1.length; i < ii; i++) {
  739. if (arr1[i] !== arr2[i]) {
  740. return false;
  741. }
  742. }
  743. return true;
  744. }
  745. function getModificationDate(date = new Date()) {
  746. const buffer = [date.getUTCFullYear().toString(), (date.getUTCMonth() + 1).toString().padStart(2, "0"), date.getUTCDate().toString().padStart(2, "0"), date.getUTCHours().toString().padStart(2, "0"), date.getUTCMinutes().toString().padStart(2, "0"), date.getUTCSeconds().toString().padStart(2, "0")];
  747. return buffer.join("");
  748. }
  749. let NormalizeRegex = null;
  750. let NormalizationMap = null;
  751. function normalizeUnicode(str) {
  752. if (!NormalizeRegex) {
  753. NormalizeRegex = /([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu;
  754. NormalizationMap = new Map([["ſt", "ſt"]]);
  755. }
  756. return str.replaceAll(NormalizeRegex, (_, p1, p2) => p1 ? p1.normalize("NFKC") : NormalizationMap.get(p2));
  757. }
  758. function getUuid() {
  759. if (typeof crypto !== "undefined" && typeof crypto?.randomUUID === "function") {
  760. return crypto.randomUUID();
  761. }
  762. const buf = new Uint8Array(32);
  763. if (typeof crypto !== "undefined" && typeof crypto?.getRandomValues === "function") {
  764. crypto.getRandomValues(buf);
  765. } else {
  766. for (let i = 0; i < 32; i++) {
  767. buf[i] = Math.floor(Math.random() * 255);
  768. }
  769. }
  770. return bytesToString(buf);
  771. }
  772. const AnnotationPrefix = "pdfjs_internal_id_";
  773. const FontRenderOps = {
  774. BEZIER_CURVE_TO: 0,
  775. MOVE_TO: 1,
  776. LINE_TO: 2,
  777. QUADRATIC_CURVE_TO: 3,
  778. RESTORE: 4,
  779. SAVE: 5,
  780. SCALE: 6,
  781. TRANSFORM: 7,
  782. TRANSLATE: 8
  783. };
  784. function toHexUtil(arr) {
  785. if (Uint8Array.prototype.toHex) {
  786. return arr.toHex();
  787. }
  788. return Array.from(arr, num => hexNumbers[num]).join("");
  789. }
  790. function toBase64Util(arr) {
  791. if (Uint8Array.prototype.toBase64) {
  792. return arr.toBase64();
  793. }
  794. return btoa(bytesToString(arr));
  795. }
  796. function fromBase64Util(str) {
  797. if (Uint8Array.fromBase64) {
  798. return Uint8Array.fromBase64(str);
  799. }
  800. return stringToBytes(atob(str));
  801. }
  802. ;// ./src/core/primitives.js
  803. const CIRCULAR_REF = Symbol("CIRCULAR_REF");
  804. const EOF = Symbol("EOF");
  805. let CmdCache = Object.create(null);
  806. let NameCache = Object.create(null);
  807. let RefCache = Object.create(null);
  808. function clearPrimitiveCaches() {
  809. CmdCache = Object.create(null);
  810. NameCache = Object.create(null);
  811. RefCache = Object.create(null);
  812. }
  813. class Name {
  814. constructor(name) {
  815. this.name = name;
  816. }
  817. static get(name) {
  818. return NameCache[name] ||= new Name(name);
  819. }
  820. }
  821. class Cmd {
  822. constructor(cmd) {
  823. this.cmd = cmd;
  824. }
  825. static get(cmd) {
  826. return CmdCache[cmd] ||= new Cmd(cmd);
  827. }
  828. }
  829. const nonSerializable = function nonSerializableClosure() {
  830. return nonSerializable;
  831. };
  832. class Dict {
  833. constructor(xref = null) {
  834. this._map = Object.create(null);
  835. this.xref = xref;
  836. this.objId = null;
  837. this.suppressEncryption = false;
  838. this.__nonSerializable__ = nonSerializable;
  839. }
  840. assignXref(newXref) {
  841. this.xref = newXref;
  842. }
  843. get size() {
  844. return Object.keys(this._map).length;
  845. }
  846. get(key1, key2, key3) {
  847. let value = this._map[key1];
  848. if (value === undefined && key2 !== undefined) {
  849. value = this._map[key2];
  850. if (value === undefined && key3 !== undefined) {
  851. value = this._map[key3];
  852. }
  853. }
  854. if (value instanceof Ref && this.xref) {
  855. return this.xref.fetch(value, this.suppressEncryption);
  856. }
  857. return value;
  858. }
  859. async getAsync(key1, key2, key3) {
  860. let value = this._map[key1];
  861. if (value === undefined && key2 !== undefined) {
  862. value = this._map[key2];
  863. if (value === undefined && key3 !== undefined) {
  864. value = this._map[key3];
  865. }
  866. }
  867. if (value instanceof Ref && this.xref) {
  868. return this.xref.fetchAsync(value, this.suppressEncryption);
  869. }
  870. return value;
  871. }
  872. getArray(key1, key2, key3) {
  873. let value = this._map[key1];
  874. if (value === undefined && key2 !== undefined) {
  875. value = this._map[key2];
  876. if (value === undefined && key3 !== undefined) {
  877. value = this._map[key3];
  878. }
  879. }
  880. if (value instanceof Ref && this.xref) {
  881. value = this.xref.fetch(value, this.suppressEncryption);
  882. }
  883. if (Array.isArray(value)) {
  884. value = value.slice();
  885. for (let i = 0, ii = value.length; i < ii; i++) {
  886. if (value[i] instanceof Ref && this.xref) {
  887. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  888. }
  889. }
  890. }
  891. return value;
  892. }
  893. getRaw(key) {
  894. return this._map[key];
  895. }
  896. getKeys() {
  897. return Object.keys(this._map);
  898. }
  899. getRawValues() {
  900. return Object.values(this._map);
  901. }
  902. set(key, value) {
  903. this._map[key] = value;
  904. }
  905. has(key) {
  906. return this._map[key] !== undefined;
  907. }
  908. forEach(callback) {
  909. for (const key in this._map) {
  910. callback(key, this.get(key));
  911. }
  912. }
  913. static get empty() {
  914. const emptyDict = new Dict(null);
  915. emptyDict.set = (key, value) => {
  916. unreachable("Should not call `set` on the empty dictionary.");
  917. };
  918. return shadow(this, "empty", emptyDict);
  919. }
  920. static merge({
  921. xref,
  922. dictArray,
  923. mergeSubDicts = false
  924. }) {
  925. const mergedDict = new Dict(xref),
  926. properties = new Map();
  927. for (const dict of dictArray) {
  928. if (!(dict instanceof Dict)) {
  929. continue;
  930. }
  931. for (const [key, value] of Object.entries(dict._map)) {
  932. let property = properties.get(key);
  933. if (property === undefined) {
  934. property = [];
  935. properties.set(key, property);
  936. } else if (!mergeSubDicts || !(value instanceof Dict)) {
  937. continue;
  938. }
  939. property.push(value);
  940. }
  941. }
  942. for (const [name, values] of properties) {
  943. if (values.length === 1 || !(values[0] instanceof Dict)) {
  944. mergedDict._map[name] = values[0];
  945. continue;
  946. }
  947. const subDict = new Dict(xref);
  948. for (const dict of values) {
  949. for (const [key, value] of Object.entries(dict._map)) {
  950. if (subDict._map[key] === undefined) {
  951. subDict._map[key] = value;
  952. }
  953. }
  954. }
  955. if (subDict.size > 0) {
  956. mergedDict._map[name] = subDict;
  957. }
  958. }
  959. properties.clear();
  960. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  961. }
  962. clone() {
  963. const dict = new Dict(this.xref);
  964. for (const key of this.getKeys()) {
  965. dict.set(key, this.getRaw(key));
  966. }
  967. return dict;
  968. }
  969. delete(key) {
  970. delete this._map[key];
  971. }
  972. }
  973. class Ref {
  974. constructor(num, gen) {
  975. this.num = num;
  976. this.gen = gen;
  977. }
  978. toString() {
  979. if (this.gen === 0) {
  980. return `${this.num}R`;
  981. }
  982. return `${this.num}R${this.gen}`;
  983. }
  984. static fromString(str) {
  985. const ref = RefCache[str];
  986. if (ref) {
  987. return ref;
  988. }
  989. const m = /^(\d+)R(\d*)$/.exec(str);
  990. if (!m || m[1] === "0") {
  991. return null;
  992. }
  993. return RefCache[str] = new Ref(parseInt(m[1]), !m[2] ? 0 : parseInt(m[2]));
  994. }
  995. static get(num, gen) {
  996. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  997. return RefCache[key] ||= new Ref(num, gen);
  998. }
  999. }
  1000. class RefSet {
  1001. constructor(parent = null) {
  1002. this._set = new Set(parent?._set);
  1003. }
  1004. has(ref) {
  1005. return this._set.has(ref.toString());
  1006. }
  1007. put(ref) {
  1008. this._set.add(ref.toString());
  1009. }
  1010. remove(ref) {
  1011. this._set.delete(ref.toString());
  1012. }
  1013. [Symbol.iterator]() {
  1014. return this._set.values();
  1015. }
  1016. clear() {
  1017. this._set.clear();
  1018. }
  1019. }
  1020. class RefSetCache {
  1021. constructor() {
  1022. this._map = new Map();
  1023. }
  1024. get size() {
  1025. return this._map.size;
  1026. }
  1027. get(ref) {
  1028. return this._map.get(ref.toString());
  1029. }
  1030. has(ref) {
  1031. return this._map.has(ref.toString());
  1032. }
  1033. put(ref, obj) {
  1034. this._map.set(ref.toString(), obj);
  1035. }
  1036. putAlias(ref, aliasRef) {
  1037. this._map.set(ref.toString(), this.get(aliasRef));
  1038. }
  1039. [Symbol.iterator]() {
  1040. return this._map.values();
  1041. }
  1042. clear() {
  1043. this._map.clear();
  1044. }
  1045. *items() {
  1046. for (const [ref, value] of this._map) {
  1047. yield [Ref.fromString(ref), value];
  1048. }
  1049. }
  1050. }
  1051. function isName(v, name) {
  1052. return v instanceof Name && (name === undefined || v.name === name);
  1053. }
  1054. function isCmd(v, cmd) {
  1055. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  1056. }
  1057. function isDict(v, type) {
  1058. return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
  1059. }
  1060. function isRefsEqual(v1, v2) {
  1061. return v1.num === v2.num && v1.gen === v2.gen;
  1062. }
  1063. ;// ./src/core/base_stream.js
  1064. class BaseStream {
  1065. get length() {
  1066. unreachable("Abstract getter `length` accessed");
  1067. }
  1068. get isEmpty() {
  1069. unreachable("Abstract getter `isEmpty` accessed");
  1070. }
  1071. get isDataLoaded() {
  1072. return shadow(this, "isDataLoaded", true);
  1073. }
  1074. getByte() {
  1075. unreachable("Abstract method `getByte` called");
  1076. }
  1077. getBytes(length) {
  1078. unreachable("Abstract method `getBytes` called");
  1079. }
  1080. async getImageData(length, decoderOptions) {
  1081. return this.getBytes(length, decoderOptions);
  1082. }
  1083. async asyncGetBytes() {
  1084. unreachable("Abstract method `asyncGetBytes` called");
  1085. }
  1086. get isAsync() {
  1087. return false;
  1088. }
  1089. get canAsyncDecodeImageFromBuffer() {
  1090. return false;
  1091. }
  1092. async getTransferableImage() {
  1093. return null;
  1094. }
  1095. peekByte() {
  1096. const peekedByte = this.getByte();
  1097. if (peekedByte !== -1) {
  1098. this.pos--;
  1099. }
  1100. return peekedByte;
  1101. }
  1102. peekBytes(length) {
  1103. const bytes = this.getBytes(length);
  1104. this.pos -= bytes.length;
  1105. return bytes;
  1106. }
  1107. getUint16() {
  1108. const b0 = this.getByte();
  1109. const b1 = this.getByte();
  1110. if (b0 === -1 || b1 === -1) {
  1111. return -1;
  1112. }
  1113. return (b0 << 8) + b1;
  1114. }
  1115. getInt32() {
  1116. const b0 = this.getByte();
  1117. const b1 = this.getByte();
  1118. const b2 = this.getByte();
  1119. const b3 = this.getByte();
  1120. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  1121. }
  1122. getByteRange(begin, end) {
  1123. unreachable("Abstract method `getByteRange` called");
  1124. }
  1125. getString(length) {
  1126. return bytesToString(this.getBytes(length));
  1127. }
  1128. skip(n) {
  1129. this.pos += n || 1;
  1130. }
  1131. reset() {
  1132. unreachable("Abstract method `reset` called");
  1133. }
  1134. moveStart() {
  1135. unreachable("Abstract method `moveStart` called");
  1136. }
  1137. makeSubStream(start, length, dict = null) {
  1138. unreachable("Abstract method `makeSubStream` called");
  1139. }
  1140. getBaseStreams() {
  1141. return null;
  1142. }
  1143. }
  1144. ;// ./src/core/core_utils.js
  1145. const PDF_VERSION_REGEXP = /^[1-9]\.\d$/;
  1146. function getLookupTableFactory(initializer) {
  1147. let lookup;
  1148. return function () {
  1149. if (initializer) {
  1150. lookup = Object.create(null);
  1151. initializer(lookup);
  1152. initializer = null;
  1153. }
  1154. return lookup;
  1155. };
  1156. }
  1157. class MissingDataException extends BaseException {
  1158. constructor(begin, end) {
  1159. super(`Missing data [${begin}, ${end})`, "MissingDataException");
  1160. this.begin = begin;
  1161. this.end = end;
  1162. }
  1163. }
  1164. class ParserEOFException extends BaseException {
  1165. constructor(msg) {
  1166. super(msg, "ParserEOFException");
  1167. }
  1168. }
  1169. class XRefEntryException extends BaseException {
  1170. constructor(msg) {
  1171. super(msg, "XRefEntryException");
  1172. }
  1173. }
  1174. class XRefParseException extends BaseException {
  1175. constructor(msg) {
  1176. super(msg, "XRefParseException");
  1177. }
  1178. }
  1179. function arrayBuffersToBytes(arr) {
  1180. const length = arr.length;
  1181. if (length === 0) {
  1182. return new Uint8Array(0);
  1183. }
  1184. if (length === 1) {
  1185. return new Uint8Array(arr[0]);
  1186. }
  1187. let dataLength = 0;
  1188. for (let i = 0; i < length; i++) {
  1189. dataLength += arr[i].byteLength;
  1190. }
  1191. const data = new Uint8Array(dataLength);
  1192. let pos = 0;
  1193. for (let i = 0; i < length; i++) {
  1194. const item = new Uint8Array(arr[i]);
  1195. data.set(item, pos);
  1196. pos += item.byteLength;
  1197. }
  1198. return data;
  1199. }
  1200. function getInheritableProperty({
  1201. dict,
  1202. key,
  1203. getArray = false,
  1204. stopWhenFound = true
  1205. }) {
  1206. let values;
  1207. const visited = new RefSet();
  1208. while (dict instanceof Dict && !(dict.objId && visited.has(dict.objId))) {
  1209. if (dict.objId) {
  1210. visited.put(dict.objId);
  1211. }
  1212. const value = getArray ? dict.getArray(key) : dict.get(key);
  1213. if (value !== undefined) {
  1214. if (stopWhenFound) {
  1215. return value;
  1216. }
  1217. (values ||= []).push(value);
  1218. }
  1219. dict = dict.get("Parent");
  1220. }
  1221. return values;
  1222. }
  1223. const ROMAN_NUMBER_MAP = ["", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM", "", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC", "", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"];
  1224. function toRomanNumerals(number, lowerCase = false) {
  1225. assert(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
  1226. const romanBuf = [];
  1227. let pos;
  1228. while (number >= 1000) {
  1229. number -= 1000;
  1230. romanBuf.push("M");
  1231. }
  1232. pos = number / 100 | 0;
  1233. number %= 100;
  1234. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  1235. pos = number / 10 | 0;
  1236. number %= 10;
  1237. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  1238. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  1239. const romanStr = romanBuf.join("");
  1240. return lowerCase ? romanStr.toLowerCase() : romanStr;
  1241. }
  1242. function log2(x) {
  1243. if (x <= 0) {
  1244. return 0;
  1245. }
  1246. return Math.ceil(Math.log2(x));
  1247. }
  1248. function readInt8(data, offset) {
  1249. return data[offset] << 24 >> 24;
  1250. }
  1251. function readUint16(data, offset) {
  1252. return data[offset] << 8 | data[offset + 1];
  1253. }
  1254. function readUint32(data, offset) {
  1255. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  1256. }
  1257. function isWhiteSpace(ch) {
  1258. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  1259. }
  1260. function isBooleanArray(arr, len) {
  1261. return Array.isArray(arr) && (len === null || arr.length === len) && arr.every(x => typeof x === "boolean");
  1262. }
  1263. function isNumberArray(arr, len) {
  1264. if (Array.isArray(arr)) {
  1265. return (len === null || arr.length === len) && arr.every(x => typeof x === "number");
  1266. }
  1267. return ArrayBuffer.isView(arr) && (arr.length === 0 || typeof arr[0] === "number") && (len === null || arr.length === len);
  1268. }
  1269. function lookupMatrix(arr, fallback) {
  1270. return isNumberArray(arr, 6) ? arr : fallback;
  1271. }
  1272. function lookupRect(arr, fallback) {
  1273. return isNumberArray(arr, 4) ? arr : fallback;
  1274. }
  1275. function lookupNormalRect(arr, fallback) {
  1276. return isNumberArray(arr, 4) ? Util.normalizeRect(arr) : fallback;
  1277. }
  1278. function parseXFAPath(path) {
  1279. const positionPattern = /(.+)\[(\d+)\]$/;
  1280. return path.split(".").map(component => {
  1281. const m = component.match(positionPattern);
  1282. if (m) {
  1283. return {
  1284. name: m[1],
  1285. pos: parseInt(m[2], 10)
  1286. };
  1287. }
  1288. return {
  1289. name: component,
  1290. pos: 0
  1291. };
  1292. });
  1293. }
  1294. function escapePDFName(str) {
  1295. const buffer = [];
  1296. let start = 0;
  1297. for (let i = 0, ii = str.length; i < ii; i++) {
  1298. const char = str.charCodeAt(i);
  1299. if (char < 0x21 || char > 0x7e || char === 0x23 || char === 0x28 || char === 0x29 || char === 0x3c || char === 0x3e || char === 0x5b || char === 0x5d || char === 0x7b || char === 0x7d || char === 0x2f || char === 0x25) {
  1300. if (start < i) {
  1301. buffer.push(str.substring(start, i));
  1302. }
  1303. buffer.push(`#${char.toString(16)}`);
  1304. start = i + 1;
  1305. }
  1306. }
  1307. if (buffer.length === 0) {
  1308. return str;
  1309. }
  1310. if (start < str.length) {
  1311. buffer.push(str.substring(start, str.length));
  1312. }
  1313. return buffer.join("");
  1314. }
  1315. function escapeString(str) {
  1316. return str.replaceAll(/([()\\\n\r])/g, match => {
  1317. if (match === "\n") {
  1318. return "\\n";
  1319. } else if (match === "\r") {
  1320. return "\\r";
  1321. }
  1322. return `\\${match}`;
  1323. });
  1324. }
  1325. function _collectJS(entry, xref, list, parents) {
  1326. if (!entry) {
  1327. return;
  1328. }
  1329. let parent = null;
  1330. if (entry instanceof Ref) {
  1331. if (parents.has(entry)) {
  1332. return;
  1333. }
  1334. parent = entry;
  1335. parents.put(parent);
  1336. entry = xref.fetch(entry);
  1337. }
  1338. if (Array.isArray(entry)) {
  1339. for (const element of entry) {
  1340. _collectJS(element, xref, list, parents);
  1341. }
  1342. } else if (entry instanceof Dict) {
  1343. if (isName(entry.get("S"), "JavaScript")) {
  1344. const js = entry.get("JS");
  1345. let code;
  1346. if (js instanceof BaseStream) {
  1347. code = js.getString();
  1348. } else if (typeof js === "string") {
  1349. code = js;
  1350. }
  1351. code &&= stringToPDFString(code).replaceAll("\x00", "");
  1352. if (code) {
  1353. list.push(code);
  1354. }
  1355. }
  1356. _collectJS(entry.getRaw("Next"), xref, list, parents);
  1357. }
  1358. if (parent) {
  1359. parents.remove(parent);
  1360. }
  1361. }
  1362. function collectActions(xref, dict, eventType) {
  1363. const actions = Object.create(null);
  1364. const additionalActionsDicts = getInheritableProperty({
  1365. dict,
  1366. key: "AA",
  1367. stopWhenFound: false
  1368. });
  1369. if (additionalActionsDicts) {
  1370. for (let i = additionalActionsDicts.length - 1; i >= 0; i--) {
  1371. const additionalActions = additionalActionsDicts[i];
  1372. if (!(additionalActions instanceof Dict)) {
  1373. continue;
  1374. }
  1375. for (const key of additionalActions.getKeys()) {
  1376. const action = eventType[key];
  1377. if (!action) {
  1378. continue;
  1379. }
  1380. const actionDict = additionalActions.getRaw(key);
  1381. const parents = new RefSet();
  1382. const list = [];
  1383. _collectJS(actionDict, xref, list, parents);
  1384. if (list.length > 0) {
  1385. actions[action] = list;
  1386. }
  1387. }
  1388. }
  1389. }
  1390. if (dict.has("A")) {
  1391. const actionDict = dict.get("A");
  1392. const parents = new RefSet();
  1393. const list = [];
  1394. _collectJS(actionDict, xref, list, parents);
  1395. if (list.length > 0) {
  1396. actions.Action = list;
  1397. }
  1398. }
  1399. return objectSize(actions) > 0 ? actions : null;
  1400. }
  1401. const XMLEntities = {
  1402. 0x3c: "&lt;",
  1403. 0x3e: "&gt;",
  1404. 0x26: "&amp;",
  1405. 0x22: "&quot;",
  1406. 0x27: "&apos;"
  1407. };
  1408. function* codePointIter(str) {
  1409. for (let i = 0, ii = str.length; i < ii; i++) {
  1410. const char = str.codePointAt(i);
  1411. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  1412. i++;
  1413. }
  1414. yield char;
  1415. }
  1416. }
  1417. function encodeToXmlString(str) {
  1418. const buffer = [];
  1419. let start = 0;
  1420. for (let i = 0, ii = str.length; i < ii; i++) {
  1421. const char = str.codePointAt(i);
  1422. if (0x20 <= char && char <= 0x7e) {
  1423. const entity = XMLEntities[char];
  1424. if (entity) {
  1425. if (start < i) {
  1426. buffer.push(str.substring(start, i));
  1427. }
  1428. buffer.push(entity);
  1429. start = i + 1;
  1430. }
  1431. } else {
  1432. if (start < i) {
  1433. buffer.push(str.substring(start, i));
  1434. }
  1435. buffer.push(`&#x${char.toString(16).toUpperCase()};`);
  1436. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  1437. i++;
  1438. }
  1439. start = i + 1;
  1440. }
  1441. }
  1442. if (buffer.length === 0) {
  1443. return str;
  1444. }
  1445. if (start < str.length) {
  1446. buffer.push(str.substring(start, str.length));
  1447. }
  1448. return buffer.join("");
  1449. }
  1450. function validateFontName(fontFamily, mustWarn = false) {
  1451. const m = /^("|').*("|')$/.exec(fontFamily);
  1452. if (m && m[1] === m[2]) {
  1453. const re = new RegExp(`[^\\\\]${m[1]}`);
  1454. if (re.test(fontFamily.slice(1, -1))) {
  1455. if (mustWarn) {
  1456. warn(`FontFamily contains unescaped ${m[1]}: ${fontFamily}.`);
  1457. }
  1458. return false;
  1459. }
  1460. } else {
  1461. for (const ident of fontFamily.split(/[ \t]+/)) {
  1462. if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) {
  1463. if (mustWarn) {
  1464. warn(`FontFamily contains invalid <custom-ident>: ${fontFamily}.`);
  1465. }
  1466. return false;
  1467. }
  1468. }
  1469. }
  1470. return true;
  1471. }
  1472. function validateCSSFont(cssFontInfo) {
  1473. const DEFAULT_CSS_FONT_OBLIQUE = "14";
  1474. const DEFAULT_CSS_FONT_WEIGHT = "400";
  1475. const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]);
  1476. const {
  1477. fontFamily,
  1478. fontWeight,
  1479. italicAngle
  1480. } = cssFontInfo;
  1481. if (!validateFontName(fontFamily, true)) {
  1482. return false;
  1483. }
  1484. const weight = fontWeight ? fontWeight.toString() : "";
  1485. cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT;
  1486. const angle = parseFloat(italicAngle);
  1487. cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString();
  1488. return true;
  1489. }
  1490. function recoverJsURL(str) {
  1491. const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"];
  1492. const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").replaceAll(".", "\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
  1493. const jsUrl = regex.exec(str);
  1494. if (jsUrl?.[2]) {
  1495. const url = jsUrl[2];
  1496. let newWindow = false;
  1497. if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
  1498. newWindow = true;
  1499. }
  1500. return {
  1501. url,
  1502. newWindow
  1503. };
  1504. }
  1505. return null;
  1506. }
  1507. function numberToString(value) {
  1508. if (Number.isInteger(value)) {
  1509. return value.toString();
  1510. }
  1511. const roundedValue = Math.round(value * 100);
  1512. if (roundedValue % 100 === 0) {
  1513. return (roundedValue / 100).toString();
  1514. }
  1515. if (roundedValue % 10 === 0) {
  1516. return value.toFixed(1);
  1517. }
  1518. return value.toFixed(2);
  1519. }
  1520. function getNewAnnotationsMap(annotationStorage) {
  1521. if (!annotationStorage) {
  1522. return null;
  1523. }
  1524. const newAnnotationsByPage = new Map();
  1525. for (const [key, value] of annotationStorage) {
  1526. if (!key.startsWith(AnnotationEditorPrefix)) {
  1527. continue;
  1528. }
  1529. let annotations = newAnnotationsByPage.get(value.pageIndex);
  1530. if (!annotations) {
  1531. annotations = [];
  1532. newAnnotationsByPage.set(value.pageIndex, annotations);
  1533. }
  1534. annotations.push(value);
  1535. }
  1536. return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null;
  1537. }
  1538. function stringToAsciiOrUTF16BE(str) {
  1539. return isAscii(str) ? str : stringToUTF16String(str, true);
  1540. }
  1541. function isAscii(str) {
  1542. return /^[\x00-\x7F]*$/.test(str);
  1543. }
  1544. function stringToUTF16HexString(str) {
  1545. const buf = [];
  1546. for (let i = 0, ii = str.length; i < ii; i++) {
  1547. const char = str.charCodeAt(i);
  1548. buf.push(hexNumbers[char >> 8 & 0xff], hexNumbers[char & 0xff]);
  1549. }
  1550. return buf.join("");
  1551. }
  1552. function stringToUTF16String(str, bigEndian = false) {
  1553. const buf = [];
  1554. if (bigEndian) {
  1555. buf.push("\xFE\xFF");
  1556. }
  1557. for (let i = 0, ii = str.length; i < ii; i++) {
  1558. const char = str.charCodeAt(i);
  1559. buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
  1560. }
  1561. return buf.join("");
  1562. }
  1563. function getRotationMatrix(rotation, width, height) {
  1564. switch (rotation) {
  1565. case 90:
  1566. return [0, 1, -1, 0, width, 0];
  1567. case 180:
  1568. return [-1, 0, 0, -1, width, height];
  1569. case 270:
  1570. return [0, -1, 1, 0, 0, height];
  1571. default:
  1572. throw new Error("Invalid rotation");
  1573. }
  1574. }
  1575. function getSizeInBytes(x) {
  1576. return Math.ceil(Math.ceil(Math.log2(1 + x)) / 8);
  1577. }
  1578. ;// ./src/core/stream.js
  1579. class Stream extends BaseStream {
  1580. constructor(arrayBuffer, start, length, dict) {
  1581. super();
  1582. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  1583. this.start = start || 0;
  1584. this.pos = this.start;
  1585. this.end = start + length || this.bytes.length;
  1586. this.dict = dict;
  1587. }
  1588. get length() {
  1589. return this.end - this.start;
  1590. }
  1591. get isEmpty() {
  1592. return this.length === 0;
  1593. }
  1594. getByte() {
  1595. if (this.pos >= this.end) {
  1596. return -1;
  1597. }
  1598. return this.bytes[this.pos++];
  1599. }
  1600. getBytes(length) {
  1601. const bytes = this.bytes;
  1602. const pos = this.pos;
  1603. const strEnd = this.end;
  1604. if (!length) {
  1605. return bytes.subarray(pos, strEnd);
  1606. }
  1607. let end = pos + length;
  1608. if (end > strEnd) {
  1609. end = strEnd;
  1610. }
  1611. this.pos = end;
  1612. return bytes.subarray(pos, end);
  1613. }
  1614. getByteRange(begin, end) {
  1615. if (begin < 0) {
  1616. begin = 0;
  1617. }
  1618. if (end > this.end) {
  1619. end = this.end;
  1620. }
  1621. return this.bytes.subarray(begin, end);
  1622. }
  1623. reset() {
  1624. this.pos = this.start;
  1625. }
  1626. moveStart() {
  1627. this.start = this.pos;
  1628. }
  1629. makeSubStream(start, length, dict = null) {
  1630. return new Stream(this.bytes.buffer, start, length, dict);
  1631. }
  1632. }
  1633. class StringStream extends Stream {
  1634. constructor(str) {
  1635. super(stringToBytes(str));
  1636. }
  1637. }
  1638. class NullStream extends Stream {
  1639. constructor() {
  1640. super(new Uint8Array(0));
  1641. }
  1642. }
  1643. ;// ./src/core/chunked_stream.js
  1644. class ChunkedStream extends Stream {
  1645. constructor(length, chunkSize, manager) {
  1646. super(new Uint8Array(length), 0, length, null);
  1647. this.chunkSize = chunkSize;
  1648. this._loadedChunks = new Set();
  1649. this.numChunks = Math.ceil(length / chunkSize);
  1650. this.manager = manager;
  1651. this.progressiveDataLength = 0;
  1652. this.lastSuccessfulEnsureByteChunk = -1;
  1653. }
  1654. getMissingChunks() {
  1655. const chunks = [];
  1656. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  1657. if (!this._loadedChunks.has(chunk)) {
  1658. chunks.push(chunk);
  1659. }
  1660. }
  1661. return chunks;
  1662. }
  1663. get numChunksLoaded() {
  1664. return this._loadedChunks.size;
  1665. }
  1666. get isDataLoaded() {
  1667. return this.numChunksLoaded === this.numChunks;
  1668. }
  1669. onReceiveData(begin, chunk) {
  1670. const chunkSize = this.chunkSize;
  1671. if (begin % chunkSize !== 0) {
  1672. throw new Error(`Bad begin offset: ${begin}`);
  1673. }
  1674. const end = begin + chunk.byteLength;
  1675. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  1676. throw new Error(`Bad end offset: ${end}`);
  1677. }
  1678. this.bytes.set(new Uint8Array(chunk), begin);
  1679. const beginChunk = Math.floor(begin / chunkSize);
  1680. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  1681. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  1682. this._loadedChunks.add(curChunk);
  1683. }
  1684. }
  1685. onReceiveProgressiveData(data) {
  1686. let position = this.progressiveDataLength;
  1687. const beginChunk = Math.floor(position / this.chunkSize);
  1688. this.bytes.set(new Uint8Array(data), position);
  1689. position += data.byteLength;
  1690. this.progressiveDataLength = position;
  1691. const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  1692. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  1693. this._loadedChunks.add(curChunk);
  1694. }
  1695. }
  1696. ensureByte(pos) {
  1697. if (pos < this.progressiveDataLength) {
  1698. return;
  1699. }
  1700. const chunk = Math.floor(pos / this.chunkSize);
  1701. if (chunk > this.numChunks) {
  1702. return;
  1703. }
  1704. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  1705. return;
  1706. }
  1707. if (!this._loadedChunks.has(chunk)) {
  1708. throw new MissingDataException(pos, pos + 1);
  1709. }
  1710. this.lastSuccessfulEnsureByteChunk = chunk;
  1711. }
  1712. ensureRange(begin, end) {
  1713. if (begin >= end) {
  1714. return;
  1715. }
  1716. if (end <= this.progressiveDataLength) {
  1717. return;
  1718. }
  1719. const beginChunk = Math.floor(begin / this.chunkSize);
  1720. if (beginChunk > this.numChunks) {
  1721. return;
  1722. }
  1723. const endChunk = Math.min(Math.floor((end - 1) / this.chunkSize) + 1, this.numChunks);
  1724. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  1725. if (!this._loadedChunks.has(chunk)) {
  1726. throw new MissingDataException(begin, end);
  1727. }
  1728. }
  1729. }
  1730. nextEmptyChunk(beginChunk) {
  1731. const numChunks = this.numChunks;
  1732. for (let i = 0; i < numChunks; ++i) {
  1733. const chunk = (beginChunk + i) % numChunks;
  1734. if (!this._loadedChunks.has(chunk)) {
  1735. return chunk;
  1736. }
  1737. }
  1738. return null;
  1739. }
  1740. hasChunk(chunk) {
  1741. return this._loadedChunks.has(chunk);
  1742. }
  1743. getByte() {
  1744. const pos = this.pos;
  1745. if (pos >= this.end) {
  1746. return -1;
  1747. }
  1748. if (pos >= this.progressiveDataLength) {
  1749. this.ensureByte(pos);
  1750. }
  1751. return this.bytes[this.pos++];
  1752. }
  1753. getBytes(length) {
  1754. const bytes = this.bytes;
  1755. const pos = this.pos;
  1756. const strEnd = this.end;
  1757. if (!length) {
  1758. if (strEnd > this.progressiveDataLength) {
  1759. this.ensureRange(pos, strEnd);
  1760. }
  1761. return bytes.subarray(pos, strEnd);
  1762. }
  1763. let end = pos + length;
  1764. if (end > strEnd) {
  1765. end = strEnd;
  1766. }
  1767. if (end > this.progressiveDataLength) {
  1768. this.ensureRange(pos, end);
  1769. }
  1770. this.pos = end;
  1771. return bytes.subarray(pos, end);
  1772. }
  1773. getByteRange(begin, end) {
  1774. if (begin < 0) {
  1775. begin = 0;
  1776. }
  1777. if (end > this.end) {
  1778. end = this.end;
  1779. }
  1780. if (end > this.progressiveDataLength) {
  1781. this.ensureRange(begin, end);
  1782. }
  1783. return this.bytes.subarray(begin, end);
  1784. }
  1785. makeSubStream(start, length, dict = null) {
  1786. if (length) {
  1787. if (start + length > this.progressiveDataLength) {
  1788. this.ensureRange(start, start + length);
  1789. }
  1790. } else if (start >= this.progressiveDataLength) {
  1791. this.ensureByte(start);
  1792. }
  1793. function ChunkedStreamSubstream() {}
  1794. ChunkedStreamSubstream.prototype = Object.create(this);
  1795. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  1796. const chunkSize = this.chunkSize;
  1797. const beginChunk = Math.floor(this.start / chunkSize);
  1798. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  1799. const missingChunks = [];
  1800. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  1801. if (!this._loadedChunks.has(chunk)) {
  1802. missingChunks.push(chunk);
  1803. }
  1804. }
  1805. return missingChunks;
  1806. };
  1807. Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", {
  1808. get() {
  1809. if (this.numChunksLoaded === this.numChunks) {
  1810. return true;
  1811. }
  1812. return this.getMissingChunks().length === 0;
  1813. },
  1814. configurable: true
  1815. });
  1816. const subStream = new ChunkedStreamSubstream();
  1817. subStream.pos = subStream.start = start;
  1818. subStream.end = start + length || this.end;
  1819. subStream.dict = dict;
  1820. return subStream;
  1821. }
  1822. getBaseStreams() {
  1823. return [this];
  1824. }
  1825. }
  1826. class ChunkedStreamManager {
  1827. constructor(pdfNetworkStream, args) {
  1828. this.length = args.length;
  1829. this.chunkSize = args.rangeChunkSize;
  1830. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  1831. this.pdfNetworkStream = pdfNetworkStream;
  1832. this.disableAutoFetch = args.disableAutoFetch;
  1833. this.msgHandler = args.msgHandler;
  1834. this.currRequestId = 0;
  1835. this._chunksNeededByRequest = new Map();
  1836. this._requestsByChunk = new Map();
  1837. this._promisesByRequest = new Map();
  1838. this.progressiveDataLength = 0;
  1839. this.aborted = false;
  1840. this._loadedStreamCapability = Promise.withResolvers();
  1841. }
  1842. sendRequest(begin, end) {
  1843. const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  1844. if (!rangeReader.isStreamingSupported) {
  1845. rangeReader.onProgress = this.onProgress.bind(this);
  1846. }
  1847. let chunks = [],
  1848. loaded = 0;
  1849. return new Promise((resolve, reject) => {
  1850. const readChunk = ({
  1851. value,
  1852. done
  1853. }) => {
  1854. try {
  1855. if (done) {
  1856. const chunkData = arrayBuffersToBytes(chunks);
  1857. chunks = null;
  1858. resolve(chunkData);
  1859. return;
  1860. }
  1861. loaded += value.byteLength;
  1862. if (rangeReader.isStreamingSupported) {
  1863. this.onProgress({
  1864. loaded
  1865. });
  1866. }
  1867. chunks.push(value);
  1868. rangeReader.read().then(readChunk, reject);
  1869. } catch (e) {
  1870. reject(e);
  1871. }
  1872. };
  1873. rangeReader.read().then(readChunk, reject);
  1874. }).then(data => {
  1875. if (this.aborted) {
  1876. return;
  1877. }
  1878. this.onReceiveData({
  1879. chunk: data,
  1880. begin
  1881. });
  1882. });
  1883. }
  1884. requestAllChunks(noFetch = false) {
  1885. if (!noFetch) {
  1886. const missingChunks = this.stream.getMissingChunks();
  1887. this._requestChunks(missingChunks);
  1888. }
  1889. return this._loadedStreamCapability.promise;
  1890. }
  1891. _requestChunks(chunks) {
  1892. const requestId = this.currRequestId++;
  1893. const chunksNeeded = new Set();
  1894. this._chunksNeededByRequest.set(requestId, chunksNeeded);
  1895. for (const chunk of chunks) {
  1896. if (!this.stream.hasChunk(chunk)) {
  1897. chunksNeeded.add(chunk);
  1898. }
  1899. }
  1900. if (chunksNeeded.size === 0) {
  1901. return Promise.resolve();
  1902. }
  1903. const capability = Promise.withResolvers();
  1904. this._promisesByRequest.set(requestId, capability);
  1905. const chunksToRequest = [];
  1906. for (const chunk of chunksNeeded) {
  1907. let requestIds = this._requestsByChunk.get(chunk);
  1908. if (!requestIds) {
  1909. requestIds = [];
  1910. this._requestsByChunk.set(chunk, requestIds);
  1911. chunksToRequest.push(chunk);
  1912. }
  1913. requestIds.push(requestId);
  1914. }
  1915. if (chunksToRequest.length > 0) {
  1916. const groupedChunksToRequest = this.groupChunks(chunksToRequest);
  1917. for (const groupedChunk of groupedChunksToRequest) {
  1918. const begin = groupedChunk.beginChunk * this.chunkSize;
  1919. const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  1920. this.sendRequest(begin, end).catch(capability.reject);
  1921. }
  1922. }
  1923. return capability.promise.catch(reason => {
  1924. if (this.aborted) {
  1925. return;
  1926. }
  1927. throw reason;
  1928. });
  1929. }
  1930. getStream() {
  1931. return this.stream;
  1932. }
  1933. requestRange(begin, end) {
  1934. end = Math.min(end, this.length);
  1935. const beginChunk = this.getBeginChunk(begin);
  1936. const endChunk = this.getEndChunk(end);
  1937. const chunks = [];
  1938. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  1939. chunks.push(chunk);
  1940. }
  1941. return this._requestChunks(chunks);
  1942. }
  1943. requestRanges(ranges = []) {
  1944. const chunksToRequest = [];
  1945. for (const range of ranges) {
  1946. const beginChunk = this.getBeginChunk(range.begin);
  1947. const endChunk = this.getEndChunk(range.end);
  1948. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  1949. if (!chunksToRequest.includes(chunk)) {
  1950. chunksToRequest.push(chunk);
  1951. }
  1952. }
  1953. }
  1954. chunksToRequest.sort(function (a, b) {
  1955. return a - b;
  1956. });
  1957. return this._requestChunks(chunksToRequest);
  1958. }
  1959. groupChunks(chunks) {
  1960. const groupedChunks = [];
  1961. let beginChunk = -1;
  1962. let prevChunk = -1;
  1963. for (let i = 0, ii = chunks.length; i < ii; ++i) {
  1964. const chunk = chunks[i];
  1965. if (beginChunk < 0) {
  1966. beginChunk = chunk;
  1967. }
  1968. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  1969. groupedChunks.push({
  1970. beginChunk,
  1971. endChunk: prevChunk + 1
  1972. });
  1973. beginChunk = chunk;
  1974. }
  1975. if (i + 1 === chunks.length) {
  1976. groupedChunks.push({
  1977. beginChunk,
  1978. endChunk: chunk + 1
  1979. });
  1980. }
  1981. prevChunk = chunk;
  1982. }
  1983. return groupedChunks;
  1984. }
  1985. onProgress(args) {
  1986. this.msgHandler.send("DocProgress", {
  1987. loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
  1988. total: this.length
  1989. });
  1990. }
  1991. onReceiveData(args) {
  1992. const chunk = args.chunk;
  1993. const isProgressive = args.begin === undefined;
  1994. const begin = isProgressive ? this.progressiveDataLength : args.begin;
  1995. const end = begin + chunk.byteLength;
  1996. const beginChunk = Math.floor(begin / this.chunkSize);
  1997. const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  1998. if (isProgressive) {
  1999. this.stream.onReceiveProgressiveData(chunk);
  2000. this.progressiveDataLength = end;
  2001. } else {
  2002. this.stream.onReceiveData(begin, chunk);
  2003. }
  2004. if (this.stream.isDataLoaded) {
  2005. this._loadedStreamCapability.resolve(this.stream);
  2006. }
  2007. const loadedRequests = [];
  2008. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2009. const requestIds = this._requestsByChunk.get(curChunk);
  2010. if (!requestIds) {
  2011. continue;
  2012. }
  2013. this._requestsByChunk.delete(curChunk);
  2014. for (const requestId of requestIds) {
  2015. const chunksNeeded = this._chunksNeededByRequest.get(requestId);
  2016. if (chunksNeeded.has(curChunk)) {
  2017. chunksNeeded.delete(curChunk);
  2018. }
  2019. if (chunksNeeded.size > 0) {
  2020. continue;
  2021. }
  2022. loadedRequests.push(requestId);
  2023. }
  2024. }
  2025. if (!this.disableAutoFetch && this._requestsByChunk.size === 0) {
  2026. let nextEmptyChunk;
  2027. if (this.stream.numChunksLoaded === 1) {
  2028. const lastChunk = this.stream.numChunks - 1;
  2029. if (!this.stream.hasChunk(lastChunk)) {
  2030. nextEmptyChunk = lastChunk;
  2031. }
  2032. } else {
  2033. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  2034. }
  2035. if (Number.isInteger(nextEmptyChunk)) {
  2036. this._requestChunks([nextEmptyChunk]);
  2037. }
  2038. }
  2039. for (const requestId of loadedRequests) {
  2040. const capability = this._promisesByRequest.get(requestId);
  2041. this._promisesByRequest.delete(requestId);
  2042. capability.resolve();
  2043. }
  2044. this.msgHandler.send("DocProgress", {
  2045. loaded: this.stream.numChunksLoaded * this.chunkSize,
  2046. total: this.length
  2047. });
  2048. }
  2049. onError(err) {
  2050. this._loadedStreamCapability.reject(err);
  2051. }
  2052. getBeginChunk(begin) {
  2053. return Math.floor(begin / this.chunkSize);
  2054. }
  2055. getEndChunk(end) {
  2056. return Math.floor((end - 1) / this.chunkSize) + 1;
  2057. }
  2058. abort(reason) {
  2059. this.aborted = true;
  2060. this.pdfNetworkStream?.cancelAllRequests(reason);
  2061. for (const capability of this._promisesByRequest.values()) {
  2062. capability.reject(reason);
  2063. }
  2064. }
  2065. }
  2066. ;// ./src/core/colorspace.js
  2067. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  2068. const COMPONENTS = 3;
  2069. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  2070. const xRatio = w1 / w2;
  2071. const yRatio = h1 / h2;
  2072. let newIndex = 0,
  2073. oldIndex;
  2074. const xScaled = new Uint16Array(w2);
  2075. const w1Scanline = w1 * COMPONENTS;
  2076. for (let i = 0; i < w2; i++) {
  2077. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  2078. }
  2079. for (let i = 0; i < h2; i++) {
  2080. const py = Math.floor(i * yRatio) * w1Scanline;
  2081. for (let j = 0; j < w2; j++) {
  2082. oldIndex = py + xScaled[j];
  2083. dest[newIndex++] = src[oldIndex++];
  2084. dest[newIndex++] = src[oldIndex++];
  2085. dest[newIndex++] = src[oldIndex++];
  2086. newIndex += alpha01;
  2087. }
  2088. }
  2089. }
  2090. function resizeRgbaImage(src, dest, w1, h1, w2, h2, alpha01) {
  2091. const xRatio = w1 / w2;
  2092. const yRatio = h1 / h2;
  2093. let newIndex = 0;
  2094. const xScaled = new Uint16Array(w2);
  2095. if (alpha01 === 1) {
  2096. for (let i = 0; i < w2; i++) {
  2097. xScaled[i] = Math.floor(i * xRatio);
  2098. }
  2099. const src32 = new Uint32Array(src.buffer);
  2100. const dest32 = new Uint32Array(dest.buffer);
  2101. const rgbMask = FeatureTest.isLittleEndian ? 0x00ffffff : 0xffffff00;
  2102. for (let i = 0; i < h2; i++) {
  2103. const buf = src32.subarray(Math.floor(i * yRatio) * w1);
  2104. for (let j = 0; j < w2; j++) {
  2105. dest32[newIndex++] |= buf[xScaled[j]] & rgbMask;
  2106. }
  2107. }
  2108. } else {
  2109. const COMPONENTS = 4;
  2110. const w1Scanline = w1 * COMPONENTS;
  2111. for (let i = 0; i < w2; i++) {
  2112. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  2113. }
  2114. for (let i = 0; i < h2; i++) {
  2115. const buf = src.subarray(Math.floor(i * yRatio) * w1Scanline);
  2116. for (let j = 0; j < w2; j++) {
  2117. const oldIndex = xScaled[j];
  2118. dest[newIndex++] = buf[oldIndex];
  2119. dest[newIndex++] = buf[oldIndex + 1];
  2120. dest[newIndex++] = buf[oldIndex + 2];
  2121. }
  2122. }
  2123. }
  2124. }
  2125. function copyRgbaImage(src, dest, alpha01) {
  2126. if (alpha01 === 1) {
  2127. const src32 = new Uint32Array(src.buffer);
  2128. const dest32 = new Uint32Array(dest.buffer);
  2129. const rgbMask = FeatureTest.isLittleEndian ? 0x00ffffff : 0xffffff00;
  2130. for (let i = 0, ii = src32.length; i < ii; i++) {
  2131. dest32[i] |= src32[i] & rgbMask;
  2132. }
  2133. } else {
  2134. let j = 0;
  2135. for (let i = 0, ii = src.length; i < ii; i += 4) {
  2136. dest[j++] = src[i];
  2137. dest[j++] = src[i + 1];
  2138. dest[j++] = src[i + 2];
  2139. }
  2140. }
  2141. }
  2142. class ColorSpace {
  2143. constructor(name, numComps) {
  2144. this.name = name;
  2145. this.numComps = numComps;
  2146. }
  2147. getRgb(src, srcOffset) {
  2148. const rgb = new Uint8ClampedArray(3);
  2149. this.getRgbItem(src, srcOffset, rgb, 0);
  2150. return rgb;
  2151. }
  2152. getRgbItem(src, srcOffset, dest, destOffset) {
  2153. unreachable("Should not call ColorSpace.getRgbItem");
  2154. }
  2155. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  2156. unreachable("Should not call ColorSpace.getRgbBuffer");
  2157. }
  2158. getOutputLength(inputLength, alpha01) {
  2159. unreachable("Should not call ColorSpace.getOutputLength");
  2160. }
  2161. isPassthrough(bits) {
  2162. return false;
  2163. }
  2164. isDefaultDecode(decodeMap, bpc) {
  2165. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  2166. }
  2167. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  2168. const count = originalWidth * originalHeight;
  2169. let rgbBuf = null;
  2170. const numComponentColors = 1 << bpc;
  2171. const needsResizing = originalHeight !== height || originalWidth !== width;
  2172. if (this.isPassthrough(bpc)) {
  2173. rgbBuf = comps;
  2174. } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
  2175. const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  2176. for (let i = 0; i < numComponentColors; i++) {
  2177. allColors[i] = i;
  2178. }
  2179. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  2180. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  2181. if (!needsResizing) {
  2182. let destPos = 0;
  2183. for (let i = 0; i < count; ++i) {
  2184. const key = comps[i] * 3;
  2185. dest[destPos++] = colorMap[key];
  2186. dest[destPos++] = colorMap[key + 1];
  2187. dest[destPos++] = colorMap[key + 2];
  2188. destPos += alpha01;
  2189. }
  2190. } else {
  2191. rgbBuf = new Uint8Array(count * 3);
  2192. let rgbPos = 0;
  2193. for (let i = 0; i < count; ++i) {
  2194. const key = comps[i] * 3;
  2195. rgbBuf[rgbPos++] = colorMap[key];
  2196. rgbBuf[rgbPos++] = colorMap[key + 1];
  2197. rgbBuf[rgbPos++] = colorMap[key + 2];
  2198. }
  2199. }
  2200. } else if (!needsResizing) {
  2201. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  2202. } else {
  2203. rgbBuf = new Uint8ClampedArray(count * 3);
  2204. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  2205. }
  2206. if (rgbBuf) {
  2207. if (needsResizing) {
  2208. resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
  2209. } else {
  2210. let destPos = 0,
  2211. rgbPos = 0;
  2212. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  2213. dest[destPos++] = rgbBuf[rgbPos++];
  2214. dest[destPos++] = rgbBuf[rgbPos++];
  2215. dest[destPos++] = rgbBuf[rgbPos++];
  2216. destPos += alpha01;
  2217. }
  2218. }
  2219. }
  2220. }
  2221. get usesZeroToOneRange() {
  2222. return shadow(this, "usesZeroToOneRange", true);
  2223. }
  2224. static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
  2225. if (!localColorSpaceCache) {
  2226. throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.');
  2227. }
  2228. if (!parsedColorSpace) {
  2229. throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.');
  2230. }
  2231. let csName, csRef;
  2232. if (cacheKey instanceof Ref) {
  2233. csRef = cacheKey;
  2234. cacheKey = xref.fetch(cacheKey);
  2235. }
  2236. if (cacheKey instanceof Name) {
  2237. csName = cacheKey.name;
  2238. }
  2239. if (csName || csRef) {
  2240. localColorSpaceCache.set(csName, csRef, parsedColorSpace);
  2241. }
  2242. }
  2243. static getCached(cacheKey, xref, localColorSpaceCache) {
  2244. if (!localColorSpaceCache) {
  2245. throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.');
  2246. }
  2247. if (cacheKey instanceof Ref) {
  2248. const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
  2249. if (localColorSpace) {
  2250. return localColorSpace;
  2251. }
  2252. try {
  2253. cacheKey = xref.fetch(cacheKey);
  2254. } catch (ex) {
  2255. if (ex instanceof MissingDataException) {
  2256. throw ex;
  2257. }
  2258. }
  2259. }
  2260. if (cacheKey instanceof Name) {
  2261. const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
  2262. if (localColorSpace) {
  2263. return localColorSpace;
  2264. }
  2265. }
  2266. return null;
  2267. }
  2268. static async parseAsync({
  2269. cs,
  2270. xref,
  2271. resources = null,
  2272. pdfFunctionFactory,
  2273. localColorSpaceCache
  2274. }) {
  2275. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  2276. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  2277. return parsedColorSpace;
  2278. }
  2279. static parse({
  2280. cs,
  2281. xref,
  2282. resources = null,
  2283. pdfFunctionFactory,
  2284. localColorSpaceCache
  2285. }) {
  2286. const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
  2287. if (cachedColorSpace) {
  2288. return cachedColorSpace;
  2289. }
  2290. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  2291. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  2292. return parsedColorSpace;
  2293. }
  2294. static _parse(cs, xref, resources = null, pdfFunctionFactory) {
  2295. cs = xref.fetchIfRef(cs);
  2296. if (cs instanceof Name) {
  2297. switch (cs.name) {
  2298. case "G":
  2299. case "DeviceGray":
  2300. return this.singletons.gray;
  2301. case "RGB":
  2302. case "DeviceRGB":
  2303. return this.singletons.rgb;
  2304. case "DeviceRGBA":
  2305. return this.singletons.rgba;
  2306. case "CMYK":
  2307. case "DeviceCMYK":
  2308. return this.singletons.cmyk;
  2309. case "Pattern":
  2310. return new PatternCS(null);
  2311. default:
  2312. if (resources instanceof Dict) {
  2313. const colorSpaces = resources.get("ColorSpace");
  2314. if (colorSpaces instanceof Dict) {
  2315. const resourcesCS = colorSpaces.get(cs.name);
  2316. if (resourcesCS) {
  2317. if (resourcesCS instanceof Name) {
  2318. return this._parse(resourcesCS, xref, resources, pdfFunctionFactory);
  2319. }
  2320. cs = resourcesCS;
  2321. break;
  2322. }
  2323. }
  2324. }
  2325. warn(`Unrecognized ColorSpace: ${cs.name}`);
  2326. return this.singletons.gray;
  2327. }
  2328. }
  2329. if (Array.isArray(cs)) {
  2330. const mode = xref.fetchIfRef(cs[0]).name;
  2331. let params, numComps, baseCS, whitePoint, blackPoint, gamma;
  2332. switch (mode) {
  2333. case "G":
  2334. case "DeviceGray":
  2335. return this.singletons.gray;
  2336. case "RGB":
  2337. case "DeviceRGB":
  2338. return this.singletons.rgb;
  2339. case "CMYK":
  2340. case "DeviceCMYK":
  2341. return this.singletons.cmyk;
  2342. case "CalGray":
  2343. params = xref.fetchIfRef(cs[1]);
  2344. whitePoint = params.getArray("WhitePoint");
  2345. blackPoint = params.getArray("BlackPoint");
  2346. gamma = params.get("Gamma");
  2347. return new CalGrayCS(whitePoint, blackPoint, gamma);
  2348. case "CalRGB":
  2349. params = xref.fetchIfRef(cs[1]);
  2350. whitePoint = params.getArray("WhitePoint");
  2351. blackPoint = params.getArray("BlackPoint");
  2352. gamma = params.getArray("Gamma");
  2353. const matrix = params.getArray("Matrix");
  2354. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  2355. case "ICCBased":
  2356. const stream = xref.fetchIfRef(cs[1]);
  2357. const dict = stream.dict;
  2358. numComps = dict.get("N");
  2359. const alt = dict.get("Alternate");
  2360. if (alt) {
  2361. const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
  2362. if (altCS.numComps === numComps) {
  2363. return altCS;
  2364. }
  2365. warn("ICCBased color space: Ignoring incorrect /Alternate entry.");
  2366. }
  2367. if (numComps === 1) {
  2368. return this.singletons.gray;
  2369. } else if (numComps === 3) {
  2370. return this.singletons.rgb;
  2371. } else if (numComps === 4) {
  2372. return this.singletons.cmyk;
  2373. }
  2374. break;
  2375. case "Pattern":
  2376. baseCS = cs[1] || null;
  2377. if (baseCS) {
  2378. baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
  2379. }
  2380. return new PatternCS(baseCS);
  2381. case "I":
  2382. case "Indexed":
  2383. baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
  2384. const hiVal = Math.max(0, Math.min(xref.fetchIfRef(cs[2]), 255));
  2385. const lookup = xref.fetchIfRef(cs[3]);
  2386. return new IndexedCS(baseCS, hiVal, lookup);
  2387. case "Separation":
  2388. case "DeviceN":
  2389. const name = xref.fetchIfRef(cs[1]);
  2390. numComps = Array.isArray(name) ? name.length : 1;
  2391. baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
  2392. const tintFn = pdfFunctionFactory.create(cs[3]);
  2393. return new AlternateCS(numComps, baseCS, tintFn);
  2394. case "Lab":
  2395. params = xref.fetchIfRef(cs[1]);
  2396. whitePoint = params.getArray("WhitePoint");
  2397. blackPoint = params.getArray("BlackPoint");
  2398. const range = params.getArray("Range");
  2399. return new LabCS(whitePoint, blackPoint, range);
  2400. default:
  2401. warn(`Unimplemented ColorSpace object: ${mode}`);
  2402. return this.singletons.gray;
  2403. }
  2404. }
  2405. warn(`Unrecognized ColorSpace object: ${cs}`);
  2406. return this.singletons.gray;
  2407. }
  2408. static isDefaultDecode(decode, numComps) {
  2409. if (!Array.isArray(decode)) {
  2410. return true;
  2411. }
  2412. if (numComps * 2 !== decode.length) {
  2413. warn("The decode map is not the correct length");
  2414. return true;
  2415. }
  2416. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  2417. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  2418. return false;
  2419. }
  2420. }
  2421. return true;
  2422. }
  2423. static get singletons() {
  2424. return shadow(this, "singletons", {
  2425. get gray() {
  2426. return shadow(this, "gray", new DeviceGrayCS());
  2427. },
  2428. get rgb() {
  2429. return shadow(this, "rgb", new DeviceRgbCS());
  2430. },
  2431. get rgba() {
  2432. return shadow(this, "rgba", new DeviceRgbaCS());
  2433. },
  2434. get cmyk() {
  2435. return shadow(this, "cmyk", new DeviceCmykCS());
  2436. }
  2437. });
  2438. }
  2439. }
  2440. class AlternateCS extends ColorSpace {
  2441. constructor(numComps, base, tintFn) {
  2442. super("Alternate", numComps);
  2443. this.base = base;
  2444. this.tintFn = tintFn;
  2445. this.tmpBuf = new Float32Array(base.numComps);
  2446. }
  2447. getRgbItem(src, srcOffset, dest, destOffset) {
  2448. const tmpBuf = this.tmpBuf;
  2449. this.tintFn(src, srcOffset, tmpBuf, 0);
  2450. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  2451. }
  2452. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  2453. const tintFn = this.tintFn;
  2454. const base = this.base;
  2455. const scale = 1 / ((1 << bits) - 1);
  2456. const baseNumComps = base.numComps;
  2457. const usesZeroToOneRange = base.usesZeroToOneRange;
  2458. const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  2459. let pos = isPassthrough ? destOffset : 0;
  2460. const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
  2461. const numComps = this.numComps;
  2462. const scaled = new Float32Array(numComps);
  2463. const tinted = new Float32Array(baseNumComps);
  2464. let i, j;
  2465. for (i = 0; i < count; i++) {
  2466. for (j = 0; j < numComps; j++) {
  2467. scaled[j] = src[srcOffset++] * scale;
  2468. }
  2469. tintFn(scaled, 0, tinted, 0);
  2470. if (usesZeroToOneRange) {
  2471. for (j = 0; j < baseNumComps; j++) {
  2472. baseBuf[pos++] = tinted[j] * 255;
  2473. }
  2474. } else {
  2475. base.getRgbItem(tinted, 0, baseBuf, pos);
  2476. pos += baseNumComps;
  2477. }
  2478. }
  2479. if (!isPassthrough) {
  2480. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  2481. }
  2482. }
  2483. getOutputLength(inputLength, alpha01) {
  2484. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  2485. }
  2486. }
  2487. class PatternCS extends ColorSpace {
  2488. constructor(baseCS) {
  2489. super("Pattern", null);
  2490. this.base = baseCS;
  2491. }
  2492. isDefaultDecode(decodeMap, bpc) {
  2493. unreachable("Should not call PatternCS.isDefaultDecode");
  2494. }
  2495. }
  2496. class IndexedCS extends ColorSpace {
  2497. constructor(base, highVal, lookup) {
  2498. super("Indexed", 1);
  2499. this.base = base;
  2500. const length = base.numComps * (highVal + 1);
  2501. this.lookup = new Uint8Array(length);
  2502. if (lookup instanceof BaseStream) {
  2503. const bytes = lookup.getBytes(length);
  2504. this.lookup.set(bytes);
  2505. } else if (typeof lookup === "string") {
  2506. for (let i = 0; i < length; ++i) {
  2507. this.lookup[i] = lookup.charCodeAt(i) & 0xff;
  2508. }
  2509. } else {
  2510. throw new FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
  2511. }
  2512. }
  2513. getRgbItem(src, srcOffset, dest, destOffset) {
  2514. const numComps = this.base.numComps;
  2515. const start = src[srcOffset] * numComps;
  2516. this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
  2517. }
  2518. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  2519. const base = this.base;
  2520. const numComps = base.numComps;
  2521. const outputDelta = base.getOutputLength(numComps, alpha01);
  2522. const lookup = this.lookup;
  2523. for (let i = 0; i < count; ++i) {
  2524. const lookupPos = src[srcOffset++] * numComps;
  2525. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  2526. destOffset += outputDelta;
  2527. }
  2528. }
  2529. getOutputLength(inputLength, alpha01) {
  2530. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  2531. }
  2532. isDefaultDecode(decodeMap, bpc) {
  2533. if (!Array.isArray(decodeMap)) {
  2534. return true;
  2535. }
  2536. if (decodeMap.length !== 2) {
  2537. warn("Decode map length is not correct");
  2538. return true;
  2539. }
  2540. if (!Number.isInteger(bpc) || bpc < 1) {
  2541. warn("Bits per component is not correct");
  2542. return true;
  2543. }
  2544. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  2545. }
  2546. }
  2547. class DeviceGrayCS extends ColorSpace {
  2548. constructor() {
  2549. super("DeviceGray", 1);
  2550. }
  2551. getRgbItem(src, srcOffset, dest, destOffset) {
  2552. const c = src[srcOffset] * 255;
  2553. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  2554. }
  2555. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  2556. const scale = 255 / ((1 << bits) - 1);
  2557. let j = srcOffset,
  2558. q = destOffset;
  2559. for (let i = 0; i < count; ++i) {
  2560. const c = scale * src[j++];
  2561. dest[q++] = c;
  2562. dest[q++] = c;
  2563. dest[q++] = c;
  2564. q += alpha01;
  2565. }
  2566. }
  2567. getOutputLength(inputLength, alpha01) {
  2568. return inputLength * (3 + alpha01);
  2569. }
  2570. }
  2571. class DeviceRgbCS extends ColorSpace {
  2572. constructor() {
  2573. super("DeviceRGB", 3);
  2574. }
  2575. getRgbItem(src, srcOffset, dest, destOffset) {
  2576. dest[destOffset] = src[srcOffset] * 255;
  2577. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  2578. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  2579. }
  2580. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  2581. if (bits === 8 && alpha01 === 0) {
  2582. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  2583. return;
  2584. }
  2585. const scale = 255 / ((1 << bits) - 1);
  2586. let j = srcOffset,
  2587. q = destOffset;
  2588. for (let i = 0; i < count; ++i) {
  2589. dest[q++] = scale * src[j++];
  2590. dest[q++] = scale * src[j++];
  2591. dest[q++] = scale * src[j++];
  2592. q += alpha01;
  2593. }
  2594. }
  2595. getOutputLength(inputLength, alpha01) {
  2596. return inputLength * (3 + alpha01) / 3 | 0;
  2597. }
  2598. isPassthrough(bits) {
  2599. return bits === 8;
  2600. }
  2601. }
  2602. class DeviceRgbaCS extends ColorSpace {
  2603. constructor() {
  2604. super("DeviceRGBA", 4);
  2605. }
  2606. getOutputLength(inputLength, _alpha01) {
  2607. return inputLength * 4;
  2608. }
  2609. isPassthrough(bits) {
  2610. return bits === 8;
  2611. }
  2612. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  2613. if (originalHeight !== height || originalWidth !== width) {
  2614. resizeRgbaImage(comps, dest, originalWidth, originalHeight, width, height, alpha01);
  2615. } else {
  2616. copyRgbaImage(comps, dest, alpha01);
  2617. }
  2618. }
  2619. }
  2620. class DeviceCmykCS extends ColorSpace {
  2621. constructor() {
  2622. super("DeviceCMYK", 4);
  2623. }
  2624. #toRgb(src, srcOffset, srcScale, dest, destOffset) {
  2625. const c = src[srcOffset] * srcScale;
  2626. const m = src[srcOffset + 1] * srcScale;
  2627. const y = src[srcOffset + 2] * srcScale;
  2628. const k = src[srcOffset + 3] * srcScale;
  2629. dest[destOffset] = 255 + c * (-4.387332384609988 * c + 54.48615194189176 * m + 18.82290502165302 * y + 212.25662451639585 * k + -285.2331026137004) + m * (1.7149763477362134 * m - 5.6096736904047315 * y + -17.873870861415444 * k - 5.497006427196366) + y * (-2.5217340131683033 * y - 21.248923337353073 * k + 17.5119270841813) + k * (-21.86122147463605 * k - 189.48180835922747);
  2630. dest[destOffset + 1] = 255 + c * (8.841041422036149 * c + 60.118027045597366 * m + 6.871425592049007 * y + 31.159100130055922 * k + -79.2970844816548) + m * (-15.310361306967817 * m + 17.575251261109482 * y + 131.35250912493976 * k - 190.9453302588951) + y * (4.444339102852739 * y + 9.8632861493405 * k - 24.86741582555878) + k * (-20.737325471181034 * k - 187.80453709719578);
  2631. dest[destOffset + 2] = 255 + c * (0.8842522430003296 * c + 8.078677503112928 * m + 30.89978309703729 * y - 0.23883238689178934 * k + -14.183576799673286) + m * (10.49593273432072 * m + 63.02378494754052 * y + 50.606957656360734 * k - 112.23884253719248) + y * (0.03296041114873217 * y + 115.60384449646641 * k + -193.58209356861505) + k * (-22.33816807309886 * k - 180.12613974708367);
  2632. }
  2633. getRgbItem(src, srcOffset, dest, destOffset) {
  2634. this.#toRgb(src, srcOffset, 1, dest, destOffset);
  2635. }
  2636. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  2637. const scale = 1 / ((1 << bits) - 1);
  2638. for (let i = 0; i < count; i++) {
  2639. this.#toRgb(src, srcOffset, scale, dest, destOffset);
  2640. srcOffset += 4;
  2641. destOffset += 3 + alpha01;
  2642. }
  2643. }
  2644. getOutputLength(inputLength, alpha01) {
  2645. return inputLength / 4 * (3 + alpha01) | 0;
  2646. }
  2647. }
  2648. class CalGrayCS extends ColorSpace {
  2649. constructor(whitePoint, blackPoint, gamma) {
  2650. super("CalGray", 1);
  2651. if (!whitePoint) {
  2652. throw new FormatError("WhitePoint missing - required for color space CalGray");
  2653. }
  2654. [this.XW, this.YW, this.ZW] = whitePoint;
  2655. [this.XB, this.YB, this.ZB] = blackPoint || [0, 0, 0];
  2656. this.G = gamma || 1;
  2657. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  2658. throw new FormatError(`Invalid WhitePoint components for ${this.name}, no fallback available`);
  2659. }
  2660. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  2661. info(`Invalid BlackPoint for ${this.name}, falling back to default.`);
  2662. this.XB = this.YB = this.ZB = 0;
  2663. }
  2664. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  2665. warn(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
  2666. }
  2667. if (this.G < 1) {
  2668. info(`Invalid Gamma: ${this.G} for ${this.name}, falling back to default.`);
  2669. this.G = 1;
  2670. }
  2671. }
  2672. #toRgb(src, srcOffset, dest, destOffset, scale) {
  2673. const A = src[srcOffset] * scale;
  2674. const AG = A ** this.G;
  2675. const L = this.YW * AG;
  2676. const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0);
  2677. dest[destOffset] = val;
  2678. dest[destOffset + 1] = val;
  2679. dest[destOffset + 2] = val;
  2680. }
  2681. getRgbItem(src, srcOffset, dest, destOffset) {
  2682. this.#toRgb(src, srcOffset, dest, destOffset, 1);
  2683. }
  2684. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  2685. const scale = 1 / ((1 << bits) - 1);
  2686. for (let i = 0; i < count; ++i) {
  2687. this.#toRgb(src, srcOffset, dest, destOffset, scale);
  2688. srcOffset += 1;
  2689. destOffset += 3 + alpha01;
  2690. }
  2691. }
  2692. getOutputLength(inputLength, alpha01) {
  2693. return inputLength * (3 + alpha01);
  2694. }
  2695. }
  2696. class CalRGBCS extends ColorSpace {
  2697. static #BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  2698. static #BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([0.9869929, -0.1470543, 0.1599627, 0.4323053, 0.5183603, 0.0492912, -0.0085287, 0.0400428, 0.9684867]);
  2699. static #SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([3.2404542, -1.5371385, -0.4985314, -0.9692660, 1.8760108, 0.0415560, 0.0556434, -0.2040259, 1.0572252]);
  2700. static #FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  2701. static #tempNormalizeMatrix = new Float32Array(3);
  2702. static #tempConvertMatrix1 = new Float32Array(3);
  2703. static #tempConvertMatrix2 = new Float32Array(3);
  2704. static #DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  2705. constructor(whitePoint, blackPoint, gamma, matrix) {
  2706. super("CalRGB", 3);
  2707. if (!whitePoint) {
  2708. throw new FormatError("WhitePoint missing - required for color space CalRGB");
  2709. }
  2710. const [XW, YW, ZW] = this.whitePoint = whitePoint;
  2711. const [XB, YB, ZB] = this.blackPoint = blackPoint || new Float32Array(3);
  2712. [this.GR, this.GG, this.GB] = gamma || new Float32Array([1, 1, 1]);
  2713. [this.MXA, this.MYA, this.MZA, this.MXB, this.MYB, this.MZB, this.MXC, this.MYC, this.MZC] = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  2714. if (XW < 0 || ZW < 0 || YW !== 1) {
  2715. throw new FormatError(`Invalid WhitePoint components for ${this.name}, no fallback available`);
  2716. }
  2717. if (XB < 0 || YB < 0 || ZB < 0) {
  2718. info(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
  2719. this.blackPoint = new Float32Array(3);
  2720. }
  2721. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  2722. info(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
  2723. this.GR = this.GG = this.GB = 1;
  2724. }
  2725. }
  2726. #matrixProduct(a, b, result) {
  2727. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  2728. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  2729. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  2730. }
  2731. #toFlat(sourceWhitePoint, LMS, result) {
  2732. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  2733. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  2734. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  2735. }
  2736. #toD65(sourceWhitePoint, LMS, result) {
  2737. const D65X = 0.95047;
  2738. const D65Y = 1;
  2739. const D65Z = 1.08883;
  2740. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  2741. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  2742. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  2743. }
  2744. #sRGBTransferFunction(color) {
  2745. if (color <= 0.0031308) {
  2746. return this.#adjustToRange(0, 1, 12.92 * color);
  2747. }
  2748. if (color >= 0.99554525) {
  2749. return 1;
  2750. }
  2751. return this.#adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
  2752. }
  2753. #adjustToRange(min, max, value) {
  2754. return Math.max(min, Math.min(max, value));
  2755. }
  2756. #decodeL(L) {
  2757. if (L < 0) {
  2758. return -this.#decodeL(-L);
  2759. }
  2760. if (L > 8.0) {
  2761. return ((L + 16) / 116) ** 3;
  2762. }
  2763. return L * CalRGBCS.#DECODE_L_CONSTANT;
  2764. }
  2765. #compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  2766. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  2767. result[0] = XYZ_Flat[0];
  2768. result[1] = XYZ_Flat[1];
  2769. result[2] = XYZ_Flat[2];
  2770. return;
  2771. }
  2772. const zeroDecodeL = this.#decodeL(0);
  2773. const X_DST = zeroDecodeL;
  2774. const X_SRC = this.#decodeL(sourceBlackPoint[0]);
  2775. const Y_DST = zeroDecodeL;
  2776. const Y_SRC = this.#decodeL(sourceBlackPoint[1]);
  2777. const Z_DST = zeroDecodeL;
  2778. const Z_SRC = this.#decodeL(sourceBlackPoint[2]);
  2779. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  2780. const X_Offset = 1 - X_Scale;
  2781. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  2782. const Y_Offset = 1 - Y_Scale;
  2783. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  2784. const Z_Offset = 1 - Z_Scale;
  2785. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  2786. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  2787. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  2788. }
  2789. #normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  2790. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  2791. result[0] = XYZ_In[0];
  2792. result[1] = XYZ_In[1];
  2793. result[2] = XYZ_In[2];
  2794. return;
  2795. }
  2796. const LMS = result;
  2797. this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  2798. const LMS_Flat = CalRGBCS.#tempNormalizeMatrix;
  2799. this.#toFlat(sourceWhitePoint, LMS, LMS_Flat);
  2800. this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  2801. }
  2802. #normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  2803. const LMS = result;
  2804. this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  2805. const LMS_D65 = CalRGBCS.#tempNormalizeMatrix;
  2806. this.#toD65(sourceWhitePoint, LMS, LMS_D65);
  2807. this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  2808. }
  2809. #toRgb(src, srcOffset, dest, destOffset, scale) {
  2810. const A = this.#adjustToRange(0, 1, src[srcOffset] * scale);
  2811. const B = this.#adjustToRange(0, 1, src[srcOffset + 1] * scale);
  2812. const C = this.#adjustToRange(0, 1, src[srcOffset + 2] * scale);
  2813. const AGR = A === 1 ? 1 : A ** this.GR;
  2814. const BGG = B === 1 ? 1 : B ** this.GG;
  2815. const CGB = C === 1 ? 1 : C ** this.GB;
  2816. const X = this.MXA * AGR + this.MXB * BGG + this.MXC * CGB;
  2817. const Y = this.MYA * AGR + this.MYB * BGG + this.MYC * CGB;
  2818. const Z = this.MZA * AGR + this.MZB * BGG + this.MZC * CGB;
  2819. const XYZ = CalRGBCS.#tempConvertMatrix1;
  2820. XYZ[0] = X;
  2821. XYZ[1] = Y;
  2822. XYZ[2] = Z;
  2823. const XYZ_Flat = CalRGBCS.#tempConvertMatrix2;
  2824. this.#normalizeWhitePointToFlat(this.whitePoint, XYZ, XYZ_Flat);
  2825. const XYZ_Black = CalRGBCS.#tempConvertMatrix1;
  2826. this.#compensateBlackPoint(this.blackPoint, XYZ_Flat, XYZ_Black);
  2827. const XYZ_D65 = CalRGBCS.#tempConvertMatrix2;
  2828. this.#normalizeWhitePointToD65(CalRGBCS.#FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  2829. const SRGB = CalRGBCS.#tempConvertMatrix1;
  2830. this.#matrixProduct(CalRGBCS.#SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  2831. dest[destOffset] = this.#sRGBTransferFunction(SRGB[0]) * 255;
  2832. dest[destOffset + 1] = this.#sRGBTransferFunction(SRGB[1]) * 255;
  2833. dest[destOffset + 2] = this.#sRGBTransferFunction(SRGB[2]) * 255;
  2834. }
  2835. getRgbItem(src, srcOffset, dest, destOffset) {
  2836. this.#toRgb(src, srcOffset, dest, destOffset, 1);
  2837. }
  2838. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  2839. const scale = 1 / ((1 << bits) - 1);
  2840. for (let i = 0; i < count; ++i) {
  2841. this.#toRgb(src, srcOffset, dest, destOffset, scale);
  2842. srcOffset += 3;
  2843. destOffset += 3 + alpha01;
  2844. }
  2845. }
  2846. getOutputLength(inputLength, alpha01) {
  2847. return inputLength * (3 + alpha01) / 3 | 0;
  2848. }
  2849. }
  2850. class LabCS extends ColorSpace {
  2851. constructor(whitePoint, blackPoint, range) {
  2852. super("Lab", 3);
  2853. if (!whitePoint) {
  2854. throw new FormatError("WhitePoint missing - required for color space Lab");
  2855. }
  2856. [this.XW, this.YW, this.ZW] = whitePoint;
  2857. [this.amin, this.amax, this.bmin, this.bmax] = range || [-100, 100, -100, 100];
  2858. [this.XB, this.YB, this.ZB] = blackPoint || [0, 0, 0];
  2859. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  2860. throw new FormatError("Invalid WhitePoint components, no fallback available");
  2861. }
  2862. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  2863. info("Invalid BlackPoint, falling back to default");
  2864. this.XB = this.YB = this.ZB = 0;
  2865. }
  2866. if (this.amin > this.amax || this.bmin > this.bmax) {
  2867. info("Invalid Range, falling back to defaults");
  2868. this.amin = -100;
  2869. this.amax = 100;
  2870. this.bmin = -100;
  2871. this.bmax = 100;
  2872. }
  2873. }
  2874. #fn_g(x) {
  2875. return x >= 6 / 29 ? x ** 3 : 108 / 841 * (x - 4 / 29);
  2876. }
  2877. #decode(value, high1, low2, high2) {
  2878. return low2 + value * (high2 - low2) / high1;
  2879. }
  2880. #toRgb(src, srcOffset, maxVal, dest, destOffset) {
  2881. let Ls = src[srcOffset];
  2882. let as = src[srcOffset + 1];
  2883. let bs = src[srcOffset + 2];
  2884. if (maxVal !== false) {
  2885. Ls = this.#decode(Ls, maxVal, 0, 100);
  2886. as = this.#decode(as, maxVal, this.amin, this.amax);
  2887. bs = this.#decode(bs, maxVal, this.bmin, this.bmax);
  2888. }
  2889. if (as > this.amax) {
  2890. as = this.amax;
  2891. } else if (as < this.amin) {
  2892. as = this.amin;
  2893. }
  2894. if (bs > this.bmax) {
  2895. bs = this.bmax;
  2896. } else if (bs < this.bmin) {
  2897. bs = this.bmin;
  2898. }
  2899. const M = (Ls + 16) / 116;
  2900. const L = M + as / 500;
  2901. const N = M - bs / 200;
  2902. const X = this.XW * this.#fn_g(L);
  2903. const Y = this.YW * this.#fn_g(M);
  2904. const Z = this.ZW * this.#fn_g(N);
  2905. let r, g, b;
  2906. if (this.ZW < 1) {
  2907. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  2908. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  2909. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  2910. } else {
  2911. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  2912. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  2913. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  2914. }
  2915. dest[destOffset] = Math.sqrt(r) * 255;
  2916. dest[destOffset + 1] = Math.sqrt(g) * 255;
  2917. dest[destOffset + 2] = Math.sqrt(b) * 255;
  2918. }
  2919. getRgbItem(src, srcOffset, dest, destOffset) {
  2920. this.#toRgb(src, srcOffset, false, dest, destOffset);
  2921. }
  2922. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  2923. const maxVal = (1 << bits) - 1;
  2924. for (let i = 0; i < count; i++) {
  2925. this.#toRgb(src, srcOffset, maxVal, dest, destOffset);
  2926. srcOffset += 3;
  2927. destOffset += 3 + alpha01;
  2928. }
  2929. }
  2930. getOutputLength(inputLength, alpha01) {
  2931. return inputLength * (3 + alpha01) / 3 | 0;
  2932. }
  2933. isDefaultDecode(decodeMap, bpc) {
  2934. return true;
  2935. }
  2936. get usesZeroToOneRange() {
  2937. return shadow(this, "usesZeroToOneRange", false);
  2938. }
  2939. }
  2940. ;// ./src/core/binary_cmap.js
  2941. function hexToInt(a, size) {
  2942. let n = 0;
  2943. for (let i = 0; i <= size; i++) {
  2944. n = n << 8 | a[i];
  2945. }
  2946. return n >>> 0;
  2947. }
  2948. function hexToStr(a, size) {
  2949. if (size === 1) {
  2950. return String.fromCharCode(a[0], a[1]);
  2951. }
  2952. if (size === 3) {
  2953. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  2954. }
  2955. return String.fromCharCode(...a.subarray(0, size + 1));
  2956. }
  2957. function addHex(a, b, size) {
  2958. let c = 0;
  2959. for (let i = size; i >= 0; i--) {
  2960. c += a[i] + b[i];
  2961. a[i] = c & 255;
  2962. c >>= 8;
  2963. }
  2964. }
  2965. function incHex(a, size) {
  2966. let c = 1;
  2967. for (let i = size; i >= 0 && c > 0; i--) {
  2968. c += a[i];
  2969. a[i] = c & 255;
  2970. c >>= 8;
  2971. }
  2972. }
  2973. const MAX_NUM_SIZE = 16;
  2974. const MAX_ENCODED_NUM_SIZE = 19;
  2975. class BinaryCMapStream {
  2976. constructor(data) {
  2977. this.buffer = data;
  2978. this.pos = 0;
  2979. this.end = data.length;
  2980. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  2981. }
  2982. readByte() {
  2983. if (this.pos >= this.end) {
  2984. return -1;
  2985. }
  2986. return this.buffer[this.pos++];
  2987. }
  2988. readNumber() {
  2989. let n = 0;
  2990. let last;
  2991. do {
  2992. const b = this.readByte();
  2993. if (b < 0) {
  2994. throw new FormatError("unexpected EOF in bcmap");
  2995. }
  2996. last = !(b & 0x80);
  2997. n = n << 7 | b & 0x7f;
  2998. } while (!last);
  2999. return n;
  3000. }
  3001. readSigned() {
  3002. const n = this.readNumber();
  3003. return n & 1 ? ~(n >>> 1) : n >>> 1;
  3004. }
  3005. readHex(num, size) {
  3006. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  3007. this.pos += size + 1;
  3008. }
  3009. readHexNumber(num, size) {
  3010. let last;
  3011. const stack = this.tmpBuf;
  3012. let sp = 0;
  3013. do {
  3014. const b = this.readByte();
  3015. if (b < 0) {
  3016. throw new FormatError("unexpected EOF in bcmap");
  3017. }
  3018. last = !(b & 0x80);
  3019. stack[sp++] = b & 0x7f;
  3020. } while (!last);
  3021. let i = size,
  3022. buffer = 0,
  3023. bufferSize = 0;
  3024. while (i >= 0) {
  3025. while (bufferSize < 8 && stack.length > 0) {
  3026. buffer |= stack[--sp] << bufferSize;
  3027. bufferSize += 7;
  3028. }
  3029. num[i] = buffer & 255;
  3030. i--;
  3031. buffer >>= 8;
  3032. bufferSize -= 8;
  3033. }
  3034. }
  3035. readHexSigned(num, size) {
  3036. this.readHexNumber(num, size);
  3037. const sign = num[size] & 1 ? 255 : 0;
  3038. let c = 0;
  3039. for (let i = 0; i <= size; i++) {
  3040. c = (c & 1) << 8 | num[i];
  3041. num[i] = c >> 1 ^ sign;
  3042. }
  3043. }
  3044. readString() {
  3045. const len = this.readNumber(),
  3046. buf = new Array(len);
  3047. for (let i = 0; i < len; i++) {
  3048. buf[i] = this.readNumber();
  3049. }
  3050. return String.fromCharCode(...buf);
  3051. }
  3052. }
  3053. class BinaryCMapReader {
  3054. async process(data, cMap, extend) {
  3055. const stream = new BinaryCMapStream(data);
  3056. const header = stream.readByte();
  3057. cMap.vertical = !!(header & 1);
  3058. let useCMap = null;
  3059. const start = new Uint8Array(MAX_NUM_SIZE);
  3060. const end = new Uint8Array(MAX_NUM_SIZE);
  3061. const char = new Uint8Array(MAX_NUM_SIZE);
  3062. const charCode = new Uint8Array(MAX_NUM_SIZE);
  3063. const tmp = new Uint8Array(MAX_NUM_SIZE);
  3064. let code;
  3065. let b;
  3066. while ((b = stream.readByte()) >= 0) {
  3067. const type = b >> 5;
  3068. if (type === 7) {
  3069. switch (b & 0x1f) {
  3070. case 0:
  3071. stream.readString();
  3072. break;
  3073. case 1:
  3074. useCMap = stream.readString();
  3075. break;
  3076. }
  3077. continue;
  3078. }
  3079. const sequence = !!(b & 0x10);
  3080. const dataSize = b & 15;
  3081. if (dataSize + 1 > MAX_NUM_SIZE) {
  3082. throw new Error("BinaryCMapReader.process: Invalid dataSize.");
  3083. }
  3084. const ucs2DataSize = 1;
  3085. const subitemsCount = stream.readNumber();
  3086. switch (type) {
  3087. case 0:
  3088. stream.readHex(start, dataSize);
  3089. stream.readHexNumber(end, dataSize);
  3090. addHex(end, start, dataSize);
  3091. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  3092. for (let i = 1; i < subitemsCount; i++) {
  3093. incHex(end, dataSize);
  3094. stream.readHexNumber(start, dataSize);
  3095. addHex(start, end, dataSize);
  3096. stream.readHexNumber(end, dataSize);
  3097. addHex(end, start, dataSize);
  3098. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  3099. }
  3100. break;
  3101. case 1:
  3102. stream.readHex(start, dataSize);
  3103. stream.readHexNumber(end, dataSize);
  3104. addHex(end, start, dataSize);
  3105. stream.readNumber();
  3106. for (let i = 1; i < subitemsCount; i++) {
  3107. incHex(end, dataSize);
  3108. stream.readHexNumber(start, dataSize);
  3109. addHex(start, end, dataSize);
  3110. stream.readHexNumber(end, dataSize);
  3111. addHex(end, start, dataSize);
  3112. stream.readNumber();
  3113. }
  3114. break;
  3115. case 2:
  3116. stream.readHex(char, dataSize);
  3117. code = stream.readNumber();
  3118. cMap.mapOne(hexToInt(char, dataSize), code);
  3119. for (let i = 1; i < subitemsCount; i++) {
  3120. incHex(char, dataSize);
  3121. if (!sequence) {
  3122. stream.readHexNumber(tmp, dataSize);
  3123. addHex(char, tmp, dataSize);
  3124. }
  3125. code = stream.readSigned() + (code + 1);
  3126. cMap.mapOne(hexToInt(char, dataSize), code);
  3127. }
  3128. break;
  3129. case 3:
  3130. stream.readHex(start, dataSize);
  3131. stream.readHexNumber(end, dataSize);
  3132. addHex(end, start, dataSize);
  3133. code = stream.readNumber();
  3134. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  3135. for (let i = 1; i < subitemsCount; i++) {
  3136. incHex(end, dataSize);
  3137. if (!sequence) {
  3138. stream.readHexNumber(start, dataSize);
  3139. addHex(start, end, dataSize);
  3140. } else {
  3141. start.set(end);
  3142. }
  3143. stream.readHexNumber(end, dataSize);
  3144. addHex(end, start, dataSize);
  3145. code = stream.readNumber();
  3146. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  3147. }
  3148. break;
  3149. case 4:
  3150. stream.readHex(char, ucs2DataSize);
  3151. stream.readHex(charCode, dataSize);
  3152. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  3153. for (let i = 1; i < subitemsCount; i++) {
  3154. incHex(char, ucs2DataSize);
  3155. if (!sequence) {
  3156. stream.readHexNumber(tmp, ucs2DataSize);
  3157. addHex(char, tmp, ucs2DataSize);
  3158. }
  3159. incHex(charCode, dataSize);
  3160. stream.readHexSigned(tmp, dataSize);
  3161. addHex(charCode, tmp, dataSize);
  3162. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  3163. }
  3164. break;
  3165. case 5:
  3166. stream.readHex(start, ucs2DataSize);
  3167. stream.readHexNumber(end, ucs2DataSize);
  3168. addHex(end, start, ucs2DataSize);
  3169. stream.readHex(charCode, dataSize);
  3170. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  3171. for (let i = 1; i < subitemsCount; i++) {
  3172. incHex(end, ucs2DataSize);
  3173. if (!sequence) {
  3174. stream.readHexNumber(start, ucs2DataSize);
  3175. addHex(start, end, ucs2DataSize);
  3176. } else {
  3177. start.set(end);
  3178. }
  3179. stream.readHexNumber(end, ucs2DataSize);
  3180. addHex(end, start, ucs2DataSize);
  3181. stream.readHex(charCode, dataSize);
  3182. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  3183. }
  3184. break;
  3185. default:
  3186. throw new Error(`BinaryCMapReader.process - unknown type: ${type}`);
  3187. }
  3188. }
  3189. if (useCMap) {
  3190. return extend(useCMap);
  3191. }
  3192. return cMap;
  3193. }
  3194. }
  3195. ;// ./src/core/decode_stream.js
  3196. const emptyBuffer = new Uint8Array(0);
  3197. class DecodeStream extends BaseStream {
  3198. constructor(maybeMinBufferLength) {
  3199. super();
  3200. this._rawMinBufferLength = maybeMinBufferLength || 0;
  3201. this.pos = 0;
  3202. this.bufferLength = 0;
  3203. this.eof = false;
  3204. this.buffer = emptyBuffer;
  3205. this.minBufferLength = 512;
  3206. if (maybeMinBufferLength) {
  3207. while (this.minBufferLength < maybeMinBufferLength) {
  3208. this.minBufferLength *= 2;
  3209. }
  3210. }
  3211. }
  3212. get isEmpty() {
  3213. while (!this.eof && this.bufferLength === 0) {
  3214. this.readBlock();
  3215. }
  3216. return this.bufferLength === 0;
  3217. }
  3218. ensureBuffer(requested) {
  3219. const buffer = this.buffer;
  3220. if (requested <= buffer.byteLength) {
  3221. return buffer;
  3222. }
  3223. let size = this.minBufferLength;
  3224. while (size < requested) {
  3225. size *= 2;
  3226. }
  3227. const buffer2 = new Uint8Array(size);
  3228. buffer2.set(buffer);
  3229. return this.buffer = buffer2;
  3230. }
  3231. getByte() {
  3232. const pos = this.pos;
  3233. while (this.bufferLength <= pos) {
  3234. if (this.eof) {
  3235. return -1;
  3236. }
  3237. this.readBlock();
  3238. }
  3239. return this.buffer[this.pos++];
  3240. }
  3241. getBytes(length, decoderOptions = null) {
  3242. const pos = this.pos;
  3243. let end;
  3244. if (length) {
  3245. this.ensureBuffer(pos + length);
  3246. end = pos + length;
  3247. while (!this.eof && this.bufferLength < end) {
  3248. this.readBlock(decoderOptions);
  3249. }
  3250. const bufEnd = this.bufferLength;
  3251. if (end > bufEnd) {
  3252. end = bufEnd;
  3253. }
  3254. } else {
  3255. while (!this.eof) {
  3256. this.readBlock(decoderOptions);
  3257. }
  3258. end = this.bufferLength;
  3259. }
  3260. this.pos = end;
  3261. return this.buffer.subarray(pos, end);
  3262. }
  3263. async getImageData(length, decoderOptions = null) {
  3264. if (!this.canAsyncDecodeImageFromBuffer) {
  3265. return this.getBytes(length, decoderOptions);
  3266. }
  3267. const data = await this.stream.asyncGetBytes();
  3268. return this.decodeImage(data, decoderOptions);
  3269. }
  3270. reset() {
  3271. this.pos = 0;
  3272. }
  3273. makeSubStream(start, length, dict = null) {
  3274. if (length === undefined) {
  3275. while (!this.eof) {
  3276. this.readBlock();
  3277. }
  3278. } else {
  3279. const end = start + length;
  3280. while (this.bufferLength <= end && !this.eof) {
  3281. this.readBlock();
  3282. }
  3283. }
  3284. return new Stream(this.buffer, start, length, dict);
  3285. }
  3286. getBaseStreams() {
  3287. return this.str ? this.str.getBaseStreams() : null;
  3288. }
  3289. }
  3290. class StreamsSequenceStream extends DecodeStream {
  3291. constructor(streams, onError = null) {
  3292. streams = streams.filter(s => s instanceof BaseStream);
  3293. let maybeLength = 0;
  3294. for (const stream of streams) {
  3295. maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length;
  3296. }
  3297. super(maybeLength);
  3298. this.streams = streams;
  3299. this._onError = onError;
  3300. }
  3301. readBlock() {
  3302. const streams = this.streams;
  3303. if (streams.length === 0) {
  3304. this.eof = true;
  3305. return;
  3306. }
  3307. const stream = streams.shift();
  3308. let chunk;
  3309. try {
  3310. chunk = stream.getBytes();
  3311. } catch (reason) {
  3312. if (this._onError) {
  3313. this._onError(reason, stream.dict?.objId);
  3314. return;
  3315. }
  3316. throw reason;
  3317. }
  3318. const bufferLength = this.bufferLength;
  3319. const newLength = bufferLength + chunk.length;
  3320. const buffer = this.ensureBuffer(newLength);
  3321. buffer.set(chunk, bufferLength);
  3322. this.bufferLength = newLength;
  3323. }
  3324. getBaseStreams() {
  3325. const baseStreamsBuf = [];
  3326. for (const stream of this.streams) {
  3327. const baseStreams = stream.getBaseStreams();
  3328. if (baseStreams) {
  3329. baseStreamsBuf.push(...baseStreams);
  3330. }
  3331. }
  3332. return baseStreamsBuf.length > 0 ? baseStreamsBuf : null;
  3333. }
  3334. }
  3335. ;// ./src/core/ascii_85_stream.js
  3336. class Ascii85Stream extends DecodeStream {
  3337. constructor(str, maybeLength) {
  3338. if (maybeLength) {
  3339. maybeLength *= 0.8;
  3340. }
  3341. super(maybeLength);
  3342. this.str = str;
  3343. this.dict = str.dict;
  3344. this.input = new Uint8Array(5);
  3345. }
  3346. readBlock() {
  3347. const TILDA_CHAR = 0x7e;
  3348. const Z_LOWER_CHAR = 0x7a;
  3349. const EOF = -1;
  3350. const str = this.str;
  3351. let c = str.getByte();
  3352. while (isWhiteSpace(c)) {
  3353. c = str.getByte();
  3354. }
  3355. if (c === EOF || c === TILDA_CHAR) {
  3356. this.eof = true;
  3357. return;
  3358. }
  3359. const bufferLength = this.bufferLength;
  3360. let buffer, i;
  3361. if (c === Z_LOWER_CHAR) {
  3362. buffer = this.ensureBuffer(bufferLength + 4);
  3363. for (i = 0; i < 4; ++i) {
  3364. buffer[bufferLength + i] = 0;
  3365. }
  3366. this.bufferLength += 4;
  3367. } else {
  3368. const input = this.input;
  3369. input[0] = c;
  3370. for (i = 1; i < 5; ++i) {
  3371. c = str.getByte();
  3372. while (isWhiteSpace(c)) {
  3373. c = str.getByte();
  3374. }
  3375. input[i] = c;
  3376. if (c === EOF || c === TILDA_CHAR) {
  3377. break;
  3378. }
  3379. }
  3380. buffer = this.ensureBuffer(bufferLength + i - 1);
  3381. this.bufferLength += i - 1;
  3382. if (i < 5) {
  3383. for (; i < 5; ++i) {
  3384. input[i] = 0x21 + 84;
  3385. }
  3386. this.eof = true;
  3387. }
  3388. let t = 0;
  3389. for (i = 0; i < 5; ++i) {
  3390. t = t * 85 + (input[i] - 0x21);
  3391. }
  3392. for (i = 3; i >= 0; --i) {
  3393. buffer[bufferLength + i] = t & 0xff;
  3394. t >>= 8;
  3395. }
  3396. }
  3397. }
  3398. }
  3399. ;// ./src/core/ascii_hex_stream.js
  3400. class AsciiHexStream extends DecodeStream {
  3401. constructor(str, maybeLength) {
  3402. if (maybeLength) {
  3403. maybeLength *= 0.5;
  3404. }
  3405. super(maybeLength);
  3406. this.str = str;
  3407. this.dict = str.dict;
  3408. this.firstDigit = -1;
  3409. }
  3410. readBlock() {
  3411. const UPSTREAM_BLOCK_SIZE = 8000;
  3412. const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  3413. if (!bytes.length) {
  3414. this.eof = true;
  3415. return;
  3416. }
  3417. const maxDecodeLength = bytes.length + 1 >> 1;
  3418. const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  3419. let bufferLength = this.bufferLength;
  3420. let firstDigit = this.firstDigit;
  3421. for (const ch of bytes) {
  3422. let digit;
  3423. if (ch >= 0x30 && ch <= 0x39) {
  3424. digit = ch & 0x0f;
  3425. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  3426. digit = (ch & 0x0f) + 9;
  3427. } else if (ch === 0x3e) {
  3428. this.eof = true;
  3429. break;
  3430. } else {
  3431. continue;
  3432. }
  3433. if (firstDigit < 0) {
  3434. firstDigit = digit;
  3435. } else {
  3436. buffer[bufferLength++] = firstDigit << 4 | digit;
  3437. firstDigit = -1;
  3438. }
  3439. }
  3440. if (firstDigit >= 0 && this.eof) {
  3441. buffer[bufferLength++] = firstDigit << 4;
  3442. firstDigit = -1;
  3443. }
  3444. this.firstDigit = firstDigit;
  3445. this.bufferLength = bufferLength;
  3446. }
  3447. }
  3448. ;// ./src/core/ccitt.js
  3449. const ccittEOL = -2;
  3450. const ccittEOF = -1;
  3451. const twoDimPass = 0;
  3452. const twoDimHoriz = 1;
  3453. const twoDimVert0 = 2;
  3454. const twoDimVertR1 = 3;
  3455. const twoDimVertL1 = 4;
  3456. const twoDimVertR2 = 5;
  3457. const twoDimVertL2 = 6;
  3458. const twoDimVertR3 = 7;
  3459. const twoDimVertL3 = 8;
  3460. const twoDimTable = [[-1, -1], [-1, -1], [7, twoDimVertL3], [7, twoDimVertR3], [6, twoDimVertL2], [6, twoDimVertL2], [6, twoDimVertR2], [6, twoDimVertR2], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0]];
  3461. const whiteTable1 = [[-1, -1], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [12, 1984], [12, 2048], [12, 2112], [12, 2176], [12, 2240], [12, 2304], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [12, 2368], [12, 2432], [12, 2496], [12, 2560]];
  3462. const whiteTable2 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [8, 29], [8, 29], [8, 30], [8, 30], [8, 45], [8, 45], [8, 46], [8, 46], [7, 22], [7, 22], [7, 22], [7, 22], [7, 23], [7, 23], [7, 23], [7, 23], [8, 47], [8, 47], [8, 48], [8, 48], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [7, 20], [7, 20], [7, 20], [7, 20], [8, 33], [8, 33], [8, 34], [8, 34], [8, 35], [8, 35], [8, 36], [8, 36], [8, 37], [8, 37], [8, 38], [8, 38], [7, 19], [7, 19], [7, 19], [7, 19], [8, 31], [8, 31], [8, 32], [8, 32], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [8, 53], [8, 53], [8, 54], [8, 54], [7, 26], [7, 26], [7, 26], [7, 26], [8, 39], [8, 39], [8, 40], [8, 40], [8, 41], [8, 41], [8, 42], [8, 42], [8, 43], [8, 43], [8, 44], [8, 44], [7, 21], [7, 21], [7, 21], [7, 21], [7, 28], [7, 28], [7, 28], [7, 28], [8, 61], [8, 61], [8, 62], [8, 62], [8, 63], [8, 63], [8, 0], [8, 0], [8, 320], [8, 320], [8, 384], [8, 384], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [7, 27], [7, 27], [7, 27], [7, 27], [8, 59], [8, 59], [8, 60], [8, 60], [9, 1472], [9, 1536], [9, 1600], [9, 1728], [7, 18], [7, 18], [7, 18], [7, 18], [7, 24], [7, 24], [7, 24], [7, 24], [8, 49], [8, 49], [8, 50], [8, 50], [8, 51], [8, 51], [8, 52], [8, 52], [7, 25], [7, 25], [7, 25], [7, 25], [8, 55], [8, 55], [8, 56], [8, 56], [8, 57], [8, 57], [8, 58], [8, 58], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [8, 448], [8, 448], [8, 512], [8, 512], [9, 704], [9, 768], [8, 640], [8, 640], [8, 576], [8, 576], [9, 832], [9, 896], [9, 960], [9, 1024], [9, 1088], [9, 1152], [9, 1216], [9, 1280], [9, 1344], [9, 1408], [7, 256], [7, 256], [7, 256], [7, 256], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7]];
  3463. const blackTable1 = [[-1, -1], [-1, -1], [12, ccittEOL], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [11, 1792], [11, 1792], [12, 1984], [12, 1984], [12, 2048], [12, 2048], [12, 2112], [12, 2112], [12, 2176], [12, 2176], [12, 2240], [12, 2240], [12, 2304], [12, 2304], [11, 1856], [11, 1856], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [11, 1920], [11, 1920], [12, 2368], [12, 2368], [12, 2432], [12, 2432], [12, 2496], [12, 2496], [12, 2560], [12, 2560], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [12, 52], [12, 52], [13, 640], [13, 704], [13, 768], [13, 832], [12, 55], [12, 55], [12, 56], [12, 56], [13, 1280], [13, 1344], [13, 1408], [13, 1472], [12, 59], [12, 59], [12, 60], [12, 60], [13, 1536], [13, 1600], [11, 24], [11, 24], [11, 24], [11, 24], [11, 25], [11, 25], [11, 25], [11, 25], [13, 1664], [13, 1728], [12, 320], [12, 320], [12, 384], [12, 384], [12, 448], [12, 448], [13, 512], [13, 576], [12, 53], [12, 53], [12, 54], [12, 54], [13, 896], [13, 960], [13, 1024], [13, 1088], [13, 1152], [13, 1216], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64]];
  3464. const blackTable2 = [[8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [11, 23], [11, 23], [12, 50], [12, 51], [12, 44], [12, 45], [12, 46], [12, 47], [12, 57], [12, 58], [12, 61], [12, 256], [10, 16], [10, 16], [10, 16], [10, 16], [10, 17], [10, 17], [10, 17], [10, 17], [12, 48], [12, 49], [12, 62], [12, 63], [12, 30], [12, 31], [12, 32], [12, 33], [12, 40], [12, 41], [11, 22], [11, 22], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [12, 128], [12, 192], [12, 26], [12, 27], [12, 28], [12, 29], [11, 19], [11, 19], [11, 20], [11, 20], [12, 34], [12, 35], [12, 36], [12, 37], [12, 38], [12, 39], [11, 21], [11, 21], [12, 42], [12, 43], [10, 0], [10, 0], [10, 0], [10, 0], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12]];
  3465. const blackTable3 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [6, 9], [6, 8], [5, 7], [5, 7], [4, 6], [4, 6], [4, 6], [4, 6], [4, 5], [4, 5], [4, 5], [4, 5], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2]];
  3466. class CCITTFaxDecoder {
  3467. constructor(source, options = {}) {
  3468. if (!source || typeof source.next !== "function") {
  3469. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  3470. }
  3471. this.source = source;
  3472. this.eof = false;
  3473. this.encoding = options.K || 0;
  3474. this.eoline = options.EndOfLine || false;
  3475. this.byteAlign = options.EncodedByteAlign || false;
  3476. this.columns = options.Columns || 1728;
  3477. this.rows = options.Rows || 0;
  3478. this.eoblock = options.EndOfBlock ?? true;
  3479. this.black = options.BlackIs1 || false;
  3480. this.codingLine = new Uint32Array(this.columns + 1);
  3481. this.refLine = new Uint32Array(this.columns + 2);
  3482. this.codingLine[0] = this.columns;
  3483. this.codingPos = 0;
  3484. this.row = 0;
  3485. this.nextLine2D = this.encoding < 0;
  3486. this.inputBits = 0;
  3487. this.inputBuf = 0;
  3488. this.outputBits = 0;
  3489. this.rowsDone = false;
  3490. let code1;
  3491. while ((code1 = this._lookBits(12)) === 0) {
  3492. this._eatBits(1);
  3493. }
  3494. if (code1 === 1) {
  3495. this._eatBits(12);
  3496. }
  3497. if (this.encoding > 0) {
  3498. this.nextLine2D = !this._lookBits(1);
  3499. this._eatBits(1);
  3500. }
  3501. }
  3502. readNextChar() {
  3503. if (this.eof) {
  3504. return -1;
  3505. }
  3506. const refLine = this.refLine;
  3507. const codingLine = this.codingLine;
  3508. const columns = this.columns;
  3509. let refPos, blackPixels, bits, i;
  3510. if (this.outputBits === 0) {
  3511. if (this.rowsDone) {
  3512. this.eof = true;
  3513. }
  3514. if (this.eof) {
  3515. return -1;
  3516. }
  3517. this.err = false;
  3518. let code1, code2, code3;
  3519. if (this.nextLine2D) {
  3520. for (i = 0; codingLine[i] < columns; ++i) {
  3521. refLine[i] = codingLine[i];
  3522. }
  3523. refLine[i++] = columns;
  3524. refLine[i] = columns;
  3525. codingLine[0] = 0;
  3526. this.codingPos = 0;
  3527. refPos = 0;
  3528. blackPixels = 0;
  3529. while (codingLine[this.codingPos] < columns) {
  3530. code1 = this._getTwoDimCode();
  3531. switch (code1) {
  3532. case twoDimPass:
  3533. this._addPixels(refLine[refPos + 1], blackPixels);
  3534. if (refLine[refPos + 1] < columns) {
  3535. refPos += 2;
  3536. }
  3537. break;
  3538. case twoDimHoriz:
  3539. code1 = code2 = 0;
  3540. if (blackPixels) {
  3541. do {
  3542. code1 += code3 = this._getBlackCode();
  3543. } while (code3 >= 64);
  3544. do {
  3545. code2 += code3 = this._getWhiteCode();
  3546. } while (code3 >= 64);
  3547. } else {
  3548. do {
  3549. code1 += code3 = this._getWhiteCode();
  3550. } while (code3 >= 64);
  3551. do {
  3552. code2 += code3 = this._getBlackCode();
  3553. } while (code3 >= 64);
  3554. }
  3555. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  3556. if (codingLine[this.codingPos] < columns) {
  3557. this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  3558. }
  3559. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  3560. refPos += 2;
  3561. }
  3562. break;
  3563. case twoDimVertR3:
  3564. this._addPixels(refLine[refPos] + 3, blackPixels);
  3565. blackPixels ^= 1;
  3566. if (codingLine[this.codingPos] < columns) {
  3567. ++refPos;
  3568. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  3569. refPos += 2;
  3570. }
  3571. }
  3572. break;
  3573. case twoDimVertR2:
  3574. this._addPixels(refLine[refPos] + 2, blackPixels);
  3575. blackPixels ^= 1;
  3576. if (codingLine[this.codingPos] < columns) {
  3577. ++refPos;
  3578. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  3579. refPos += 2;
  3580. }
  3581. }
  3582. break;
  3583. case twoDimVertR1:
  3584. this._addPixels(refLine[refPos] + 1, blackPixels);
  3585. blackPixels ^= 1;
  3586. if (codingLine[this.codingPos] < columns) {
  3587. ++refPos;
  3588. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  3589. refPos += 2;
  3590. }
  3591. }
  3592. break;
  3593. case twoDimVert0:
  3594. this._addPixels(refLine[refPos], blackPixels);
  3595. blackPixels ^= 1;
  3596. if (codingLine[this.codingPos] < columns) {
  3597. ++refPos;
  3598. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  3599. refPos += 2;
  3600. }
  3601. }
  3602. break;
  3603. case twoDimVertL3:
  3604. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  3605. blackPixels ^= 1;
  3606. if (codingLine[this.codingPos] < columns) {
  3607. if (refPos > 0) {
  3608. --refPos;
  3609. } else {
  3610. ++refPos;
  3611. }
  3612. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  3613. refPos += 2;
  3614. }
  3615. }
  3616. break;
  3617. case twoDimVertL2:
  3618. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  3619. blackPixels ^= 1;
  3620. if (codingLine[this.codingPos] < columns) {
  3621. if (refPos > 0) {
  3622. --refPos;
  3623. } else {
  3624. ++refPos;
  3625. }
  3626. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  3627. refPos += 2;
  3628. }
  3629. }
  3630. break;
  3631. case twoDimVertL1:
  3632. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  3633. blackPixels ^= 1;
  3634. if (codingLine[this.codingPos] < columns) {
  3635. if (refPos > 0) {
  3636. --refPos;
  3637. } else {
  3638. ++refPos;
  3639. }
  3640. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  3641. refPos += 2;
  3642. }
  3643. }
  3644. break;
  3645. case ccittEOF:
  3646. this._addPixels(columns, 0);
  3647. this.eof = true;
  3648. break;
  3649. default:
  3650. info("bad 2d code");
  3651. this._addPixels(columns, 0);
  3652. this.err = true;
  3653. }
  3654. }
  3655. } else {
  3656. codingLine[0] = 0;
  3657. this.codingPos = 0;
  3658. blackPixels = 0;
  3659. while (codingLine[this.codingPos] < columns) {
  3660. code1 = 0;
  3661. if (blackPixels) {
  3662. do {
  3663. code1 += code3 = this._getBlackCode();
  3664. } while (code3 >= 64);
  3665. } else {
  3666. do {
  3667. code1 += code3 = this._getWhiteCode();
  3668. } while (code3 >= 64);
  3669. }
  3670. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  3671. blackPixels ^= 1;
  3672. }
  3673. }
  3674. let gotEOL = false;
  3675. if (this.byteAlign) {
  3676. this.inputBits &= ~7;
  3677. }
  3678. if (!this.eoblock && this.row === this.rows - 1) {
  3679. this.rowsDone = true;
  3680. } else {
  3681. code1 = this._lookBits(12);
  3682. if (this.eoline) {
  3683. while (code1 !== ccittEOF && code1 !== 1) {
  3684. this._eatBits(1);
  3685. code1 = this._lookBits(12);
  3686. }
  3687. } else {
  3688. while (code1 === 0) {
  3689. this._eatBits(1);
  3690. code1 = this._lookBits(12);
  3691. }
  3692. }
  3693. if (code1 === 1) {
  3694. this._eatBits(12);
  3695. gotEOL = true;
  3696. } else if (code1 === ccittEOF) {
  3697. this.eof = true;
  3698. }
  3699. }
  3700. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  3701. this.nextLine2D = !this._lookBits(1);
  3702. this._eatBits(1);
  3703. }
  3704. if (this.eoblock && gotEOL && this.byteAlign) {
  3705. code1 = this._lookBits(12);
  3706. if (code1 === 1) {
  3707. this._eatBits(12);
  3708. if (this.encoding > 0) {
  3709. this._lookBits(1);
  3710. this._eatBits(1);
  3711. }
  3712. if (this.encoding >= 0) {
  3713. for (i = 0; i < 4; ++i) {
  3714. code1 = this._lookBits(12);
  3715. if (code1 !== 1) {
  3716. info("bad rtc code: " + code1);
  3717. }
  3718. this._eatBits(12);
  3719. if (this.encoding > 0) {
  3720. this._lookBits(1);
  3721. this._eatBits(1);
  3722. }
  3723. }
  3724. }
  3725. this.eof = true;
  3726. }
  3727. } else if (this.err && this.eoline) {
  3728. while (true) {
  3729. code1 = this._lookBits(13);
  3730. if (code1 === ccittEOF) {
  3731. this.eof = true;
  3732. return -1;
  3733. }
  3734. if (code1 >> 1 === 1) {
  3735. break;
  3736. }
  3737. this._eatBits(1);
  3738. }
  3739. this._eatBits(12);
  3740. if (this.encoding > 0) {
  3741. this._eatBits(1);
  3742. this.nextLine2D = !(code1 & 1);
  3743. }
  3744. }
  3745. this.outputBits = codingLine[0] > 0 ? codingLine[this.codingPos = 0] : codingLine[this.codingPos = 1];
  3746. this.row++;
  3747. }
  3748. let c;
  3749. if (this.outputBits >= 8) {
  3750. c = this.codingPos & 1 ? 0 : 0xff;
  3751. this.outputBits -= 8;
  3752. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  3753. this.codingPos++;
  3754. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  3755. }
  3756. } else {
  3757. bits = 8;
  3758. c = 0;
  3759. do {
  3760. if (typeof this.outputBits !== "number") {
  3761. throw new FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.');
  3762. }
  3763. if (this.outputBits > bits) {
  3764. c <<= bits;
  3765. if (!(this.codingPos & 1)) {
  3766. c |= 0xff >> 8 - bits;
  3767. }
  3768. this.outputBits -= bits;
  3769. bits = 0;
  3770. } else {
  3771. c <<= this.outputBits;
  3772. if (!(this.codingPos & 1)) {
  3773. c |= 0xff >> 8 - this.outputBits;
  3774. }
  3775. bits -= this.outputBits;
  3776. this.outputBits = 0;
  3777. if (codingLine[this.codingPos] < columns) {
  3778. this.codingPos++;
  3779. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  3780. } else if (bits > 0) {
  3781. c <<= bits;
  3782. bits = 0;
  3783. }
  3784. }
  3785. } while (bits);
  3786. }
  3787. if (this.black) {
  3788. c ^= 0xff;
  3789. }
  3790. return c;
  3791. }
  3792. _addPixels(a1, blackPixels) {
  3793. const codingLine = this.codingLine;
  3794. let codingPos = this.codingPos;
  3795. if (a1 > codingLine[codingPos]) {
  3796. if (a1 > this.columns) {
  3797. info("row is wrong length");
  3798. this.err = true;
  3799. a1 = this.columns;
  3800. }
  3801. if (codingPos & 1 ^ blackPixels) {
  3802. ++codingPos;
  3803. }
  3804. codingLine[codingPos] = a1;
  3805. }
  3806. this.codingPos = codingPos;
  3807. }
  3808. _addPixelsNeg(a1, blackPixels) {
  3809. const codingLine = this.codingLine;
  3810. let codingPos = this.codingPos;
  3811. if (a1 > codingLine[codingPos]) {
  3812. if (a1 > this.columns) {
  3813. info("row is wrong length");
  3814. this.err = true;
  3815. a1 = this.columns;
  3816. }
  3817. if (codingPos & 1 ^ blackPixels) {
  3818. ++codingPos;
  3819. }
  3820. codingLine[codingPos] = a1;
  3821. } else if (a1 < codingLine[codingPos]) {
  3822. if (a1 < 0) {
  3823. info("invalid code");
  3824. this.err = true;
  3825. a1 = 0;
  3826. }
  3827. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  3828. --codingPos;
  3829. }
  3830. codingLine[codingPos] = a1;
  3831. }
  3832. this.codingPos = codingPos;
  3833. }
  3834. _findTableCode(start, end, table, limit) {
  3835. const limitValue = limit || 0;
  3836. for (let i = start; i <= end; ++i) {
  3837. let code = this._lookBits(i);
  3838. if (code === ccittEOF) {
  3839. return [true, 1, false];
  3840. }
  3841. if (i < end) {
  3842. code <<= end - i;
  3843. }
  3844. if (!limitValue || code >= limitValue) {
  3845. const p = table[code - limitValue];
  3846. if (p[0] === i) {
  3847. this._eatBits(i);
  3848. return [true, p[1], true];
  3849. }
  3850. }
  3851. }
  3852. return [false, 0, false];
  3853. }
  3854. _getTwoDimCode() {
  3855. let code = 0;
  3856. let p;
  3857. if (this.eoblock) {
  3858. code = this._lookBits(7);
  3859. p = twoDimTable[code];
  3860. if (p?.[0] > 0) {
  3861. this._eatBits(p[0]);
  3862. return p[1];
  3863. }
  3864. } else {
  3865. const result = this._findTableCode(1, 7, twoDimTable);
  3866. if (result[0] && result[2]) {
  3867. return result[1];
  3868. }
  3869. }
  3870. info("Bad two dim code");
  3871. return ccittEOF;
  3872. }
  3873. _getWhiteCode() {
  3874. let code = 0;
  3875. let p;
  3876. if (this.eoblock) {
  3877. code = this._lookBits(12);
  3878. if (code === ccittEOF) {
  3879. return 1;
  3880. }
  3881. p = code >> 5 === 0 ? whiteTable1[code] : whiteTable2[code >> 3];
  3882. if (p[0] > 0) {
  3883. this._eatBits(p[0]);
  3884. return p[1];
  3885. }
  3886. } else {
  3887. let result = this._findTableCode(1, 9, whiteTable2);
  3888. if (result[0]) {
  3889. return result[1];
  3890. }
  3891. result = this._findTableCode(11, 12, whiteTable1);
  3892. if (result[0]) {
  3893. return result[1];
  3894. }
  3895. }
  3896. info("bad white code");
  3897. this._eatBits(1);
  3898. return 1;
  3899. }
  3900. _getBlackCode() {
  3901. let code, p;
  3902. if (this.eoblock) {
  3903. code = this._lookBits(13);
  3904. if (code === ccittEOF) {
  3905. return 1;
  3906. }
  3907. if (code >> 7 === 0) {
  3908. p = blackTable1[code];
  3909. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  3910. p = blackTable2[(code >> 1) - 64];
  3911. } else {
  3912. p = blackTable3[code >> 7];
  3913. }
  3914. if (p[0] > 0) {
  3915. this._eatBits(p[0]);
  3916. return p[1];
  3917. }
  3918. } else {
  3919. let result = this._findTableCode(2, 6, blackTable3);
  3920. if (result[0]) {
  3921. return result[1];
  3922. }
  3923. result = this._findTableCode(7, 12, blackTable2, 64);
  3924. if (result[0]) {
  3925. return result[1];
  3926. }
  3927. result = this._findTableCode(10, 13, blackTable1);
  3928. if (result[0]) {
  3929. return result[1];
  3930. }
  3931. }
  3932. info("bad black code");
  3933. this._eatBits(1);
  3934. return 1;
  3935. }
  3936. _lookBits(n) {
  3937. let c;
  3938. while (this.inputBits < n) {
  3939. if ((c = this.source.next()) === -1) {
  3940. if (this.inputBits === 0) {
  3941. return ccittEOF;
  3942. }
  3943. return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
  3944. }
  3945. this.inputBuf = this.inputBuf << 8 | c;
  3946. this.inputBits += 8;
  3947. }
  3948. return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
  3949. }
  3950. _eatBits(n) {
  3951. if ((this.inputBits -= n) < 0) {
  3952. this.inputBits = 0;
  3953. }
  3954. }
  3955. }
  3956. ;// ./src/core/ccitt_stream.js
  3957. class CCITTFaxStream extends DecodeStream {
  3958. constructor(str, maybeLength, params) {
  3959. super(maybeLength);
  3960. this.str = str;
  3961. this.dict = str.dict;
  3962. if (!(params instanceof Dict)) {
  3963. params = Dict.empty;
  3964. }
  3965. const source = {
  3966. next() {
  3967. return str.getByte();
  3968. }
  3969. };
  3970. this.ccittFaxDecoder = new CCITTFaxDecoder(source, {
  3971. K: params.get("K"),
  3972. EndOfLine: params.get("EndOfLine"),
  3973. EncodedByteAlign: params.get("EncodedByteAlign"),
  3974. Columns: params.get("Columns"),
  3975. Rows: params.get("Rows"),
  3976. EndOfBlock: params.get("EndOfBlock"),
  3977. BlackIs1: params.get("BlackIs1")
  3978. });
  3979. }
  3980. readBlock() {
  3981. while (!this.eof) {
  3982. const c = this.ccittFaxDecoder.readNextChar();
  3983. if (c === -1) {
  3984. this.eof = true;
  3985. return;
  3986. }
  3987. this.ensureBuffer(this.bufferLength + 1);
  3988. this.buffer[this.bufferLength++] = c;
  3989. }
  3990. }
  3991. }
  3992. ;// ./src/core/flate_stream.js
  3993. const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  3994. const lengthDecode = new Int32Array([0x00003, 0x00004, 0x00005, 0x00006, 0x00007, 0x00008, 0x00009, 0x0000a, 0x1000b, 0x1000d, 0x1000f, 0x10011, 0x20013, 0x20017, 0x2001b, 0x2001f, 0x30023, 0x3002b, 0x30033, 0x3003b, 0x40043, 0x40053, 0x40063, 0x40073, 0x50083, 0x500a3, 0x500c3, 0x500e3, 0x00102, 0x00102, 0x00102]);
  3995. const distDecode = new Int32Array([0x00001, 0x00002, 0x00003, 0x00004, 0x10005, 0x10007, 0x20009, 0x2000d, 0x30011, 0x30019, 0x40021, 0x40031, 0x50041, 0x50061, 0x60081, 0x600c1, 0x70101, 0x70181, 0x80201, 0x80301, 0x90401, 0x90601, 0xa0801, 0xa0c01, 0xb1001, 0xb1801, 0xc2001, 0xc3001, 0xd4001, 0xd6001]);
  3996. const fixedLitCodeTab = [new Int32Array([0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c0, 0x70108, 0x80060, 0x80020, 0x900a0, 0x80000, 0x80080, 0x80040, 0x900e0, 0x70104, 0x80058, 0x80018, 0x90090, 0x70114, 0x80078, 0x80038, 0x900d0, 0x7010c, 0x80068, 0x80028, 0x900b0, 0x80008, 0x80088, 0x80048, 0x900f0, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c8, 0x7010a, 0x80064, 0x80024, 0x900a8, 0x80004, 0x80084, 0x80044, 0x900e8, 0x70106, 0x8005c, 0x8001c, 0x90098, 0x70116, 0x8007c, 0x8003c, 0x900d8, 0x7010e, 0x8006c, 0x8002c, 0x900b8, 0x8000c, 0x8008c, 0x8004c, 0x900f8, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c4, 0x70109, 0x80062, 0x80022, 0x900a4, 0x80002, 0x80082, 0x80042, 0x900e4, 0x70105, 0x8005a, 0x8001a, 0x90094, 0x70115, 0x8007a, 0x8003a, 0x900d4, 0x7010d, 0x8006a, 0x8002a, 0x900b4, 0x8000a, 0x8008a, 0x8004a, 0x900f4, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cc, 0x7010b, 0x80066, 0x80026, 0x900ac, 0x80006, 0x80086, 0x80046, 0x900ec, 0x70107, 0x8005e, 0x8001e, 0x9009c, 0x70117, 0x8007e, 0x8003e, 0x900dc, 0x7010f, 0x8006e, 0x8002e, 0x900bc, 0x8000e, 0x8008e, 0x8004e, 0x900fc, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c2, 0x70108, 0x80061, 0x80021, 0x900a2, 0x80001, 0x80081, 0x80041, 0x900e2, 0x70104, 0x80059, 0x80019, 0x90092, 0x70114, 0x80079, 0x80039, 0x900d2, 0x7010c, 0x80069, 0x80029, 0x900b2, 0x80009, 0x80089, 0x80049, 0x900f2, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900ca, 0x7010a, 0x80065, 0x80025, 0x900aa, 0x80005, 0x80085, 0x80045, 0x900ea, 0x70106, 0x8005d, 0x8001d, 0x9009a, 0x70116, 0x8007d, 0x8003d, 0x900da, 0x7010e, 0x8006d, 0x8002d, 0x900ba, 0x8000d, 0x8008d, 0x8004d, 0x900fa, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c6, 0x70109, 0x80063, 0x80023, 0x900a6, 0x80003, 0x80083, 0x80043, 0x900e6, 0x70105, 0x8005b, 0x8001b, 0x90096, 0x70115, 0x8007b, 0x8003b, 0x900d6, 0x7010d, 0x8006b, 0x8002b, 0x900b6, 0x8000b, 0x8008b, 0x8004b, 0x900f6, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900ce, 0x7010b, 0x80067, 0x80027, 0x900ae, 0x80007, 0x80087, 0x80047, 0x900ee, 0x70107, 0x8005f, 0x8001f, 0x9009e, 0x70117, 0x8007f, 0x8003f, 0x900de, 0x7010f, 0x8006f, 0x8002f, 0x900be, 0x8000f, 0x8008f, 0x8004f, 0x900fe, 0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c1, 0x70108, 0x80060, 0x80020, 0x900a1, 0x80000, 0x80080, 0x80040, 0x900e1, 0x70104, 0x80058, 0x80018, 0x90091, 0x70114, 0x80078, 0x80038, 0x900d1, 0x7010c, 0x80068, 0x80028, 0x900b1, 0x80008, 0x80088, 0x80048, 0x900f1, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c9, 0x7010a, 0x80064, 0x80024, 0x900a9, 0x80004, 0x80084, 0x80044, 0x900e9, 0x70106, 0x8005c, 0x8001c, 0x90099, 0x70116, 0x8007c, 0x8003c, 0x900d9, 0x7010e, 0x8006c, 0x8002c, 0x900b9, 0x8000c, 0x8008c, 0x8004c, 0x900f9, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c5, 0x70109, 0x80062, 0x80022, 0x900a5, 0x80002, 0x80082, 0x80042, 0x900e5, 0x70105, 0x8005a, 0x8001a, 0x90095, 0x70115, 0x8007a, 0x8003a, 0x900d5, 0x7010d, 0x8006a, 0x8002a, 0x900b5, 0x8000a, 0x8008a, 0x8004a, 0x900f5, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cd, 0x7010b, 0x80066, 0x80026, 0x900ad, 0x80006, 0x80086, 0x80046, 0x900ed, 0x70107, 0x8005e, 0x8001e, 0x9009d, 0x70117, 0x8007e, 0x8003e, 0x900dd, 0x7010f, 0x8006e, 0x8002e, 0x900bd, 0x8000e, 0x8008e, 0x8004e, 0x900fd, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c3, 0x70108, 0x80061, 0x80021, 0x900a3, 0x80001, 0x80081, 0x80041, 0x900e3, 0x70104, 0x80059, 0x80019, 0x90093, 0x70114, 0x80079, 0x80039, 0x900d3, 0x7010c, 0x80069, 0x80029, 0x900b3, 0x80009, 0x80089, 0x80049, 0x900f3, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900cb, 0x7010a, 0x80065, 0x80025, 0x900ab, 0x80005, 0x80085, 0x80045, 0x900eb, 0x70106, 0x8005d, 0x8001d, 0x9009b, 0x70116, 0x8007d, 0x8003d, 0x900db, 0x7010e, 0x8006d, 0x8002d, 0x900bb, 0x8000d, 0x8008d, 0x8004d, 0x900fb, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c7, 0x70109, 0x80063, 0x80023, 0x900a7, 0x80003, 0x80083, 0x80043, 0x900e7, 0x70105, 0x8005b, 0x8001b, 0x90097, 0x70115, 0x8007b, 0x8003b, 0x900d7, 0x7010d, 0x8006b, 0x8002b, 0x900b7, 0x8000b, 0x8008b, 0x8004b, 0x900f7, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900cf, 0x7010b, 0x80067, 0x80027, 0x900af, 0x80007, 0x80087, 0x80047, 0x900ef, 0x70107, 0x8005f, 0x8001f, 0x9009f, 0x70117, 0x8007f, 0x8003f, 0x900df, 0x7010f, 0x8006f, 0x8002f, 0x900bf, 0x8000f, 0x8008f, 0x8004f, 0x900ff]), 9];
  3997. const fixedDistCodeTab = [new Int32Array([0x50000, 0x50010, 0x50008, 0x50018, 0x50004, 0x50014, 0x5000c, 0x5001c, 0x50002, 0x50012, 0x5000a, 0x5001a, 0x50006, 0x50016, 0x5000e, 0x00000, 0x50001, 0x50011, 0x50009, 0x50019, 0x50005, 0x50015, 0x5000d, 0x5001d, 0x50003, 0x50013, 0x5000b, 0x5001b, 0x50007, 0x50017, 0x5000f, 0x00000]), 5];
  3998. class FlateStream extends DecodeStream {
  3999. constructor(str, maybeLength) {
  4000. super(maybeLength);
  4001. this.str = str;
  4002. this.dict = str.dict;
  4003. const cmf = str.getByte();
  4004. const flg = str.getByte();
  4005. if (cmf === -1 || flg === -1) {
  4006. throw new FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
  4007. }
  4008. if ((cmf & 0x0f) !== 0x08) {
  4009. throw new FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
  4010. }
  4011. if (((cmf << 8) + flg) % 31 !== 0) {
  4012. throw new FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
  4013. }
  4014. if (flg & 0x20) {
  4015. throw new FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
  4016. }
  4017. this.codeSize = 0;
  4018. this.codeBuf = 0;
  4019. }
  4020. async getImageData(length, _decoderOptions) {
  4021. const data = await this.asyncGetBytes();
  4022. return data?.subarray(0, length) || this.getBytes(length);
  4023. }
  4024. async asyncGetBytes() {
  4025. this.str.reset();
  4026. const bytes = this.str.getBytes();
  4027. try {
  4028. const {
  4029. readable,
  4030. writable
  4031. } = new DecompressionStream("deflate");
  4032. const writer = writable.getWriter();
  4033. await writer.ready;
  4034. writer.write(bytes).then(async () => {
  4035. await writer.ready;
  4036. await writer.close();
  4037. }).catch(() => {});
  4038. const chunks = [];
  4039. let totalLength = 0;
  4040. for await (const chunk of readable) {
  4041. chunks.push(chunk);
  4042. totalLength += chunk.byteLength;
  4043. }
  4044. const data = new Uint8Array(totalLength);
  4045. let offset = 0;
  4046. for (const chunk of chunks) {
  4047. data.set(chunk, offset);
  4048. offset += chunk.byteLength;
  4049. }
  4050. return data;
  4051. } catch {
  4052. this.str = new Stream(bytes, 2, bytes.length, this.str.dict);
  4053. this.reset();
  4054. return null;
  4055. }
  4056. }
  4057. get isAsync() {
  4058. return true;
  4059. }
  4060. getBits(bits) {
  4061. const str = this.str;
  4062. let codeSize = this.codeSize;
  4063. let codeBuf = this.codeBuf;
  4064. let b;
  4065. while (codeSize < bits) {
  4066. if ((b = str.getByte()) === -1) {
  4067. throw new FormatError("Bad encoding in flate stream");
  4068. }
  4069. codeBuf |= b << codeSize;
  4070. codeSize += 8;
  4071. }
  4072. b = codeBuf & (1 << bits) - 1;
  4073. this.codeBuf = codeBuf >> bits;
  4074. this.codeSize = codeSize -= bits;
  4075. return b;
  4076. }
  4077. getCode(table) {
  4078. const str = this.str;
  4079. const codes = table[0];
  4080. const maxLen = table[1];
  4081. let codeSize = this.codeSize;
  4082. let codeBuf = this.codeBuf;
  4083. let b;
  4084. while (codeSize < maxLen) {
  4085. if ((b = str.getByte()) === -1) {
  4086. break;
  4087. }
  4088. codeBuf |= b << codeSize;
  4089. codeSize += 8;
  4090. }
  4091. const code = codes[codeBuf & (1 << maxLen) - 1];
  4092. const codeLen = code >> 16;
  4093. const codeVal = code & 0xffff;
  4094. if (codeLen < 1 || codeSize < codeLen) {
  4095. throw new FormatError("Bad encoding in flate stream");
  4096. }
  4097. this.codeBuf = codeBuf >> codeLen;
  4098. this.codeSize = codeSize - codeLen;
  4099. return codeVal;
  4100. }
  4101. generateHuffmanTable(lengths) {
  4102. const n = lengths.length;
  4103. let maxLen = 0;
  4104. let i;
  4105. for (i = 0; i < n; ++i) {
  4106. if (lengths[i] > maxLen) {
  4107. maxLen = lengths[i];
  4108. }
  4109. }
  4110. const size = 1 << maxLen;
  4111. const codes = new Int32Array(size);
  4112. for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  4113. for (let val = 0; val < n; ++val) {
  4114. if (lengths[val] === len) {
  4115. let code2 = 0;
  4116. let t = code;
  4117. for (i = 0; i < len; ++i) {
  4118. code2 = code2 << 1 | t & 1;
  4119. t >>= 1;
  4120. }
  4121. for (i = code2; i < size; i += skip) {
  4122. codes[i] = len << 16 | val;
  4123. }
  4124. ++code;
  4125. }
  4126. }
  4127. }
  4128. return [codes, maxLen];
  4129. }
  4130. #endsStreamOnError(err) {
  4131. info(err);
  4132. this.eof = true;
  4133. }
  4134. readBlock() {
  4135. let buffer, hdr, len;
  4136. const str = this.str;
  4137. try {
  4138. hdr = this.getBits(3);
  4139. } catch (ex) {
  4140. this.#endsStreamOnError(ex.message);
  4141. return;
  4142. }
  4143. if (hdr & 1) {
  4144. this.eof = true;
  4145. }
  4146. hdr >>= 1;
  4147. if (hdr === 0) {
  4148. let b;
  4149. if ((b = str.getByte()) === -1) {
  4150. this.#endsStreamOnError("Bad block header in flate stream");
  4151. return;
  4152. }
  4153. let blockLen = b;
  4154. if ((b = str.getByte()) === -1) {
  4155. this.#endsStreamOnError("Bad block header in flate stream");
  4156. return;
  4157. }
  4158. blockLen |= b << 8;
  4159. if ((b = str.getByte()) === -1) {
  4160. this.#endsStreamOnError("Bad block header in flate stream");
  4161. return;
  4162. }
  4163. let check = b;
  4164. if ((b = str.getByte()) === -1) {
  4165. this.#endsStreamOnError("Bad block header in flate stream");
  4166. return;
  4167. }
  4168. check |= b << 8;
  4169. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  4170. throw new FormatError("Bad uncompressed block length in flate stream");
  4171. }
  4172. this.codeBuf = 0;
  4173. this.codeSize = 0;
  4174. const bufferLength = this.bufferLength,
  4175. end = bufferLength + blockLen;
  4176. buffer = this.ensureBuffer(end);
  4177. this.bufferLength = end;
  4178. if (blockLen === 0) {
  4179. if (str.peekByte() === -1) {
  4180. this.eof = true;
  4181. }
  4182. } else {
  4183. const block = str.getBytes(blockLen);
  4184. buffer.set(block, bufferLength);
  4185. if (block.length < blockLen) {
  4186. this.eof = true;
  4187. }
  4188. }
  4189. return;
  4190. }
  4191. let litCodeTable;
  4192. let distCodeTable;
  4193. if (hdr === 1) {
  4194. litCodeTable = fixedLitCodeTab;
  4195. distCodeTable = fixedDistCodeTab;
  4196. } else if (hdr === 2) {
  4197. const numLitCodes = this.getBits(5) + 257;
  4198. const numDistCodes = this.getBits(5) + 1;
  4199. const numCodeLenCodes = this.getBits(4) + 4;
  4200. const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  4201. let i;
  4202. for (i = 0; i < numCodeLenCodes; ++i) {
  4203. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  4204. }
  4205. const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  4206. len = 0;
  4207. i = 0;
  4208. const codes = numLitCodes + numDistCodes;
  4209. const codeLengths = new Uint8Array(codes);
  4210. let bitsLength, bitsOffset, what;
  4211. while (i < codes) {
  4212. const code = this.getCode(codeLenCodeTab);
  4213. if (code === 16) {
  4214. bitsLength = 2;
  4215. bitsOffset = 3;
  4216. what = len;
  4217. } else if (code === 17) {
  4218. bitsLength = 3;
  4219. bitsOffset = 3;
  4220. what = len = 0;
  4221. } else if (code === 18) {
  4222. bitsLength = 7;
  4223. bitsOffset = 11;
  4224. what = len = 0;
  4225. } else {
  4226. codeLengths[i++] = len = code;
  4227. continue;
  4228. }
  4229. let repeatLength = this.getBits(bitsLength) + bitsOffset;
  4230. while (repeatLength-- > 0) {
  4231. codeLengths[i++] = what;
  4232. }
  4233. }
  4234. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  4235. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  4236. } else {
  4237. throw new FormatError("Unknown block type in flate stream");
  4238. }
  4239. buffer = this.buffer;
  4240. let limit = buffer ? buffer.length : 0;
  4241. let pos = this.bufferLength;
  4242. while (true) {
  4243. let code1 = this.getCode(litCodeTable);
  4244. if (code1 < 256) {
  4245. if (pos + 1 >= limit) {
  4246. buffer = this.ensureBuffer(pos + 1);
  4247. limit = buffer.length;
  4248. }
  4249. buffer[pos++] = code1;
  4250. continue;
  4251. }
  4252. if (code1 === 256) {
  4253. this.bufferLength = pos;
  4254. return;
  4255. }
  4256. code1 -= 257;
  4257. code1 = lengthDecode[code1];
  4258. let code2 = code1 >> 16;
  4259. if (code2 > 0) {
  4260. code2 = this.getBits(code2);
  4261. }
  4262. len = (code1 & 0xffff) + code2;
  4263. code1 = this.getCode(distCodeTable);
  4264. code1 = distDecode[code1];
  4265. code2 = code1 >> 16;
  4266. if (code2 > 0) {
  4267. code2 = this.getBits(code2);
  4268. }
  4269. const dist = (code1 & 0xffff) + code2;
  4270. if (pos + len >= limit) {
  4271. buffer = this.ensureBuffer(pos + len);
  4272. limit = buffer.length;
  4273. }
  4274. for (let k = 0; k < len; ++k, ++pos) {
  4275. buffer[pos] = buffer[pos - dist];
  4276. }
  4277. }
  4278. }
  4279. }
  4280. ;// ./src/core/arithmetic_decoder.js
  4281. const QeTable = [{
  4282. qe: 0x5601,
  4283. nmps: 1,
  4284. nlps: 1,
  4285. switchFlag: 1
  4286. }, {
  4287. qe: 0x3401,
  4288. nmps: 2,
  4289. nlps: 6,
  4290. switchFlag: 0
  4291. }, {
  4292. qe: 0x1801,
  4293. nmps: 3,
  4294. nlps: 9,
  4295. switchFlag: 0
  4296. }, {
  4297. qe: 0x0ac1,
  4298. nmps: 4,
  4299. nlps: 12,
  4300. switchFlag: 0
  4301. }, {
  4302. qe: 0x0521,
  4303. nmps: 5,
  4304. nlps: 29,
  4305. switchFlag: 0
  4306. }, {
  4307. qe: 0x0221,
  4308. nmps: 38,
  4309. nlps: 33,
  4310. switchFlag: 0
  4311. }, {
  4312. qe: 0x5601,
  4313. nmps: 7,
  4314. nlps: 6,
  4315. switchFlag: 1
  4316. }, {
  4317. qe: 0x5401,
  4318. nmps: 8,
  4319. nlps: 14,
  4320. switchFlag: 0
  4321. }, {
  4322. qe: 0x4801,
  4323. nmps: 9,
  4324. nlps: 14,
  4325. switchFlag: 0
  4326. }, {
  4327. qe: 0x3801,
  4328. nmps: 10,
  4329. nlps: 14,
  4330. switchFlag: 0
  4331. }, {
  4332. qe: 0x3001,
  4333. nmps: 11,
  4334. nlps: 17,
  4335. switchFlag: 0
  4336. }, {
  4337. qe: 0x2401,
  4338. nmps: 12,
  4339. nlps: 18,
  4340. switchFlag: 0
  4341. }, {
  4342. qe: 0x1c01,
  4343. nmps: 13,
  4344. nlps: 20,
  4345. switchFlag: 0
  4346. }, {
  4347. qe: 0x1601,
  4348. nmps: 29,
  4349. nlps: 21,
  4350. switchFlag: 0
  4351. }, {
  4352. qe: 0x5601,
  4353. nmps: 15,
  4354. nlps: 14,
  4355. switchFlag: 1
  4356. }, {
  4357. qe: 0x5401,
  4358. nmps: 16,
  4359. nlps: 14,
  4360. switchFlag: 0
  4361. }, {
  4362. qe: 0x5101,
  4363. nmps: 17,
  4364. nlps: 15,
  4365. switchFlag: 0
  4366. }, {
  4367. qe: 0x4801,
  4368. nmps: 18,
  4369. nlps: 16,
  4370. switchFlag: 0
  4371. }, {
  4372. qe: 0x3801,
  4373. nmps: 19,
  4374. nlps: 17,
  4375. switchFlag: 0
  4376. }, {
  4377. qe: 0x3401,
  4378. nmps: 20,
  4379. nlps: 18,
  4380. switchFlag: 0
  4381. }, {
  4382. qe: 0x3001,
  4383. nmps: 21,
  4384. nlps: 19,
  4385. switchFlag: 0
  4386. }, {
  4387. qe: 0x2801,
  4388. nmps: 22,
  4389. nlps: 19,
  4390. switchFlag: 0
  4391. }, {
  4392. qe: 0x2401,
  4393. nmps: 23,
  4394. nlps: 20,
  4395. switchFlag: 0
  4396. }, {
  4397. qe: 0x2201,
  4398. nmps: 24,
  4399. nlps: 21,
  4400. switchFlag: 0
  4401. }, {
  4402. qe: 0x1c01,
  4403. nmps: 25,
  4404. nlps: 22,
  4405. switchFlag: 0
  4406. }, {
  4407. qe: 0x1801,
  4408. nmps: 26,
  4409. nlps: 23,
  4410. switchFlag: 0
  4411. }, {
  4412. qe: 0x1601,
  4413. nmps: 27,
  4414. nlps: 24,
  4415. switchFlag: 0
  4416. }, {
  4417. qe: 0x1401,
  4418. nmps: 28,
  4419. nlps: 25,
  4420. switchFlag: 0
  4421. }, {
  4422. qe: 0x1201,
  4423. nmps: 29,
  4424. nlps: 26,
  4425. switchFlag: 0
  4426. }, {
  4427. qe: 0x1101,
  4428. nmps: 30,
  4429. nlps: 27,
  4430. switchFlag: 0
  4431. }, {
  4432. qe: 0x0ac1,
  4433. nmps: 31,
  4434. nlps: 28,
  4435. switchFlag: 0
  4436. }, {
  4437. qe: 0x09c1,
  4438. nmps: 32,
  4439. nlps: 29,
  4440. switchFlag: 0
  4441. }, {
  4442. qe: 0x08a1,
  4443. nmps: 33,
  4444. nlps: 30,
  4445. switchFlag: 0
  4446. }, {
  4447. qe: 0x0521,
  4448. nmps: 34,
  4449. nlps: 31,
  4450. switchFlag: 0
  4451. }, {
  4452. qe: 0x0441,
  4453. nmps: 35,
  4454. nlps: 32,
  4455. switchFlag: 0
  4456. }, {
  4457. qe: 0x02a1,
  4458. nmps: 36,
  4459. nlps: 33,
  4460. switchFlag: 0
  4461. }, {
  4462. qe: 0x0221,
  4463. nmps: 37,
  4464. nlps: 34,
  4465. switchFlag: 0
  4466. }, {
  4467. qe: 0x0141,
  4468. nmps: 38,
  4469. nlps: 35,
  4470. switchFlag: 0
  4471. }, {
  4472. qe: 0x0111,
  4473. nmps: 39,
  4474. nlps: 36,
  4475. switchFlag: 0
  4476. }, {
  4477. qe: 0x0085,
  4478. nmps: 40,
  4479. nlps: 37,
  4480. switchFlag: 0
  4481. }, {
  4482. qe: 0x0049,
  4483. nmps: 41,
  4484. nlps: 38,
  4485. switchFlag: 0
  4486. }, {
  4487. qe: 0x0025,
  4488. nmps: 42,
  4489. nlps: 39,
  4490. switchFlag: 0
  4491. }, {
  4492. qe: 0x0015,
  4493. nmps: 43,
  4494. nlps: 40,
  4495. switchFlag: 0
  4496. }, {
  4497. qe: 0x0009,
  4498. nmps: 44,
  4499. nlps: 41,
  4500. switchFlag: 0
  4501. }, {
  4502. qe: 0x0005,
  4503. nmps: 45,
  4504. nlps: 42,
  4505. switchFlag: 0
  4506. }, {
  4507. qe: 0x0001,
  4508. nmps: 45,
  4509. nlps: 43,
  4510. switchFlag: 0
  4511. }, {
  4512. qe: 0x5601,
  4513. nmps: 46,
  4514. nlps: 46,
  4515. switchFlag: 0
  4516. }];
  4517. class ArithmeticDecoder {
  4518. constructor(data, start, end) {
  4519. this.data = data;
  4520. this.bp = start;
  4521. this.dataEnd = end;
  4522. this.chigh = data[start];
  4523. this.clow = 0;
  4524. this.byteIn();
  4525. this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
  4526. this.clow = this.clow << 7 & 0xffff;
  4527. this.ct -= 7;
  4528. this.a = 0x8000;
  4529. }
  4530. byteIn() {
  4531. const data = this.data;
  4532. let bp = this.bp;
  4533. if (data[bp] === 0xff) {
  4534. if (data[bp + 1] > 0x8f) {
  4535. this.clow += 0xff00;
  4536. this.ct = 8;
  4537. } else {
  4538. bp++;
  4539. this.clow += data[bp] << 9;
  4540. this.ct = 7;
  4541. this.bp = bp;
  4542. }
  4543. } else {
  4544. bp++;
  4545. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  4546. this.ct = 8;
  4547. this.bp = bp;
  4548. }
  4549. if (this.clow > 0xffff) {
  4550. this.chigh += this.clow >> 16;
  4551. this.clow &= 0xffff;
  4552. }
  4553. }
  4554. readBit(contexts, pos) {
  4555. let cx_index = contexts[pos] >> 1,
  4556. cx_mps = contexts[pos] & 1;
  4557. const qeTableIcx = QeTable[cx_index];
  4558. const qeIcx = qeTableIcx.qe;
  4559. let d;
  4560. let a = this.a - qeIcx;
  4561. if (this.chigh < qeIcx) {
  4562. if (a < qeIcx) {
  4563. a = qeIcx;
  4564. d = cx_mps;
  4565. cx_index = qeTableIcx.nmps;
  4566. } else {
  4567. a = qeIcx;
  4568. d = 1 ^ cx_mps;
  4569. if (qeTableIcx.switchFlag === 1) {
  4570. cx_mps = d;
  4571. }
  4572. cx_index = qeTableIcx.nlps;
  4573. }
  4574. } else {
  4575. this.chigh -= qeIcx;
  4576. if ((a & 0x8000) !== 0) {
  4577. this.a = a;
  4578. return cx_mps;
  4579. }
  4580. if (a < qeIcx) {
  4581. d = 1 ^ cx_mps;
  4582. if (qeTableIcx.switchFlag === 1) {
  4583. cx_mps = d;
  4584. }
  4585. cx_index = qeTableIcx.nlps;
  4586. } else {
  4587. d = cx_mps;
  4588. cx_index = qeTableIcx.nmps;
  4589. }
  4590. }
  4591. do {
  4592. if (this.ct === 0) {
  4593. this.byteIn();
  4594. }
  4595. a <<= 1;
  4596. this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
  4597. this.clow = this.clow << 1 & 0xffff;
  4598. this.ct--;
  4599. } while ((a & 0x8000) === 0);
  4600. this.a = a;
  4601. contexts[pos] = cx_index << 1 | cx_mps;
  4602. return d;
  4603. }
  4604. }
  4605. ;// ./src/core/jbig2.js
  4606. class Jbig2Error extends BaseException {
  4607. constructor(msg) {
  4608. super(msg, "Jbig2Error");
  4609. }
  4610. }
  4611. class ContextCache {
  4612. getContexts(id) {
  4613. if (id in this) {
  4614. return this[id];
  4615. }
  4616. return this[id] = new Int8Array(1 << 16);
  4617. }
  4618. }
  4619. class DecodingContext {
  4620. constructor(data, start, end) {
  4621. this.data = data;
  4622. this.start = start;
  4623. this.end = end;
  4624. }
  4625. get decoder() {
  4626. const decoder = new ArithmeticDecoder(this.data, this.start, this.end);
  4627. return shadow(this, "decoder", decoder);
  4628. }
  4629. get contextCache() {
  4630. const cache = new ContextCache();
  4631. return shadow(this, "contextCache", cache);
  4632. }
  4633. }
  4634. const MAX_INT_32 = 2 ** 31 - 1;
  4635. const MIN_INT_32 = -(2 ** 31);
  4636. function decodeInteger(contextCache, procedure, decoder) {
  4637. const contexts = contextCache.getContexts(procedure);
  4638. let prev = 1;
  4639. function readBits(length) {
  4640. let v = 0;
  4641. for (let i = 0; i < length; i++) {
  4642. const bit = decoder.readBit(contexts, prev);
  4643. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  4644. v = v << 1 | bit;
  4645. }
  4646. return v >>> 0;
  4647. }
  4648. const sign = readBits(1);
  4649. const value = readBits(1) ? readBits(1) ? readBits(1) ? readBits(1) ? readBits(1) ? readBits(32) + 4436 : readBits(12) + 340 : readBits(8) + 84 : readBits(6) + 20 : readBits(4) + 4 : readBits(2);
  4650. let signedValue;
  4651. if (sign === 0) {
  4652. signedValue = value;
  4653. } else if (value > 0) {
  4654. signedValue = -value;
  4655. }
  4656. if (signedValue >= MIN_INT_32 && signedValue <= MAX_INT_32) {
  4657. return signedValue;
  4658. }
  4659. return null;
  4660. }
  4661. function decodeIAID(contextCache, decoder, codeLength) {
  4662. const contexts = contextCache.getContexts("IAID");
  4663. let prev = 1;
  4664. for (let i = 0; i < codeLength; i++) {
  4665. const bit = decoder.readBit(contexts, prev);
  4666. prev = prev << 1 | bit;
  4667. }
  4668. if (codeLength < 31) {
  4669. return prev & (1 << codeLength) - 1;
  4670. }
  4671. return prev & 0x7fffffff;
  4672. }
  4673. const SegmentTypes = ["SymbolDictionary", null, null, null, "IntermediateTextRegion", null, "ImmediateTextRegion", "ImmediateLosslessTextRegion", null, null, null, null, null, null, null, null, "PatternDictionary", null, null, null, "IntermediateHalftoneRegion", null, "ImmediateHalftoneRegion", "ImmediateLosslessHalftoneRegion", null, null, null, null, null, null, null, null, null, null, null, null, "IntermediateGenericRegion", null, "ImmediateGenericRegion", "ImmediateLosslessGenericRegion", "IntermediateGenericRefinementRegion", null, "ImmediateGenericRefinementRegion", "ImmediateLosslessGenericRefinementRegion", null, null, null, null, "PageInformation", "EndOfPage", "EndOfStripe", "EndOfFile", "Profiles", "Tables", null, null, null, null, null, null, null, null, "Extension"];
  4674. const CodingTemplates = [[{
  4675. x: -1,
  4676. y: -2
  4677. }, {
  4678. x: 0,
  4679. y: -2
  4680. }, {
  4681. x: 1,
  4682. y: -2
  4683. }, {
  4684. x: -2,
  4685. y: -1
  4686. }, {
  4687. x: -1,
  4688. y: -1
  4689. }, {
  4690. x: 0,
  4691. y: -1
  4692. }, {
  4693. x: 1,
  4694. y: -1
  4695. }, {
  4696. x: 2,
  4697. y: -1
  4698. }, {
  4699. x: -4,
  4700. y: 0
  4701. }, {
  4702. x: -3,
  4703. y: 0
  4704. }, {
  4705. x: -2,
  4706. y: 0
  4707. }, {
  4708. x: -1,
  4709. y: 0
  4710. }], [{
  4711. x: -1,
  4712. y: -2
  4713. }, {
  4714. x: 0,
  4715. y: -2
  4716. }, {
  4717. x: 1,
  4718. y: -2
  4719. }, {
  4720. x: 2,
  4721. y: -2
  4722. }, {
  4723. x: -2,
  4724. y: -1
  4725. }, {
  4726. x: -1,
  4727. y: -1
  4728. }, {
  4729. x: 0,
  4730. y: -1
  4731. }, {
  4732. x: 1,
  4733. y: -1
  4734. }, {
  4735. x: 2,
  4736. y: -1
  4737. }, {
  4738. x: -3,
  4739. y: 0
  4740. }, {
  4741. x: -2,
  4742. y: 0
  4743. }, {
  4744. x: -1,
  4745. y: 0
  4746. }], [{
  4747. x: -1,
  4748. y: -2
  4749. }, {
  4750. x: 0,
  4751. y: -2
  4752. }, {
  4753. x: 1,
  4754. y: -2
  4755. }, {
  4756. x: -2,
  4757. y: -1
  4758. }, {
  4759. x: -1,
  4760. y: -1
  4761. }, {
  4762. x: 0,
  4763. y: -1
  4764. }, {
  4765. x: 1,
  4766. y: -1
  4767. }, {
  4768. x: -2,
  4769. y: 0
  4770. }, {
  4771. x: -1,
  4772. y: 0
  4773. }], [{
  4774. x: -3,
  4775. y: -1
  4776. }, {
  4777. x: -2,
  4778. y: -1
  4779. }, {
  4780. x: -1,
  4781. y: -1
  4782. }, {
  4783. x: 0,
  4784. y: -1
  4785. }, {
  4786. x: 1,
  4787. y: -1
  4788. }, {
  4789. x: -4,
  4790. y: 0
  4791. }, {
  4792. x: -3,
  4793. y: 0
  4794. }, {
  4795. x: -2,
  4796. y: 0
  4797. }, {
  4798. x: -1,
  4799. y: 0
  4800. }]];
  4801. const RefinementTemplates = [{
  4802. coding: [{
  4803. x: 0,
  4804. y: -1
  4805. }, {
  4806. x: 1,
  4807. y: -1
  4808. }, {
  4809. x: -1,
  4810. y: 0
  4811. }],
  4812. reference: [{
  4813. x: 0,
  4814. y: -1
  4815. }, {
  4816. x: 1,
  4817. y: -1
  4818. }, {
  4819. x: -1,
  4820. y: 0
  4821. }, {
  4822. x: 0,
  4823. y: 0
  4824. }, {
  4825. x: 1,
  4826. y: 0
  4827. }, {
  4828. x: -1,
  4829. y: 1
  4830. }, {
  4831. x: 0,
  4832. y: 1
  4833. }, {
  4834. x: 1,
  4835. y: 1
  4836. }]
  4837. }, {
  4838. coding: [{
  4839. x: -1,
  4840. y: -1
  4841. }, {
  4842. x: 0,
  4843. y: -1
  4844. }, {
  4845. x: 1,
  4846. y: -1
  4847. }, {
  4848. x: -1,
  4849. y: 0
  4850. }],
  4851. reference: [{
  4852. x: 0,
  4853. y: -1
  4854. }, {
  4855. x: -1,
  4856. y: 0
  4857. }, {
  4858. x: 0,
  4859. y: 0
  4860. }, {
  4861. x: 1,
  4862. y: 0
  4863. }, {
  4864. x: 0,
  4865. y: 1
  4866. }, {
  4867. x: 1,
  4868. y: 1
  4869. }]
  4870. }];
  4871. const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  4872. const RefinementReusedContexts = [0x0020, 0x0008];
  4873. function decodeBitmapTemplate0(width, height, decodingContext) {
  4874. const decoder = decodingContext.decoder;
  4875. const contexts = decodingContext.contextCache.getContexts("GB");
  4876. const bitmap = [];
  4877. let contextLabel, i, j, pixel, row, row1, row2;
  4878. const OLD_PIXEL_MASK = 0x7bf7;
  4879. for (i = 0; i < height; i++) {
  4880. row = bitmap[i] = new Uint8Array(width);
  4881. row1 = i < 1 ? row : bitmap[i - 1];
  4882. row2 = i < 2 ? row : bitmap[i - 2];
  4883. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  4884. for (j = 0; j < width; j++) {
  4885. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  4886. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  4887. }
  4888. }
  4889. return bitmap;
  4890. }
  4891. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  4892. if (mmr) {
  4893. const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  4894. return decodeMMRBitmap(input, width, height, false);
  4895. }
  4896. if (templateIndex === 0 && !skip && !prediction && at.length === 4 && at[0].x === 3 && at[0].y === -1 && at[1].x === -3 && at[1].y === -1 && at[2].x === 2 && at[2].y === -2 && at[3].x === -2 && at[3].y === -2) {
  4897. return decodeBitmapTemplate0(width, height, decodingContext);
  4898. }
  4899. const useskip = !!skip;
  4900. const template = CodingTemplates[templateIndex].concat(at);
  4901. template.sort(function (a, b) {
  4902. return a.y - b.y || a.x - b.x;
  4903. });
  4904. const templateLength = template.length;
  4905. const templateX = new Int8Array(templateLength);
  4906. const templateY = new Int8Array(templateLength);
  4907. const changingTemplateEntries = [];
  4908. let reuseMask = 0,
  4909. minX = 0,
  4910. maxX = 0,
  4911. minY = 0;
  4912. let c, k;
  4913. for (k = 0; k < templateLength; k++) {
  4914. templateX[k] = template[k].x;
  4915. templateY[k] = template[k].y;
  4916. minX = Math.min(minX, template[k].x);
  4917. maxX = Math.max(maxX, template[k].x);
  4918. minY = Math.min(minY, template[k].y);
  4919. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  4920. reuseMask |= 1 << templateLength - 1 - k;
  4921. } else {
  4922. changingTemplateEntries.push(k);
  4923. }
  4924. }
  4925. const changingEntriesLength = changingTemplateEntries.length;
  4926. const changingTemplateX = new Int8Array(changingEntriesLength);
  4927. const changingTemplateY = new Int8Array(changingEntriesLength);
  4928. const changingTemplateBit = new Uint16Array(changingEntriesLength);
  4929. for (c = 0; c < changingEntriesLength; c++) {
  4930. k = changingTemplateEntries[c];
  4931. changingTemplateX[c] = template[k].x;
  4932. changingTemplateY[c] = template[k].y;
  4933. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  4934. }
  4935. const sbb_left = -minX;
  4936. const sbb_top = -minY;
  4937. const sbb_right = width - maxX;
  4938. const pseudoPixelContext = ReusedContexts[templateIndex];
  4939. let row = new Uint8Array(width);
  4940. const bitmap = [];
  4941. const decoder = decodingContext.decoder;
  4942. const contexts = decodingContext.contextCache.getContexts("GB");
  4943. let ltp = 0,
  4944. j,
  4945. i0,
  4946. j0,
  4947. contextLabel = 0,
  4948. bit,
  4949. shift;
  4950. for (let i = 0; i < height; i++) {
  4951. if (prediction) {
  4952. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  4953. ltp ^= sltp;
  4954. if (ltp) {
  4955. bitmap.push(row);
  4956. continue;
  4957. }
  4958. }
  4959. row = new Uint8Array(row);
  4960. bitmap.push(row);
  4961. for (j = 0; j < width; j++) {
  4962. if (useskip && skip[i][j]) {
  4963. row[j] = 0;
  4964. continue;
  4965. }
  4966. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  4967. contextLabel = contextLabel << 1 & reuseMask;
  4968. for (k = 0; k < changingEntriesLength; k++) {
  4969. i0 = i + changingTemplateY[k];
  4970. j0 = j + changingTemplateX[k];
  4971. bit = bitmap[i0][j0];
  4972. if (bit) {
  4973. bit = changingTemplateBit[k];
  4974. contextLabel |= bit;
  4975. }
  4976. }
  4977. } else {
  4978. contextLabel = 0;
  4979. shift = templateLength - 1;
  4980. for (k = 0; k < templateLength; k++, shift--) {
  4981. j0 = j + templateX[k];
  4982. if (j0 >= 0 && j0 < width) {
  4983. i0 = i + templateY[k];
  4984. if (i0 >= 0) {
  4985. bit = bitmap[i0][j0];
  4986. if (bit) {
  4987. contextLabel |= bit << shift;
  4988. }
  4989. }
  4990. }
  4991. }
  4992. }
  4993. const pixel = decoder.readBit(contexts, contextLabel);
  4994. row[j] = pixel;
  4995. }
  4996. }
  4997. return bitmap;
  4998. }
  4999. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  5000. let codingTemplate = RefinementTemplates[templateIndex].coding;
  5001. if (templateIndex === 0) {
  5002. codingTemplate = codingTemplate.concat([at[0]]);
  5003. }
  5004. const codingTemplateLength = codingTemplate.length;
  5005. const codingTemplateX = new Int32Array(codingTemplateLength);
  5006. const codingTemplateY = new Int32Array(codingTemplateLength);
  5007. let k;
  5008. for (k = 0; k < codingTemplateLength; k++) {
  5009. codingTemplateX[k] = codingTemplate[k].x;
  5010. codingTemplateY[k] = codingTemplate[k].y;
  5011. }
  5012. let referenceTemplate = RefinementTemplates[templateIndex].reference;
  5013. if (templateIndex === 0) {
  5014. referenceTemplate = referenceTemplate.concat([at[1]]);
  5015. }
  5016. const referenceTemplateLength = referenceTemplate.length;
  5017. const referenceTemplateX = new Int32Array(referenceTemplateLength);
  5018. const referenceTemplateY = new Int32Array(referenceTemplateLength);
  5019. for (k = 0; k < referenceTemplateLength; k++) {
  5020. referenceTemplateX[k] = referenceTemplate[k].x;
  5021. referenceTemplateY[k] = referenceTemplate[k].y;
  5022. }
  5023. const referenceWidth = referenceBitmap[0].length;
  5024. const referenceHeight = referenceBitmap.length;
  5025. const pseudoPixelContext = RefinementReusedContexts[templateIndex];
  5026. const bitmap = [];
  5027. const decoder = decodingContext.decoder;
  5028. const contexts = decodingContext.contextCache.getContexts("GR");
  5029. let ltp = 0;
  5030. for (let i = 0; i < height; i++) {
  5031. if (prediction) {
  5032. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  5033. ltp ^= sltp;
  5034. if (ltp) {
  5035. throw new Jbig2Error("prediction is not supported");
  5036. }
  5037. }
  5038. const row = new Uint8Array(width);
  5039. bitmap.push(row);
  5040. for (let j = 0; j < width; j++) {
  5041. let i0, j0;
  5042. let contextLabel = 0;
  5043. for (k = 0; k < codingTemplateLength; k++) {
  5044. i0 = i + codingTemplateY[k];
  5045. j0 = j + codingTemplateX[k];
  5046. if (i0 < 0 || j0 < 0 || j0 >= width) {
  5047. contextLabel <<= 1;
  5048. } else {
  5049. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  5050. }
  5051. }
  5052. for (k = 0; k < referenceTemplateLength; k++) {
  5053. i0 = i + referenceTemplateY[k] - offsetY;
  5054. j0 = j + referenceTemplateX[k] - offsetX;
  5055. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  5056. contextLabel <<= 1;
  5057. } else {
  5058. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  5059. }
  5060. }
  5061. const pixel = decoder.readBit(contexts, contextLabel);
  5062. row[j] = pixel;
  5063. }
  5064. }
  5065. return bitmap;
  5066. }
  5067. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
  5068. if (huffman && refinement) {
  5069. throw new Jbig2Error("symbol refinement with Huffman is not supported");
  5070. }
  5071. const newSymbols = [];
  5072. let currentHeight = 0;
  5073. let symbolCodeLength = log2(symbols.length + numberOfNewSymbols);
  5074. const decoder = decodingContext.decoder;
  5075. const contextCache = decodingContext.contextCache;
  5076. let tableB1, symbolWidths;
  5077. if (huffman) {
  5078. tableB1 = getStandardTable(1);
  5079. symbolWidths = [];
  5080. symbolCodeLength = Math.max(symbolCodeLength, 1);
  5081. }
  5082. while (newSymbols.length < numberOfNewSymbols) {
  5083. const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
  5084. currentHeight += deltaHeight;
  5085. let currentWidth = 0,
  5086. totalWidth = 0;
  5087. const firstSymbol = huffman ? symbolWidths.length : 0;
  5088. while (true) {
  5089. const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
  5090. if (deltaWidth === null) {
  5091. break;
  5092. }
  5093. currentWidth += deltaWidth;
  5094. totalWidth += currentWidth;
  5095. let bitmap;
  5096. if (refinement) {
  5097. const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
  5098. if (numberOfInstances > 1) {
  5099. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
  5100. } else {
  5101. const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  5102. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  5103. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  5104. const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  5105. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  5106. }
  5107. newSymbols.push(bitmap);
  5108. } else if (huffman) {
  5109. symbolWidths.push(currentWidth);
  5110. } else {
  5111. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  5112. newSymbols.push(bitmap);
  5113. }
  5114. }
  5115. if (huffman && !refinement) {
  5116. const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
  5117. huffmanInput.byteAlign();
  5118. let collectiveBitmap;
  5119. if (bitmapSize === 0) {
  5120. collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
  5121. } else {
  5122. const originalEnd = huffmanInput.end;
  5123. const bitmapEnd = huffmanInput.position + bitmapSize;
  5124. huffmanInput.end = bitmapEnd;
  5125. collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
  5126. huffmanInput.end = originalEnd;
  5127. huffmanInput.position = bitmapEnd;
  5128. }
  5129. const numberOfSymbolsDecoded = symbolWidths.length;
  5130. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  5131. newSymbols.push(collectiveBitmap);
  5132. } else {
  5133. let i,
  5134. y,
  5135. xMin = 0,
  5136. xMax,
  5137. bitmapWidth,
  5138. symbolBitmap;
  5139. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  5140. bitmapWidth = symbolWidths[i];
  5141. xMax = xMin + bitmapWidth;
  5142. symbolBitmap = [];
  5143. for (y = 0; y < currentHeight; y++) {
  5144. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  5145. }
  5146. newSymbols.push(symbolBitmap);
  5147. xMin = xMax;
  5148. }
  5149. }
  5150. }
  5151. }
  5152. const exportedSymbols = [],
  5153. flags = [];
  5154. let currentFlag = false,
  5155. i,
  5156. ii;
  5157. const totalSymbolsLength = symbols.length + numberOfNewSymbols;
  5158. while (flags.length < totalSymbolsLength) {
  5159. let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
  5160. while (runLength--) {
  5161. flags.push(currentFlag);
  5162. }
  5163. currentFlag = !currentFlag;
  5164. }
  5165. for (i = 0, ii = symbols.length; i < ii; i++) {
  5166. if (flags[i]) {
  5167. exportedSymbols.push(symbols[i]);
  5168. }
  5169. }
  5170. for (let j = 0; j < numberOfNewSymbols; i++, j++) {
  5171. if (flags[i]) {
  5172. exportedSymbols.push(newSymbols[j]);
  5173. }
  5174. }
  5175. return exportedSymbols;
  5176. }
  5177. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
  5178. if (huffman && refinement) {
  5179. throw new Jbig2Error("refinement with Huffman is not supported");
  5180. }
  5181. const bitmap = [];
  5182. let i, row;
  5183. for (i = 0; i < height; i++) {
  5184. row = new Uint8Array(width);
  5185. if (defaultPixelValue) {
  5186. for (let j = 0; j < width; j++) {
  5187. row[j] = defaultPixelValue;
  5188. }
  5189. }
  5190. bitmap.push(row);
  5191. }
  5192. const decoder = decodingContext.decoder;
  5193. const contextCache = decodingContext.contextCache;
  5194. let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
  5195. let firstS = 0;
  5196. i = 0;
  5197. while (i < numberOfSymbolInstances) {
  5198. const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
  5199. stripT += deltaT;
  5200. const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
  5201. firstS += deltaFirstS;
  5202. let currentS = firstS;
  5203. do {
  5204. let currentT = 0;
  5205. if (stripSize > 1) {
  5206. currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
  5207. }
  5208. const t = stripSize * stripT + currentT;
  5209. const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
  5210. const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
  5211. let symbolBitmap = inputSymbols[symbolId];
  5212. let symbolWidth = symbolBitmap[0].length;
  5213. let symbolHeight = symbolBitmap.length;
  5214. if (applyRefinement) {
  5215. const rdw = decodeInteger(contextCache, "IARDW", decoder);
  5216. const rdh = decodeInteger(contextCache, "IARDH", decoder);
  5217. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  5218. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  5219. symbolWidth += rdw;
  5220. symbolHeight += rdh;
  5221. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  5222. }
  5223. let increment = 0;
  5224. if (!transposed) {
  5225. if (referenceCorner > 1) {
  5226. currentS += symbolWidth - 1;
  5227. } else {
  5228. increment = symbolWidth - 1;
  5229. }
  5230. } else if (!(referenceCorner & 1)) {
  5231. currentS += symbolHeight - 1;
  5232. } else {
  5233. increment = symbolHeight - 1;
  5234. }
  5235. const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  5236. const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  5237. let s2, t2, symbolRow;
  5238. if (transposed) {
  5239. for (s2 = 0; s2 < symbolHeight; s2++) {
  5240. row = bitmap[offsetS + s2];
  5241. if (!row) {
  5242. continue;
  5243. }
  5244. symbolRow = symbolBitmap[s2];
  5245. const maxWidth = Math.min(width - offsetT, symbolWidth);
  5246. switch (combinationOperator) {
  5247. case 0:
  5248. for (t2 = 0; t2 < maxWidth; t2++) {
  5249. row[offsetT + t2] |= symbolRow[t2];
  5250. }
  5251. break;
  5252. case 2:
  5253. for (t2 = 0; t2 < maxWidth; t2++) {
  5254. row[offsetT + t2] ^= symbolRow[t2];
  5255. }
  5256. break;
  5257. default:
  5258. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  5259. }
  5260. }
  5261. } else {
  5262. for (t2 = 0; t2 < symbolHeight; t2++) {
  5263. row = bitmap[offsetT + t2];
  5264. if (!row) {
  5265. continue;
  5266. }
  5267. symbolRow = symbolBitmap[t2];
  5268. switch (combinationOperator) {
  5269. case 0:
  5270. for (s2 = 0; s2 < symbolWidth; s2++) {
  5271. row[offsetS + s2] |= symbolRow[s2];
  5272. }
  5273. break;
  5274. case 2:
  5275. for (s2 = 0; s2 < symbolWidth; s2++) {
  5276. row[offsetS + s2] ^= symbolRow[s2];
  5277. }
  5278. break;
  5279. default:
  5280. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  5281. }
  5282. }
  5283. }
  5284. i++;
  5285. const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
  5286. if (deltaS === null) {
  5287. break;
  5288. }
  5289. currentS += increment + deltaS + dsOffset;
  5290. } while (true);
  5291. }
  5292. return bitmap;
  5293. }
  5294. function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
  5295. const at = [];
  5296. if (!mmr) {
  5297. at.push({
  5298. x: -patternWidth,
  5299. y: 0
  5300. });
  5301. if (template === 0) {
  5302. at.push({
  5303. x: -3,
  5304. y: -1
  5305. }, {
  5306. x: 2,
  5307. y: -2
  5308. }, {
  5309. x: -2,
  5310. y: -2
  5311. });
  5312. }
  5313. }
  5314. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  5315. const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
  5316. const patterns = [];
  5317. for (let i = 0; i <= maxPatternIndex; i++) {
  5318. const patternBitmap = [];
  5319. const xMin = patternWidth * i;
  5320. const xMax = xMin + patternWidth;
  5321. for (let y = 0; y < patternHeight; y++) {
  5322. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  5323. }
  5324. patterns.push(patternBitmap);
  5325. }
  5326. return patterns;
  5327. }
  5328. function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
  5329. const skip = null;
  5330. if (enableSkip) {
  5331. throw new Jbig2Error("skip is not supported");
  5332. }
  5333. if (combinationOperator !== 0) {
  5334. throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`);
  5335. }
  5336. const regionBitmap = [];
  5337. let i, j, row;
  5338. for (i = 0; i < regionHeight; i++) {
  5339. row = new Uint8Array(regionWidth);
  5340. if (defaultPixelValue) {
  5341. for (j = 0; j < regionWidth; j++) {
  5342. row[j] = defaultPixelValue;
  5343. }
  5344. }
  5345. regionBitmap.push(row);
  5346. }
  5347. const numberOfPatterns = patterns.length;
  5348. const pattern0 = patterns[0];
  5349. const patternWidth = pattern0[0].length,
  5350. patternHeight = pattern0.length;
  5351. const bitsPerValue = log2(numberOfPatterns);
  5352. const at = [];
  5353. if (!mmr) {
  5354. at.push({
  5355. x: template <= 1 ? 3 : 2,
  5356. y: -1
  5357. });
  5358. if (template === 0) {
  5359. at.push({
  5360. x: -3,
  5361. y: -1
  5362. }, {
  5363. x: 2,
  5364. y: -2
  5365. }, {
  5366. x: -2,
  5367. y: -2
  5368. });
  5369. }
  5370. }
  5371. const grayScaleBitPlanes = [];
  5372. let mmrInput, bitmap;
  5373. if (mmr) {
  5374. mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  5375. }
  5376. for (i = bitsPerValue - 1; i >= 0; i--) {
  5377. if (mmr) {
  5378. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  5379. } else {
  5380. bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
  5381. }
  5382. grayScaleBitPlanes[i] = bitmap;
  5383. }
  5384. let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
  5385. for (mg = 0; mg < gridHeight; mg++) {
  5386. for (ng = 0; ng < gridWidth; ng++) {
  5387. bit = 0;
  5388. patternIndex = 0;
  5389. for (j = bitsPerValue - 1; j >= 0; j--) {
  5390. bit ^= grayScaleBitPlanes[j][mg][ng];
  5391. patternIndex |= bit << j;
  5392. }
  5393. patternBitmap = patterns[patternIndex];
  5394. x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
  5395. y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
  5396. if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
  5397. for (i = 0; i < patternHeight; i++) {
  5398. regionRow = regionBitmap[y + i];
  5399. patternRow = patternBitmap[i];
  5400. for (j = 0; j < patternWidth; j++) {
  5401. regionRow[x + j] |= patternRow[j];
  5402. }
  5403. }
  5404. } else {
  5405. let regionX, regionY;
  5406. for (i = 0; i < patternHeight; i++) {
  5407. regionY = y + i;
  5408. if (regionY < 0 || regionY >= regionHeight) {
  5409. continue;
  5410. }
  5411. regionRow = regionBitmap[regionY];
  5412. patternRow = patternBitmap[i];
  5413. for (j = 0; j < patternWidth; j++) {
  5414. regionX = x + j;
  5415. if (regionX >= 0 && regionX < regionWidth) {
  5416. regionRow[regionX] |= patternRow[j];
  5417. }
  5418. }
  5419. }
  5420. }
  5421. }
  5422. }
  5423. return regionBitmap;
  5424. }
  5425. function readSegmentHeader(data, start) {
  5426. const segmentHeader = {};
  5427. segmentHeader.number = readUint32(data, start);
  5428. const flags = data[start + 4];
  5429. const segmentType = flags & 0x3f;
  5430. if (!SegmentTypes[segmentType]) {
  5431. throw new Jbig2Error("invalid segment type: " + segmentType);
  5432. }
  5433. segmentHeader.type = segmentType;
  5434. segmentHeader.typeName = SegmentTypes[segmentType];
  5435. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  5436. const pageAssociationFieldSize = !!(flags & 0x40);
  5437. const referredFlags = data[start + 5];
  5438. let referredToCount = referredFlags >> 5 & 7;
  5439. const retainBits = [referredFlags & 31];
  5440. let position = start + 6;
  5441. if (referredFlags === 7) {
  5442. referredToCount = readUint32(data, position - 1) & 0x1fffffff;
  5443. position += 3;
  5444. let bytes = referredToCount + 7 >> 3;
  5445. retainBits[0] = data[position++];
  5446. while (--bytes > 0) {
  5447. retainBits.push(data[position++]);
  5448. }
  5449. } else if (referredFlags === 5 || referredFlags === 6) {
  5450. throw new Jbig2Error("invalid referred-to flags");
  5451. }
  5452. segmentHeader.retainBits = retainBits;
  5453. let referredToSegmentNumberSize = 4;
  5454. if (segmentHeader.number <= 256) {
  5455. referredToSegmentNumberSize = 1;
  5456. } else if (segmentHeader.number <= 65536) {
  5457. referredToSegmentNumberSize = 2;
  5458. }
  5459. const referredTo = [];
  5460. let i, ii;
  5461. for (i = 0; i < referredToCount; i++) {
  5462. let number;
  5463. if (referredToSegmentNumberSize === 1) {
  5464. number = data[position];
  5465. } else if (referredToSegmentNumberSize === 2) {
  5466. number = readUint16(data, position);
  5467. } else {
  5468. number = readUint32(data, position);
  5469. }
  5470. referredTo.push(number);
  5471. position += referredToSegmentNumberSize;
  5472. }
  5473. segmentHeader.referredTo = referredTo;
  5474. if (!pageAssociationFieldSize) {
  5475. segmentHeader.pageAssociation = data[position++];
  5476. } else {
  5477. segmentHeader.pageAssociation = readUint32(data, position);
  5478. position += 4;
  5479. }
  5480. segmentHeader.length = readUint32(data, position);
  5481. position += 4;
  5482. if (segmentHeader.length === 0xffffffff) {
  5483. if (segmentType === 38) {
  5484. const genericRegionInfo = readRegionSegmentInformation(data, position);
  5485. const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  5486. const genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  5487. const searchPatternLength = 6;
  5488. const searchPattern = new Uint8Array(searchPatternLength);
  5489. if (!genericRegionMmr) {
  5490. searchPattern[0] = 0xff;
  5491. searchPattern[1] = 0xac;
  5492. }
  5493. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
  5494. searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
  5495. searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
  5496. searchPattern[5] = genericRegionInfo.height & 0xff;
  5497. for (i = position, ii = data.length; i < ii; i++) {
  5498. let j = 0;
  5499. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  5500. j++;
  5501. }
  5502. if (j === searchPatternLength) {
  5503. segmentHeader.length = i + searchPatternLength;
  5504. break;
  5505. }
  5506. }
  5507. if (segmentHeader.length === 0xffffffff) {
  5508. throw new Jbig2Error("segment end was not found");
  5509. }
  5510. } else {
  5511. throw new Jbig2Error("invalid unknown segment length");
  5512. }
  5513. }
  5514. segmentHeader.headerEnd = position;
  5515. return segmentHeader;
  5516. }
  5517. function readSegments(header, data, start, end) {
  5518. const segments = [];
  5519. let position = start;
  5520. while (position < end) {
  5521. const segmentHeader = readSegmentHeader(data, position);
  5522. position = segmentHeader.headerEnd;
  5523. const segment = {
  5524. header: segmentHeader,
  5525. data
  5526. };
  5527. if (!header.randomAccess) {
  5528. segment.start = position;
  5529. position += segmentHeader.length;
  5530. segment.end = position;
  5531. }
  5532. segments.push(segment);
  5533. if (segmentHeader.type === 51) {
  5534. break;
  5535. }
  5536. }
  5537. if (header.randomAccess) {
  5538. for (let i = 0, ii = segments.length; i < ii; i++) {
  5539. segments[i].start = position;
  5540. position += segments[i].header.length;
  5541. segments[i].end = position;
  5542. }
  5543. }
  5544. return segments;
  5545. }
  5546. function readRegionSegmentInformation(data, start) {
  5547. return {
  5548. width: readUint32(data, start),
  5549. height: readUint32(data, start + 4),
  5550. x: readUint32(data, start + 8),
  5551. y: readUint32(data, start + 12),
  5552. combinationOperator: data[start + 16] & 7
  5553. };
  5554. }
  5555. const RegionSegmentInformationFieldLength = 17;
  5556. function processSegment(segment, visitor) {
  5557. const header = segment.header;
  5558. const data = segment.data,
  5559. end = segment.end;
  5560. let position = segment.start;
  5561. let args, at, i, atLength;
  5562. switch (header.type) {
  5563. case 0:
  5564. const dictionary = {};
  5565. const dictionaryFlags = readUint16(data, position);
  5566. dictionary.huffman = !!(dictionaryFlags & 1);
  5567. dictionary.refinement = !!(dictionaryFlags & 2);
  5568. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  5569. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  5570. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  5571. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  5572. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  5573. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  5574. dictionary.template = dictionaryFlags >> 10 & 3;
  5575. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  5576. position += 2;
  5577. if (!dictionary.huffman) {
  5578. atLength = dictionary.template === 0 ? 4 : 1;
  5579. at = [];
  5580. for (i = 0; i < atLength; i++) {
  5581. at.push({
  5582. x: readInt8(data, position),
  5583. y: readInt8(data, position + 1)
  5584. });
  5585. position += 2;
  5586. }
  5587. dictionary.at = at;
  5588. }
  5589. if (dictionary.refinement && !dictionary.refinementTemplate) {
  5590. at = [];
  5591. for (i = 0; i < 2; i++) {
  5592. at.push({
  5593. x: readInt8(data, position),
  5594. y: readInt8(data, position + 1)
  5595. });
  5596. position += 2;
  5597. }
  5598. dictionary.refinementAt = at;
  5599. }
  5600. dictionary.numberOfExportedSymbols = readUint32(data, position);
  5601. position += 4;
  5602. dictionary.numberOfNewSymbols = readUint32(data, position);
  5603. position += 4;
  5604. args = [dictionary, header.number, header.referredTo, data, position, end];
  5605. break;
  5606. case 6:
  5607. case 7:
  5608. const textRegion = {};
  5609. textRegion.info = readRegionSegmentInformation(data, position);
  5610. position += RegionSegmentInformationFieldLength;
  5611. const textRegionSegmentFlags = readUint16(data, position);
  5612. position += 2;
  5613. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  5614. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  5615. textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
  5616. textRegion.stripSize = 1 << textRegion.logStripSize;
  5617. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  5618. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  5619. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  5620. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  5621. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  5622. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  5623. if (textRegion.huffman) {
  5624. const textRegionHuffmanFlags = readUint16(data, position);
  5625. position += 2;
  5626. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  5627. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  5628. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  5629. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  5630. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  5631. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  5632. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  5633. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
  5634. }
  5635. if (textRegion.refinement && !textRegion.refinementTemplate) {
  5636. at = [];
  5637. for (i = 0; i < 2; i++) {
  5638. at.push({
  5639. x: readInt8(data, position),
  5640. y: readInt8(data, position + 1)
  5641. });
  5642. position += 2;
  5643. }
  5644. textRegion.refinementAt = at;
  5645. }
  5646. textRegion.numberOfSymbolInstances = readUint32(data, position);
  5647. position += 4;
  5648. args = [textRegion, header.referredTo, data, position, end];
  5649. break;
  5650. case 16:
  5651. const patternDictionary = {};
  5652. const patternDictionaryFlags = data[position++];
  5653. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  5654. patternDictionary.template = patternDictionaryFlags >> 1 & 3;
  5655. patternDictionary.patternWidth = data[position++];
  5656. patternDictionary.patternHeight = data[position++];
  5657. patternDictionary.maxPatternIndex = readUint32(data, position);
  5658. position += 4;
  5659. args = [patternDictionary, header.number, data, position, end];
  5660. break;
  5661. case 22:
  5662. case 23:
  5663. const halftoneRegion = {};
  5664. halftoneRegion.info = readRegionSegmentInformation(data, position);
  5665. position += RegionSegmentInformationFieldLength;
  5666. const halftoneRegionFlags = data[position++];
  5667. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  5668. halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
  5669. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  5670. halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
  5671. halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
  5672. halftoneRegion.gridWidth = readUint32(data, position);
  5673. position += 4;
  5674. halftoneRegion.gridHeight = readUint32(data, position);
  5675. position += 4;
  5676. halftoneRegion.gridOffsetX = readUint32(data, position) & 0xffffffff;
  5677. position += 4;
  5678. halftoneRegion.gridOffsetY = readUint32(data, position) & 0xffffffff;
  5679. position += 4;
  5680. halftoneRegion.gridVectorX = readUint16(data, position);
  5681. position += 2;
  5682. halftoneRegion.gridVectorY = readUint16(data, position);
  5683. position += 2;
  5684. args = [halftoneRegion, header.referredTo, data, position, end];
  5685. break;
  5686. case 38:
  5687. case 39:
  5688. const genericRegion = {};
  5689. genericRegion.info = readRegionSegmentInformation(data, position);
  5690. position += RegionSegmentInformationFieldLength;
  5691. const genericRegionSegmentFlags = data[position++];
  5692. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  5693. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  5694. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  5695. if (!genericRegion.mmr) {
  5696. atLength = genericRegion.template === 0 ? 4 : 1;
  5697. at = [];
  5698. for (i = 0; i < atLength; i++) {
  5699. at.push({
  5700. x: readInt8(data, position),
  5701. y: readInt8(data, position + 1)
  5702. });
  5703. position += 2;
  5704. }
  5705. genericRegion.at = at;
  5706. }
  5707. args = [genericRegion, data, position, end];
  5708. break;
  5709. case 48:
  5710. const pageInfo = {
  5711. width: readUint32(data, position),
  5712. height: readUint32(data, position + 4),
  5713. resolutionX: readUint32(data, position + 8),
  5714. resolutionY: readUint32(data, position + 12)
  5715. };
  5716. if (pageInfo.height === 0xffffffff) {
  5717. delete pageInfo.height;
  5718. }
  5719. const pageSegmentFlags = data[position + 16];
  5720. readUint16(data, position + 17);
  5721. pageInfo.lossless = !!(pageSegmentFlags & 1);
  5722. pageInfo.refinement = !!(pageSegmentFlags & 2);
  5723. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  5724. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  5725. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  5726. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  5727. args = [pageInfo];
  5728. break;
  5729. case 49:
  5730. break;
  5731. case 50:
  5732. break;
  5733. case 51:
  5734. break;
  5735. case 53:
  5736. args = [header.number, data, position, end];
  5737. break;
  5738. case 62:
  5739. break;
  5740. default:
  5741. throw new Jbig2Error(`segment type ${header.typeName}(${header.type}) is not implemented`);
  5742. }
  5743. const callbackName = "on" + header.typeName;
  5744. if (callbackName in visitor) {
  5745. visitor[callbackName].apply(visitor, args);
  5746. }
  5747. }
  5748. function processSegments(segments, visitor) {
  5749. for (let i = 0, ii = segments.length; i < ii; i++) {
  5750. processSegment(segments[i], visitor);
  5751. }
  5752. }
  5753. function parseJbig2Chunks(chunks) {
  5754. const visitor = new SimpleSegmentVisitor();
  5755. for (let i = 0, ii = chunks.length; i < ii; i++) {
  5756. const chunk = chunks[i];
  5757. const segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  5758. processSegments(segments, visitor);
  5759. }
  5760. return visitor.buffer;
  5761. }
  5762. function parseJbig2(data) {
  5763. throw new Error("Not implemented: parseJbig2");
  5764. }
  5765. class SimpleSegmentVisitor {
  5766. onPageInformation(info) {
  5767. this.currentPageInfo = info;
  5768. const rowSize = info.width + 7 >> 3;
  5769. const buffer = new Uint8ClampedArray(rowSize * info.height);
  5770. if (info.defaultPixelValue) {
  5771. buffer.fill(0xff);
  5772. }
  5773. this.buffer = buffer;
  5774. }
  5775. drawBitmap(regionInfo, bitmap) {
  5776. const pageInfo = this.currentPageInfo;
  5777. const width = regionInfo.width,
  5778. height = regionInfo.height;
  5779. const rowSize = pageInfo.width + 7 >> 3;
  5780. const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  5781. const buffer = this.buffer;
  5782. const mask0 = 128 >> (regionInfo.x & 7);
  5783. let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  5784. let i, j, mask, offset;
  5785. switch (combinationOperator) {
  5786. case 0:
  5787. for (i = 0; i < height; i++) {
  5788. mask = mask0;
  5789. offset = offset0;
  5790. for (j = 0; j < width; j++) {
  5791. if (bitmap[i][j]) {
  5792. buffer[offset] |= mask;
  5793. }
  5794. mask >>= 1;
  5795. if (!mask) {
  5796. mask = 128;
  5797. offset++;
  5798. }
  5799. }
  5800. offset0 += rowSize;
  5801. }
  5802. break;
  5803. case 2:
  5804. for (i = 0; i < height; i++) {
  5805. mask = mask0;
  5806. offset = offset0;
  5807. for (j = 0; j < width; j++) {
  5808. if (bitmap[i][j]) {
  5809. buffer[offset] ^= mask;
  5810. }
  5811. mask >>= 1;
  5812. if (!mask) {
  5813. mask = 128;
  5814. offset++;
  5815. }
  5816. }
  5817. offset0 += rowSize;
  5818. }
  5819. break;
  5820. default:
  5821. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  5822. }
  5823. }
  5824. onImmediateGenericRegion(region, data, start, end) {
  5825. const regionInfo = region.info;
  5826. const decodingContext = new DecodingContext(data, start, end);
  5827. const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  5828. this.drawBitmap(regionInfo, bitmap);
  5829. }
  5830. onImmediateLosslessGenericRegion() {
  5831. this.onImmediateGenericRegion(...arguments);
  5832. }
  5833. onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  5834. let huffmanTables, huffmanInput;
  5835. if (dictionary.huffman) {
  5836. huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
  5837. huffmanInput = new Reader(data, start, end);
  5838. }
  5839. let symbols = this.symbols;
  5840. if (!symbols) {
  5841. this.symbols = symbols = {};
  5842. }
  5843. const inputSymbols = [];
  5844. for (const referredSegment of referredSegments) {
  5845. const referredSymbols = symbols[referredSegment];
  5846. if (referredSymbols) {
  5847. inputSymbols.push(...referredSymbols);
  5848. }
  5849. }
  5850. const decodingContext = new DecodingContext(data, start, end);
  5851. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
  5852. }
  5853. onImmediateTextRegion(region, referredSegments, data, start, end) {
  5854. const regionInfo = region.info;
  5855. let huffmanTables, huffmanInput;
  5856. const symbols = this.symbols;
  5857. const inputSymbols = [];
  5858. for (const referredSegment of referredSegments) {
  5859. const referredSymbols = symbols[referredSegment];
  5860. if (referredSymbols) {
  5861. inputSymbols.push(...referredSymbols);
  5862. }
  5863. }
  5864. const symbolCodeLength = log2(inputSymbols.length);
  5865. if (region.huffman) {
  5866. huffmanInput = new Reader(data, start, end);
  5867. huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
  5868. }
  5869. const decodingContext = new DecodingContext(data, start, end);
  5870. const bitmap = decodeTextRegion(region.huffman, region.refinement, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.numberOfSymbolInstances, region.stripSize, inputSymbols, symbolCodeLength, region.transposed, region.dsOffset, region.referenceCorner, region.combinationOperator, huffmanTables, region.refinementTemplate, region.refinementAt, decodingContext, region.logStripSize, huffmanInput);
  5871. this.drawBitmap(regionInfo, bitmap);
  5872. }
  5873. onImmediateLosslessTextRegion() {
  5874. this.onImmediateTextRegion(...arguments);
  5875. }
  5876. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  5877. let patterns = this.patterns;
  5878. if (!patterns) {
  5879. this.patterns = patterns = {};
  5880. }
  5881. const decodingContext = new DecodingContext(data, start, end);
  5882. patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
  5883. }
  5884. onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
  5885. const patterns = this.patterns[referredSegments[0]];
  5886. const regionInfo = region.info;
  5887. const decodingContext = new DecodingContext(data, start, end);
  5888. const bitmap = decodeHalftoneRegion(region.mmr, patterns, region.template, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.enableSkip, region.combinationOperator, region.gridWidth, region.gridHeight, region.gridOffsetX, region.gridOffsetY, region.gridVectorX, region.gridVectorY, decodingContext);
  5889. this.drawBitmap(regionInfo, bitmap);
  5890. }
  5891. onImmediateLosslessHalftoneRegion() {
  5892. this.onImmediateHalftoneRegion(...arguments);
  5893. }
  5894. onTables(currentSegment, data, start, end) {
  5895. let customTables = this.customTables;
  5896. if (!customTables) {
  5897. this.customTables = customTables = {};
  5898. }
  5899. customTables[currentSegment] = decodeTablesSegment(data, start, end);
  5900. }
  5901. }
  5902. class HuffmanLine {
  5903. constructor(lineData) {
  5904. if (lineData.length === 2) {
  5905. this.isOOB = true;
  5906. this.rangeLow = 0;
  5907. this.prefixLength = lineData[0];
  5908. this.rangeLength = 0;
  5909. this.prefixCode = lineData[1];
  5910. this.isLowerRange = false;
  5911. } else {
  5912. this.isOOB = false;
  5913. this.rangeLow = lineData[0];
  5914. this.prefixLength = lineData[1];
  5915. this.rangeLength = lineData[2];
  5916. this.prefixCode = lineData[3];
  5917. this.isLowerRange = lineData[4] === "lower";
  5918. }
  5919. }
  5920. }
  5921. class HuffmanTreeNode {
  5922. constructor(line) {
  5923. this.children = [];
  5924. if (line) {
  5925. this.isLeaf = true;
  5926. this.rangeLength = line.rangeLength;
  5927. this.rangeLow = line.rangeLow;
  5928. this.isLowerRange = line.isLowerRange;
  5929. this.isOOB = line.isOOB;
  5930. } else {
  5931. this.isLeaf = false;
  5932. }
  5933. }
  5934. buildTree(line, shift) {
  5935. const bit = line.prefixCode >> shift & 1;
  5936. if (shift <= 0) {
  5937. this.children[bit] = new HuffmanTreeNode(line);
  5938. } else {
  5939. let node = this.children[bit];
  5940. if (!node) {
  5941. this.children[bit] = node = new HuffmanTreeNode(null);
  5942. }
  5943. node.buildTree(line, shift - 1);
  5944. }
  5945. }
  5946. decodeNode(reader) {
  5947. if (this.isLeaf) {
  5948. if (this.isOOB) {
  5949. return null;
  5950. }
  5951. const htOffset = reader.readBits(this.rangeLength);
  5952. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  5953. }
  5954. const node = this.children[reader.readBit()];
  5955. if (!node) {
  5956. throw new Jbig2Error("invalid Huffman data");
  5957. }
  5958. return node.decodeNode(reader);
  5959. }
  5960. }
  5961. class HuffmanTable {
  5962. constructor(lines, prefixCodesDone) {
  5963. if (!prefixCodesDone) {
  5964. this.assignPrefixCodes(lines);
  5965. }
  5966. this.rootNode = new HuffmanTreeNode(null);
  5967. for (let i = 0, ii = lines.length; i < ii; i++) {
  5968. const line = lines[i];
  5969. if (line.prefixLength > 0) {
  5970. this.rootNode.buildTree(line, line.prefixLength - 1);
  5971. }
  5972. }
  5973. }
  5974. decode(reader) {
  5975. return this.rootNode.decodeNode(reader);
  5976. }
  5977. assignPrefixCodes(lines) {
  5978. const linesLength = lines.length;
  5979. let prefixLengthMax = 0;
  5980. for (let i = 0; i < linesLength; i++) {
  5981. prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
  5982. }
  5983. const histogram = new Uint32Array(prefixLengthMax + 1);
  5984. for (let i = 0; i < linesLength; i++) {
  5985. histogram[lines[i].prefixLength]++;
  5986. }
  5987. let currentLength = 1,
  5988. firstCode = 0,
  5989. currentCode,
  5990. currentTemp,
  5991. line;
  5992. histogram[0] = 0;
  5993. while (currentLength <= prefixLengthMax) {
  5994. firstCode = firstCode + histogram[currentLength - 1] << 1;
  5995. currentCode = firstCode;
  5996. currentTemp = 0;
  5997. while (currentTemp < linesLength) {
  5998. line = lines[currentTemp];
  5999. if (line.prefixLength === currentLength) {
  6000. line.prefixCode = currentCode;
  6001. currentCode++;
  6002. }
  6003. currentTemp++;
  6004. }
  6005. currentLength++;
  6006. }
  6007. }
  6008. }
  6009. function decodeTablesSegment(data, start, end) {
  6010. const flags = data[start];
  6011. const lowestValue = readUint32(data, start + 1) & 0xffffffff;
  6012. const highestValue = readUint32(data, start + 5) & 0xffffffff;
  6013. const reader = new Reader(data, start + 9, end);
  6014. const prefixSizeBits = (flags >> 1 & 7) + 1;
  6015. const rangeSizeBits = (flags >> 4 & 7) + 1;
  6016. const lines = [];
  6017. let prefixLength,
  6018. rangeLength,
  6019. currentRangeLow = lowestValue;
  6020. do {
  6021. prefixLength = reader.readBits(prefixSizeBits);
  6022. rangeLength = reader.readBits(rangeSizeBits);
  6023. lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
  6024. currentRangeLow += 1 << rangeLength;
  6025. } while (currentRangeLow < highestValue);
  6026. prefixLength = reader.readBits(prefixSizeBits);
  6027. lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
  6028. prefixLength = reader.readBits(prefixSizeBits);
  6029. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  6030. if (flags & 1) {
  6031. prefixLength = reader.readBits(prefixSizeBits);
  6032. lines.push(new HuffmanLine([prefixLength, 0]));
  6033. }
  6034. return new HuffmanTable(lines, false);
  6035. }
  6036. const standardTablesCache = {};
  6037. function getStandardTable(number) {
  6038. let table = standardTablesCache[number];
  6039. if (table) {
  6040. return table;
  6041. }
  6042. let lines;
  6043. switch (number) {
  6044. case 1:
  6045. lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
  6046. break;
  6047. case 2:
  6048. lines = [[0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xe], [11, 5, 6, 0x1e], [75, 6, 32, 0x3e], [6, 0x3f]];
  6049. break;
  6050. case 3:
  6051. lines = [[-256, 8, 8, 0xfe], [0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xe], [11, 5, 6, 0x1e], [-257, 8, 32, 0xff, "lower"], [75, 7, 32, 0x7e], [6, 0x3e]];
  6052. break;
  6053. case 4:
  6054. lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xe], [12, 5, 6, 0x1e], [76, 5, 32, 0x1f]];
  6055. break;
  6056. case 5:
  6057. lines = [[-255, 7, 8, 0x7e], [1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xe], [12, 5, 6, 0x1e], [-256, 7, 32, 0x7f, "lower"], [76, 6, 32, 0x3e]];
  6058. break;
  6059. case 6:
  6060. lines = [[-2048, 5, 10, 0x1c], [-1024, 4, 9, 0x8], [-512, 4, 8, 0x9], [-256, 4, 7, 0xa], [-128, 5, 6, 0x1d], [-64, 5, 5, 0x1e], [-32, 4, 5, 0xb], [0, 2, 7, 0x0], [128, 3, 7, 0x2], [256, 3, 8, 0x3], [512, 4, 9, 0xc], [1024, 4, 10, 0xd], [-2049, 6, 32, 0x3e, "lower"], [2048, 6, 32, 0x3f]];
  6061. break;
  6062. case 7:
  6063. lines = [[-1024, 4, 9, 0x8], [-512, 3, 8, 0x0], [-256, 4, 7, 0x9], [-128, 5, 6, 0x1a], [-64, 5, 5, 0x1b], [-32, 4, 5, 0xa], [0, 4, 5, 0xb], [32, 5, 5, 0x1c], [64, 5, 6, 0x1d], [128, 4, 7, 0xc], [256, 3, 8, 0x1], [512, 3, 9, 0x2], [1024, 3, 10, 0x3], [-1025, 5, 32, 0x1e, "lower"], [2048, 5, 32, 0x1f]];
  6064. break;
  6065. case 8:
  6066. lines = [[-15, 8, 3, 0xfc], [-7, 9, 1, 0x1fc], [-5, 8, 1, 0xfd], [-3, 9, 0, 0x1fd], [-2, 7, 0, 0x7c], [-1, 4, 0, 0xa], [0, 2, 1, 0x0], [2, 5, 0, 0x1a], [3, 6, 0, 0x3a], [4, 3, 4, 0x4], [20, 6, 1, 0x3b], [22, 4, 4, 0xb], [38, 4, 5, 0xc], [70, 5, 6, 0x1b], [134, 5, 7, 0x1c], [262, 6, 7, 0x3c], [390, 7, 8, 0x7d], [646, 6, 10, 0x3d], [-16, 9, 32, 0x1fe, "lower"], [1670, 9, 32, 0x1ff], [2, 0x1]];
  6067. break;
  6068. case 9:
  6069. lines = [[-31, 8, 4, 0xfc], [-15, 9, 2, 0x1fc], [-11, 8, 2, 0xfd], [-7, 9, 1, 0x1fd], [-5, 7, 1, 0x7c], [-3, 4, 1, 0xa], [-1, 3, 1, 0x2], [1, 3, 1, 0x3], [3, 5, 1, 0x1a], [5, 6, 1, 0x3a], [7, 3, 5, 0x4], [39, 6, 2, 0x3b], [43, 4, 5, 0xb], [75, 4, 6, 0xc], [139, 5, 7, 0x1b], [267, 5, 8, 0x1c], [523, 6, 8, 0x3c], [779, 7, 9, 0x7d], [1291, 6, 11, 0x3d], [-32, 9, 32, 0x1fe, "lower"], [3339, 9, 32, 0x1ff], [2, 0x0]];
  6070. break;
  6071. case 10:
  6072. lines = [[-21, 7, 4, 0x7a], [-5, 8, 0, 0xfc], [-4, 7, 0, 0x7b], [-3, 5, 0, 0x18], [-2, 2, 2, 0x0], [2, 5, 0, 0x19], [3, 6, 0, 0x36], [4, 7, 0, 0x7c], [5, 8, 0, 0xfd], [6, 2, 6, 0x1], [70, 5, 5, 0x1a], [102, 6, 5, 0x37], [134, 6, 6, 0x38], [198, 6, 7, 0x39], [326, 6, 8, 0x3a], [582, 6, 9, 0x3b], [1094, 6, 10, 0x3c], [2118, 7, 11, 0x7d], [-22, 8, 32, 0xfe, "lower"], [4166, 8, 32, 0xff], [2, 0x2]];
  6073. break;
  6074. case 11:
  6075. lines = [[1, 1, 0, 0x0], [2, 2, 1, 0x2], [4, 4, 0, 0xc], [5, 4, 1, 0xd], [7, 5, 1, 0x1c], [9, 5, 2, 0x1d], [13, 6, 2, 0x3c], [17, 7, 2, 0x7a], [21, 7, 3, 0x7b], [29, 7, 4, 0x7c], [45, 7, 5, 0x7d], [77, 7, 6, 0x7e], [141, 7, 32, 0x7f]];
  6076. break;
  6077. case 12:
  6078. lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 1, 0x6], [5, 5, 0, 0x1c], [6, 5, 1, 0x1d], [8, 6, 1, 0x3c], [10, 7, 0, 0x7a], [11, 7, 1, 0x7b], [13, 7, 2, 0x7c], [17, 7, 3, 0x7d], [25, 7, 4, 0x7e], [41, 8, 5, 0xfe], [73, 8, 32, 0xff]];
  6079. break;
  6080. case 13:
  6081. lines = [[1, 1, 0, 0x0], [2, 3, 0, 0x4], [3, 4, 0, 0xc], [4, 5, 0, 0x1c], [5, 4, 1, 0xd], [7, 3, 3, 0x5], [15, 6, 1, 0x3a], [17, 6, 2, 0x3b], [21, 6, 3, 0x3c], [29, 6, 4, 0x3d], [45, 6, 5, 0x3e], [77, 7, 6, 0x7e], [141, 7, 32, 0x7f]];
  6082. break;
  6083. case 14:
  6084. lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
  6085. break;
  6086. case 15:
  6087. lines = [[-24, 7, 4, 0x7c], [-8, 6, 2, 0x3c], [-4, 5, 1, 0x1c], [-2, 4, 0, 0xc], [-1, 3, 0, 0x4], [0, 1, 0, 0x0], [1, 3, 0, 0x5], [2, 4, 0, 0xd], [3, 5, 1, 0x1d], [5, 6, 2, 0x3d], [9, 7, 4, 0x7d], [-25, 7, 32, 0x7e, "lower"], [25, 7, 32, 0x7f]];
  6088. break;
  6089. default:
  6090. throw new Jbig2Error(`standard table B.${number} does not exist`);
  6091. }
  6092. for (let i = 0, ii = lines.length; i < ii; i++) {
  6093. lines[i] = new HuffmanLine(lines[i]);
  6094. }
  6095. table = new HuffmanTable(lines, true);
  6096. standardTablesCache[number] = table;
  6097. return table;
  6098. }
  6099. class Reader {
  6100. constructor(data, start, end) {
  6101. this.data = data;
  6102. this.start = start;
  6103. this.end = end;
  6104. this.position = start;
  6105. this.shift = -1;
  6106. this.currentByte = 0;
  6107. }
  6108. readBit() {
  6109. if (this.shift < 0) {
  6110. if (this.position >= this.end) {
  6111. throw new Jbig2Error("end of data while reading bit");
  6112. }
  6113. this.currentByte = this.data[this.position++];
  6114. this.shift = 7;
  6115. }
  6116. const bit = this.currentByte >> this.shift & 1;
  6117. this.shift--;
  6118. return bit;
  6119. }
  6120. readBits(numBits) {
  6121. let result = 0,
  6122. i;
  6123. for (i = numBits - 1; i >= 0; i--) {
  6124. result |= this.readBit() << i;
  6125. }
  6126. return result;
  6127. }
  6128. byteAlign() {
  6129. this.shift = -1;
  6130. }
  6131. next() {
  6132. if (this.position >= this.end) {
  6133. return -1;
  6134. }
  6135. return this.data[this.position++];
  6136. }
  6137. }
  6138. function getCustomHuffmanTable(index, referredTo, customTables) {
  6139. let currentIndex = 0;
  6140. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  6141. const table = customTables[referredTo[i]];
  6142. if (table) {
  6143. if (index === currentIndex) {
  6144. return table;
  6145. }
  6146. currentIndex++;
  6147. }
  6148. }
  6149. throw new Jbig2Error("can't find custom Huffman table");
  6150. }
  6151. function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
  6152. const codes = [];
  6153. for (let i = 0; i <= 34; i++) {
  6154. const codeLength = reader.readBits(4);
  6155. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  6156. }
  6157. const runCodesTable = new HuffmanTable(codes, false);
  6158. codes.length = 0;
  6159. for (let i = 0; i < numberOfSymbols;) {
  6160. const codeLength = runCodesTable.decode(reader);
  6161. if (codeLength >= 32) {
  6162. let repeatedLength, numberOfRepeats, j;
  6163. switch (codeLength) {
  6164. case 32:
  6165. if (i === 0) {
  6166. throw new Jbig2Error("no previous value in symbol ID table");
  6167. }
  6168. numberOfRepeats = reader.readBits(2) + 3;
  6169. repeatedLength = codes[i - 1].prefixLength;
  6170. break;
  6171. case 33:
  6172. numberOfRepeats = reader.readBits(3) + 3;
  6173. repeatedLength = 0;
  6174. break;
  6175. case 34:
  6176. numberOfRepeats = reader.readBits(7) + 11;
  6177. repeatedLength = 0;
  6178. break;
  6179. default:
  6180. throw new Jbig2Error("invalid code length in symbol ID table");
  6181. }
  6182. for (j = 0; j < numberOfRepeats; j++) {
  6183. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  6184. i++;
  6185. }
  6186. } else {
  6187. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  6188. i++;
  6189. }
  6190. }
  6191. reader.byteAlign();
  6192. const symbolIDTable = new HuffmanTable(codes, false);
  6193. let customIndex = 0,
  6194. tableFirstS,
  6195. tableDeltaS,
  6196. tableDeltaT;
  6197. switch (textRegion.huffmanFS) {
  6198. case 0:
  6199. case 1:
  6200. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  6201. break;
  6202. case 3:
  6203. tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  6204. customIndex++;
  6205. break;
  6206. default:
  6207. throw new Jbig2Error("invalid Huffman FS selector");
  6208. }
  6209. switch (textRegion.huffmanDS) {
  6210. case 0:
  6211. case 1:
  6212. case 2:
  6213. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  6214. break;
  6215. case 3:
  6216. tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  6217. customIndex++;
  6218. break;
  6219. default:
  6220. throw new Jbig2Error("invalid Huffman DS selector");
  6221. }
  6222. switch (textRegion.huffmanDT) {
  6223. case 0:
  6224. case 1:
  6225. case 2:
  6226. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  6227. break;
  6228. case 3:
  6229. tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
  6230. customIndex++;
  6231. break;
  6232. default:
  6233. throw new Jbig2Error("invalid Huffman DT selector");
  6234. }
  6235. if (textRegion.refinement) {
  6236. throw new Jbig2Error("refinement with Huffman is not supported");
  6237. }
  6238. return {
  6239. symbolIDTable,
  6240. tableFirstS,
  6241. tableDeltaS,
  6242. tableDeltaT
  6243. };
  6244. }
  6245. function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
  6246. let customIndex = 0,
  6247. tableDeltaHeight,
  6248. tableDeltaWidth;
  6249. switch (dictionary.huffmanDHSelector) {
  6250. case 0:
  6251. case 1:
  6252. tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
  6253. break;
  6254. case 3:
  6255. tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
  6256. customIndex++;
  6257. break;
  6258. default:
  6259. throw new Jbig2Error("invalid Huffman DH selector");
  6260. }
  6261. switch (dictionary.huffmanDWSelector) {
  6262. case 0:
  6263. case 1:
  6264. tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
  6265. break;
  6266. case 3:
  6267. tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
  6268. customIndex++;
  6269. break;
  6270. default:
  6271. throw new Jbig2Error("invalid Huffman DW selector");
  6272. }
  6273. let tableBitmapSize, tableAggregateInstances;
  6274. if (dictionary.bitmapSizeSelector) {
  6275. tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
  6276. customIndex++;
  6277. } else {
  6278. tableBitmapSize = getStandardTable(1);
  6279. }
  6280. if (dictionary.aggregationInstancesSelector) {
  6281. tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
  6282. } else {
  6283. tableAggregateInstances = getStandardTable(1);
  6284. }
  6285. return {
  6286. tableDeltaHeight,
  6287. tableDeltaWidth,
  6288. tableBitmapSize,
  6289. tableAggregateInstances
  6290. };
  6291. }
  6292. function readUncompressedBitmap(reader, width, height) {
  6293. const bitmap = [];
  6294. for (let y = 0; y < height; y++) {
  6295. const row = new Uint8Array(width);
  6296. bitmap.push(row);
  6297. for (let x = 0; x < width; x++) {
  6298. row[x] = reader.readBit();
  6299. }
  6300. reader.byteAlign();
  6301. }
  6302. return bitmap;
  6303. }
  6304. function decodeMMRBitmap(input, width, height, endOfBlock) {
  6305. const params = {
  6306. K: -1,
  6307. Columns: width,
  6308. Rows: height,
  6309. BlackIs1: true,
  6310. EndOfBlock: endOfBlock
  6311. };
  6312. const decoder = new CCITTFaxDecoder(input, params);
  6313. const bitmap = [];
  6314. let currentByte,
  6315. eof = false;
  6316. for (let y = 0; y < height; y++) {
  6317. const row = new Uint8Array(width);
  6318. bitmap.push(row);
  6319. let shift = -1;
  6320. for (let x = 0; x < width; x++) {
  6321. if (shift < 0) {
  6322. currentByte = decoder.readNextChar();
  6323. if (currentByte === -1) {
  6324. currentByte = 0;
  6325. eof = true;
  6326. }
  6327. shift = 7;
  6328. }
  6329. row[x] = currentByte >> shift & 1;
  6330. shift--;
  6331. }
  6332. }
  6333. if (endOfBlock && !eof) {
  6334. const lookForEOFLimit = 5;
  6335. for (let i = 0; i < lookForEOFLimit; i++) {
  6336. if (decoder.readNextChar() === -1) {
  6337. break;
  6338. }
  6339. }
  6340. }
  6341. return bitmap;
  6342. }
  6343. class Jbig2Image {
  6344. parseChunks(chunks) {
  6345. return parseJbig2Chunks(chunks);
  6346. }
  6347. parse(data) {
  6348. throw new Error("Not implemented: Jbig2Image.parse");
  6349. }
  6350. }
  6351. ;// ./src/core/jbig2_stream.js
  6352. class Jbig2Stream extends DecodeStream {
  6353. constructor(stream, maybeLength, params) {
  6354. super(maybeLength);
  6355. this.stream = stream;
  6356. this.dict = stream.dict;
  6357. this.maybeLength = maybeLength;
  6358. this.params = params;
  6359. }
  6360. get bytes() {
  6361. return shadow(this, "bytes", this.stream.getBytes(this.maybeLength));
  6362. }
  6363. ensureBuffer(requested) {}
  6364. readBlock() {
  6365. this.decodeImage();
  6366. }
  6367. decodeImage(bytes) {
  6368. if (this.eof) {
  6369. return this.buffer;
  6370. }
  6371. bytes ||= this.bytes;
  6372. const jbig2Image = new Jbig2Image();
  6373. const chunks = [];
  6374. if (this.params instanceof Dict) {
  6375. const globalsStream = this.params.get("JBIG2Globals");
  6376. if (globalsStream instanceof BaseStream) {
  6377. const globals = globalsStream.getBytes();
  6378. chunks.push({
  6379. data: globals,
  6380. start: 0,
  6381. end: globals.length
  6382. });
  6383. }
  6384. }
  6385. chunks.push({
  6386. data: bytes,
  6387. start: 0,
  6388. end: bytes.length
  6389. });
  6390. const data = jbig2Image.parseChunks(chunks);
  6391. const dataLength = data.length;
  6392. for (let i = 0; i < dataLength; i++) {
  6393. data[i] ^= 0xff;
  6394. }
  6395. this.buffer = data;
  6396. this.bufferLength = dataLength;
  6397. this.eof = true;
  6398. return this.buffer;
  6399. }
  6400. get canAsyncDecodeImageFromBuffer() {
  6401. return this.stream.isAsync;
  6402. }
  6403. }
  6404. ;// ./src/shared/image_utils.js
  6405. function convertToRGBA(params) {
  6406. switch (params.kind) {
  6407. case ImageKind.GRAYSCALE_1BPP:
  6408. return convertBlackAndWhiteToRGBA(params);
  6409. case ImageKind.RGB_24BPP:
  6410. return convertRGBToRGBA(params);
  6411. }
  6412. return null;
  6413. }
  6414. function convertBlackAndWhiteToRGBA({
  6415. src,
  6416. srcPos = 0,
  6417. dest,
  6418. width,
  6419. height,
  6420. nonBlackColor = 0xffffffff,
  6421. inverseDecode = false
  6422. }) {
  6423. const black = FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
  6424. const [zeroMapping, oneMapping] = inverseDecode ? [nonBlackColor, black] : [black, nonBlackColor];
  6425. const widthInSource = width >> 3;
  6426. const widthRemainder = width & 7;
  6427. const srcLength = src.length;
  6428. dest = new Uint32Array(dest.buffer);
  6429. let destPos = 0;
  6430. for (let i = 0; i < height; i++) {
  6431. for (const max = srcPos + widthInSource; srcPos < max; srcPos++) {
  6432. const elem = srcPos < srcLength ? src[srcPos] : 255;
  6433. dest[destPos++] = elem & 0b10000000 ? oneMapping : zeroMapping;
  6434. dest[destPos++] = elem & 0b1000000 ? oneMapping : zeroMapping;
  6435. dest[destPos++] = elem & 0b100000 ? oneMapping : zeroMapping;
  6436. dest[destPos++] = elem & 0b10000 ? oneMapping : zeroMapping;
  6437. dest[destPos++] = elem & 0b1000 ? oneMapping : zeroMapping;
  6438. dest[destPos++] = elem & 0b100 ? oneMapping : zeroMapping;
  6439. dest[destPos++] = elem & 0b10 ? oneMapping : zeroMapping;
  6440. dest[destPos++] = elem & 0b1 ? oneMapping : zeroMapping;
  6441. }
  6442. if (widthRemainder === 0) {
  6443. continue;
  6444. }
  6445. const elem = srcPos < srcLength ? src[srcPos++] : 255;
  6446. for (let j = 0; j < widthRemainder; j++) {
  6447. dest[destPos++] = elem & 1 << 7 - j ? oneMapping : zeroMapping;
  6448. }
  6449. }
  6450. return {
  6451. srcPos,
  6452. destPos
  6453. };
  6454. }
  6455. function convertRGBToRGBA({
  6456. src,
  6457. srcPos = 0,
  6458. dest,
  6459. destPos = 0,
  6460. width,
  6461. height
  6462. }) {
  6463. let i = 0;
  6464. const len32 = src.length >> 2;
  6465. const src32 = new Uint32Array(src.buffer, srcPos, len32);
  6466. if (FeatureTest.isLittleEndian) {
  6467. for (; i < len32 - 2; i += 3, destPos += 4) {
  6468. const s1 = src32[i];
  6469. const s2 = src32[i + 1];
  6470. const s3 = src32[i + 2];
  6471. dest[destPos] = s1 | 0xff000000;
  6472. dest[destPos + 1] = s1 >>> 24 | s2 << 8 | 0xff000000;
  6473. dest[destPos + 2] = s2 >>> 16 | s3 << 16 | 0xff000000;
  6474. dest[destPos + 3] = s3 >>> 8 | 0xff000000;
  6475. }
  6476. for (let j = i * 4, jj = src.length; j < jj; j += 3) {
  6477. dest[destPos++] = src[j] | src[j + 1] << 8 | src[j + 2] << 16 | 0xff000000;
  6478. }
  6479. } else {
  6480. for (; i < len32 - 2; i += 3, destPos += 4) {
  6481. const s1 = src32[i];
  6482. const s2 = src32[i + 1];
  6483. const s3 = src32[i + 2];
  6484. dest[destPos] = s1 | 0xff;
  6485. dest[destPos + 1] = s1 << 24 | s2 >>> 8 | 0xff;
  6486. dest[destPos + 2] = s2 << 16 | s3 >>> 16 | 0xff;
  6487. dest[destPos + 3] = s3 << 8 | 0xff;
  6488. }
  6489. for (let j = i * 4, jj = src.length; j < jj; j += 3) {
  6490. dest[destPos++] = src[j] << 24 | src[j + 1] << 16 | src[j + 2] << 8 | 0xff;
  6491. }
  6492. }
  6493. return {
  6494. srcPos,
  6495. destPos
  6496. };
  6497. }
  6498. function grayToRGBA(src, dest) {
  6499. if (FeatureTest.isLittleEndian) {
  6500. for (let i = 0, ii = src.length; i < ii; i++) {
  6501. dest[i] = src[i] * 0x10101 | 0xff000000;
  6502. }
  6503. } else {
  6504. for (let i = 0, ii = src.length; i < ii; i++) {
  6505. dest[i] = src[i] * 0x1010100 | 0x000000ff;
  6506. }
  6507. }
  6508. }
  6509. ;// ./src/core/jpg.js
  6510. class JpegError extends BaseException {
  6511. constructor(msg) {
  6512. super(msg, "JpegError");
  6513. }
  6514. }
  6515. class DNLMarkerError extends BaseException {
  6516. constructor(message, scanLines) {
  6517. super(message, "DNLMarkerError");
  6518. this.scanLines = scanLines;
  6519. }
  6520. }
  6521. class EOIMarkerError extends BaseException {
  6522. constructor(msg) {
  6523. super(msg, "EOIMarkerError");
  6524. }
  6525. }
  6526. const dctZigZag = new Uint8Array([0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63]);
  6527. const dctCos1 = 4017;
  6528. const dctSin1 = 799;
  6529. const dctCos3 = 3406;
  6530. const dctSin3 = 2276;
  6531. const dctCos6 = 1567;
  6532. const dctSin6 = 3784;
  6533. const dctSqrt2 = 5793;
  6534. const dctSqrt1d2 = 2896;
  6535. function buildHuffmanTable(codeLengths, values) {
  6536. let k = 0,
  6537. i,
  6538. j,
  6539. length = 16;
  6540. while (length > 0 && !codeLengths[length - 1]) {
  6541. length--;
  6542. }
  6543. const code = [{
  6544. children: [],
  6545. index: 0
  6546. }];
  6547. let p = code[0],
  6548. q;
  6549. for (i = 0; i < length; i++) {
  6550. for (j = 0; j < codeLengths[i]; j++) {
  6551. p = code.pop();
  6552. p.children[p.index] = values[k];
  6553. while (p.index > 0) {
  6554. p = code.pop();
  6555. }
  6556. p.index++;
  6557. code.push(p);
  6558. while (code.length <= i) {
  6559. code.push(q = {
  6560. children: [],
  6561. index: 0
  6562. });
  6563. p.children[p.index] = q.children;
  6564. p = q;
  6565. }
  6566. k++;
  6567. }
  6568. if (i + 1 < length) {
  6569. code.push(q = {
  6570. children: [],
  6571. index: 0
  6572. });
  6573. p.children[p.index] = q.children;
  6574. p = q;
  6575. }
  6576. }
  6577. return code[0].children;
  6578. }
  6579. function getBlockBufferOffset(component, row, col) {
  6580. return 64 * ((component.blocksPerLine + 1) * row + col);
  6581. }
  6582. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) {
  6583. const mcusPerLine = frame.mcusPerLine;
  6584. const progressive = frame.progressive;
  6585. const startOffset = offset;
  6586. let bitsData = 0,
  6587. bitsCount = 0;
  6588. function readBit() {
  6589. if (bitsCount > 0) {
  6590. bitsCount--;
  6591. return bitsData >> bitsCount & 1;
  6592. }
  6593. bitsData = data[offset++];
  6594. if (bitsData === 0xff) {
  6595. const nextByte = data[offset++];
  6596. if (nextByte) {
  6597. if (nextByte === 0xdc && parseDNLMarker) {
  6598. offset += 2;
  6599. const scanLines = readUint16(data, offset);
  6600. offset += 2;
  6601. if (scanLines > 0 && scanLines !== frame.scanLines) {
  6602. throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
  6603. }
  6604. } else if (nextByte === 0xd9) {
  6605. if (parseDNLMarker) {
  6606. const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
  6607. if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 5) {
  6608. throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
  6609. }
  6610. }
  6611. throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
  6612. }
  6613. throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
  6614. }
  6615. }
  6616. bitsCount = 7;
  6617. return bitsData >>> 7;
  6618. }
  6619. function decodeHuffman(tree) {
  6620. let node = tree;
  6621. while (true) {
  6622. node = node[readBit()];
  6623. switch (typeof node) {
  6624. case "number":
  6625. return node;
  6626. case "object":
  6627. continue;
  6628. }
  6629. throw new JpegError("invalid huffman sequence");
  6630. }
  6631. }
  6632. function receive(length) {
  6633. let n = 0;
  6634. while (length > 0) {
  6635. n = n << 1 | readBit();
  6636. length--;
  6637. }
  6638. return n;
  6639. }
  6640. function receiveAndExtend(length) {
  6641. if (length === 1) {
  6642. return readBit() === 1 ? 1 : -1;
  6643. }
  6644. const n = receive(length);
  6645. if (n >= 1 << length - 1) {
  6646. return n;
  6647. }
  6648. return n + (-1 << length) + 1;
  6649. }
  6650. function decodeBaseline(component, blockOffset) {
  6651. const t = decodeHuffman(component.huffmanTableDC);
  6652. const diff = t === 0 ? 0 : receiveAndExtend(t);
  6653. component.blockData[blockOffset] = component.pred += diff;
  6654. let k = 1;
  6655. while (k < 64) {
  6656. const rs = decodeHuffman(component.huffmanTableAC);
  6657. const s = rs & 15,
  6658. r = rs >> 4;
  6659. if (s === 0) {
  6660. if (r < 15) {
  6661. break;
  6662. }
  6663. k += 16;
  6664. continue;
  6665. }
  6666. k += r;
  6667. const z = dctZigZag[k];
  6668. component.blockData[blockOffset + z] = receiveAndExtend(s);
  6669. k++;
  6670. }
  6671. }
  6672. function decodeDCFirst(component, blockOffset) {
  6673. const t = decodeHuffman(component.huffmanTableDC);
  6674. const diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  6675. component.blockData[blockOffset] = component.pred += diff;
  6676. }
  6677. function decodeDCSuccessive(component, blockOffset) {
  6678. component.blockData[blockOffset] |= readBit() << successive;
  6679. }
  6680. let eobrun = 0;
  6681. function decodeACFirst(component, blockOffset) {
  6682. if (eobrun > 0) {
  6683. eobrun--;
  6684. return;
  6685. }
  6686. let k = spectralStart;
  6687. const e = spectralEnd;
  6688. while (k <= e) {
  6689. const rs = decodeHuffman(component.huffmanTableAC);
  6690. const s = rs & 15,
  6691. r = rs >> 4;
  6692. if (s === 0) {
  6693. if (r < 15) {
  6694. eobrun = receive(r) + (1 << r) - 1;
  6695. break;
  6696. }
  6697. k += 16;
  6698. continue;
  6699. }
  6700. k += r;
  6701. const z = dctZigZag[k];
  6702. component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
  6703. k++;
  6704. }
  6705. }
  6706. let successiveACState = 0,
  6707. successiveACNextValue;
  6708. function decodeACSuccessive(component, blockOffset) {
  6709. let k = spectralStart;
  6710. const e = spectralEnd;
  6711. let r = 0;
  6712. let s;
  6713. let rs;
  6714. while (k <= e) {
  6715. const offsetZ = blockOffset + dctZigZag[k];
  6716. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  6717. switch (successiveACState) {
  6718. case 0:
  6719. rs = decodeHuffman(component.huffmanTableAC);
  6720. s = rs & 15;
  6721. r = rs >> 4;
  6722. if (s === 0) {
  6723. if (r < 15) {
  6724. eobrun = receive(r) + (1 << r);
  6725. successiveACState = 4;
  6726. } else {
  6727. r = 16;
  6728. successiveACState = 1;
  6729. }
  6730. } else {
  6731. if (s !== 1) {
  6732. throw new JpegError("invalid ACn encoding");
  6733. }
  6734. successiveACNextValue = receiveAndExtend(s);
  6735. successiveACState = r ? 2 : 3;
  6736. }
  6737. continue;
  6738. case 1:
  6739. case 2:
  6740. if (component.blockData[offsetZ]) {
  6741. component.blockData[offsetZ] += sign * (readBit() << successive);
  6742. } else {
  6743. r--;
  6744. if (r === 0) {
  6745. successiveACState = successiveACState === 2 ? 3 : 0;
  6746. }
  6747. }
  6748. break;
  6749. case 3:
  6750. if (component.blockData[offsetZ]) {
  6751. component.blockData[offsetZ] += sign * (readBit() << successive);
  6752. } else {
  6753. component.blockData[offsetZ] = successiveACNextValue << successive;
  6754. successiveACState = 0;
  6755. }
  6756. break;
  6757. case 4:
  6758. if (component.blockData[offsetZ]) {
  6759. component.blockData[offsetZ] += sign * (readBit() << successive);
  6760. }
  6761. break;
  6762. }
  6763. k++;
  6764. }
  6765. if (successiveACState === 4) {
  6766. eobrun--;
  6767. if (eobrun === 0) {
  6768. successiveACState = 0;
  6769. }
  6770. }
  6771. }
  6772. let blockRow = 0;
  6773. function decodeMcu(component, decode, mcu, row, col) {
  6774. const mcuRow = mcu / mcusPerLine | 0;
  6775. const mcuCol = mcu % mcusPerLine;
  6776. blockRow = mcuRow * component.v + row;
  6777. const blockCol = mcuCol * component.h + col;
  6778. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  6779. decode(component, blockOffset);
  6780. }
  6781. function decodeBlock(component, decode, mcu) {
  6782. blockRow = mcu / component.blocksPerLine | 0;
  6783. const blockCol = mcu % component.blocksPerLine;
  6784. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  6785. decode(component, blockOffset);
  6786. }
  6787. const componentsLength = components.length;
  6788. let component, i, j, k, n;
  6789. let decodeFn;
  6790. if (progressive) {
  6791. if (spectralStart === 0) {
  6792. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  6793. } else {
  6794. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  6795. }
  6796. } else {
  6797. decodeFn = decodeBaseline;
  6798. }
  6799. let mcu = 0,
  6800. fileMarker;
  6801. const mcuExpected = componentsLength === 1 ? components[0].blocksPerLine * components[0].blocksPerColumn : mcusPerLine * frame.mcusPerColumn;
  6802. let h, v;
  6803. while (mcu <= mcuExpected) {
  6804. const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  6805. if (mcuToRead > 0) {
  6806. for (i = 0; i < componentsLength; i++) {
  6807. components[i].pred = 0;
  6808. }
  6809. eobrun = 0;
  6810. if (componentsLength === 1) {
  6811. component = components[0];
  6812. for (n = 0; n < mcuToRead; n++) {
  6813. decodeBlock(component, decodeFn, mcu);
  6814. mcu++;
  6815. }
  6816. } else {
  6817. for (n = 0; n < mcuToRead; n++) {
  6818. for (i = 0; i < componentsLength; i++) {
  6819. component = components[i];
  6820. h = component.h;
  6821. v = component.v;
  6822. for (j = 0; j < v; j++) {
  6823. for (k = 0; k < h; k++) {
  6824. decodeMcu(component, decodeFn, mcu, j, k);
  6825. }
  6826. }
  6827. }
  6828. mcu++;
  6829. }
  6830. }
  6831. }
  6832. bitsCount = 0;
  6833. fileMarker = findNextFileMarker(data, offset);
  6834. if (!fileMarker) {
  6835. break;
  6836. }
  6837. if (fileMarker.invalid) {
  6838. const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
  6839. warn(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
  6840. offset = fileMarker.offset;
  6841. }
  6842. if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
  6843. offset += 2;
  6844. } else {
  6845. break;
  6846. }
  6847. }
  6848. return offset - startOffset;
  6849. }
  6850. function quantizeAndInverse(component, blockBufferOffset, p) {
  6851. const qt = component.quantizationTable,
  6852. blockData = component.blockData;
  6853. let v0, v1, v2, v3, v4, v5, v6, v7;
  6854. let p0, p1, p2, p3, p4, p5, p6, p7;
  6855. let t;
  6856. if (!qt) {
  6857. throw new JpegError("missing required Quantization Table.");
  6858. }
  6859. for (let row = 0; row < 64; row += 8) {
  6860. p0 = blockData[blockBufferOffset + row];
  6861. p1 = blockData[blockBufferOffset + row + 1];
  6862. p2 = blockData[blockBufferOffset + row + 2];
  6863. p3 = blockData[blockBufferOffset + row + 3];
  6864. p4 = blockData[blockBufferOffset + row + 4];
  6865. p5 = blockData[blockBufferOffset + row + 5];
  6866. p6 = blockData[blockBufferOffset + row + 6];
  6867. p7 = blockData[blockBufferOffset + row + 7];
  6868. p0 *= qt[row];
  6869. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  6870. t = dctSqrt2 * p0 + 512 >> 10;
  6871. p[row] = t;
  6872. p[row + 1] = t;
  6873. p[row + 2] = t;
  6874. p[row + 3] = t;
  6875. p[row + 4] = t;
  6876. p[row + 5] = t;
  6877. p[row + 6] = t;
  6878. p[row + 7] = t;
  6879. continue;
  6880. }
  6881. p1 *= qt[row + 1];
  6882. p2 *= qt[row + 2];
  6883. p3 *= qt[row + 3];
  6884. p4 *= qt[row + 4];
  6885. p5 *= qt[row + 5];
  6886. p6 *= qt[row + 6];
  6887. p7 *= qt[row + 7];
  6888. v0 = dctSqrt2 * p0 + 128 >> 8;
  6889. v1 = dctSqrt2 * p4 + 128 >> 8;
  6890. v2 = p2;
  6891. v3 = p6;
  6892. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  6893. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  6894. v5 = p3 << 4;
  6895. v6 = p5 << 4;
  6896. v0 = v0 + v1 + 1 >> 1;
  6897. v1 = v0 - v1;
  6898. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  6899. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  6900. v3 = t;
  6901. v4 = v4 + v6 + 1 >> 1;
  6902. v6 = v4 - v6;
  6903. v7 = v7 + v5 + 1 >> 1;
  6904. v5 = v7 - v5;
  6905. v0 = v0 + v3 + 1 >> 1;
  6906. v3 = v0 - v3;
  6907. v1 = v1 + v2 + 1 >> 1;
  6908. v2 = v1 - v2;
  6909. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  6910. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  6911. v7 = t;
  6912. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  6913. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  6914. v6 = t;
  6915. p[row] = v0 + v7;
  6916. p[row + 7] = v0 - v7;
  6917. p[row + 1] = v1 + v6;
  6918. p[row + 6] = v1 - v6;
  6919. p[row + 2] = v2 + v5;
  6920. p[row + 5] = v2 - v5;
  6921. p[row + 3] = v3 + v4;
  6922. p[row + 4] = v3 - v4;
  6923. }
  6924. for (let col = 0; col < 8; ++col) {
  6925. p0 = p[col];
  6926. p1 = p[col + 8];
  6927. p2 = p[col + 16];
  6928. p3 = p[col + 24];
  6929. p4 = p[col + 32];
  6930. p5 = p[col + 40];
  6931. p6 = p[col + 48];
  6932. p7 = p[col + 56];
  6933. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  6934. t = dctSqrt2 * p0 + 8192 >> 14;
  6935. if (t < -2040) {
  6936. t = 0;
  6937. } else if (t >= 2024) {
  6938. t = 255;
  6939. } else {
  6940. t = t + 2056 >> 4;
  6941. }
  6942. blockData[blockBufferOffset + col] = t;
  6943. blockData[blockBufferOffset + col + 8] = t;
  6944. blockData[blockBufferOffset + col + 16] = t;
  6945. blockData[blockBufferOffset + col + 24] = t;
  6946. blockData[blockBufferOffset + col + 32] = t;
  6947. blockData[blockBufferOffset + col + 40] = t;
  6948. blockData[blockBufferOffset + col + 48] = t;
  6949. blockData[blockBufferOffset + col + 56] = t;
  6950. continue;
  6951. }
  6952. v0 = dctSqrt2 * p0 + 2048 >> 12;
  6953. v1 = dctSqrt2 * p4 + 2048 >> 12;
  6954. v2 = p2;
  6955. v3 = p6;
  6956. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  6957. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  6958. v5 = p3;
  6959. v6 = p5;
  6960. v0 = (v0 + v1 + 1 >> 1) + 4112;
  6961. v1 = v0 - v1;
  6962. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  6963. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  6964. v3 = t;
  6965. v4 = v4 + v6 + 1 >> 1;
  6966. v6 = v4 - v6;
  6967. v7 = v7 + v5 + 1 >> 1;
  6968. v5 = v7 - v5;
  6969. v0 = v0 + v3 + 1 >> 1;
  6970. v3 = v0 - v3;
  6971. v1 = v1 + v2 + 1 >> 1;
  6972. v2 = v1 - v2;
  6973. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  6974. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  6975. v7 = t;
  6976. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  6977. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  6978. v6 = t;
  6979. p0 = v0 + v7;
  6980. p7 = v0 - v7;
  6981. p1 = v1 + v6;
  6982. p6 = v1 - v6;
  6983. p2 = v2 + v5;
  6984. p5 = v2 - v5;
  6985. p3 = v3 + v4;
  6986. p4 = v3 - v4;
  6987. if (p0 < 16) {
  6988. p0 = 0;
  6989. } else if (p0 >= 4080) {
  6990. p0 = 255;
  6991. } else {
  6992. p0 >>= 4;
  6993. }
  6994. if (p1 < 16) {
  6995. p1 = 0;
  6996. } else if (p1 >= 4080) {
  6997. p1 = 255;
  6998. } else {
  6999. p1 >>= 4;
  7000. }
  7001. if (p2 < 16) {
  7002. p2 = 0;
  7003. } else if (p2 >= 4080) {
  7004. p2 = 255;
  7005. } else {
  7006. p2 >>= 4;
  7007. }
  7008. if (p3 < 16) {
  7009. p3 = 0;
  7010. } else if (p3 >= 4080) {
  7011. p3 = 255;
  7012. } else {
  7013. p3 >>= 4;
  7014. }
  7015. if (p4 < 16) {
  7016. p4 = 0;
  7017. } else if (p4 >= 4080) {
  7018. p4 = 255;
  7019. } else {
  7020. p4 >>= 4;
  7021. }
  7022. if (p5 < 16) {
  7023. p5 = 0;
  7024. } else if (p5 >= 4080) {
  7025. p5 = 255;
  7026. } else {
  7027. p5 >>= 4;
  7028. }
  7029. if (p6 < 16) {
  7030. p6 = 0;
  7031. } else if (p6 >= 4080) {
  7032. p6 = 255;
  7033. } else {
  7034. p6 >>= 4;
  7035. }
  7036. if (p7 < 16) {
  7037. p7 = 0;
  7038. } else if (p7 >= 4080) {
  7039. p7 = 255;
  7040. } else {
  7041. p7 >>= 4;
  7042. }
  7043. blockData[blockBufferOffset + col] = p0;
  7044. blockData[blockBufferOffset + col + 8] = p1;
  7045. blockData[blockBufferOffset + col + 16] = p2;
  7046. blockData[blockBufferOffset + col + 24] = p3;
  7047. blockData[blockBufferOffset + col + 32] = p4;
  7048. blockData[blockBufferOffset + col + 40] = p5;
  7049. blockData[blockBufferOffset + col + 48] = p6;
  7050. blockData[blockBufferOffset + col + 56] = p7;
  7051. }
  7052. }
  7053. function buildComponentData(frame, component) {
  7054. const blocksPerLine = component.blocksPerLine;
  7055. const blocksPerColumn = component.blocksPerColumn;
  7056. const computationBuffer = new Int16Array(64);
  7057. for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  7058. for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  7059. const offset = getBlockBufferOffset(component, blockRow, blockCol);
  7060. quantizeAndInverse(component, offset, computationBuffer);
  7061. }
  7062. }
  7063. return component.blockData;
  7064. }
  7065. function findNextFileMarker(data, currentPos, startPos = currentPos) {
  7066. const maxPos = data.length - 1;
  7067. let newPos = startPos < currentPos ? startPos : currentPos;
  7068. if (currentPos >= maxPos) {
  7069. return null;
  7070. }
  7071. const currentMarker = readUint16(data, currentPos);
  7072. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  7073. return {
  7074. invalid: null,
  7075. marker: currentMarker,
  7076. offset: currentPos
  7077. };
  7078. }
  7079. let newMarker = readUint16(data, newPos);
  7080. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  7081. if (++newPos >= maxPos) {
  7082. return null;
  7083. }
  7084. newMarker = readUint16(data, newPos);
  7085. }
  7086. return {
  7087. invalid: currentMarker.toString(16),
  7088. marker: newMarker,
  7089. offset: newPos
  7090. };
  7091. }
  7092. function prepareComponents(frame) {
  7093. const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  7094. const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  7095. for (const component of frame.components) {
  7096. const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  7097. const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  7098. const blocksPerLineForMcu = mcusPerLine * component.h;
  7099. const blocksPerColumnForMcu = mcusPerColumn * component.v;
  7100. const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  7101. component.blockData = new Int16Array(blocksBufferSize);
  7102. component.blocksPerLine = blocksPerLine;
  7103. component.blocksPerColumn = blocksPerColumn;
  7104. }
  7105. frame.mcusPerLine = mcusPerLine;
  7106. frame.mcusPerColumn = mcusPerColumn;
  7107. }
  7108. function readDataBlock(data, offset) {
  7109. const length = readUint16(data, offset);
  7110. offset += 2;
  7111. let endOffset = offset + length - 2;
  7112. const fileMarker = findNextFileMarker(data, endOffset, offset);
  7113. if (fileMarker?.invalid) {
  7114. warn("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
  7115. endOffset = fileMarker.offset;
  7116. }
  7117. const array = data.subarray(offset, endOffset);
  7118. offset += array.length;
  7119. return {
  7120. appData: array,
  7121. newOffset: offset
  7122. };
  7123. }
  7124. function skipData(data, offset) {
  7125. const length = readUint16(data, offset);
  7126. offset += 2;
  7127. const endOffset = offset + length - 2;
  7128. const fileMarker = findNextFileMarker(data, endOffset, offset);
  7129. if (fileMarker?.invalid) {
  7130. return fileMarker.offset;
  7131. }
  7132. return endOffset;
  7133. }
  7134. class JpegImage {
  7135. constructor({
  7136. decodeTransform = null,
  7137. colorTransform = -1
  7138. } = {}) {
  7139. this._decodeTransform = decodeTransform;
  7140. this._colorTransform = colorTransform;
  7141. }
  7142. static canUseImageDecoder(data, colorTransform = -1) {
  7143. let offset = 0;
  7144. let numComponents = null;
  7145. let fileMarker = readUint16(data, offset);
  7146. offset += 2;
  7147. if (fileMarker !== 0xffd8) {
  7148. throw new JpegError("SOI not found");
  7149. }
  7150. fileMarker = readUint16(data, offset);
  7151. offset += 2;
  7152. markerLoop: while (fileMarker !== 0xffd9) {
  7153. switch (fileMarker) {
  7154. case 0xffc0:
  7155. case 0xffc1:
  7156. case 0xffc2:
  7157. numComponents = data[offset + (2 + 1 + 2 + 2)];
  7158. break markerLoop;
  7159. case 0xffff:
  7160. if (data[offset] !== 0xff) {
  7161. offset--;
  7162. }
  7163. break;
  7164. }
  7165. offset = skipData(data, offset);
  7166. fileMarker = readUint16(data, offset);
  7167. offset += 2;
  7168. }
  7169. if (numComponents === 4) {
  7170. return false;
  7171. }
  7172. if (numComponents === 3 && colorTransform === 0) {
  7173. return false;
  7174. }
  7175. return true;
  7176. }
  7177. parse(data, {
  7178. dnlScanLines = null
  7179. } = {}) {
  7180. let offset = 0;
  7181. let jfif = null;
  7182. let adobe = null;
  7183. let frame, resetInterval;
  7184. let numSOSMarkers = 0;
  7185. const quantizationTables = [];
  7186. const huffmanTablesAC = [],
  7187. huffmanTablesDC = [];
  7188. let fileMarker = readUint16(data, offset);
  7189. offset += 2;
  7190. if (fileMarker !== 0xffd8) {
  7191. throw new JpegError("SOI not found");
  7192. }
  7193. fileMarker = readUint16(data, offset);
  7194. offset += 2;
  7195. markerLoop: while (fileMarker !== 0xffd9) {
  7196. let i, j, l;
  7197. switch (fileMarker) {
  7198. case 0xffe0:
  7199. case 0xffe1:
  7200. case 0xffe2:
  7201. case 0xffe3:
  7202. case 0xffe4:
  7203. case 0xffe5:
  7204. case 0xffe6:
  7205. case 0xffe7:
  7206. case 0xffe8:
  7207. case 0xffe9:
  7208. case 0xffea:
  7209. case 0xffeb:
  7210. case 0xffec:
  7211. case 0xffed:
  7212. case 0xffee:
  7213. case 0xffef:
  7214. case 0xfffe:
  7215. const {
  7216. appData,
  7217. newOffset
  7218. } = readDataBlock(data, offset);
  7219. offset = newOffset;
  7220. if (fileMarker === 0xffe0) {
  7221. if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  7222. jfif = {
  7223. version: {
  7224. major: appData[5],
  7225. minor: appData[6]
  7226. },
  7227. densityUnits: appData[7],
  7228. xDensity: appData[8] << 8 | appData[9],
  7229. yDensity: appData[10] << 8 | appData[11],
  7230. thumbWidth: appData[12],
  7231. thumbHeight: appData[13],
  7232. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  7233. };
  7234. }
  7235. }
  7236. if (fileMarker === 0xffee) {
  7237. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
  7238. adobe = {
  7239. version: appData[5] << 8 | appData[6],
  7240. flags0: appData[7] << 8 | appData[8],
  7241. flags1: appData[9] << 8 | appData[10],
  7242. transformCode: appData[11]
  7243. };
  7244. }
  7245. }
  7246. break;
  7247. case 0xffdb:
  7248. const quantizationTablesLength = readUint16(data, offset);
  7249. offset += 2;
  7250. const quantizationTablesEnd = quantizationTablesLength + offset - 2;
  7251. let z;
  7252. while (offset < quantizationTablesEnd) {
  7253. const quantizationTableSpec = data[offset++];
  7254. const tableData = new Uint16Array(64);
  7255. if (quantizationTableSpec >> 4 === 0) {
  7256. for (j = 0; j < 64; j++) {
  7257. z = dctZigZag[j];
  7258. tableData[z] = data[offset++];
  7259. }
  7260. } else if (quantizationTableSpec >> 4 === 1) {
  7261. for (j = 0; j < 64; j++) {
  7262. z = dctZigZag[j];
  7263. tableData[z] = readUint16(data, offset);
  7264. offset += 2;
  7265. }
  7266. } else {
  7267. throw new JpegError("DQT - invalid table spec");
  7268. }
  7269. quantizationTables[quantizationTableSpec & 15] = tableData;
  7270. }
  7271. break;
  7272. case 0xffc0:
  7273. case 0xffc1:
  7274. case 0xffc2:
  7275. if (frame) {
  7276. throw new JpegError("Only single frame JPEGs supported");
  7277. }
  7278. offset += 2;
  7279. frame = {};
  7280. frame.extended = fileMarker === 0xffc1;
  7281. frame.progressive = fileMarker === 0xffc2;
  7282. frame.precision = data[offset++];
  7283. const sofScanLines = readUint16(data, offset);
  7284. offset += 2;
  7285. frame.scanLines = dnlScanLines || sofScanLines;
  7286. frame.samplesPerLine = readUint16(data, offset);
  7287. offset += 2;
  7288. frame.components = [];
  7289. frame.componentIds = {};
  7290. const componentsCount = data[offset++];
  7291. let maxH = 0,
  7292. maxV = 0;
  7293. for (i = 0; i < componentsCount; i++) {
  7294. const componentId = data[offset];
  7295. const h = data[offset + 1] >> 4;
  7296. const v = data[offset + 1] & 15;
  7297. if (maxH < h) {
  7298. maxH = h;
  7299. }
  7300. if (maxV < v) {
  7301. maxV = v;
  7302. }
  7303. const qId = data[offset + 2];
  7304. l = frame.components.push({
  7305. h,
  7306. v,
  7307. quantizationId: qId,
  7308. quantizationTable: null
  7309. });
  7310. frame.componentIds[componentId] = l - 1;
  7311. offset += 3;
  7312. }
  7313. frame.maxH = maxH;
  7314. frame.maxV = maxV;
  7315. prepareComponents(frame);
  7316. break;
  7317. case 0xffc4:
  7318. const huffmanLength = readUint16(data, offset);
  7319. offset += 2;
  7320. for (i = 2; i < huffmanLength;) {
  7321. const huffmanTableSpec = data[offset++];
  7322. const codeLengths = new Uint8Array(16);
  7323. let codeLengthSum = 0;
  7324. for (j = 0; j < 16; j++, offset++) {
  7325. codeLengthSum += codeLengths[j] = data[offset];
  7326. }
  7327. const huffmanValues = new Uint8Array(codeLengthSum);
  7328. for (j = 0; j < codeLengthSum; j++, offset++) {
  7329. huffmanValues[j] = data[offset];
  7330. }
  7331. i += 17 + codeLengthSum;
  7332. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  7333. }
  7334. break;
  7335. case 0xffdd:
  7336. offset += 2;
  7337. resetInterval = readUint16(data, offset);
  7338. offset += 2;
  7339. break;
  7340. case 0xffda:
  7341. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  7342. offset += 2;
  7343. const selectorsCount = data[offset++],
  7344. components = [];
  7345. for (i = 0; i < selectorsCount; i++) {
  7346. const index = data[offset++];
  7347. const componentIndex = frame.componentIds[index];
  7348. const component = frame.components[componentIndex];
  7349. component.index = index;
  7350. const tableSpec = data[offset++];
  7351. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  7352. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  7353. components.push(component);
  7354. }
  7355. const spectralStart = data[offset++],
  7356. spectralEnd = data[offset++],
  7357. successiveApproximation = data[offset++];
  7358. try {
  7359. const processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
  7360. offset += processed;
  7361. } catch (ex) {
  7362. if (ex instanceof DNLMarkerError) {
  7363. warn(`${ex.message} -- attempting to re-parse the JPEG image.`);
  7364. return this.parse(data, {
  7365. dnlScanLines: ex.scanLines
  7366. });
  7367. } else if (ex instanceof EOIMarkerError) {
  7368. warn(`${ex.message} -- ignoring the rest of the image data.`);
  7369. break markerLoop;
  7370. }
  7371. throw ex;
  7372. }
  7373. break;
  7374. case 0xffdc:
  7375. offset += 4;
  7376. break;
  7377. case 0xffff:
  7378. if (data[offset] !== 0xff) {
  7379. offset--;
  7380. }
  7381. break;
  7382. default:
  7383. const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
  7384. if (nextFileMarker?.invalid) {
  7385. warn("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
  7386. offset = nextFileMarker.offset;
  7387. break;
  7388. }
  7389. if (!nextFileMarker || offset >= data.length - 1) {
  7390. warn("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
  7391. break markerLoop;
  7392. }
  7393. throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
  7394. }
  7395. fileMarker = readUint16(data, offset);
  7396. offset += 2;
  7397. }
  7398. if (!frame) {
  7399. throw new JpegError("JpegImage.parse - no frame data found.");
  7400. }
  7401. this.width = frame.samplesPerLine;
  7402. this.height = frame.scanLines;
  7403. this.jfif = jfif;
  7404. this.adobe = adobe;
  7405. this.components = [];
  7406. for (const component of frame.components) {
  7407. const quantizationTable = quantizationTables[component.quantizationId];
  7408. if (quantizationTable) {
  7409. component.quantizationTable = quantizationTable;
  7410. }
  7411. this.components.push({
  7412. index: component.index,
  7413. output: buildComponentData(frame, component),
  7414. scaleX: component.h / frame.maxH,
  7415. scaleY: component.v / frame.maxV,
  7416. blocksPerLine: component.blocksPerLine,
  7417. blocksPerColumn: component.blocksPerColumn
  7418. });
  7419. }
  7420. this.numComponents = this.components.length;
  7421. return undefined;
  7422. }
  7423. _getLinearizedBlockData(width, height, isSourcePDF = false) {
  7424. const scaleX = this.width / width,
  7425. scaleY = this.height / height;
  7426. let component, componentScaleX, componentScaleY, blocksPerScanline;
  7427. let x, y, i, j, k;
  7428. let index;
  7429. let offset = 0;
  7430. let output;
  7431. const numComponents = this.components.length;
  7432. const dataLength = width * height * numComponents;
  7433. const data = new Uint8ClampedArray(dataLength);
  7434. const xScaleBlockOffset = new Uint32Array(width);
  7435. const mask3LSB = 0xfffffff8;
  7436. let lastComponentScaleX;
  7437. for (i = 0; i < numComponents; i++) {
  7438. component = this.components[i];
  7439. componentScaleX = component.scaleX * scaleX;
  7440. componentScaleY = component.scaleY * scaleY;
  7441. offset = i;
  7442. output = component.output;
  7443. blocksPerScanline = component.blocksPerLine + 1 << 3;
  7444. if (componentScaleX !== lastComponentScaleX) {
  7445. for (x = 0; x < width; x++) {
  7446. j = 0 | x * componentScaleX;
  7447. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  7448. }
  7449. lastComponentScaleX = componentScaleX;
  7450. }
  7451. for (y = 0; y < height; y++) {
  7452. j = 0 | y * componentScaleY;
  7453. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  7454. for (x = 0; x < width; x++) {
  7455. data[offset] = output[index + xScaleBlockOffset[x]];
  7456. offset += numComponents;
  7457. }
  7458. }
  7459. }
  7460. let transform = this._decodeTransform;
  7461. if (!isSourcePDF && numComponents === 4 && !transform) {
  7462. transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
  7463. }
  7464. if (transform) {
  7465. for (i = 0; i < dataLength;) {
  7466. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  7467. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  7468. }
  7469. }
  7470. }
  7471. return data;
  7472. }
  7473. get _isColorConversionNeeded() {
  7474. if (this.adobe) {
  7475. return !!this.adobe.transformCode;
  7476. }
  7477. if (this.numComponents === 3) {
  7478. if (this._colorTransform === 0) {
  7479. return false;
  7480. } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) {
  7481. return false;
  7482. }
  7483. return true;
  7484. }
  7485. if (this._colorTransform === 1) {
  7486. return true;
  7487. }
  7488. return false;
  7489. }
  7490. _convertYccToRgb(data) {
  7491. let Y, Cb, Cr;
  7492. for (let i = 0, length = data.length; i < length; i += 3) {
  7493. Y = data[i];
  7494. Cb = data[i + 1];
  7495. Cr = data[i + 2];
  7496. data[i] = Y - 179.456 + 1.402 * Cr;
  7497. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  7498. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  7499. }
  7500. return data;
  7501. }
  7502. _convertYccToRgba(data, out) {
  7503. for (let i = 0, j = 0, length = data.length; i < length; i += 3, j += 4) {
  7504. const Y = data[i];
  7505. const Cb = data[i + 1];
  7506. const Cr = data[i + 2];
  7507. out[j] = Y - 179.456 + 1.402 * Cr;
  7508. out[j + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  7509. out[j + 2] = Y - 226.816 + 1.772 * Cb;
  7510. out[j + 3] = 255;
  7511. }
  7512. return out;
  7513. }
  7514. _convertYcckToRgb(data) {
  7515. let Y, Cb, Cr, k;
  7516. let offset = 0;
  7517. for (let i = 0, length = data.length; i < length; i += 4) {
  7518. Y = data[i];
  7519. Cb = data[i + 1];
  7520. Cr = data[i + 2];
  7521. k = data[i + 3];
  7522. data[offset++] = -122.67195406894 + Cb * (-6.60635669420364e-5 * Cb + 0.000437130475926232 * Cr - 5.4080610064599e-5 * Y + 0.00048449797120281 * k - 0.154362151871126) + Cr * (-0.000957964378445773 * Cr + 0.000817076911346625 * Y - 0.00477271405408747 * k + 1.53380253221734) + Y * (0.000961250184130688 * Y - 0.00266257332283933 * k + 0.48357088451265) + k * (-0.000336197177618394 * k + 0.484791561490776);
  7523. data[offset++] = 107.268039397724 + Cb * (2.19927104525741e-5 * Cb - 0.000640992018297945 * Cr + 0.000659397001245577 * Y + 0.000426105652938837 * k - 0.176491792462875) + Cr * (-0.000778269941513683 * Cr + 0.00130872261408275 * Y + 0.000770482631801132 * k - 0.151051492775562) + Y * (0.00126935368114843 * Y - 0.00265090189010898 * k + 0.25802910206845) + k * (-0.000318913117588328 * k - 0.213742400323665);
  7524. data[offset++] = -20.810012546947 + Cb * (-0.000570115196973677 * Cb - 2.63409051004589e-5 * Cr + 0.0020741088115012 * Y - 0.00288260236853442 * k + 0.814272968359295) + Cr * (-1.53496057440975e-5 * Cr - 0.000132689043961446 * Y + 0.000560833691242812 * k - 0.195152027534049) + Y * (0.00174418132927582 * Y - 0.00255243321439347 * k + 0.116935020465145) + k * (-0.000343531996510555 * k + 0.24165260232407);
  7525. }
  7526. return data.subarray(0, offset);
  7527. }
  7528. _convertYcckToRgba(data) {
  7529. for (let i = 0, length = data.length; i < length; i += 4) {
  7530. const Y = data[i];
  7531. const Cb = data[i + 1];
  7532. const Cr = data[i + 2];
  7533. const k = data[i + 3];
  7534. data[i] = -122.67195406894 + Cb * (-6.60635669420364e-5 * Cb + 0.000437130475926232 * Cr - 5.4080610064599e-5 * Y + 0.00048449797120281 * k - 0.154362151871126) + Cr * (-0.000957964378445773 * Cr + 0.000817076911346625 * Y - 0.00477271405408747 * k + 1.53380253221734) + Y * (0.000961250184130688 * Y - 0.00266257332283933 * k + 0.48357088451265) + k * (-0.000336197177618394 * k + 0.484791561490776);
  7535. data[i + 1] = 107.268039397724 + Cb * (2.19927104525741e-5 * Cb - 0.000640992018297945 * Cr + 0.000659397001245577 * Y + 0.000426105652938837 * k - 0.176491792462875) + Cr * (-0.000778269941513683 * Cr + 0.00130872261408275 * Y + 0.000770482631801132 * k - 0.151051492775562) + Y * (0.00126935368114843 * Y - 0.00265090189010898 * k + 0.25802910206845) + k * (-0.000318913117588328 * k - 0.213742400323665);
  7536. data[i + 2] = -20.810012546947 + Cb * (-0.000570115196973677 * Cb - 2.63409051004589e-5 * Cr + 0.0020741088115012 * Y - 0.00288260236853442 * k + 0.814272968359295) + Cr * (-1.53496057440975e-5 * Cr - 0.000132689043961446 * Y + 0.000560833691242812 * k - 0.195152027534049) + Y * (0.00174418132927582 * Y - 0.00255243321439347 * k + 0.116935020465145) + k * (-0.000343531996510555 * k + 0.24165260232407);
  7537. data[i + 3] = 255;
  7538. }
  7539. return data;
  7540. }
  7541. _convertYcckToCmyk(data) {
  7542. let Y, Cb, Cr;
  7543. for (let i = 0, length = data.length; i < length; i += 4) {
  7544. Y = data[i];
  7545. Cb = data[i + 1];
  7546. Cr = data[i + 2];
  7547. data[i] = 434.456 - Y - 1.402 * Cr;
  7548. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  7549. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  7550. }
  7551. return data;
  7552. }
  7553. _convertCmykToRgb(data) {
  7554. let c, m, y, k;
  7555. let offset = 0;
  7556. for (let i = 0, length = data.length; i < length; i += 4) {
  7557. c = data[i];
  7558. m = data[i + 1];
  7559. y = data[i + 2];
  7560. k = data[i + 3];
  7561. data[offset++] = 255 + c * (-0.00006747147073602441 * c + 0.0008379262121013727 * m + 0.0002894718188643294 * y + 0.003264231057537806 * k - 1.1185611867203937) + m * (0.000026374107616089405 * m - 0.00008626949158638572 * y - 0.0002748769067499491 * k - 0.02155688794978967) + y * (-0.00003878099212869363 * y - 0.0003267808279485286 * k + 0.0686742238595345) - k * (0.0003361971776183937 * k + 0.7430659151342254);
  7562. data[offset++] = 255 + c * (0.00013596372813588848 * c + 0.000924537132573585 * m + 0.00010567359618683593 * y + 0.0004791864687436512 * k - 0.3109689587515875) + m * (-0.00023545346108370344 * m + 0.0002702845253534714 * y + 0.0020200308977307156 * k - 0.7488052167015494) + y * (0.00006834815998235662 * y + 0.00015168452363460973 * k - 0.09751927774728933) - k * (0.0003189131175883281 * k + 0.7364883807733168);
  7563. data[offset++] = 255 + c * (0.000013598650411385307 * c + 0.00012423956175490851 * m + 0.0004751985097583589 * y - 0.0000036729317476630422 * k - 0.05562186980264034) + m * (0.00016141380598724676 * m + 0.0009692239130725186 * y + 0.0007782692450036253 * k - 0.44015232367526463) + y * (5.068882914068769e-7 * y + 0.0017778369011375071 * k - 0.7591454649749609) - k * (0.0003435319965105553 * k + 0.7063770186160144);
  7564. }
  7565. return data.subarray(0, offset);
  7566. }
  7567. _convertCmykToRgba(data) {
  7568. for (let i = 0, length = data.length; i < length; i += 4) {
  7569. const c = data[i];
  7570. const m = data[i + 1];
  7571. const y = data[i + 2];
  7572. const k = data[i + 3];
  7573. data[i] = 255 + c * (-0.00006747147073602441 * c + 0.0008379262121013727 * m + 0.0002894718188643294 * y + 0.003264231057537806 * k - 1.1185611867203937) + m * (0.000026374107616089405 * m - 0.00008626949158638572 * y - 0.0002748769067499491 * k - 0.02155688794978967) + y * (-0.00003878099212869363 * y - 0.0003267808279485286 * k + 0.0686742238595345) - k * (0.0003361971776183937 * k + 0.7430659151342254);
  7574. data[i + 1] = 255 + c * (0.00013596372813588848 * c + 0.000924537132573585 * m + 0.00010567359618683593 * y + 0.0004791864687436512 * k - 0.3109689587515875) + m * (-0.00023545346108370344 * m + 0.0002702845253534714 * y + 0.0020200308977307156 * k - 0.7488052167015494) + y * (0.00006834815998235662 * y + 0.00015168452363460973 * k - 0.09751927774728933) - k * (0.0003189131175883281 * k + 0.7364883807733168);
  7575. data[i + 2] = 255 + c * (0.000013598650411385307 * c + 0.00012423956175490851 * m + 0.0004751985097583589 * y - 0.0000036729317476630422 * k - 0.05562186980264034) + m * (0.00016141380598724676 * m + 0.0009692239130725186 * y + 0.0007782692450036253 * k - 0.44015232367526463) + y * (5.068882914068769e-7 * y + 0.0017778369011375071 * k - 0.7591454649749609) - k * (0.0003435319965105553 * k + 0.7063770186160144);
  7576. data[i + 3] = 255;
  7577. }
  7578. return data;
  7579. }
  7580. getData({
  7581. width,
  7582. height,
  7583. forceRGBA = false,
  7584. forceRGB = false,
  7585. isSourcePDF = false
  7586. }) {
  7587. if (this.numComponents > 4) {
  7588. throw new JpegError("Unsupported color mode");
  7589. }
  7590. const data = this._getLinearizedBlockData(width, height, isSourcePDF);
  7591. if (this.numComponents === 1 && (forceRGBA || forceRGB)) {
  7592. const len = data.length * (forceRGBA ? 4 : 3);
  7593. const rgbaData = new Uint8ClampedArray(len);
  7594. let offset = 0;
  7595. if (forceRGBA) {
  7596. grayToRGBA(data, new Uint32Array(rgbaData.buffer));
  7597. } else {
  7598. for (const grayColor of data) {
  7599. rgbaData[offset++] = grayColor;
  7600. rgbaData[offset++] = grayColor;
  7601. rgbaData[offset++] = grayColor;
  7602. }
  7603. }
  7604. return rgbaData;
  7605. } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
  7606. if (forceRGBA) {
  7607. const rgbaData = new Uint8ClampedArray(data.length / 3 * 4);
  7608. return this._convertYccToRgba(data, rgbaData);
  7609. }
  7610. return this._convertYccToRgb(data);
  7611. } else if (this.numComponents === 4) {
  7612. if (this._isColorConversionNeeded) {
  7613. if (forceRGBA) {
  7614. return this._convertYcckToRgba(data);
  7615. }
  7616. if (forceRGB) {
  7617. return this._convertYcckToRgb(data);
  7618. }
  7619. return this._convertYcckToCmyk(data);
  7620. } else if (forceRGBA) {
  7621. return this._convertCmykToRgba(data);
  7622. } else if (forceRGB) {
  7623. return this._convertCmykToRgb(data);
  7624. }
  7625. }
  7626. return data;
  7627. }
  7628. }
  7629. ;// ./src/core/jpeg_stream.js
  7630. class JpegStream extends DecodeStream {
  7631. constructor(stream, maybeLength, params) {
  7632. super(maybeLength);
  7633. this.stream = stream;
  7634. this.dict = stream.dict;
  7635. this.maybeLength = maybeLength;
  7636. this.params = params;
  7637. }
  7638. static get canUseImageDecoder() {
  7639. return shadow(this, "canUseImageDecoder", typeof ImageDecoder === "undefined" ? Promise.resolve(false) : ImageDecoder.isTypeSupported("image/jpeg"));
  7640. }
  7641. get bytes() {
  7642. return shadow(this, "bytes", this.stream.getBytes(this.maybeLength));
  7643. }
  7644. ensureBuffer(requested) {}
  7645. readBlock() {
  7646. this.decodeImage();
  7647. }
  7648. get jpegOptions() {
  7649. const jpegOptions = {
  7650. decodeTransform: undefined,
  7651. colorTransform: undefined
  7652. };
  7653. const decodeArr = this.dict.getArray("D", "Decode");
  7654. if ((this.forceRGBA || this.forceRGB) && Array.isArray(decodeArr)) {
  7655. const bitsPerComponent = this.dict.get("BPC", "BitsPerComponent") || 8;
  7656. const decodeArrLength = decodeArr.length;
  7657. const transform = new Int32Array(decodeArrLength);
  7658. let transformNeeded = false;
  7659. const maxValue = (1 << bitsPerComponent) - 1;
  7660. for (let i = 0; i < decodeArrLength; i += 2) {
  7661. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  7662. transform[i + 1] = decodeArr[i] * maxValue | 0;
  7663. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  7664. transformNeeded = true;
  7665. }
  7666. }
  7667. if (transformNeeded) {
  7668. jpegOptions.decodeTransform = transform;
  7669. }
  7670. }
  7671. if (this.params instanceof Dict) {
  7672. const colorTransform = this.params.get("ColorTransform");
  7673. if (Number.isInteger(colorTransform)) {
  7674. jpegOptions.colorTransform = colorTransform;
  7675. }
  7676. }
  7677. return shadow(this, "jpegOptions", jpegOptions);
  7678. }
  7679. #skipUselessBytes(data) {
  7680. for (let i = 0, ii = data.length - 1; i < ii; i++) {
  7681. if (data[i] === 0xff && data[i + 1] === 0xd8) {
  7682. if (i > 0) {
  7683. data = data.subarray(i);
  7684. }
  7685. break;
  7686. }
  7687. }
  7688. return data;
  7689. }
  7690. decodeImage(bytes) {
  7691. if (this.eof) {
  7692. return this.buffer;
  7693. }
  7694. bytes = this.#skipUselessBytes(bytes || this.bytes);
  7695. const jpegImage = new JpegImage(this.jpegOptions);
  7696. jpegImage.parse(bytes);
  7697. const data = jpegImage.getData({
  7698. width: this.drawWidth,
  7699. height: this.drawHeight,
  7700. forceRGBA: this.forceRGBA,
  7701. forceRGB: this.forceRGB,
  7702. isSourcePDF: true
  7703. });
  7704. this.buffer = data;
  7705. this.bufferLength = data.length;
  7706. this.eof = true;
  7707. return this.buffer;
  7708. }
  7709. get canAsyncDecodeImageFromBuffer() {
  7710. return this.stream.isAsync;
  7711. }
  7712. async getTransferableImage() {
  7713. if (!(await JpegStream.canUseImageDecoder)) {
  7714. return null;
  7715. }
  7716. const jpegOptions = this.jpegOptions;
  7717. if (jpegOptions.decodeTransform) {
  7718. return null;
  7719. }
  7720. let decoder;
  7721. try {
  7722. const bytes = this.canAsyncDecodeImageFromBuffer && (await this.stream.asyncGetBytes()) || this.bytes;
  7723. if (!bytes) {
  7724. return null;
  7725. }
  7726. const data = this.#skipUselessBytes(bytes);
  7727. if (!JpegImage.canUseImageDecoder(data, jpegOptions.colorTransform)) {
  7728. return null;
  7729. }
  7730. decoder = new ImageDecoder({
  7731. data,
  7732. type: "image/jpeg",
  7733. preferAnimation: false
  7734. });
  7735. return (await decoder.decode()).image;
  7736. } catch (reason) {
  7737. warn(`getTransferableImage - failed: "${reason}".`);
  7738. return null;
  7739. } finally {
  7740. decoder?.close();
  7741. }
  7742. }
  7743. }
  7744. ;// ./external/openjpeg/openjpeg.js
  7745. var OpenJPEG = (() => {
  7746. var _scriptName = typeof document != 'undefined' ? document.currentScript?.src : undefined;
  7747. return function (moduleArg = {}) {
  7748. var moduleRtn;
  7749. var Module = moduleArg;
  7750. var readyPromiseResolve, readyPromiseReject;
  7751. var readyPromise = new Promise((resolve, reject) => {
  7752. readyPromiseResolve = resolve;
  7753. readyPromiseReject = reject;
  7754. });
  7755. var ENVIRONMENT_IS_WEB = true;
  7756. var ENVIRONMENT_IS_WORKER = false;
  7757. Module.decode = function (bytes, {
  7758. numComponents = 4,
  7759. isIndexedColormap = false,
  7760. smaskInData = false
  7761. }) {
  7762. const size = bytes.length;
  7763. const ptr = Module._malloc(size);
  7764. Module.HEAPU8.set(bytes, ptr);
  7765. const ret = Module._jp2_decode(ptr, size, numComponents > 0 ? numComponents : 0, !!isIndexedColormap, !!smaskInData);
  7766. Module._free(ptr);
  7767. if (ret) {
  7768. const {
  7769. errorMessages: errorMessages
  7770. } = Module;
  7771. if (errorMessages) {
  7772. delete Module.errorMessages;
  7773. return errorMessages;
  7774. }
  7775. return "Unknown error";
  7776. }
  7777. const {
  7778. imageData: imageData
  7779. } = Module;
  7780. Module.imageData = null;
  7781. return imageData;
  7782. };
  7783. var moduleOverrides = Object.assign({}, Module);
  7784. var arguments_ = [];
  7785. var thisProgram = "./this.program";
  7786. var quit_ = (status, toThrow) => {
  7787. throw toThrow;
  7788. };
  7789. var scriptDirectory = "";
  7790. var read_, readAsync, readBinary;
  7791. if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
  7792. if (ENVIRONMENT_IS_WORKER) {
  7793. scriptDirectory = self.location.href;
  7794. } else if (typeof document != "undefined" && document.currentScript) {
  7795. scriptDirectory = document.currentScript.src;
  7796. }
  7797. if (_scriptName) {
  7798. scriptDirectory = _scriptName;
  7799. }
  7800. if (scriptDirectory.startsWith("blob:")) {
  7801. scriptDirectory = "";
  7802. } else {
  7803. scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1);
  7804. }
  7805. read_ = url => {
  7806. var xhr = new XMLHttpRequest();
  7807. xhr.open("GET", url, false);
  7808. xhr.send(null);
  7809. return xhr.responseText;
  7810. };
  7811. if (ENVIRONMENT_IS_WORKER) {
  7812. readBinary = url => {
  7813. var xhr = new XMLHttpRequest();
  7814. xhr.open("GET", url, false);
  7815. xhr.responseType = "arraybuffer";
  7816. xhr.send(null);
  7817. return new Uint8Array(xhr.response);
  7818. };
  7819. }
  7820. readAsync = (url, onload, onerror) => {
  7821. fetch(url, {
  7822. credentials: "same-origin"
  7823. }).then(response => {
  7824. if (response.ok) {
  7825. return response.arrayBuffer();
  7826. }
  7827. return Promise.reject(new Error(response.status + " : " + response.url));
  7828. }).then(onload, onerror);
  7829. };
  7830. } else {}
  7831. var out = Module["print"] || console.log.bind(console);
  7832. var err = Module["printErr"] || console.error.bind(console);
  7833. Object.assign(Module, moduleOverrides);
  7834. moduleOverrides = null;
  7835. if (Module["arguments"]) arguments_ = Module["arguments"];
  7836. if (Module["thisProgram"]) thisProgram = Module["thisProgram"];
  7837. if (Module["quit"]) quit_ = Module["quit"];
  7838. var wasmBinary;
  7839. if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"];
  7840. function intArrayFromBase64(s) {
  7841. var decoded = atob(s);
  7842. var bytes = new Uint8Array(decoded.length);
  7843. for (var i = 0; i < decoded.length; ++i) {
  7844. bytes[i] = decoded.charCodeAt(i);
  7845. }
  7846. return bytes;
  7847. }
  7848. function tryParseAsDataURI(filename) {
  7849. if (!isDataURI(filename)) {
  7850. return;
  7851. }
  7852. return intArrayFromBase64(filename.slice(dataURIPrefix.length));
  7853. }
  7854. var wasmMemory;
  7855. var ABORT = false;
  7856. var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
  7857. function updateMemoryViews() {
  7858. var b = wasmMemory.buffer;
  7859. Module["HEAP8"] = HEAP8 = new Int8Array(b);
  7860. Module["HEAP16"] = HEAP16 = new Int16Array(b);
  7861. Module["HEAPU8"] = HEAPU8 = new Uint8Array(b);
  7862. Module["HEAPU16"] = HEAPU16 = new Uint16Array(b);
  7863. Module["HEAP32"] = HEAP32 = new Int32Array(b);
  7864. Module["HEAPU32"] = HEAPU32 = new Uint32Array(b);
  7865. Module["HEAPF32"] = HEAPF32 = new Float32Array(b);
  7866. Module["HEAPF64"] = HEAPF64 = new Float64Array(b);
  7867. }
  7868. var __ATPRERUN__ = [];
  7869. var __ATINIT__ = [];
  7870. var __ATPOSTRUN__ = [];
  7871. var runtimeInitialized = false;
  7872. function preRun() {
  7873. if (Module["preRun"]) {
  7874. if (typeof Module["preRun"] == "function") Module["preRun"] = [Module["preRun"]];
  7875. while (Module["preRun"].length) {
  7876. addOnPreRun(Module["preRun"].shift());
  7877. }
  7878. }
  7879. callRuntimeCallbacks(__ATPRERUN__);
  7880. }
  7881. function initRuntime() {
  7882. runtimeInitialized = true;
  7883. callRuntimeCallbacks(__ATINIT__);
  7884. }
  7885. function postRun() {
  7886. if (Module["postRun"]) {
  7887. if (typeof Module["postRun"] == "function") Module["postRun"] = [Module["postRun"]];
  7888. while (Module["postRun"].length) {
  7889. addOnPostRun(Module["postRun"].shift());
  7890. }
  7891. }
  7892. callRuntimeCallbacks(__ATPOSTRUN__);
  7893. }
  7894. function addOnPreRun(cb) {
  7895. __ATPRERUN__.unshift(cb);
  7896. }
  7897. function addOnInit(cb) {
  7898. __ATINIT__.unshift(cb);
  7899. }
  7900. function addOnPostRun(cb) {
  7901. __ATPOSTRUN__.unshift(cb);
  7902. }
  7903. var runDependencies = 0;
  7904. var runDependencyWatcher = null;
  7905. var dependenciesFulfilled = null;
  7906. function addRunDependency(id) {
  7907. runDependencies++;
  7908. Module["monitorRunDependencies"]?.(runDependencies);
  7909. }
  7910. function removeRunDependency(id) {
  7911. runDependencies--;
  7912. Module["monitorRunDependencies"]?.(runDependencies);
  7913. if (runDependencies == 0) {
  7914. if (runDependencyWatcher !== null) {
  7915. clearInterval(runDependencyWatcher);
  7916. runDependencyWatcher = null;
  7917. }
  7918. if (dependenciesFulfilled) {
  7919. var callback = dependenciesFulfilled;
  7920. dependenciesFulfilled = null;
  7921. callback();
  7922. }
  7923. }
  7924. }
  7925. var dataURIPrefix = "data:application/octet-stream;base64,";
  7926. var isDataURI = filename => filename.startsWith(dataURIPrefix);
  7927. function findWasmBinary() {
  7928. var f = "data:application/octet-stream;base64,AGFzbQEAAAABzgEaYAN/f38Bf2AEf39/fwF/YAF/AGACf38AYAF/AX9gA39/fwBgAn9/AX9gBH9/f38AYAN/fn8BfmAFf39/f38Bf2ACfn8Bf2ACfn8BfmAFf39/f38AYAN/fn8Bf2AAAX9gB39/f39/f38Bf2AJf39/f39/f39/AX9gC39/f39/f39/f39/AX9gBn9/f39/fwF/YAZ/fH9/f38Bf2AIf39/f39/f38AYAh/f39/f39/fw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EFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgACADQQRrIgRLBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAswAQF/AkAgAEUNACABRQ0AQQggACABbCIBECUiAARAIABBACABEBUaCyAAIQILIAILEQAgAEUEQEEADwtBCCAAECUL8gICAn8BfgJAIAJFDQAgACABOgAAIAAgAmoiA0EBayABOgAAIAJBA0kNACAAIAE6AAIgACABOgABIANBA2sgAToAACADQQJrIAE6AAAgAkEHSQ0AIAAgAToAAyADQQRrIAE6AAAgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBBGsgATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQQhrIAE2AgAgAkEMayABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkEQayABNgIAIAJBFGsgATYCACACQRhrIAE2AgAgAkEcayABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa1CgYCAgBB+IQUgAyAEaiEBA0AgASAFNwMYIAEgBTcDECABIAU3AwggASAFNwMAIAFBIGohASACQSBrIgJBH0sNAAsLIAALJwEBfyMAQRBrIgMkACADIAI2AgwgACABIAJBAEEAEGsgA0EQaiQAC+gFAQ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GpBAmpBAnVrNgIAIAEgKmoiCiAKKAIAIB8oAgAgASAfaiA6IAYbKAIAakECakECdWs2AgAgQygCACABIENqICYgBhsoAgBqQQJqIQYgASApaiEBDAILIBQgAUECdCIBaiIGIAYoAgAgCkEBdEECakECdWs2AgAgASAkaiIGIAYoAgAgFCgCFEEBdEECakECdWs2AgAgASAqaiIGIAYoAgAgFCgCGEEBdEECakECdWs2AgAgASApaiEBIBQoAhxBAXRBAmohBgwBCyAUIAcgLCAGG0EDdEEEa0ECdCIKaigCACEyIAZFBEAgFCABQQJ0IgFqIgYgBigCACAyIEUoAgBqQQJqQQJ1azYCACABICRqIgYgBigCACAKICRqKAIAIDwoAgBqQQJqQQJ1azYCACABICpqIgYgBigCACAKICpqKAIAIDooAgBqQQJqQQJ1azYCACABIClqIQEgCiApaigCACAmKAIAakECaiEGDAELIBQgAUECdCIBaiIGIAYoAgAgMiAGKAIQakECakECdWs2AgAgASAkaiIGIAYoAgAgCiAkaigCACAGKAIQakECakECdWs2AgAgASAqaiIGIAYoAgAgCiAqaigCACAGKAIQakECakECdWs2AgAgCiApaigCACABIClqIgEoAhBqQQJqIQYLIAEgASgCACAGQQJ1azYCACAHQQFqIgcgG0cNAAsLIA4gHE4NACAMIA4iASIHSgRAA0AgFCABQQV0aiIHIAf9AAIgIAf9AAIA/a4BQQH9rAEgB/0AAhD9rgH9CwIQIAFBAWoiASAMRw0ACyAMIQcLIAcgHE4NAANAIEMgB0EDdCIBQQJ0aiIyAn8gB0EASARAIBQoAgAhBiAHQX9HBEAgNiABQQJ0IgFqIgogCigCACAGajYCACABICBqIgYgBigCACAkKAIAajYCACABIB9qIgEgASgCACAqKAIAajYCACApKAIADAILIDYgAUECdCIBaiIKIAooAgAgVygCACAGakEBdWo2AgAgASAgaiIGIAYoAgAgVigCACAkKAIAakEBdWo2AgAgASAfaiIBIAEoAgAgVSgCACAqKAIAakEBdWo2AgAgVCgCACApKAIAakEBdQwBCyABID4gByASSBshBiASIAdBAWoiZkwE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AAIAwgACgCACICrSIHfCAHgCILPgIQIAAgDSAAKAIEIgatIgd8IAeAIg4+AhRCASAANQIoIgeGIg9CAX0iCCAJIAKsIhB8IBB/xHwgB4enIAggC8R8IAeHp2siAkEASARAIAMgAjYCBCADIAQ2AgAgAUEBQdPkACADEA9BACECDAMLIAAgAjYCCCAIIAogBqwiC3wgC3/EfCAHh6cgDsQgD3xCAX0gB4enayICQQBIBEAgAyACNgIUIAMgBDYCECABQQFBmOUAIANBEGoQD0EAIQIMAwsgACACNgIMIABBNGohAEEBIQIgBEEBaiIEIAVHDQALDAELIAFBAUGnM0EAEA8LIANBIGokACACC9cGAQZ/IAAEQAJAIAAoAgAEQCAAKAIMIgEEQCABEC4gACgCDBAQIABBADYCDAsgACgCECIBBEAgARAQIABCADcDEAsgACgCQBAQIABCADcCPAwBCyAAKAIsIgEEQCABEBAgAEEANgIsCyAAKAIgIgEEQCABEBAgAEIANwMgCyAAKAI0IgFFDQAgARAQIABCADcCNAsgACgC0AEQVSAAKAKcASIBBEAgACgCaCAAKAJsbCIDBH8DQCABEC4gAUGMLGohASACQQFqIgIgA0cNAAsgACgCnAEFIAELEBAgAEEANgKcAQsgACgCdCIBBEAgACgCcCICBEBBACEBA0AgACgCdCABQQN0aigCACIDBEAgAxAQIAAoAnAhAgsgAUEBaiIBIAJJDQALIAAoAnQhAQsgAEEANgJwIAEQECAAQQA2AnQLIAAoAogBEBAgAEEANgJ4IABBADYCiAEgACgCZBAQIABBADYCZCAALQC8AUECcUUEQCAAKAKoARAQCyAAQdAAakEAQfAAEBUaIAAoAsABEDIgAEEANgLAASAAKALEARAyIABBADYCwAEgACgCyAEiAQRAIAEoAhwiAgRAIAIQECABQQA2AhwLIAEoAigiAgRAIAEoAiQEQANAIAIgBUEobCIDaigCJCIEBEAgBBAQIAEoAigiAiADakEANgIkCyACIANqKAIQIgQEQCAEEBAgASgCKCICIANqQQA2AhALIAIgA2ooAhgiBARAIAQQECABKAIoIgIgA2pBADYCGAsgBUEBa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A8LIAAoAkwiBUUEQCAAQQFBJBATIgU2AkwgBUUNAQsgAiAFED8gACgCwAFBFiADECRFDQAgACgCwAEiBigCACEEIAYoAgghBQJAIAQEQEEBIQcgBEEBcSEIIARBAUYEf0EABSAEQX5xIQlBACEEA0ACf0EAIAdFDQAaQQAgACABIAMgBSgCABEAAEUNABogACABIAMgBSgCBBEAAEEARwshByAFQQhqIQUgBEECaiIEIAlHDQALIAdBAXMLIQQCQAJAIAgEQCAEDQEgACABIAMgBSgCABEAAEEARyEHCyAGQQA2AgAgB0EBcUUNAQwDCyAGQQA2AgALIAAoAkgQISAAQQA2AkhBAA8LIAZBADYCAAsgACACEEchBwsgBwv4BAEGfwJAQQFBMBATIgIEfyACIAAoAsgBIgH9AAMA/QsDACACIAEpAxA3AxAgAiABKAIYIgE2AhggAiABQRhsEBQiATYCHCABRQRAIAIQEEEADwsCQCAAKALIASgCHCIDBEAgASADIAIoAhhBGGwQEhoMAQsgARAQIAJBADYCHAsgAiAAKALIASgCJCIBNgIkIAIgAUEoEBMiATYCKCABRQRAIAIoAhwQECACEBBBAA8LAkAgACgCyAEoAigEQCACKAIkRQ0BA0AgASAFQShsIgNqIAAoAsgBKAIoIANqKAIUIgE2AhQgAUEYbBAUIQEgAigCKCIEIANqIgYgATYCGCABRQRAIAUEf0EAIQEDQCACKAIoIAFBKGxqKAIYEBAgAUEBaiIBIAVHDQALIAIoAigFIAQLEBAMBQsCQCAAKALIASgCKCADaigCGCIEBEAgASAEIAYoAhRBGGwQEhogAigCKCEBDAELIAEQECACKAIoIgEgA2pBADYCGAsgASADaiAAKALIASgCKCADaigCBCIBNgIEIAFBGGwQFCEBIAIoAigiBCADaiIGIAE2AhAgAUUEQCAFBH9BACEBA0AgAUEobCIAIAIoAihqKAIYEBAgAigCKCAAaigCEBAQIAFBAWoiASAFRw0ACyACKAIoBSAECxAQDAULAkAgACgCyAEoAiggA2ooAhAiBARAIAEgBCAGKAIEQRhsEBIaIAIoAighAQwBCyABEBAgAigC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MADwsgAiACKAIAIgFBBGo2AgAgACABMQAANwMADwsgAiACKAIAQQdqQXhxIgFBCGo2AgAgACABKwMAOQMADwsgACACIAMRAwALDwsgAiACKAIAIgFBBGo2AgAgACABNAIANwMADwsgAiACKAIAIgFBBGo2AgAgACABNQIANwMADwsgAiACKAIAQQdqQXhxIgFBCGo2AgAgACABKQMANwMAC3MBBn8gACgCACIDLAAAQTBrIgFBCUsEQEEADwsDQEF/IQQgAkHMmbPmAE0EQEF/IAEgAkEKbCIFaiABIAVB/////wdzSxshBAsgACADQQFqIgU2AgAgAywAASEGIAQhAiAFIQMgBkEwayIBQQpJDQALIAILtBQCFX8BfiMAQUBqIggkACAIIAE2AjwgCEEnaiEWIAhBKGohEQJAAkACQAJAA0BBACEHA0AgASENIAcgDkH/////B3NKDQIgByAOaiEOAkACQAJAAkAgASIHLQAAIgsEQANAAkACQCALQf8BcSIBRQRAIAchAQwBCyABQSVHDQEgByELA0AgCy0AAUElRwRAIAshAQwCCyAHQQFqIQcgCy0AAiEZIAtBAmoiASELIBlBJUYNAAsLIAcgDWsiByAOQf////8HcyIXSg0JIAAEQCAAIA0gBxAZCyAHDQcgCCABNgI8IAFBAWohB0F/IRACQCABLAABQTBrIglBCUsNACABLQACQSRHDQAgAUEDaiEHQQEhEiAJIRALIAggBzYCPEEAIQwCQCAHLAAAIgtBIGsiAUEfSwRAIAchCQwBCyAHIQlBASABdCIBQYnRBHFFDQADQCAIIAdBAWoiCTYCPCABIAxyIQwgBywAASILQSBrIgFBIE8NASAJIQdBASABdCIBQYnRBHENAAsLAkAgC0EqRgRAAn8CQCAJLAABQTBrIgFBCUsNACAJLQACQSRHDQACfyAARQRAIAQgAUECdGpBCjYCAEEADAELIAMgAUEDdGooAgALIQ8gCUEDaiEBQQEMAQsgEg0GIAlBAWohASAARQRAIAggATYCPEEAIRJBACEPDAMLIAIgAigCACIHQQRqNgIAIAcoAgAhD0EACyESIAggATYCPCAPQQBODQFBACAPayEPIAxBgMAAciEMDAELI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GoiAyAAKAIgIgJNDQALCyABIAJJBEAgACAAKAIYIAFBAnRqIAAoAhQgAiABaxAwCyAAKAIAEBAgABAQC0QAIAAoAhwiASAAKAIgSQRAA0AgACAAKAIYIAAoAhQgAWxBAnRqEF0gAUEBaiIBIAAoAiBJDQALCyAAKAIAEBAgABAQC6gBAQV/IAAoAlQiAygCACEFIAMoAgQiBCAAKAIUIAAoAhwiB2siBiAEIAZJGyIGBEAgBSAHIAYQEhogAyADKAIAIAZqIgU2AgAgAyADKAIEIAZrIgQ2AgQLIAQgAiACIARLGyIEBEAgBSABIAQQEhogAyADKAIAIARqIgU2AgAgAyADKAIEIARrNgIECyAFQQA6AAAgACAAKAIsIgE2AhwgACABNgIUIAILngUCBn4EfyABIAEoAgBBB2pBeHEiAUEQajYCACAAIQsgASkDACEDIAEpAwghByMAQSBrIggkACAHQv///////z+DIQQCfiAHQjCIQv//AYMiBaciCkGB+ABrQf0PTQRAIARCBIYgA0I8iIQhAiAKQYD4AGutIQUCQCADQv//////////D4MiA0KBgICAgICAgAhaBEAgAkIBfCECDAELIANCgICAgICAgIAIUg0AIAJCAYMgAnwhAgtCACACIAJC/////////wdWIgAbIQIgAK0gBXwMAQsCQCADIASEUA0AIAVC//8BUg0AIARCBIYgA0I8iIRCgICAgICAgASEIQJC/w8MAQtC/w8gCkH+hwFLDQAaQgBBgPgAQYH4ACAFUCIBGyIAIAprIglB8ABKDQAaIAMhAiAEIARCgICAgICAwACEIAEbIgYhBAJAQYABIAlrIgFBwABxBEAgAyABQUBqrYYhBEIAIQIMAQsgAUUNACAEIAGtIgWGIAJBwAAgAWutiIQhBCACIAWGIQILIAggAjcDECAIIAQ3AxgCQCAJQcAAcQRAIAYgCUFAaq2IIQNCACEGDAELIAlFDQAgBkHAACAJa62GIAMgCa0iAoiEIQMgBiACiCEGCyAIIAM3AwAgCCAGNwMIIAgpAwhCBIYgCCkDACICQjyIhCEDAkAgACAKRyAIKQMQIAgpAxiEQgBSca0gAkL//////////w+DhCIC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EAIAAgASACIAUoAgARAABFDQAaIAAgASACIAUoAgQRAABBAEcLIQQgBUEIaiEFIAhBAmoiCCADRw0ACyAERQshAyAHBEAgAw0CIAAgASACIAUoAgARAABBAEchBAsgBkEANgIAIARFDQILIAAoAgAaQQEPCyAGQQA2AgALC0EACwoAIAAoAgAaQQALFAAgACgCACIABEAgACABNgK4AQsLIQAgACgCACABEFMgAEEAOgB8IAAgASgCuEBBAXE2AoABCzIAIAJFBEBBAA8LIAAoAgAgASACIAMQSEUEQCADQQFBqS9BABAPQQAPCyAAIAIgAxBxC2kCAn8BfCMAQRBrIgMkACACBEADQCAAIANBCGoQRCABAn8gAysDCCIFmUQAAAAAAADgQWMEQCAFqgwBC0GAgICAeAs2AgAgAUEEaiEBIABBCGohACAEQQFqIgQgAkcNAAsLIANBEGokAAuEAQICfwF9IwBBEGsiAyQAIAIEQANAIAMgAC0AADoADyADIAAtAAE6AA4gAyAALQACOgANIAMgAC0AAzoADCABAn8gAyoCDCIFi0MAAABPXQRAIAWoDAELQYCAgIB4CzYCACABQQRqIQEgAEEEaiEAIARBAWoiBCACRw0ACwsgA0EQaiQAC0sBAn8jAEEQayIDJAAgAgRAA0AgACADQQxqQQQQESABIAMoAgw2AgAgAUEEaiEBIABBBGohACAEQQFqIgQgAkcNAAsLIANBEGokAAtLAQJ/IwBBEGsiAyQAIAIEQANAIAAgA0EMakECEBEgASADKAIMNgIAIAFBBGohASAAQQJqIQAgBEEBaiIEIAJHDQALCyADQRBqJAALSgECfyMAQRBrIgMkACACBEADQCAAIANBCGoQRCABIAMrAwi2OAIAIAFBBGohASAAQQhqIQAgBEEBaiIEIAJHDQALCyADQRBqJAALaAECfyMAQRBrIgMkACACBEADQCADIAAtAAA6AA8gAyAALQABOgAOIAMgAC0AAjoADSADIAAtAAM6AAwgASADKgIMOAIAIAFBBGohASAAQQRqIQAgBEEBaiIEIAJHDQALCyADQRBqJAALTAECfyMAQRBrIgMkACACBEADQCAAIANBDGpBBBARIAEgAygCDLM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BwsMBCw4aAAAAGhoaAAAAAAAACQBB88MBCwEUAEH/wwELFRcAAAAAFwAAAAAJFAAAAAAAFAAAFABBrcQBCwEWAEG5xAELJxUAAAAAFQAAAAAJFgAAAAAAFgAAFgAAMDEyMzQ1Njc4OUFCQ0RFRgBB4MQBCwmQbAEAAAAAAAUAQfTEAQsBaQBBjMUBCwpqAAAAawAAAHhoAEGkxQELAQIAQbTFAQsI//////////8AQfjFAQsBBQBBhMYBCwFsAEGcxgELDmoAAABtAAAAiGgAAAAEAEG0xgELAQEAQcTGAQsF/////wo=";
  7929. return f;
  7930. }
  7931. var wasmBinaryFile;
  7932. function getBinarySync(file) {
  7933. if (file == wasmBinaryFile && wasmBinary) {
  7934. return new Uint8Array(wasmBinary);
  7935. }
  7936. var binary = tryParseAsDataURI(file);
  7937. if (binary) {
  7938. return binary;
  7939. }
  7940. if (readBinary) {
  7941. return readBinary(file);
  7942. }
  7943. throw 'sync fetching of the wasm failed: you can preload it to Module["wasmBinary"] manually, or emcc.py will do that for you when generating HTML (but not JS)';
  7944. }
  7945. function instantiateSync(file, info) {
  7946. var module;
  7947. var binary = getBinarySync(file);
  7948. module = new WebAssembly.Module(binary);
  7949. var instance = new WebAssembly.Instance(module, info);
  7950. return [instance, module];
  7951. }
  7952. function getWasmImports() {
  7953. return {
  7954. a: wasmImports
  7955. };
  7956. }
  7957. function createWasm() {
  7958. var info = getWasmImports();
  7959. function receiveInstance(instance, module) {
  7960. wasmExports = instance.exports;
  7961. wasmMemory = wasmExports["p"];
  7962. updateMemoryViews();
  7963. addOnInit(wasmExports["q"]);
  7964. removeRunDependency("wasm-instantiate");
  7965. return wasmExports;
  7966. }
  7967. addRunDependency("wasm-instantiate");
  7968. if (Module["instantiateWasm"]) {
  7969. try {
  7970. return Module["instantiateWasm"](info, receiveInstance);
  7971. } catch (e) {
  7972. err(`Module.instantiateWasm callback failed with error: ${e}`);
  7973. readyPromiseReject(e);
  7974. }
  7975. }
  7976. if (!wasmBinaryFile) wasmBinaryFile = findWasmBinary();
  7977. var result = instantiateSync(wasmBinaryFile, info);
  7978. return receiveInstance(result[0]);
  7979. }
  7980. var callRuntimeCallbacks = callbacks => {
  7981. while (callbacks.length > 0) {
  7982. callbacks.shift()(Module);
  7983. }
  7984. };
  7985. var noExitRuntime = Module["noExitRuntime"] || true;
  7986. var __emscripten_memcpy_js = (dest, src, num) => HEAPU8.copyWithin(dest, src, src + num);
  7987. function _copy_pixels_1(compG_ptr, nb_pixels) {
  7988. compG_ptr >>= 2;
  7989. const imageData = Module.imageData = new Uint8ClampedArray(nb_pixels);
  7990. const compG = Module.HEAP32.subarray(compG_ptr, compG_ptr + nb_pixels);
  7991. imageData.set(compG);
  7992. }
  7993. function _copy_pixels_3(compR_ptr, compG_ptr, compB_ptr, nb_pixels) {
  7994. compR_ptr >>= 2;
  7995. compG_ptr >>= 2;
  7996. compB_ptr >>= 2;
  7997. const imageData = Module.imageData = new Uint8ClampedArray(nb_pixels * 3);
  7998. const compR = Module.HEAP32.subarray(compR_ptr, compR_ptr + nb_pixels);
  7999. const compG = Module.HEAP32.subarray(compG_ptr, compG_ptr + nb_pixels);
  8000. const compB = Module.HEAP32.subarray(compB_ptr, compB_ptr + nb_pixels);
  8001. for (let i = 0; i < nb_pixels; i++) {
  8002. imageData[3 * i] = compR[i];
  8003. imageData[3 * i + 1] = compG[i];
  8004. imageData[3 * i + 2] = compB[i];
  8005. }
  8006. }
  8007. function _copy_pixels_4(compR_ptr, compG_ptr, compB_ptr, compA_ptr, nb_pixels) {
  8008. compR_ptr >>= 2;
  8009. compG_ptr >>= 2;
  8010. compB_ptr >>= 2;
  8011. compA_ptr >>= 2;
  8012. const imageData = Module.imageData = new Uint8ClampedArray(nb_pixels * 4);
  8013. const compR = Module.HEAP32.subarray(compR_ptr, compR_ptr + nb_pixels);
  8014. const compG = Module.HEAP32.subarray(compG_ptr, compG_ptr + nb_pixels);
  8015. const compB = Module.HEAP32.subarray(compB_ptr, compB_ptr + nb_pixels);
  8016. const compA = Module.HEAP32.subarray(compA_ptr, compA_ptr + nb_pixels);
  8017. for (let i = 0; i < nb_pixels; i++) {
  8018. imageData[4 * i] = compR[i];
  8019. imageData[4 * i + 1] = compG[i];
  8020. imageData[4 * i + 2] = compB[i];
  8021. imageData[4 * i + 3] = compA[i];
  8022. }
  8023. }
  8024. var getHeapMax = () => 2147483648;
  8025. var growMemory = size => {
  8026. var b = wasmMemory.buffer;
  8027. var pages = (size - b.byteLength + 65535) / 65536;
  8028. try {
  8029. wasmMemory.grow(pages);
  8030. updateMemoryViews();
  8031. return 1;
  8032. } catch (e) {}
  8033. };
  8034. var _emscripten_resize_heap = requestedSize => {
  8035. var oldSize = HEAPU8.length;
  8036. requestedSize >>>= 0;
  8037. var maxHeapSize = getHeapMax();
  8038. if (requestedSize > maxHeapSize) {
  8039. return false;
  8040. }
  8041. var alignUp = (x, multiple) => x + (multiple - x % multiple) % multiple;
  8042. for (var cutDown = 1; cutDown <= 4; cutDown *= 2) {
  8043. var overGrownHeapSize = oldSize * (1 + .2 / cutDown);
  8044. overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296);
  8045. var newSize = Math.min(maxHeapSize, alignUp(Math.max(requestedSize, overGrownHeapSize), 65536));
  8046. var replacement = growMemory(newSize);
  8047. if (replacement) {
  8048. return true;
  8049. }
  8050. }
  8051. return false;
  8052. };
  8053. var ENV = {};
  8054. var getExecutableName = () => thisProgram || "./this.program";
  8055. var getEnvStrings = () => {
  8056. if (!getEnvStrings.strings) {
  8057. var lang = (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8";
  8058. var env = {
  8059. USER: "web_user",
  8060. LOGNAME: "web_user",
  8061. PATH: "/",
  8062. PWD: "/",
  8063. HOME: "/home/web_user",
  8064. LANG: lang,
  8065. _: getExecutableName()
  8066. };
  8067. for (var x in ENV) {
  8068. if (ENV[x] === undefined) delete env[x];else env[x] = ENV[x];
  8069. }
  8070. var strings = [];
  8071. for (var x in env) {
  8072. strings.push(`${x}=${env[x]}`);
  8073. }
  8074. getEnvStrings.strings = strings;
  8075. }
  8076. return getEnvStrings.strings;
  8077. };
  8078. var stringToAscii = (str, buffer) => {
  8079. for (var i = 0; i < str.length; ++i) {
  8080. HEAP8[buffer++] = str.charCodeAt(i);
  8081. }
  8082. HEAP8[buffer] = 0;
  8083. };
  8084. var _environ_get = (__environ, environ_buf) => {
  8085. var bufSize = 0;
  8086. getEnvStrings().forEach((string, i) => {
  8087. var ptr = environ_buf + bufSize;
  8088. HEAPU32[__environ + i * 4 >> 2] = ptr;
  8089. stringToAscii(string, ptr);
  8090. bufSize += string.length + 1;
  8091. });
  8092. return 0;
  8093. };
  8094. var _environ_sizes_get = (penviron_count, penviron_buf_size) => {
  8095. var strings = getEnvStrings();
  8096. HEAPU32[penviron_count >> 2] = strings.length;
  8097. var bufSize = 0;
  8098. strings.forEach(string => bufSize += string.length + 1);
  8099. HEAPU32[penviron_buf_size >> 2] = bufSize;
  8100. return 0;
  8101. };
  8102. var _fd_close = fd => 52;
  8103. var convertI32PairToI53Checked = (lo, hi) => hi + 2097152 >>> 0 < 4194305 - !!lo ? (lo >>> 0) + hi * 4294967296 : NaN;
  8104. function _fd_seek(fd, offset_low, offset_high, whence, newOffset) {
  8105. var offset = convertI32PairToI53Checked(offset_low, offset_high);
  8106. return 70;
  8107. }
  8108. var printCharBuffers = [null, [], []];
  8109. var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf8") : undefined;
  8110. var UTF8ArrayToString = (heapOrArray, idx, maxBytesToRead) => {
  8111. var endIdx = idx + maxBytesToRead;
  8112. var endPtr = idx;
  8113. while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr;
  8114. if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
  8115. return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
  8116. }
  8117. var str = "";
  8118. while (idx < endPtr) {
  8119. var u0 = heapOrArray[idx++];
  8120. if (!(u0 & 128)) {
  8121. str += String.fromCharCode(u0);
  8122. continue;
  8123. }
  8124. var u1 = heapOrArray[idx++] & 63;
  8125. if ((u0 & 224) == 192) {
  8126. str += String.fromCharCode((u0 & 31) << 6 | u1);
  8127. continue;
  8128. }
  8129. var u2 = heapOrArray[idx++] & 63;
  8130. if ((u0 & 240) == 224) {
  8131. u0 = (u0 & 15) << 12 | u1 << 6 | u2;
  8132. } else {
  8133. u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heapOrArray[idx++] & 63;
  8134. }
  8135. if (u0 < 65536) {
  8136. str += String.fromCharCode(u0);
  8137. } else {
  8138. var ch = u0 - 65536;
  8139. str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023);
  8140. }
  8141. }
  8142. return str;
  8143. };
  8144. var printChar = (stream, curr) => {
  8145. var buffer = printCharBuffers[stream];
  8146. if (curr === 0 || curr === 10) {
  8147. (stream === 1 ? out : err)(UTF8ArrayToString(buffer, 0));
  8148. buffer.length = 0;
  8149. } else {
  8150. buffer.push(curr);
  8151. }
  8152. };
  8153. var UTF8ToString = (ptr, maxBytesToRead) => ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "";
  8154. var _fd_write = (fd, iov, iovcnt, pnum) => {
  8155. var num = 0;
  8156. for (var i = 0; i < iovcnt; i++) {
  8157. var ptr = HEAPU32[iov >> 2];
  8158. var len = HEAPU32[iov + 4 >> 2];
  8159. iov += 8;
  8160. for (var j = 0; j < len; j++) {
  8161. printChar(fd, HEAPU8[ptr + j]);
  8162. }
  8163. num += len;
  8164. }
  8165. HEAPU32[pnum >> 2] = num;
  8166. return 0;
  8167. };
  8168. function _gray_to_rgba(compG_ptr, nb_pixels) {
  8169. compG_ptr >>= 2;
  8170. const imageData = Module.imageData = new Uint8ClampedArray(nb_pixels * 4);
  8171. const compG = Module.HEAP32.subarray(compG_ptr, compG_ptr + nb_pixels);
  8172. for (let i = 0; i < nb_pixels; i++) {
  8173. imageData[4 * i] = imageData[4 * i + 1] = imageData[4 * i + 2] = compG[i];
  8174. imageData[4 * i + 3] = 255;
  8175. }
  8176. }
  8177. function _graya_to_rgba(compG_ptr, compA_ptr, nb_pixels) {
  8178. compG_ptr >>= 2;
  8179. compA_ptr >>= 2;
  8180. const imageData = Module.imageData = new Uint8ClampedArray(nb_pixels * 4);
  8181. const compG = Module.HEAP32.subarray(compG_ptr, compG_ptr + nb_pixels);
  8182. const compA = Module.HEAP32.subarray(compA_ptr, compA_ptr + nb_pixels);
  8183. for (let i = 0; i < nb_pixels; i++) {
  8184. imageData[4 * i] = imageData[4 * i + 1] = imageData[4 * i + 2] = compG[i];
  8185. imageData[4 * i + 3] = compA[i];
  8186. }
  8187. }
  8188. function _jsPrintWarning(message_ptr) {
  8189. const message = UTF8ToString(message_ptr);
  8190. (Module.warn || console.warn)(`OpenJPEG: ${message}`);
  8191. }
  8192. function _rgb_to_rgba(compR_ptr, compG_ptr, compB_ptr, nb_pixels) {
  8193. compR_ptr >>= 2;
  8194. compG_ptr >>= 2;
  8195. compB_ptr >>= 2;
  8196. const imageData = Module.imageData = new Uint8ClampedArray(nb_pixels * 4);
  8197. const compR = Module.HEAP32.subarray(compR_ptr, compR_ptr + nb_pixels);
  8198. const compG = Module.HEAP32.subarray(compG_ptr, compG_ptr + nb_pixels);
  8199. const compB = Module.HEAP32.subarray(compB_ptr, compB_ptr + nb_pixels);
  8200. for (let i = 0; i < nb_pixels; i++) {
  8201. imageData[4 * i] = compR[i];
  8202. imageData[4 * i + 1] = compG[i];
  8203. imageData[4 * i + 2] = compB[i];
  8204. imageData[4 * i + 3] = 255;
  8205. }
  8206. }
  8207. function _storeErrorMessage(message_ptr) {
  8208. const message = UTF8ToString(message_ptr);
  8209. if (!Module.errorMessages) {
  8210. Module.errorMessages = message;
  8211. } else {
  8212. Module.errorMessages += "\n" + message;
  8213. }
  8214. }
  8215. var wasmImports = {
  8216. c: __emscripten_memcpy_js,
  8217. g: _copy_pixels_1,
  8218. f: _copy_pixels_3,
  8219. e: _copy_pixels_4,
  8220. k: _emscripten_resize_heap,
  8221. l: _environ_get,
  8222. m: _environ_sizes_get,
  8223. n: _fd_close,
  8224. j: _fd_seek,
  8225. b: _fd_write,
  8226. o: _gray_to_rgba,
  8227. i: _graya_to_rgba,
  8228. d: _jsPrintWarning,
  8229. h: _rgb_to_rgba,
  8230. a: _storeErrorMessage
  8231. };
  8232. var wasmExports = createWasm();
  8233. var ___wasm_call_ctors = wasmExports["q"];
  8234. var _malloc = Module["_malloc"] = wasmExports["r"];
  8235. var _free = Module["_free"] = wasmExports["s"];
  8236. var _jp2_decode = Module["_jp2_decode"] = wasmExports["u"];
  8237. var calledRun;
  8238. dependenciesFulfilled = function runCaller() {
  8239. if (!calledRun) run();
  8240. if (!calledRun) dependenciesFulfilled = runCaller;
  8241. };
  8242. function run() {
  8243. if (runDependencies > 0) {
  8244. return;
  8245. }
  8246. preRun();
  8247. if (runDependencies > 0) {
  8248. return;
  8249. }
  8250. function doRun() {
  8251. if (calledRun) return;
  8252. calledRun = true;
  8253. Module["calledRun"] = true;
  8254. if (ABORT) return;
  8255. initRuntime();
  8256. readyPromiseResolve(Module);
  8257. if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"]();
  8258. postRun();
  8259. }
  8260. if (Module["setStatus"]) {
  8261. Module["setStatus"]("Running...");
  8262. setTimeout(function () {
  8263. setTimeout(function () {
  8264. Module["setStatus"]("");
  8265. }, 1);
  8266. doRun();
  8267. }, 1);
  8268. } else {
  8269. doRun();
  8270. }
  8271. }
  8272. if (Module["preInit"]) {
  8273. if (typeof Module["preInit"] == "function") Module["preInit"] = [Module["preInit"]];
  8274. while (Module["preInit"].length > 0) {
  8275. Module["preInit"].pop()();
  8276. }
  8277. }
  8278. run();
  8279. moduleRtn = Module;
  8280. return moduleRtn;
  8281. };
  8282. })();
  8283. /* harmony default export */ const openjpeg = (OpenJPEG);
  8284. ;// ./src/core/jpx.js
  8285. class JpxError extends BaseException {
  8286. constructor(msg) {
  8287. super(msg, "JpxError");
  8288. }
  8289. }
  8290. class JpxImage {
  8291. static #module = null;
  8292. static decode(data, decoderOptions) {
  8293. decoderOptions ||= {};
  8294. this.#module ||= openjpeg({
  8295. warn: warn
  8296. });
  8297. const imageData = this.#module.decode(data, decoderOptions);
  8298. if (typeof imageData === "string") {
  8299. throw new JpxError(imageData);
  8300. }
  8301. return imageData;
  8302. }
  8303. static cleanup() {
  8304. this.#module = null;
  8305. }
  8306. static parseImageProperties(stream) {
  8307. let newByte = stream.getByte();
  8308. while (newByte >= 0) {
  8309. const oldByte = newByte;
  8310. newByte = stream.getByte();
  8311. const code = oldByte << 8 | newByte;
  8312. if (code === 0xff51) {
  8313. stream.skip(4);
  8314. const Xsiz = stream.getInt32() >>> 0;
  8315. const Ysiz = stream.getInt32() >>> 0;
  8316. const XOsiz = stream.getInt32() >>> 0;
  8317. const YOsiz = stream.getInt32() >>> 0;
  8318. stream.skip(16);
  8319. const Csiz = stream.getUint16();
  8320. return {
  8321. width: Xsiz - XOsiz,
  8322. height: Ysiz - YOsiz,
  8323. bitsPerComponent: 8,
  8324. componentsCount: Csiz
  8325. };
  8326. }
  8327. }
  8328. throw new JpxError("No size marker found in JPX stream");
  8329. }
  8330. }
  8331. ;// ./src/core/jpx_stream.js
  8332. class JpxStream extends DecodeStream {
  8333. constructor(stream, maybeLength, params) {
  8334. super(maybeLength);
  8335. this.stream = stream;
  8336. this.dict = stream.dict;
  8337. this.maybeLength = maybeLength;
  8338. this.params = params;
  8339. }
  8340. get bytes() {
  8341. return shadow(this, "bytes", this.stream.getBytes(this.maybeLength));
  8342. }
  8343. ensureBuffer(requested) {}
  8344. readBlock(decoderOptions) {
  8345. this.decodeImage(null, decoderOptions);
  8346. }
  8347. decodeImage(bytes, decoderOptions) {
  8348. if (this.eof) {
  8349. return this.buffer;
  8350. }
  8351. bytes ||= this.bytes;
  8352. this.buffer = JpxImage.decode(bytes, decoderOptions);
  8353. this.bufferLength = this.buffer.length;
  8354. this.eof = true;
  8355. return this.buffer;
  8356. }
  8357. get canAsyncDecodeImageFromBuffer() {
  8358. return this.stream.isAsync;
  8359. }
  8360. }
  8361. ;// ./src/core/lzw_stream.js
  8362. class LZWStream extends DecodeStream {
  8363. constructor(str, maybeLength, earlyChange) {
  8364. super(maybeLength);
  8365. this.str = str;
  8366. this.dict = str.dict;
  8367. this.cachedData = 0;
  8368. this.bitsCached = 0;
  8369. const maxLzwDictionarySize = 4096;
  8370. const lzwState = {
  8371. earlyChange,
  8372. codeLength: 9,
  8373. nextCode: 258,
  8374. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  8375. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  8376. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  8377. currentSequence: new Uint8Array(maxLzwDictionarySize),
  8378. currentSequenceLength: 0
  8379. };
  8380. for (let i = 0; i < 256; ++i) {
  8381. lzwState.dictionaryValues[i] = i;
  8382. lzwState.dictionaryLengths[i] = 1;
  8383. }
  8384. this.lzwState = lzwState;
  8385. }
  8386. readBits(n) {
  8387. let bitsCached = this.bitsCached;
  8388. let cachedData = this.cachedData;
  8389. while (bitsCached < n) {
  8390. const c = this.str.getByte();
  8391. if (c === -1) {
  8392. this.eof = true;
  8393. return null;
  8394. }
  8395. cachedData = cachedData << 8 | c;
  8396. bitsCached += 8;
  8397. }
  8398. this.bitsCached = bitsCached -= n;
  8399. this.cachedData = cachedData;
  8400. this.lastCode = null;
  8401. return cachedData >>> bitsCached & (1 << n) - 1;
  8402. }
  8403. readBlock() {
  8404. const blockSize = 512,
  8405. decodedSizeDelta = blockSize;
  8406. let estimatedDecodedSize = blockSize * 2;
  8407. let i, j, q;
  8408. const lzwState = this.lzwState;
  8409. if (!lzwState) {
  8410. return;
  8411. }
  8412. const earlyChange = lzwState.earlyChange;
  8413. let nextCode = lzwState.nextCode;
  8414. const dictionaryValues = lzwState.dictionaryValues;
  8415. const dictionaryLengths = lzwState.dictionaryLengths;
  8416. const dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  8417. let codeLength = lzwState.codeLength;
  8418. let prevCode = lzwState.prevCode;
  8419. const currentSequence = lzwState.currentSequence;
  8420. let currentSequenceLength = lzwState.currentSequenceLength;
  8421. let decodedLength = 0;
  8422. let currentBufferLength = this.bufferLength;
  8423. let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  8424. for (i = 0; i < blockSize; i++) {
  8425. const code = this.readBits(codeLength);
  8426. const hasPrev = currentSequenceLength > 0;
  8427. if (code < 256) {
  8428. currentSequence[0] = code;
  8429. currentSequenceLength = 1;
  8430. } else if (code >= 258) {
  8431. if (code < nextCode) {
  8432. currentSequenceLength = dictionaryLengths[code];
  8433. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  8434. currentSequence[j] = dictionaryValues[q];
  8435. q = dictionaryPrevCodes[q];
  8436. }
  8437. } else {
  8438. currentSequence[currentSequenceLength++] = currentSequence[0];
  8439. }
  8440. } else if (code === 256) {
  8441. codeLength = 9;
  8442. nextCode = 258;
  8443. currentSequenceLength = 0;
  8444. continue;
  8445. } else {
  8446. this.eof = true;
  8447. delete this.lzwState;
  8448. break;
  8449. }
  8450. if (hasPrev) {
  8451. dictionaryPrevCodes[nextCode] = prevCode;
  8452. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  8453. dictionaryValues[nextCode] = currentSequence[0];
  8454. nextCode++;
  8455. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  8456. }
  8457. prevCode = code;
  8458. decodedLength += currentSequenceLength;
  8459. if (estimatedDecodedSize < decodedLength) {
  8460. do {
  8461. estimatedDecodedSize += decodedSizeDelta;
  8462. } while (estimatedDecodedSize < decodedLength);
  8463. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  8464. }
  8465. for (j = 0; j < currentSequenceLength; j++) {
  8466. buffer[currentBufferLength++] = currentSequence[j];
  8467. }
  8468. }
  8469. lzwState.nextCode = nextCode;
  8470. lzwState.codeLength = codeLength;
  8471. lzwState.prevCode = prevCode;
  8472. lzwState.currentSequenceLength = currentSequenceLength;
  8473. this.bufferLength = currentBufferLength;
  8474. }
  8475. }
  8476. ;// ./src/core/predictor_stream.js
  8477. class PredictorStream extends DecodeStream {
  8478. constructor(str, maybeLength, params) {
  8479. super(maybeLength);
  8480. if (!(params instanceof Dict)) {
  8481. return str;
  8482. }
  8483. const predictor = this.predictor = params.get("Predictor") || 1;
  8484. if (predictor <= 1) {
  8485. return str;
  8486. }
  8487. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  8488. throw new FormatError(`Unsupported predictor: ${predictor}`);
  8489. }
  8490. this.readBlock = predictor === 2 ? this.readBlockTiff : this.readBlockPng;
  8491. this.str = str;
  8492. this.dict = str.dict;
  8493. const colors = this.colors = params.get("Colors") || 1;
  8494. const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8;
  8495. const columns = this.columns = params.get("Columns") || 1;
  8496. this.pixBytes = colors * bits + 7 >> 3;
  8497. this.rowBytes = columns * colors * bits + 7 >> 3;
  8498. return this;
  8499. }
  8500. readBlockTiff() {
  8501. const rowBytes = this.rowBytes;
  8502. const bufferLength = this.bufferLength;
  8503. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  8504. const bits = this.bits;
  8505. const colors = this.colors;
  8506. const rawBytes = this.str.getBytes(rowBytes);
  8507. this.eof = !rawBytes.length;
  8508. if (this.eof) {
  8509. return;
  8510. }
  8511. let inbuf = 0,
  8512. outbuf = 0;
  8513. let inbits = 0,
  8514. outbits = 0;
  8515. let pos = bufferLength;
  8516. let i;
  8517. if (bits === 1 && colors === 1) {
  8518. for (i = 0; i < rowBytes; ++i) {
  8519. let c = rawBytes[i] ^ inbuf;
  8520. c ^= c >> 1;
  8521. c ^= c >> 2;
  8522. c ^= c >> 4;
  8523. inbuf = (c & 1) << 7;
  8524. buffer[pos++] = c;
  8525. }
  8526. } else if (bits === 8) {
  8527. for (i = 0; i < colors; ++i) {
  8528. buffer[pos++] = rawBytes[i];
  8529. }
  8530. for (; i < rowBytes; ++i) {
  8531. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  8532. pos++;
  8533. }
  8534. } else if (bits === 16) {
  8535. const bytesPerPixel = colors * 2;
  8536. for (i = 0; i < bytesPerPixel; ++i) {
  8537. buffer[pos++] = rawBytes[i];
  8538. }
  8539. for (; i < rowBytes; i += 2) {
  8540. const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
  8541. buffer[pos++] = sum >> 8 & 0xff;
  8542. buffer[pos++] = sum & 0xff;
  8543. }
  8544. } else {
  8545. const compArray = new Uint8Array(colors + 1);
  8546. const bitMask = (1 << bits) - 1;
  8547. let j = 0,
  8548. k = bufferLength;
  8549. const columns = this.columns;
  8550. for (i = 0; i < columns; ++i) {
  8551. for (let kk = 0; kk < colors; ++kk) {
  8552. if (inbits < bits) {
  8553. inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
  8554. inbits += 8;
  8555. }
  8556. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  8557. inbits -= bits;
  8558. outbuf = outbuf << bits | compArray[kk];
  8559. outbits += bits;
  8560. if (outbits >= 8) {
  8561. buffer[k++] = outbuf >> outbits - 8 & 0xff;
  8562. outbits -= 8;
  8563. }
  8564. }
  8565. }
  8566. if (outbits > 0) {
  8567. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  8568. }
  8569. }
  8570. this.bufferLength += rowBytes;
  8571. }
  8572. readBlockPng() {
  8573. const rowBytes = this.rowBytes;
  8574. const pixBytes = this.pixBytes;
  8575. const predictor = this.str.getByte();
  8576. const rawBytes = this.str.getBytes(rowBytes);
  8577. this.eof = !rawBytes.length;
  8578. if (this.eof) {
  8579. return;
  8580. }
  8581. const bufferLength = this.bufferLength;
  8582. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  8583. let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  8584. if (prevRow.length === 0) {
  8585. prevRow = new Uint8Array(rowBytes);
  8586. }
  8587. let i,
  8588. j = bufferLength,
  8589. up,
  8590. c;
  8591. switch (predictor) {
  8592. case 0:
  8593. for (i = 0; i < rowBytes; ++i) {
  8594. buffer[j++] = rawBytes[i];
  8595. }
  8596. break;
  8597. case 1:
  8598. for (i = 0; i < pixBytes; ++i) {
  8599. buffer[j++] = rawBytes[i];
  8600. }
  8601. for (; i < rowBytes; ++i) {
  8602. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
  8603. j++;
  8604. }
  8605. break;
  8606. case 2:
  8607. for (i = 0; i < rowBytes; ++i) {
  8608. buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
  8609. }
  8610. break;
  8611. case 3:
  8612. for (i = 0; i < pixBytes; ++i) {
  8613. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  8614. }
  8615. for (; i < rowBytes; ++i) {
  8616. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
  8617. j++;
  8618. }
  8619. break;
  8620. case 4:
  8621. for (i = 0; i < pixBytes; ++i) {
  8622. up = prevRow[i];
  8623. c = rawBytes[i];
  8624. buffer[j++] = up + c;
  8625. }
  8626. for (; i < rowBytes; ++i) {
  8627. up = prevRow[i];
  8628. const upLeft = prevRow[i - pixBytes];
  8629. const left = buffer[j - pixBytes];
  8630. const p = left + up - upLeft;
  8631. let pa = p - left;
  8632. if (pa < 0) {
  8633. pa = -pa;
  8634. }
  8635. let pb = p - up;
  8636. if (pb < 0) {
  8637. pb = -pb;
  8638. }
  8639. let pc = p - upLeft;
  8640. if (pc < 0) {
  8641. pc = -pc;
  8642. }
  8643. c = rawBytes[i];
  8644. if (pa <= pb && pa <= pc) {
  8645. buffer[j++] = left + c;
  8646. } else if (pb <= pc) {
  8647. buffer[j++] = up + c;
  8648. } else {
  8649. buffer[j++] = upLeft + c;
  8650. }
  8651. }
  8652. break;
  8653. default:
  8654. throw new FormatError(`Unsupported predictor: ${predictor}`);
  8655. }
  8656. this.bufferLength += rowBytes;
  8657. }
  8658. }
  8659. ;// ./src/core/run_length_stream.js
  8660. class RunLengthStream extends DecodeStream {
  8661. constructor(str, maybeLength) {
  8662. super(maybeLength);
  8663. this.str = str;
  8664. this.dict = str.dict;
  8665. }
  8666. readBlock() {
  8667. const repeatHeader = this.str.getBytes(2);
  8668. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  8669. this.eof = true;
  8670. return;
  8671. }
  8672. let buffer;
  8673. let bufferLength = this.bufferLength;
  8674. let n = repeatHeader[0];
  8675. if (n < 128) {
  8676. buffer = this.ensureBuffer(bufferLength + n + 1);
  8677. buffer[bufferLength++] = repeatHeader[1];
  8678. if (n > 0) {
  8679. const source = this.str.getBytes(n);
  8680. buffer.set(source, bufferLength);
  8681. bufferLength += n;
  8682. }
  8683. } else {
  8684. n = 257 - n;
  8685. const b = repeatHeader[1];
  8686. buffer = this.ensureBuffer(bufferLength + n + 1);
  8687. for (let i = 0; i < n; i++) {
  8688. buffer[bufferLength++] = b;
  8689. }
  8690. }
  8691. this.bufferLength = bufferLength;
  8692. }
  8693. }
  8694. ;// ./src/core/parser.js
  8695. const MAX_LENGTH_TO_CACHE = 1000;
  8696. function getInlineImageCacheKey(bytes) {
  8697. const strBuf = [],
  8698. ii = bytes.length;
  8699. let i = 0;
  8700. while (i < ii - 1) {
  8701. strBuf.push(bytes[i++] << 8 | bytes[i++]);
  8702. }
  8703. if (i < ii) {
  8704. strBuf.push(bytes[i]);
  8705. }
  8706. return ii + "_" + String.fromCharCode.apply(null, strBuf);
  8707. }
  8708. class Parser {
  8709. constructor({
  8710. lexer,
  8711. xref,
  8712. allowStreams = false,
  8713. recoveryMode = false
  8714. }) {
  8715. this.lexer = lexer;
  8716. this.xref = xref;
  8717. this.allowStreams = allowStreams;
  8718. this.recoveryMode = recoveryMode;
  8719. this.imageCache = Object.create(null);
  8720. this._imageId = 0;
  8721. this.refill();
  8722. }
  8723. refill() {
  8724. this.buf1 = this.lexer.getObj();
  8725. this.buf2 = this.lexer.getObj();
  8726. }
  8727. shift() {
  8728. if (this.buf2 instanceof Cmd && this.buf2.cmd === "ID") {
  8729. this.buf1 = this.buf2;
  8730. this.buf2 = null;
  8731. } else {
  8732. this.buf1 = this.buf2;
  8733. this.buf2 = this.lexer.getObj();
  8734. }
  8735. }
  8736. tryShift() {
  8737. try {
  8738. this.shift();
  8739. return true;
  8740. } catch (e) {
  8741. if (e instanceof MissingDataException) {
  8742. throw e;
  8743. }
  8744. return false;
  8745. }
  8746. }
  8747. getObj(cipherTransform = null) {
  8748. const buf1 = this.buf1;
  8749. this.shift();
  8750. if (buf1 instanceof Cmd) {
  8751. switch (buf1.cmd) {
  8752. case "BI":
  8753. return this.makeInlineImage(cipherTransform);
  8754. case "[":
  8755. const array = [];
  8756. while (!isCmd(this.buf1, "]") && this.buf1 !== EOF) {
  8757. array.push(this.getObj(cipherTransform));
  8758. }
  8759. if (this.buf1 === EOF) {
  8760. if (this.recoveryMode) {
  8761. return array;
  8762. }
  8763. throw new ParserEOFException("End of file inside array.");
  8764. }
  8765. this.shift();
  8766. return array;
  8767. case "<<":
  8768. const dict = new Dict(this.xref);
  8769. while (!isCmd(this.buf1, ">>") && this.buf1 !== EOF) {
  8770. if (!(this.buf1 instanceof Name)) {
  8771. info("Malformed dictionary: key must be a name object");
  8772. this.shift();
  8773. continue;
  8774. }
  8775. const key = this.buf1.name;
  8776. this.shift();
  8777. if (this.buf1 === EOF) {
  8778. break;
  8779. }
  8780. dict.set(key, this.getObj(cipherTransform));
  8781. }
  8782. if (this.buf1 === EOF) {
  8783. if (this.recoveryMode) {
  8784. return dict;
  8785. }
  8786. throw new ParserEOFException("End of file inside dictionary.");
  8787. }
  8788. if (isCmd(this.buf2, "stream")) {
  8789. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  8790. }
  8791. this.shift();
  8792. return dict;
  8793. default:
  8794. return buf1;
  8795. }
  8796. }
  8797. if (Number.isInteger(buf1)) {
  8798. if (Number.isInteger(this.buf1) && isCmd(this.buf2, "R")) {
  8799. const ref = Ref.get(buf1, this.buf1);
  8800. this.shift();
  8801. this.shift();
  8802. return ref;
  8803. }
  8804. return buf1;
  8805. }
  8806. if (typeof buf1 === "string") {
  8807. if (cipherTransform) {
  8808. return cipherTransform.decryptString(buf1);
  8809. }
  8810. return buf1;
  8811. }
  8812. return buf1;
  8813. }
  8814. findDefaultInlineStreamEnd(stream) {
  8815. const E = 0x45,
  8816. I = 0x49,
  8817. SPACE = 0x20,
  8818. LF = 0xa,
  8819. CR = 0xd,
  8820. NUL = 0x0;
  8821. const {
  8822. knownCommands
  8823. } = this.lexer,
  8824. startPos = stream.pos,
  8825. n = 15;
  8826. let state = 0,
  8827. ch,
  8828. maybeEIPos;
  8829. while ((ch = stream.getByte()) !== -1) {
  8830. if (state === 0) {
  8831. state = ch === E ? 1 : 0;
  8832. } else if (state === 1) {
  8833. state = ch === I ? 2 : 0;
  8834. } else {
  8835. if (ch === SPACE || ch === LF || ch === CR) {
  8836. maybeEIPos = stream.pos;
  8837. const followingBytes = stream.peekBytes(n);
  8838. const ii = followingBytes.length;
  8839. if (ii === 0) {
  8840. break;
  8841. }
  8842. for (let i = 0; i < ii; i++) {
  8843. ch = followingBytes[i];
  8844. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  8845. continue;
  8846. }
  8847. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  8848. state = 0;
  8849. break;
  8850. }
  8851. }
  8852. if (state !== 2) {
  8853. continue;
  8854. }
  8855. if (!knownCommands) {
  8856. warn("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");
  8857. continue;
  8858. }
  8859. const tmpLexer = new Lexer(new Stream(followingBytes.slice()), knownCommands);
  8860. tmpLexer._hexStringWarn = () => {};
  8861. let numArgs = 0;
  8862. while (true) {
  8863. const nextObj = tmpLexer.getObj();
  8864. if (nextObj === EOF) {
  8865. state = 0;
  8866. break;
  8867. }
  8868. if (nextObj instanceof Cmd) {
  8869. const knownCommand = knownCommands[nextObj.cmd];
  8870. if (!knownCommand) {
  8871. state = 0;
  8872. break;
  8873. } else if (knownCommand.variableArgs ? numArgs <= knownCommand.numArgs : numArgs === knownCommand.numArgs) {
  8874. break;
  8875. }
  8876. numArgs = 0;
  8877. continue;
  8878. }
  8879. numArgs++;
  8880. }
  8881. if (state === 2) {
  8882. break;
  8883. }
  8884. } else {
  8885. state = 0;
  8886. }
  8887. }
  8888. }
  8889. if (ch === -1) {
  8890. warn("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
  8891. if (maybeEIPos) {
  8892. warn('... trying to recover by using the last "EI" occurrence.');
  8893. stream.skip(-(stream.pos - maybeEIPos));
  8894. }
  8895. }
  8896. let endOffset = 4;
  8897. stream.skip(-endOffset);
  8898. ch = stream.peekByte();
  8899. stream.skip(endOffset);
  8900. if (!isWhiteSpace(ch)) {
  8901. endOffset--;
  8902. }
  8903. return stream.pos - endOffset - startPos;
  8904. }
  8905. findDCTDecodeInlineStreamEnd(stream) {
  8906. const startPos = stream.pos;
  8907. let foundEOI = false,
  8908. b,
  8909. markerLength;
  8910. while ((b = stream.getByte()) !== -1) {
  8911. if (b !== 0xff) {
  8912. continue;
  8913. }
  8914. switch (stream.getByte()) {
  8915. case 0x00:
  8916. break;
  8917. case 0xff:
  8918. stream.skip(-1);
  8919. break;
  8920. case 0xd9:
  8921. foundEOI = true;
  8922. break;
  8923. case 0xc0:
  8924. case 0xc1:
  8925. case 0xc2:
  8926. case 0xc3:
  8927. case 0xc5:
  8928. case 0xc6:
  8929. case 0xc7:
  8930. case 0xc9:
  8931. case 0xca:
  8932. case 0xcb:
  8933. case 0xcd:
  8934. case 0xce:
  8935. case 0xcf:
  8936. case 0xc4:
  8937. case 0xcc:
  8938. case 0xda:
  8939. case 0xdb:
  8940. case 0xdc:
  8941. case 0xdd:
  8942. case 0xde:
  8943. case 0xdf:
  8944. case 0xe0:
  8945. case 0xe1:
  8946. case 0xe2:
  8947. case 0xe3:
  8948. case 0xe4:
  8949. case 0xe5:
  8950. case 0xe6:
  8951. case 0xe7:
  8952. case 0xe8:
  8953. case 0xe9:
  8954. case 0xea:
  8955. case 0xeb:
  8956. case 0xec:
  8957. case 0xed:
  8958. case 0xee:
  8959. case 0xef:
  8960. case 0xfe:
  8961. markerLength = stream.getUint16();
  8962. if (markerLength > 2) {
  8963. stream.skip(markerLength - 2);
  8964. } else {
  8965. stream.skip(-2);
  8966. }
  8967. break;
  8968. }
  8969. if (foundEOI) {
  8970. break;
  8971. }
  8972. }
  8973. const length = stream.pos - startPos;
  8974. if (b === -1) {
  8975. warn("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
  8976. stream.skip(-length);
  8977. return this.findDefaultInlineStreamEnd(stream);
  8978. }
  8979. this.inlineStreamSkipEI(stream);
  8980. return length;
  8981. }
  8982. findASCII85DecodeInlineStreamEnd(stream) {
  8983. const TILDE = 0x7e,
  8984. GT = 0x3e;
  8985. const startPos = stream.pos;
  8986. let ch;
  8987. while ((ch = stream.getByte()) !== -1) {
  8988. if (ch === TILDE) {
  8989. const tildePos = stream.pos;
  8990. ch = stream.peekByte();
  8991. while (isWhiteSpace(ch)) {
  8992. stream.skip();
  8993. ch = stream.peekByte();
  8994. }
  8995. if (ch === GT) {
  8996. stream.skip();
  8997. break;
  8998. }
  8999. if (stream.pos > tildePos) {
  9000. const maybeEI = stream.peekBytes(2);
  9001. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  9002. break;
  9003. }
  9004. }
  9005. }
  9006. }
  9007. const length = stream.pos - startPos;
  9008. if (ch === -1) {
  9009. warn("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  9010. stream.skip(-length);
  9011. return this.findDefaultInlineStreamEnd(stream);
  9012. }
  9013. this.inlineStreamSkipEI(stream);
  9014. return length;
  9015. }
  9016. findASCIIHexDecodeInlineStreamEnd(stream) {
  9017. const GT = 0x3e;
  9018. const startPos = stream.pos;
  9019. let ch;
  9020. while ((ch = stream.getByte()) !== -1) {
  9021. if (ch === GT) {
  9022. break;
  9023. }
  9024. }
  9025. const length = stream.pos - startPos;
  9026. if (ch === -1) {
  9027. warn("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  9028. stream.skip(-length);
  9029. return this.findDefaultInlineStreamEnd(stream);
  9030. }
  9031. this.inlineStreamSkipEI(stream);
  9032. return length;
  9033. }
  9034. inlineStreamSkipEI(stream) {
  9035. const E = 0x45,
  9036. I = 0x49;
  9037. let state = 0,
  9038. ch;
  9039. while ((ch = stream.getByte()) !== -1) {
  9040. if (state === 0) {
  9041. state = ch === E ? 1 : 0;
  9042. } else if (state === 1) {
  9043. state = ch === I ? 2 : 0;
  9044. } else if (state === 2) {
  9045. break;
  9046. }
  9047. }
  9048. }
  9049. makeInlineImage(cipherTransform) {
  9050. const lexer = this.lexer;
  9051. const stream = lexer.stream;
  9052. const dictMap = Object.create(null);
  9053. let dictLength;
  9054. while (!isCmd(this.buf1, "ID") && this.buf1 !== EOF) {
  9055. if (!(this.buf1 instanceof Name)) {
  9056. throw new FormatError("Dictionary key must be a name object");
  9057. }
  9058. const key = this.buf1.name;
  9059. this.shift();
  9060. if (this.buf1 === EOF) {
  9061. break;
  9062. }
  9063. dictMap[key] = this.getObj(cipherTransform);
  9064. }
  9065. if (lexer.beginInlineImagePos !== -1) {
  9066. dictLength = stream.pos - lexer.beginInlineImagePos;
  9067. }
  9068. const filter = this.xref.fetchIfRef(dictMap.F || dictMap.Filter);
  9069. let filterName;
  9070. if (filter instanceof Name) {
  9071. filterName = filter.name;
  9072. } else if (Array.isArray(filter)) {
  9073. const filterZero = this.xref.fetchIfRef(filter[0]);
  9074. if (filterZero instanceof Name) {
  9075. filterName = filterZero.name;
  9076. }
  9077. }
  9078. const startPos = stream.pos;
  9079. let length;
  9080. switch (filterName) {
  9081. case "DCT":
  9082. case "DCTDecode":
  9083. length = this.findDCTDecodeInlineStreamEnd(stream);
  9084. break;
  9085. case "A85":
  9086. case "ASCII85Decode":
  9087. length = this.findASCII85DecodeInlineStreamEnd(stream);
  9088. break;
  9089. case "AHx":
  9090. case "ASCIIHexDecode":
  9091. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  9092. break;
  9093. default:
  9094. length = this.findDefaultInlineStreamEnd(stream);
  9095. }
  9096. let cacheKey;
  9097. if (length < MAX_LENGTH_TO_CACHE && dictLength > 0) {
  9098. const initialStreamPos = stream.pos;
  9099. stream.pos = lexer.beginInlineImagePos;
  9100. cacheKey = getInlineImageCacheKey(stream.getBytes(dictLength + length));
  9101. stream.pos = initialStreamPos;
  9102. const cacheEntry = this.imageCache[cacheKey];
  9103. if (cacheEntry !== undefined) {
  9104. this.buf2 = Cmd.get("EI");
  9105. this.shift();
  9106. cacheEntry.reset();
  9107. return cacheEntry;
  9108. }
  9109. }
  9110. const dict = new Dict(this.xref);
  9111. for (const key in dictMap) {
  9112. dict.set(key, dictMap[key]);
  9113. }
  9114. let imageStream = stream.makeSubStream(startPos, length, dict);
  9115. if (cipherTransform) {
  9116. imageStream = cipherTransform.createStream(imageStream, length);
  9117. }
  9118. imageStream = this.filter(imageStream, dict, length);
  9119. imageStream.dict = dict;
  9120. if (cacheKey !== undefined) {
  9121. imageStream.cacheKey = `inline_img_${++this._imageId}`;
  9122. this.imageCache[cacheKey] = imageStream;
  9123. }
  9124. this.buf2 = Cmd.get("EI");
  9125. this.shift();
  9126. return imageStream;
  9127. }
  9128. #findStreamLength(startPos) {
  9129. const {
  9130. stream
  9131. } = this.lexer;
  9132. stream.pos = startPos;
  9133. const SCAN_BLOCK_LENGTH = 2048;
  9134. const signatureLength = "endstream".length;
  9135. const END_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64]);
  9136. const endLength = END_SIGNATURE.length;
  9137. const PARTIAL_SIGNATURE = [new Uint8Array([0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]), new Uint8Array([0x73, 0x74, 0x65, 0x61, 0x6d]), new Uint8Array([0x73, 0x74, 0x72, 0x65, 0x61])];
  9138. const normalLength = signatureLength - endLength;
  9139. while (stream.pos < stream.end) {
  9140. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  9141. const scanLength = scanBytes.length - signatureLength;
  9142. if (scanLength <= 0) {
  9143. break;
  9144. }
  9145. let pos = 0;
  9146. while (pos < scanLength) {
  9147. let j = 0;
  9148. while (j < endLength && scanBytes[pos + j] === END_SIGNATURE[j]) {
  9149. j++;
  9150. }
  9151. if (j >= endLength) {
  9152. let found = false;
  9153. for (const part of PARTIAL_SIGNATURE) {
  9154. const partLen = part.length;
  9155. let k = 0;
  9156. while (k < partLen && scanBytes[pos + j + k] === part[k]) {
  9157. k++;
  9158. }
  9159. if (k >= normalLength) {
  9160. found = true;
  9161. break;
  9162. }
  9163. if (k >= partLen) {
  9164. const lastByte = scanBytes[pos + j + k];
  9165. if (isWhiteSpace(lastByte)) {
  9166. info(`Found "${bytesToString([...END_SIGNATURE, ...part])}" when ` + "searching for endstream command.");
  9167. found = true;
  9168. }
  9169. break;
  9170. }
  9171. }
  9172. if (found) {
  9173. stream.pos += pos;
  9174. return stream.pos - startPos;
  9175. }
  9176. }
  9177. pos++;
  9178. }
  9179. stream.pos += scanLength;
  9180. }
  9181. return -1;
  9182. }
  9183. makeStream(dict, cipherTransform) {
  9184. const lexer = this.lexer;
  9185. let stream = lexer.stream;
  9186. lexer.skipToNextLine();
  9187. const startPos = stream.pos - 1;
  9188. let length = dict.get("Length");
  9189. if (!Number.isInteger(length)) {
  9190. info(`Bad length "${length && length.toString()}" in stream.`);
  9191. length = 0;
  9192. }
  9193. stream.pos = startPos + length;
  9194. lexer.nextChar();
  9195. if (this.tryShift() && isCmd(this.buf2, "endstream")) {
  9196. this.shift();
  9197. } else {
  9198. length = this.#findStreamLength(startPos);
  9199. if (length < 0) {
  9200. throw new FormatError("Missing endstream command.");
  9201. }
  9202. lexer.nextChar();
  9203. this.shift();
  9204. this.shift();
  9205. }
  9206. this.shift();
  9207. stream = stream.makeSubStream(startPos, length, dict);
  9208. if (cipherTransform) {
  9209. stream = cipherTransform.createStream(stream, length);
  9210. }
  9211. stream = this.filter(stream, dict, length);
  9212. stream.dict = dict;
  9213. return stream;
  9214. }
  9215. filter(stream, dict, length) {
  9216. let filter = dict.get("F", "Filter");
  9217. let params = dict.get("DP", "DecodeParms");
  9218. if (filter instanceof Name) {
  9219. if (Array.isArray(params)) {
  9220. warn("/DecodeParms should not be an Array, when /Filter is a Name.");
  9221. }
  9222. return this.makeFilter(stream, filter.name, length, params);
  9223. }
  9224. let maybeLength = length;
  9225. if (Array.isArray(filter)) {
  9226. const filterArray = filter;
  9227. const paramsArray = params;
  9228. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  9229. filter = this.xref.fetchIfRef(filterArray[i]);
  9230. if (!(filter instanceof Name)) {
  9231. throw new FormatError(`Bad filter name "${filter}"`);
  9232. }
  9233. params = null;
  9234. if (Array.isArray(paramsArray) && i in paramsArray) {
  9235. params = this.xref.fetchIfRef(paramsArray[i]);
  9236. }
  9237. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  9238. maybeLength = null;
  9239. }
  9240. }
  9241. return stream;
  9242. }
  9243. makeFilter(stream, name, maybeLength, params) {
  9244. if (maybeLength === 0) {
  9245. warn(`Empty "${name}" stream.`);
  9246. return new NullStream();
  9247. }
  9248. try {
  9249. switch (name) {
  9250. case "Fl":
  9251. case "FlateDecode":
  9252. if (params) {
  9253. return new PredictorStream(new FlateStream(stream, maybeLength), maybeLength, params);
  9254. }
  9255. return new FlateStream(stream, maybeLength);
  9256. case "LZW":
  9257. case "LZWDecode":
  9258. let earlyChange = 1;
  9259. if (params) {
  9260. if (params.has("EarlyChange")) {
  9261. earlyChange = params.get("EarlyChange");
  9262. }
  9263. return new PredictorStream(new LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  9264. }
  9265. return new LZWStream(stream, maybeLength, earlyChange);
  9266. case "DCT":
  9267. case "DCTDecode":
  9268. return new JpegStream(stream, maybeLength, params);
  9269. case "JPX":
  9270. case "JPXDecode":
  9271. return new JpxStream(stream, maybeLength, params);
  9272. case "A85":
  9273. case "ASCII85Decode":
  9274. return new Ascii85Stream(stream, maybeLength);
  9275. case "AHx":
  9276. case "ASCIIHexDecode":
  9277. return new AsciiHexStream(stream, maybeLength);
  9278. case "CCF":
  9279. case "CCITTFaxDecode":
  9280. return new CCITTFaxStream(stream, maybeLength, params);
  9281. case "RL":
  9282. case "RunLengthDecode":
  9283. return new RunLengthStream(stream, maybeLength);
  9284. case "JBIG2Decode":
  9285. return new Jbig2Stream(stream, maybeLength, params);
  9286. }
  9287. warn(`Filter "${name}" is not supported.`);
  9288. return stream;
  9289. } catch (ex) {
  9290. if (ex instanceof MissingDataException) {
  9291. throw ex;
  9292. }
  9293. warn(`Invalid stream: "${ex}"`);
  9294. return new NullStream();
  9295. }
  9296. }
  9297. }
  9298. const specialChars = [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
  9299. function toHexDigit(ch) {
  9300. if (ch >= 0x30 && ch <= 0x39) {
  9301. return ch & 0x0f;
  9302. }
  9303. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  9304. return (ch & 0x0f) + 9;
  9305. }
  9306. return -1;
  9307. }
  9308. class Lexer {
  9309. constructor(stream, knownCommands = null) {
  9310. this.stream = stream;
  9311. this.nextChar();
  9312. this.strBuf = [];
  9313. this.knownCommands = knownCommands;
  9314. this._hexStringNumWarn = 0;
  9315. this.beginInlineImagePos = -1;
  9316. }
  9317. nextChar() {
  9318. return this.currentChar = this.stream.getByte();
  9319. }
  9320. peekChar() {
  9321. return this.stream.peekByte();
  9322. }
  9323. getNumber() {
  9324. let ch = this.currentChar;
  9325. let eNotation = false;
  9326. let divideBy = 0;
  9327. let sign = 1;
  9328. if (ch === 0x2d) {
  9329. sign = -1;
  9330. ch = this.nextChar();
  9331. if (ch === 0x2d) {
  9332. ch = this.nextChar();
  9333. }
  9334. } else if (ch === 0x2b) {
  9335. ch = this.nextChar();
  9336. }
  9337. if (ch === 0x0a || ch === 0x0d) {
  9338. do {
  9339. ch = this.nextChar();
  9340. } while (ch === 0x0a || ch === 0x0d);
  9341. }
  9342. if (ch === 0x2e) {
  9343. divideBy = 10;
  9344. ch = this.nextChar();
  9345. }
  9346. if (ch < 0x30 || ch > 0x39) {
  9347. const msg = `Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`;
  9348. if (isWhiteSpace(ch) || ch === -1) {
  9349. info(`Lexer.getNumber - "${msg}".`);
  9350. return 0;
  9351. }
  9352. throw new FormatError(msg);
  9353. }
  9354. let baseValue = ch - 0x30;
  9355. let powerValue = 0;
  9356. let powerValueSign = 1;
  9357. while ((ch = this.nextChar()) >= 0) {
  9358. if (ch >= 0x30 && ch <= 0x39) {
  9359. const currentDigit = ch - 0x30;
  9360. if (eNotation) {
  9361. powerValue = powerValue * 10 + currentDigit;
  9362. } else {
  9363. if (divideBy !== 0) {
  9364. divideBy *= 10;
  9365. }
  9366. baseValue = baseValue * 10 + currentDigit;
  9367. }
  9368. } else if (ch === 0x2e) {
  9369. if (divideBy === 0) {
  9370. divideBy = 1;
  9371. } else {
  9372. break;
  9373. }
  9374. } else if (ch === 0x2d) {
  9375. warn("Badly formatted number: minus sign in the middle");
  9376. } else if (ch === 0x45 || ch === 0x65) {
  9377. ch = this.peekChar();
  9378. if (ch === 0x2b || ch === 0x2d) {
  9379. powerValueSign = ch === 0x2d ? -1 : 1;
  9380. this.nextChar();
  9381. } else if (ch < 0x30 || ch > 0x39) {
  9382. break;
  9383. }
  9384. eNotation = true;
  9385. } else {
  9386. break;
  9387. }
  9388. }
  9389. if (divideBy !== 0) {
  9390. baseValue /= divideBy;
  9391. }
  9392. if (eNotation) {
  9393. baseValue *= 10 ** (powerValueSign * powerValue);
  9394. }
  9395. return sign * baseValue;
  9396. }
  9397. getString() {
  9398. let numParen = 1;
  9399. let done = false;
  9400. const strBuf = this.strBuf;
  9401. strBuf.length = 0;
  9402. let ch = this.nextChar();
  9403. while (true) {
  9404. let charBuffered = false;
  9405. switch (ch | 0) {
  9406. case -1:
  9407. warn("Unterminated string");
  9408. done = true;
  9409. break;
  9410. case 0x28:
  9411. ++numParen;
  9412. strBuf.push("(");
  9413. break;
  9414. case 0x29:
  9415. if (--numParen === 0) {
  9416. this.nextChar();
  9417. done = true;
  9418. } else {
  9419. strBuf.push(")");
  9420. }
  9421. break;
  9422. case 0x5c:
  9423. ch = this.nextChar();
  9424. switch (ch) {
  9425. case -1:
  9426. warn("Unterminated string");
  9427. done = true;
  9428. break;
  9429. case 0x6e:
  9430. strBuf.push("\n");
  9431. break;
  9432. case 0x72:
  9433. strBuf.push("\r");
  9434. break;
  9435. case 0x74:
  9436. strBuf.push("\t");
  9437. break;
  9438. case 0x62:
  9439. strBuf.push("\b");
  9440. break;
  9441. case 0x66:
  9442. strBuf.push("\f");
  9443. break;
  9444. case 0x5c:
  9445. case 0x28:
  9446. case 0x29:
  9447. strBuf.push(String.fromCharCode(ch));
  9448. break;
  9449. case 0x30:
  9450. case 0x31:
  9451. case 0x32:
  9452. case 0x33:
  9453. case 0x34:
  9454. case 0x35:
  9455. case 0x36:
  9456. case 0x37:
  9457. let x = ch & 0x0f;
  9458. ch = this.nextChar();
  9459. charBuffered = true;
  9460. if (ch >= 0x30 && ch <= 0x37) {
  9461. x = (x << 3) + (ch & 0x0f);
  9462. ch = this.nextChar();
  9463. if (ch >= 0x30 && ch <= 0x37) {
  9464. charBuffered = false;
  9465. x = (x << 3) + (ch & 0x0f);
  9466. }
  9467. }
  9468. strBuf.push(String.fromCharCode(x));
  9469. break;
  9470. case 0x0d:
  9471. if (this.peekChar() === 0x0a) {
  9472. this.nextChar();
  9473. }
  9474. break;
  9475. case 0x0a:
  9476. break;
  9477. default:
  9478. strBuf.push(String.fromCharCode(ch));
  9479. break;
  9480. }
  9481. break;
  9482. default:
  9483. strBuf.push(String.fromCharCode(ch));
  9484. break;
  9485. }
  9486. if (done) {
  9487. break;
  9488. }
  9489. if (!charBuffered) {
  9490. ch = this.nextChar();
  9491. }
  9492. }
  9493. return strBuf.join("");
  9494. }
  9495. getName() {
  9496. let ch, previousCh;
  9497. const strBuf = this.strBuf;
  9498. strBuf.length = 0;
  9499. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  9500. if (ch === 0x23) {
  9501. ch = this.nextChar();
  9502. if (specialChars[ch]) {
  9503. warn("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
  9504. strBuf.push("#");
  9505. break;
  9506. }
  9507. const x = toHexDigit(ch);
  9508. if (x !== -1) {
  9509. previousCh = ch;
  9510. ch = this.nextChar();
  9511. const x2 = toHexDigit(ch);
  9512. if (x2 === -1) {
  9513. warn(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
  9514. strBuf.push("#", String.fromCharCode(previousCh));
  9515. if (specialChars[ch]) {
  9516. break;
  9517. }
  9518. strBuf.push(String.fromCharCode(ch));
  9519. continue;
  9520. }
  9521. strBuf.push(String.fromCharCode(x << 4 | x2));
  9522. } else {
  9523. strBuf.push("#", String.fromCharCode(ch));
  9524. }
  9525. } else {
  9526. strBuf.push(String.fromCharCode(ch));
  9527. }
  9528. }
  9529. if (strBuf.length > 127) {
  9530. warn(`Name token is longer than allowed by the spec: ${strBuf.length}`);
  9531. }
  9532. return Name.get(strBuf.join(""));
  9533. }
  9534. _hexStringWarn(ch) {
  9535. const MAX_HEX_STRING_NUM_WARN = 5;
  9536. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  9537. warn("getHexString - ignoring additional invalid characters.");
  9538. return;
  9539. }
  9540. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  9541. return;
  9542. }
  9543. warn(`getHexString - ignoring invalid character: ${ch}`);
  9544. }
  9545. getHexString() {
  9546. const strBuf = this.strBuf;
  9547. strBuf.length = 0;
  9548. let ch = this.currentChar;
  9549. let firstDigit = -1,
  9550. digit = -1;
  9551. this._hexStringNumWarn = 0;
  9552. while (true) {
  9553. if (ch < 0) {
  9554. warn("Unterminated hex string");
  9555. break;
  9556. } else if (ch === 0x3e) {
  9557. this.nextChar();
  9558. break;
  9559. } else if (specialChars[ch] === 1) {
  9560. ch = this.nextChar();
  9561. continue;
  9562. } else {
  9563. digit = toHexDigit(ch);
  9564. if (digit === -1) {
  9565. this._hexStringWarn(ch);
  9566. } else if (firstDigit === -1) {
  9567. firstDigit = digit;
  9568. } else {
  9569. strBuf.push(String.fromCharCode(firstDigit << 4 | digit));
  9570. firstDigit = -1;
  9571. }
  9572. ch = this.nextChar();
  9573. }
  9574. }
  9575. if (firstDigit !== -1) {
  9576. strBuf.push(String.fromCharCode(firstDigit << 4));
  9577. }
  9578. return strBuf.join("");
  9579. }
  9580. getObj() {
  9581. let comment = false;
  9582. let ch = this.currentChar;
  9583. while (true) {
  9584. if (ch < 0) {
  9585. return EOF;
  9586. }
  9587. if (comment) {
  9588. if (ch === 0x0a || ch === 0x0d) {
  9589. comment = false;
  9590. }
  9591. } else if (ch === 0x25) {
  9592. comment = true;
  9593. } else if (specialChars[ch] !== 1) {
  9594. break;
  9595. }
  9596. ch = this.nextChar();
  9597. }
  9598. switch (ch | 0) {
  9599. case 0x30:
  9600. case 0x31:
  9601. case 0x32:
  9602. case 0x33:
  9603. case 0x34:
  9604. case 0x35:
  9605. case 0x36:
  9606. case 0x37:
  9607. case 0x38:
  9608. case 0x39:
  9609. case 0x2b:
  9610. case 0x2d:
  9611. case 0x2e:
  9612. return this.getNumber();
  9613. case 0x28:
  9614. return this.getString();
  9615. case 0x2f:
  9616. return this.getName();
  9617. case 0x5b:
  9618. this.nextChar();
  9619. return Cmd.get("[");
  9620. case 0x5d:
  9621. this.nextChar();
  9622. return Cmd.get("]");
  9623. case 0x3c:
  9624. ch = this.nextChar();
  9625. if (ch === 0x3c) {
  9626. this.nextChar();
  9627. return Cmd.get("<<");
  9628. }
  9629. return this.getHexString();
  9630. case 0x3e:
  9631. ch = this.nextChar();
  9632. if (ch === 0x3e) {
  9633. this.nextChar();
  9634. return Cmd.get(">>");
  9635. }
  9636. return Cmd.get(">");
  9637. case 0x7b:
  9638. this.nextChar();
  9639. return Cmd.get("{");
  9640. case 0x7d:
  9641. this.nextChar();
  9642. return Cmd.get("}");
  9643. case 0x29:
  9644. this.nextChar();
  9645. throw new FormatError(`Illegal character: ${ch}`);
  9646. }
  9647. let str = String.fromCharCode(ch);
  9648. if (ch < 0x20 || ch > 0x7f) {
  9649. const nextCh = this.peekChar();
  9650. if (nextCh >= 0x20 && nextCh <= 0x7f) {
  9651. this.nextChar();
  9652. return Cmd.get(str);
  9653. }
  9654. }
  9655. const knownCommands = this.knownCommands;
  9656. let knownCommandFound = knownCommands?.[str] !== undefined;
  9657. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  9658. const possibleCommand = str + String.fromCharCode(ch);
  9659. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  9660. break;
  9661. }
  9662. if (str.length === 128) {
  9663. throw new FormatError(`Command token too long: ${str.length}`);
  9664. }
  9665. str = possibleCommand;
  9666. knownCommandFound = knownCommands?.[str] !== undefined;
  9667. }
  9668. if (str === "true") {
  9669. return true;
  9670. }
  9671. if (str === "false") {
  9672. return false;
  9673. }
  9674. if (str === "null") {
  9675. return null;
  9676. }
  9677. if (str === "BI") {
  9678. this.beginInlineImagePos = this.stream.pos;
  9679. }
  9680. return Cmd.get(str);
  9681. }
  9682. skipToNextLine() {
  9683. let ch = this.currentChar;
  9684. while (ch >= 0) {
  9685. if (ch === 0x0d) {
  9686. ch = this.nextChar();
  9687. if (ch === 0x0a) {
  9688. this.nextChar();
  9689. }
  9690. break;
  9691. } else if (ch === 0x0a) {
  9692. this.nextChar();
  9693. break;
  9694. }
  9695. ch = this.nextChar();
  9696. }
  9697. }
  9698. }
  9699. class Linearization {
  9700. static create(stream) {
  9701. function getInt(linDict, name, allowZeroValue = false) {
  9702. const obj = linDict.get(name);
  9703. if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  9704. return obj;
  9705. }
  9706. throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
  9707. }
  9708. function getHints(linDict) {
  9709. const hints = linDict.get("H");
  9710. let hintsLength;
  9711. if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  9712. for (let index = 0; index < hintsLength; index++) {
  9713. const hint = hints[index];
  9714. if (!(Number.isInteger(hint) && hint > 0)) {
  9715. throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
  9716. }
  9717. }
  9718. return hints;
  9719. }
  9720. throw new Error("Hint array in the linearization dictionary is invalid.");
  9721. }
  9722. const parser = new Parser({
  9723. lexer: new Lexer(stream),
  9724. xref: null
  9725. });
  9726. const obj1 = parser.getObj();
  9727. const obj2 = parser.getObj();
  9728. const obj3 = parser.getObj();
  9729. const linDict = parser.getObj();
  9730. let obj, length;
  9731. if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && isCmd(obj3, "obj") && linDict instanceof Dict && typeof (obj = linDict.get("Linearized")) === "number" && obj > 0)) {
  9732. return null;
  9733. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  9734. throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
  9735. }
  9736. return {
  9737. length,
  9738. hints: getHints(linDict),
  9739. objectNumberFirst: getInt(linDict, "O"),
  9740. endFirst: getInt(linDict, "E"),
  9741. numPages: getInt(linDict, "N"),
  9742. mainXRefEntriesOffset: getInt(linDict, "T"),
  9743. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
  9744. };
  9745. }
  9746. }
  9747. ;// ./src/core/cmap.js
  9748. const BUILT_IN_CMAPS = ["Adobe-GB1-UCS2", "Adobe-CNS1-UCS2", "Adobe-Japan1-UCS2", "Adobe-Korea1-UCS2", "78-EUC-H", "78-EUC-V", "78-H", "78-RKSJ-H", "78-RKSJ-V", "78-V", "78ms-RKSJ-H", "78ms-RKSJ-V", "83pv-RKSJ-H", "90ms-RKSJ-H", "90ms-RKSJ-V", "90msp-RKSJ-H", "90msp-RKSJ-V", "90pv-RKSJ-H", "90pv-RKSJ-V", "Add-H", "Add-RKSJ-H", "Add-RKSJ-V", "Add-V", "Adobe-CNS1-0", "Adobe-CNS1-1", "Adobe-CNS1-2", "Adobe-CNS1-3", "Adobe-CNS1-4", "Adobe-CNS1-5", "Adobe-CNS1-6", "Adobe-GB1-0", "Adobe-GB1-1", "Adobe-GB1-2", "Adobe-GB1-3", "Adobe-GB1-4", "Adobe-GB1-5", "Adobe-Japan1-0", "Adobe-Japan1-1", "Adobe-Japan1-2", "Adobe-Japan1-3", "Adobe-Japan1-4", "Adobe-Japan1-5", "Adobe-Japan1-6", "Adobe-Korea1-0", "Adobe-Korea1-1", "Adobe-Korea1-2", "B5-H", "B5-V", "B5pc-H", "B5pc-V", "CNS-EUC-H", "CNS-EUC-V", "CNS1-H", "CNS1-V", "CNS2-H", "CNS2-V", "ETHK-B5-H", "ETHK-B5-V", "ETen-B5-H", "ETen-B5-V", "ETenms-B5-H", "ETenms-B5-V", "EUC-H", "EUC-V", "Ext-H", "Ext-RKSJ-H", "Ext-RKSJ-V", "Ext-V", "GB-EUC-H", "GB-EUC-V", "GB-H", "GB-V", "GBK-EUC-H", "GBK-EUC-V", "GBK2K-H", "GBK2K-V", "GBKp-EUC-H", "GBKp-EUC-V", "GBT-EUC-H", "GBT-EUC-V", "GBT-H", "GBT-V", "GBTpc-EUC-H", "GBTpc-EUC-V", "GBpc-EUC-H", "GBpc-EUC-V", "H", "HKdla-B5-H", "HKdla-B5-V", "HKdlb-B5-H", "HKdlb-B5-V", "HKgccs-B5-H", "HKgccs-B5-V", "HKm314-B5-H", "HKm314-B5-V", "HKm471-B5-H", "HKm471-B5-V", "HKscs-B5-H", "HKscs-B5-V", "Hankaku", "Hiragana", "KSC-EUC-H", "KSC-EUC-V", "KSC-H", "KSC-Johab-H", "KSC-Johab-V", "KSC-V", "KSCms-UHC-H", "KSCms-UHC-HW-H", "KSCms-UHC-HW-V", "KSCms-UHC-V", "KSCpc-EUC-H", "KSCpc-EUC-V", "Katakana", "NWP-H", "NWP-V", "RKSJ-H", "RKSJ-V", "Roman", "UniCNS-UCS2-H", "UniCNS-UCS2-V", "UniCNS-UTF16-H", "UniCNS-UTF16-V", "UniCNS-UTF32-H", "UniCNS-UTF32-V", "UniCNS-UTF8-H", "UniCNS-UTF8-V", "UniGB-UCS2-H", "UniGB-UCS2-V", "UniGB-UTF16-H", "UniGB-UTF16-V", "UniGB-UTF32-H", "UniGB-UTF32-V", "UniGB-UTF8-H", "UniGB-UTF8-V", "UniJIS-UCS2-H", "UniJIS-UCS2-HW-H", "UniJIS-UCS2-HW-V", "UniJIS-UCS2-V", "UniJIS-UTF16-H", "UniJIS-UTF16-V", "UniJIS-UTF32-H", "UniJIS-UTF32-V", "UniJIS-UTF8-H", "UniJIS-UTF8-V", "UniJIS2004-UTF16-H", "UniJIS2004-UTF16-V", "UniJIS2004-UTF32-H", "UniJIS2004-UTF32-V", "UniJIS2004-UTF8-H", "UniJIS2004-UTF8-V", "UniJISPro-UCS2-HW-V", "UniJISPro-UCS2-V", "UniJISPro-UTF8-V", "UniJISX0213-UTF32-H", "UniJISX0213-UTF32-V", "UniJISX02132004-UTF32-H", "UniJISX02132004-UTF32-V", "UniKS-UCS2-H", "UniKS-UCS2-V", "UniKS-UTF16-H", "UniKS-UTF16-V", "UniKS-UTF32-H", "UniKS-UTF32-V", "UniKS-UTF8-H", "UniKS-UTF8-V", "V", "WP-Symbol"];
  9749. const MAX_MAP_RANGE = 2 ** 24 - 1;
  9750. class CMap {
  9751. constructor(builtInCMap = false) {
  9752. this.codespaceRanges = [[], [], [], []];
  9753. this.numCodespaceRanges = 0;
  9754. this._map = [];
  9755. this.name = "";
  9756. this.vertical = false;
  9757. this.useCMap = null;
  9758. this.builtInCMap = builtInCMap;
  9759. }
  9760. addCodespaceRange(n, low, high) {
  9761. this.codespaceRanges[n - 1].push(low, high);
  9762. this.numCodespaceRanges++;
  9763. }
  9764. mapCidRange(low, high, dstLow) {
  9765. if (high - low > MAX_MAP_RANGE) {
  9766. throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
  9767. }
  9768. while (low <= high) {
  9769. this._map[low++] = dstLow++;
  9770. }
  9771. }
  9772. mapBfRange(low, high, dstLow) {
  9773. if (high - low > MAX_MAP_RANGE) {
  9774. throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
  9775. }
  9776. const lastByte = dstLow.length - 1;
  9777. while (low <= high) {
  9778. this._map[low++] = dstLow;
  9779. const nextCharCode = dstLow.charCodeAt(lastByte) + 1;
  9780. if (nextCharCode > 0xff) {
  9781. dstLow = dstLow.substring(0, lastByte - 1) + String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 1) + "\x00";
  9782. continue;
  9783. }
  9784. dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(nextCharCode);
  9785. }
  9786. }
  9787. mapBfRangeToArray(low, high, array) {
  9788. if (high - low > MAX_MAP_RANGE) {
  9789. throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
  9790. }
  9791. const ii = array.length;
  9792. let i = 0;
  9793. while (low <= high && i < ii) {
  9794. this._map[low] = array[i++];
  9795. ++low;
  9796. }
  9797. }
  9798. mapOne(src, dst) {
  9799. this._map[src] = dst;
  9800. }
  9801. lookup(code) {
  9802. return this._map[code];
  9803. }
  9804. contains(code) {
  9805. return this._map[code] !== undefined;
  9806. }
  9807. forEach(callback) {
  9808. const map = this._map;
  9809. const length = map.length;
  9810. if (length <= 0x10000) {
  9811. for (let i = 0; i < length; i++) {
  9812. if (map[i] !== undefined) {
  9813. callback(i, map[i]);
  9814. }
  9815. }
  9816. } else {
  9817. for (const i in map) {
  9818. callback(i, map[i]);
  9819. }
  9820. }
  9821. }
  9822. charCodeOf(value) {
  9823. const map = this._map;
  9824. if (map.length <= 0x10000) {
  9825. return map.indexOf(value);
  9826. }
  9827. for (const charCode in map) {
  9828. if (map[charCode] === value) {
  9829. return charCode | 0;
  9830. }
  9831. }
  9832. return -1;
  9833. }
  9834. getMap() {
  9835. return this._map;
  9836. }
  9837. readCharCode(str, offset, out) {
  9838. let c = 0;
  9839. const codespaceRanges = this.codespaceRanges;
  9840. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  9841. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  9842. const codespaceRange = codespaceRanges[n];
  9843. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  9844. const low = codespaceRange[k++];
  9845. const high = codespaceRange[k++];
  9846. if (c >= low && c <= high) {
  9847. out.charcode = c;
  9848. out.length = n + 1;
  9849. return;
  9850. }
  9851. }
  9852. }
  9853. out.charcode = 0;
  9854. out.length = 1;
  9855. }
  9856. getCharCodeLength(charCode) {
  9857. const codespaceRanges = this.codespaceRanges;
  9858. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  9859. const codespaceRange = codespaceRanges[n];
  9860. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  9861. const low = codespaceRange[k++];
  9862. const high = codespaceRange[k++];
  9863. if (charCode >= low && charCode <= high) {
  9864. return n + 1;
  9865. }
  9866. }
  9867. }
  9868. return 1;
  9869. }
  9870. get length() {
  9871. return this._map.length;
  9872. }
  9873. get isIdentityCMap() {
  9874. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  9875. return false;
  9876. }
  9877. if (this._map.length !== 0x10000) {
  9878. return false;
  9879. }
  9880. for (let i = 0; i < 0x10000; i++) {
  9881. if (this._map[i] !== i) {
  9882. return false;
  9883. }
  9884. }
  9885. return true;
  9886. }
  9887. }
  9888. class IdentityCMap extends CMap {
  9889. constructor(vertical, n) {
  9890. super();
  9891. this.vertical = vertical;
  9892. this.addCodespaceRange(n, 0, 0xffff);
  9893. }
  9894. mapCidRange(low, high, dstLow) {
  9895. unreachable("should not call mapCidRange");
  9896. }
  9897. mapBfRange(low, high, dstLow) {
  9898. unreachable("should not call mapBfRange");
  9899. }
  9900. mapBfRangeToArray(low, high, array) {
  9901. unreachable("should not call mapBfRangeToArray");
  9902. }
  9903. mapOne(src, dst) {
  9904. unreachable("should not call mapCidOne");
  9905. }
  9906. lookup(code) {
  9907. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  9908. }
  9909. contains(code) {
  9910. return Number.isInteger(code) && code <= 0xffff;
  9911. }
  9912. forEach(callback) {
  9913. for (let i = 0; i <= 0xffff; i++) {
  9914. callback(i, i);
  9915. }
  9916. }
  9917. charCodeOf(value) {
  9918. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  9919. }
  9920. getMap() {
  9921. const map = new Array(0x10000);
  9922. for (let i = 0; i <= 0xffff; i++) {
  9923. map[i] = i;
  9924. }
  9925. return map;
  9926. }
  9927. get length() {
  9928. return 0x10000;
  9929. }
  9930. get isIdentityCMap() {
  9931. unreachable("should not access .isIdentityCMap");
  9932. }
  9933. }
  9934. function strToInt(str) {
  9935. let a = 0;
  9936. for (let i = 0; i < str.length; i++) {
  9937. a = a << 8 | str.charCodeAt(i);
  9938. }
  9939. return a >>> 0;
  9940. }
  9941. function expectString(obj) {
  9942. if (typeof obj !== "string") {
  9943. throw new FormatError("Malformed CMap: expected string.");
  9944. }
  9945. }
  9946. function expectInt(obj) {
  9947. if (!Number.isInteger(obj)) {
  9948. throw new FormatError("Malformed CMap: expected int.");
  9949. }
  9950. }
  9951. function parseBfChar(cMap, lexer) {
  9952. while (true) {
  9953. let obj = lexer.getObj();
  9954. if (obj === EOF) {
  9955. break;
  9956. }
  9957. if (isCmd(obj, "endbfchar")) {
  9958. return;
  9959. }
  9960. expectString(obj);
  9961. const src = strToInt(obj);
  9962. obj = lexer.getObj();
  9963. expectString(obj);
  9964. const dst = obj;
  9965. cMap.mapOne(src, dst);
  9966. }
  9967. }
  9968. function parseBfRange(cMap, lexer) {
  9969. while (true) {
  9970. let obj = lexer.getObj();
  9971. if (obj === EOF) {
  9972. break;
  9973. }
  9974. if (isCmd(obj, "endbfrange")) {
  9975. return;
  9976. }
  9977. expectString(obj);
  9978. const low = strToInt(obj);
  9979. obj = lexer.getObj();
  9980. expectString(obj);
  9981. const high = strToInt(obj);
  9982. obj = lexer.getObj();
  9983. if (Number.isInteger(obj) || typeof obj === "string") {
  9984. const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
  9985. cMap.mapBfRange(low, high, dstLow);
  9986. } else if (isCmd(obj, "[")) {
  9987. obj = lexer.getObj();
  9988. const array = [];
  9989. while (!isCmd(obj, "]") && obj !== EOF) {
  9990. array.push(obj);
  9991. obj = lexer.getObj();
  9992. }
  9993. cMap.mapBfRangeToArray(low, high, array);
  9994. } else {
  9995. break;
  9996. }
  9997. }
  9998. throw new FormatError("Invalid bf range.");
  9999. }
  10000. function parseCidChar(cMap, lexer) {
  10001. while (true) {
  10002. let obj = lexer.getObj();
  10003. if (obj === EOF) {
  10004. break;
  10005. }
  10006. if (isCmd(obj, "endcidchar")) {
  10007. return;
  10008. }
  10009. expectString(obj);
  10010. const src = strToInt(obj);
  10011. obj = lexer.getObj();
  10012. expectInt(obj);
  10013. const dst = obj;
  10014. cMap.mapOne(src, dst);
  10015. }
  10016. }
  10017. function parseCidRange(cMap, lexer) {
  10018. while (true) {
  10019. let obj = lexer.getObj();
  10020. if (obj === EOF) {
  10021. break;
  10022. }
  10023. if (isCmd(obj, "endcidrange")) {
  10024. return;
  10025. }
  10026. expectString(obj);
  10027. const low = strToInt(obj);
  10028. obj = lexer.getObj();
  10029. expectString(obj);
  10030. const high = strToInt(obj);
  10031. obj = lexer.getObj();
  10032. expectInt(obj);
  10033. const dstLow = obj;
  10034. cMap.mapCidRange(low, high, dstLow);
  10035. }
  10036. }
  10037. function parseCodespaceRange(cMap, lexer) {
  10038. while (true) {
  10039. let obj = lexer.getObj();
  10040. if (obj === EOF) {
  10041. break;
  10042. }
  10043. if (isCmd(obj, "endcodespacerange")) {
  10044. return;
  10045. }
  10046. if (typeof obj !== "string") {
  10047. break;
  10048. }
  10049. const low = strToInt(obj);
  10050. obj = lexer.getObj();
  10051. if (typeof obj !== "string") {
  10052. break;
  10053. }
  10054. const high = strToInt(obj);
  10055. cMap.addCodespaceRange(obj.length, low, high);
  10056. }
  10057. throw new FormatError("Invalid codespace range.");
  10058. }
  10059. function parseWMode(cMap, lexer) {
  10060. const obj = lexer.getObj();
  10061. if (Number.isInteger(obj)) {
  10062. cMap.vertical = !!obj;
  10063. }
  10064. }
  10065. function parseCMapName(cMap, lexer) {
  10066. const obj = lexer.getObj();
  10067. if (obj instanceof Name) {
  10068. cMap.name = obj.name;
  10069. }
  10070. }
  10071. async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  10072. let previous, embeddedUseCMap;
  10073. objLoop: while (true) {
  10074. try {
  10075. const obj = lexer.getObj();
  10076. if (obj === EOF) {
  10077. break;
  10078. } else if (obj instanceof Name) {
  10079. if (obj.name === "WMode") {
  10080. parseWMode(cMap, lexer);
  10081. } else if (obj.name === "CMapName") {
  10082. parseCMapName(cMap, lexer);
  10083. }
  10084. previous = obj;
  10085. } else if (obj instanceof Cmd) {
  10086. switch (obj.cmd) {
  10087. case "endcmap":
  10088. break objLoop;
  10089. case "usecmap":
  10090. if (previous instanceof Name) {
  10091. embeddedUseCMap = previous.name;
  10092. }
  10093. break;
  10094. case "begincodespacerange":
  10095. parseCodespaceRange(cMap, lexer);
  10096. break;
  10097. case "beginbfchar":
  10098. parseBfChar(cMap, lexer);
  10099. break;
  10100. case "begincidchar":
  10101. parseCidChar(cMap, lexer);
  10102. break;
  10103. case "beginbfrange":
  10104. parseBfRange(cMap, lexer);
  10105. break;
  10106. case "begincidrange":
  10107. parseCidRange(cMap, lexer);
  10108. break;
  10109. }
  10110. }
  10111. } catch (ex) {
  10112. if (ex instanceof MissingDataException) {
  10113. throw ex;
  10114. }
  10115. warn("Invalid cMap data: " + ex);
  10116. continue;
  10117. }
  10118. }
  10119. if (!useCMap && embeddedUseCMap) {
  10120. useCMap = embeddedUseCMap;
  10121. }
  10122. if (useCMap) {
  10123. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  10124. }
  10125. return cMap;
  10126. }
  10127. async function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  10128. cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap);
  10129. if (cMap.numCodespaceRanges === 0) {
  10130. const useCodespaceRanges = cMap.useCMap.codespaceRanges;
  10131. for (let i = 0; i < useCodespaceRanges.length; i++) {
  10132. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  10133. }
  10134. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  10135. }
  10136. cMap.useCMap.forEach(function (key, value) {
  10137. if (!cMap.contains(key)) {
  10138. cMap.mapOne(key, cMap.useCMap.lookup(key));
  10139. }
  10140. });
  10141. return cMap;
  10142. }
  10143. async function createBuiltInCMap(name, fetchBuiltInCMap) {
  10144. if (name === "Identity-H") {
  10145. return new IdentityCMap(false, 2);
  10146. } else if (name === "Identity-V") {
  10147. return new IdentityCMap(true, 2);
  10148. }
  10149. if (!BUILT_IN_CMAPS.includes(name)) {
  10150. throw new Error("Unknown CMap name: " + name);
  10151. }
  10152. if (!fetchBuiltInCMap) {
  10153. throw new Error("Built-in CMap parameters are not provided.");
  10154. }
  10155. const {
  10156. cMapData,
  10157. isCompressed
  10158. } = await fetchBuiltInCMap(name);
  10159. const cMap = new CMap(true);
  10160. if (isCompressed) {
  10161. return new BinaryCMapReader().process(cMapData, cMap, useCMap => extendCMap(cMap, fetchBuiltInCMap, useCMap));
  10162. }
  10163. const lexer = new Lexer(new Stream(cMapData));
  10164. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  10165. }
  10166. class CMapFactory {
  10167. static async create({
  10168. encoding,
  10169. fetchBuiltInCMap,
  10170. useCMap
  10171. }) {
  10172. if (encoding instanceof Name) {
  10173. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  10174. } else if (encoding instanceof BaseStream) {
  10175. const parsedCMap = await parseCMap(new CMap(), new Lexer(encoding), fetchBuiltInCMap, useCMap);
  10176. if (parsedCMap.isIdentityCMap) {
  10177. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  10178. }
  10179. return parsedCMap;
  10180. }
  10181. throw new Error("Encoding required.");
  10182. }
  10183. }
  10184. ;// ./src/core/charsets.js
  10185. const ISOAdobeCharset = [".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodcentered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron"];
  10186. const ExpertCharset = [".notdef", "space", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "onequarter", "onehalf", "threequarters", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall"];
  10187. const ExpertSubsetCharset = [".notdef", "space", "dollaroldstyle", "dollarsuperior", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "hyphensuperior", "colonmonetary", "onefitted", "rupiah", "centoldstyle", "figuredash", "hypheninferior", "onequarter", "onehalf", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior"];
  10188. ;// ./src/core/encodings.js
  10189. const ExpertEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclamsmall", "Hungarumlautsmall", "", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "", "", "", "isuperior", "", "", "lsuperior", "msuperior", "nsuperior", "osuperior", "", "", "rsuperior", "ssuperior", "tsuperior", "", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "exclamdownsmall", "centoldstyle", "Lslashsmall", "", "", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "", "Dotaccentsmall", "", "", "Macronsmall", "", "", "figuredash", "hypheninferior", "", "", "Ogoneksmall", "Ringsmall", "Cedillasmall", "", "", "", "onequarter", "onehalf", "threequarters", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "", "", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall"];
  10190. const MacExpertEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclamsmall", "Hungarumlautsmall", "centoldstyle", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "", "threequartersemdash", "", "questionsmall", "", "", "", "", "Ethsmall", "", "", "onequarter", "onehalf", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "", "", "", "", "", "", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "", "parenrightinferior", "Circumflexsmall", "hypheninferior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "", "", "asuperior", "centsuperior", "", "", "", "", "Aacutesmall", "Agravesmall", "Acircumflexsmall", "Adieresissmall", "Atildesmall", "Aringsmall", "Ccedillasmall", "Eacutesmall", "Egravesmall", "Ecircumflexsmall", "Edieresissmall", "Iacutesmall", "Igravesmall", "Icircumflexsmall", "Idieresissmall", "Ntildesmall", "Oacutesmall", "Ogravesmall", "Ocircumflexsmall", "Odieresissmall", "Otildesmall", "Uacutesmall", "Ugravesmall", "Ucircumflexsmall", "Udieresissmall", "", "eightsuperior", "fourinferior", "threeinferior", "sixinferior", "eightinferior", "seveninferior", "Scaronsmall", "", "centinferior", "twoinferior", "", "Dieresissmall", "", "Caronsmall", "osuperior", "fiveinferior", "", "commainferior", "periodinferior", "Yacutesmall", "", "dollarinferior", "", "", "Thornsmall", "", "nineinferior", "zeroinferior", "Zcaronsmall", "AEsmall", "Oslashsmall", "questiondownsmall", "oneinferior", "Lslashsmall", "", "", "", "", "", "", "Cedillasmall", "", "", "", "", "", "OEsmall", "figuredash", "hyphensuperior", "", "", "", "", "exclamdownsmall", "", "Ydieresissmall", "", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "ninesuperior", "zerosuperior", "", "esuperior", "rsuperior", "tsuperior", "", "", "isuperior", "ssuperior", "dsuperior", "", "", "", "", "", "lsuperior", "Ogoneksmall", "Brevesmall", "Macronsmall", "bsuperior", "nsuperior", "msuperior", "commasuperior", "periodsuperior", "Dotaccentsmall", "Ringsmall", "", "", "", ""];
  10191. const MacRomanEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "", "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", "section", "bullet", "paragraph", "germandbls", "registered", "copyright", "trademark", "acute", "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", "mu", "partialdiff", "summation", "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", "florin", "approxequal", "Delta", "guillemotleft", "guillemotright", "ellipsis", "space", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron"];
  10192. const StandardEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "", "endash", "dagger", "daggerdbl", "periodcentered", "", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "", "questiondown", "", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "", "ring", "cedilla", "", "hungarumlaut", "ogonek", "caron", "emdash", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "AE", "", "ordfeminine", "", "", "", "", "Lslash", "Oslash", "OE", "ordmasculine", "", "", "", "", "", "ae", "", "", "", "dotlessi", "", "", "lslash", "oslash", "oe", "germandbls", "", "", "", ""];
  10193. const WinAnsiEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "bullet", "Euro", "bullet", "quotesinglbase", "florin", "quotedblbase", "ellipsis", "dagger", "daggerdbl", "circumflex", "perthousand", "Scaron", "guilsinglleft", "OE", "bullet", "Zcaron", "bullet", "bullet", "quoteleft", "quoteright", "quotedblleft", "quotedblright", "bullet", "endash", "emdash", "tilde", "trademark", "scaron", "guilsinglright", "oe", "bullet", "zcaron", "Ydieresis", "space", "exclamdown", "cent", "sterling", "currency", "yen", "brokenbar", "section", "dieresis", "copyright", "ordfeminine", "guillemotleft", "logicalnot", "hyphen", "registered", "macron", "degree", "plusminus", "twosuperior", "threesuperior", "acute", "mu", "paragraph", "periodcentered", "cedilla", "onesuperior", "ordmasculine", "guillemotright", "onequarter", "onehalf", "threequarters", "questiondown", "Agrave", "Aacute", "Acircumflex", "Atilde", "Adieresis", "Aring", "AE", "Ccedilla", "Egrave", "Eacute", "Ecircumflex", "Edieresis", "Igrave", "Iacute", "Icircumflex", "Idieresis", "Eth", "Ntilde", "Ograve", "Oacute", "Ocircumflex", "Otilde", "Odieresis", "multiply", "Oslash", "Ugrave", "Uacute", "Ucircumflex", "Udieresis", "Yacute", "Thorn", "germandbls", "agrave", "aacute", "acircumflex", "atilde", "adieresis", "aring", "ae", "ccedilla", "egrave", "eacute", "ecircumflex", "edieresis", "igrave", "iacute", "icircumflex", "idieresis", "eth", "ntilde", "ograve", "oacute", "ocircumflex", "otilde", "odieresis", "divide", "oslash", "ugrave", "uacute", "ucircumflex", "udieresis", "yacute", "thorn", "ydieresis"];
  10194. const SymbolSetEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "universal", "numbersign", "existential", "percent", "ampersand", "suchthat", "parenleft", "parenright", "asteriskmath", "plus", "comma", "minus", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "congruent", "Alpha", "Beta", "Chi", "Delta", "Epsilon", "Phi", "Gamma", "Eta", "Iota", "theta1", "Kappa", "Lambda", "Mu", "Nu", "Omicron", "Pi", "Theta", "Rho", "Sigma", "Tau", "Upsilon", "sigma1", "Omega", "Xi", "Psi", "Zeta", "bracketleft", "therefore", "bracketright", "perpendicular", "underscore", "radicalex", "alpha", "beta", "chi", "delta", "epsilon", "phi", "gamma", "eta", "iota", "phi1", "kappa", "lambda", "mu", "nu", "omicron", "pi", "theta", "rho", "sigma", "tau", "upsilon", "omega1", "omega", "xi", "psi", "zeta", "braceleft", "bar", "braceright", "similar", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Euro", "Upsilon1", "minute", "lessequal", "fraction", "infinity", "florin", "club", "diamond", "heart", "spade", "arrowboth", "arrowleft", "arrowup", "arrowright", "arrowdown", "degree", "plusminus", "second", "greaterequal", "multiply", "proportional", "partialdiff", "bullet", "divide", "notequal", "equivalence", "approxequal", "ellipsis", "arrowvertex", "arrowhorizex", "carriagereturn", "aleph", "Ifraktur", "Rfraktur", "weierstrass", "circlemultiply", "circleplus", "emptyset", "intersection", "union", "propersuperset", "reflexsuperset", "notsubset", "propersubset", "reflexsubset", "element", "notelement", "angle", "gradient", "registerserif", "copyrightserif", "trademarkserif", "product", "radical", "dotmath", "logicalnot", "logicaland", "logicalor", "arrowdblboth", "arrowdblleft", "arrowdblup", "arrowdblright", "arrowdbldown", "lozenge", "angleleft", "registersans", "copyrightsans", "trademarksans", "summation", "parenlefttp", "parenleftex", "parenleftbt", "bracketlefttp", "bracketleftex", "bracketleftbt", "bracelefttp", "braceleftmid", "braceleftbt", "braceex", "", "angleright", "integral", "integraltp", "integralex", "integralbt", "parenrighttp", "parenrightex", "parenrightbt", "bracketrighttp", "bracketrightex", "bracketrightbt", "bracerighttp", "bracerightmid", "bracerightbt", ""];
  10195. const ZapfDingbatsEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "a1", "a2", "a202", "a3", "a4", "a5", "a119", "a118", "a117", "a11", "a12", "a13", "a14", "a15", "a16", "a105", "a17", "a18", "a19", "a20", "a21", "a22", "a23", "a24", "a25", "a26", "a27", "a28", "a6", "a7", "a8", "a9", "a10", "a29", "a30", "a31", "a32", "a33", "a34", "a35", "a36", "a37", "a38", "a39", "a40", "a41", "a42", "a43", "a44", "a45", "a46", "a47", "a48", "a49", "a50", "a51", "a52", "a53", "a54", "a55", "a56", "a57", "a58", "a59", "a60", "a61", "a62", "a63", "a64", "a65", "a66", "a67", "a68", "a69", "a70", "a71", "a72", "a73", "a74", "a203", "a75", "a204", "a76", "a77", "a78", "a79", "a81", "a82", "a83", "a84", "a97", "a98", "a99", "a100", "", "a89", "a90", "a93", "a94", "a91", "a92", "a205", "a85", "a206", "a86", "a87", "a88", "a95", "a96", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "a101", "a102", "a103", "a104", "a106", "a107", "a108", "a112", "a111", "a110", "a109", "a120", "a121", "a122", "a123", "a124", "a125", "a126", "a127", "a128", "a129", "a130", "a131", "a132", "a133", "a134", "a135", "a136", "a137", "a138", "a139", "a140", "a141", "a142", "a143", "a144", "a145", "a146", "a147", "a148", "a149", "a150", "a151", "a152", "a153", "a154", "a155", "a156", "a157", "a158", "a159", "a160", "a161", "a163", "a164", "a196", "a165", "a192", "a166", "a167", "a168", "a169", "a170", "a171", "a172", "a173", "a162", "a174", "a175", "a176", "a177", "a178", "a179", "a193", "a180", "a199", "a181", "a200", "a182", "", "a201", "a183", "a184", "a197", "a185", "a194", "a198", "a186", "a195", "a187", "a188", "a189", "a190", "a191", ""];
  10196. function getEncoding(encodingName) {
  10197. switch (encodingName) {
  10198. case "WinAnsiEncoding":
  10199. return WinAnsiEncoding;
  10200. case "StandardEncoding":
  10201. return StandardEncoding;
  10202. case "MacRomanEncoding":
  10203. return MacRomanEncoding;
  10204. case "SymbolSetEncoding":
  10205. return SymbolSetEncoding;
  10206. case "ZapfDingbatsEncoding":
  10207. return ZapfDingbatsEncoding;
  10208. case "ExpertEncoding":
  10209. return ExpertEncoding;
  10210. case "MacExpertEncoding":
  10211. return MacExpertEncoding;
  10212. default:
  10213. return null;
  10214. }
  10215. }
  10216. ;// ./src/core/cff_parser.js
  10217. const MAX_SUBR_NESTING = 10;
  10218. const CFFStandardStrings = [".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodcentered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall", "001.000", "001.001", "001.002", "001.003", "Black", "Bold", "Book", "Light", "Medium", "Regular", "Roman", "Semibold"];
  10219. const NUM_STANDARD_CFF_STRINGS = 391;
  10220. const CharstringValidationData = [null, {
  10221. id: "hstem",
  10222. min: 2,
  10223. stackClearing: true,
  10224. stem: true
  10225. }, null, {
  10226. id: "vstem",
  10227. min: 2,
  10228. stackClearing: true,
  10229. stem: true
  10230. }, {
  10231. id: "vmoveto",
  10232. min: 1,
  10233. stackClearing: true
  10234. }, {
  10235. id: "rlineto",
  10236. min: 2,
  10237. resetStack: true
  10238. }, {
  10239. id: "hlineto",
  10240. min: 1,
  10241. resetStack: true
  10242. }, {
  10243. id: "vlineto",
  10244. min: 1,
  10245. resetStack: true
  10246. }, {
  10247. id: "rrcurveto",
  10248. min: 6,
  10249. resetStack: true
  10250. }, null, {
  10251. id: "callsubr",
  10252. min: 1,
  10253. undefStack: true
  10254. }, {
  10255. id: "return",
  10256. min: 0,
  10257. undefStack: true
  10258. }, null, null, {
  10259. id: "endchar",
  10260. min: 0,
  10261. stackClearing: true
  10262. }, null, null, null, {
  10263. id: "hstemhm",
  10264. min: 2,
  10265. stackClearing: true,
  10266. stem: true
  10267. }, {
  10268. id: "hintmask",
  10269. min: 0,
  10270. stackClearing: true
  10271. }, {
  10272. id: "cntrmask",
  10273. min: 0,
  10274. stackClearing: true
  10275. }, {
  10276. id: "rmoveto",
  10277. min: 2,
  10278. stackClearing: true
  10279. }, {
  10280. id: "hmoveto",
  10281. min: 1,
  10282. stackClearing: true
  10283. }, {
  10284. id: "vstemhm",
  10285. min: 2,
  10286. stackClearing: true,
  10287. stem: true
  10288. }, {
  10289. id: "rcurveline",
  10290. min: 8,
  10291. resetStack: true
  10292. }, {
  10293. id: "rlinecurve",
  10294. min: 8,
  10295. resetStack: true
  10296. }, {
  10297. id: "vvcurveto",
  10298. min: 4,
  10299. resetStack: true
  10300. }, {
  10301. id: "hhcurveto",
  10302. min: 4,
  10303. resetStack: true
  10304. }, null, {
  10305. id: "callgsubr",
  10306. min: 1,
  10307. undefStack: true
  10308. }, {
  10309. id: "vhcurveto",
  10310. min: 4,
  10311. resetStack: true
  10312. }, {
  10313. id: "hvcurveto",
  10314. min: 4,
  10315. resetStack: true
  10316. }];
  10317. const CharstringValidationData12 = [null, null, null, {
  10318. id: "and",
  10319. min: 2,
  10320. stackDelta: -1
  10321. }, {
  10322. id: "or",
  10323. min: 2,
  10324. stackDelta: -1
  10325. }, {
  10326. id: "not",
  10327. min: 1,
  10328. stackDelta: 0
  10329. }, null, null, null, {
  10330. id: "abs",
  10331. min: 1,
  10332. stackDelta: 0
  10333. }, {
  10334. id: "add",
  10335. min: 2,
  10336. stackDelta: -1,
  10337. stackFn(stack, index) {
  10338. stack[index - 2] = stack[index - 2] + stack[index - 1];
  10339. }
  10340. }, {
  10341. id: "sub",
  10342. min: 2,
  10343. stackDelta: -1,
  10344. stackFn(stack, index) {
  10345. stack[index - 2] = stack[index - 2] - stack[index - 1];
  10346. }
  10347. }, {
  10348. id: "div",
  10349. min: 2,
  10350. stackDelta: -1,
  10351. stackFn(stack, index) {
  10352. stack[index - 2] = stack[index - 2] / stack[index - 1];
  10353. }
  10354. }, null, {
  10355. id: "neg",
  10356. min: 1,
  10357. stackDelta: 0,
  10358. stackFn(stack, index) {
  10359. stack[index - 1] = -stack[index - 1];
  10360. }
  10361. }, {
  10362. id: "eq",
  10363. min: 2,
  10364. stackDelta: -1
  10365. }, null, null, {
  10366. id: "drop",
  10367. min: 1,
  10368. stackDelta: -1
  10369. }, null, {
  10370. id: "put",
  10371. min: 2,
  10372. stackDelta: -2
  10373. }, {
  10374. id: "get",
  10375. min: 1,
  10376. stackDelta: 0
  10377. }, {
  10378. id: "ifelse",
  10379. min: 4,
  10380. stackDelta: -3
  10381. }, {
  10382. id: "random",
  10383. min: 0,
  10384. stackDelta: 1
  10385. }, {
  10386. id: "mul",
  10387. min: 2,
  10388. stackDelta: -1,
  10389. stackFn(stack, index) {
  10390. stack[index - 2] = stack[index - 2] * stack[index - 1];
  10391. }
  10392. }, null, {
  10393. id: "sqrt",
  10394. min: 1,
  10395. stackDelta: 0
  10396. }, {
  10397. id: "dup",
  10398. min: 1,
  10399. stackDelta: 1
  10400. }, {
  10401. id: "exch",
  10402. min: 2,
  10403. stackDelta: 0
  10404. }, {
  10405. id: "index",
  10406. min: 2,
  10407. stackDelta: 0
  10408. }, {
  10409. id: "roll",
  10410. min: 3,
  10411. stackDelta: -2
  10412. }, null, null, null, {
  10413. id: "hflex",
  10414. min: 7,
  10415. resetStack: true
  10416. }, {
  10417. id: "flex",
  10418. min: 13,
  10419. resetStack: true
  10420. }, {
  10421. id: "hflex1",
  10422. min: 9,
  10423. resetStack: true
  10424. }, {
  10425. id: "flex1",
  10426. min: 11,
  10427. resetStack: true
  10428. }];
  10429. class CFFParser {
  10430. constructor(file, properties, seacAnalysisEnabled) {
  10431. this.bytes = file.getBytes();
  10432. this.properties = properties;
  10433. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  10434. }
  10435. parse() {
  10436. const properties = this.properties;
  10437. const cff = new CFF();
  10438. this.cff = cff;
  10439. const header = this.parseHeader();
  10440. const nameIndex = this.parseIndex(header.endPos);
  10441. const topDictIndex = this.parseIndex(nameIndex.endPos);
  10442. const stringIndex = this.parseIndex(topDictIndex.endPos);
  10443. const globalSubrIndex = this.parseIndex(stringIndex.endPos);
  10444. const topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  10445. const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  10446. cff.header = header.obj;
  10447. cff.names = this.parseNameIndex(nameIndex.obj);
  10448. cff.strings = this.parseStringIndex(stringIndex.obj);
  10449. cff.topDict = topDict;
  10450. cff.globalSubrIndex = globalSubrIndex.obj;
  10451. this.parsePrivateDict(cff.topDict);
  10452. cff.isCIDFont = topDict.hasName("ROS");
  10453. const charStringOffset = topDict.getByName("CharStrings");
  10454. const charStringIndex = this.parseIndex(charStringOffset).obj;
  10455. const fontMatrix = topDict.getByName("FontMatrix");
  10456. if (fontMatrix) {
  10457. properties.fontMatrix = fontMatrix;
  10458. }
  10459. const fontBBox = topDict.getByName("FontBBox");
  10460. if (fontBBox) {
  10461. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  10462. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  10463. properties.ascentScaled = true;
  10464. }
  10465. let charset, encoding;
  10466. if (cff.isCIDFont) {
  10467. const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
  10468. for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  10469. const dictRaw = fdArrayIndex.get(i);
  10470. const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  10471. this.parsePrivateDict(fontDict);
  10472. cff.fdArray.push(fontDict);
  10473. }
  10474. encoding = null;
  10475. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
  10476. cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
  10477. } else {
  10478. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
  10479. encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
  10480. }
  10481. cff.charset = charset;
  10482. cff.encoding = encoding;
  10483. const charStringsAndSeacs = this.parseCharStrings({
  10484. charStrings: charStringIndex,
  10485. localSubrIndex: topDict.privateDict.subrsIndex,
  10486. globalSubrIndex: globalSubrIndex.obj,
  10487. fdSelect: cff.fdSelect,
  10488. fdArray: cff.fdArray,
  10489. privateDict: topDict.privateDict
  10490. });
  10491. cff.charStrings = charStringsAndSeacs.charStrings;
  10492. cff.seacs = charStringsAndSeacs.seacs;
  10493. cff.widths = charStringsAndSeacs.widths;
  10494. return cff;
  10495. }
  10496. parseHeader() {
  10497. let bytes = this.bytes;
  10498. const bytesLength = bytes.length;
  10499. let offset = 0;
  10500. while (offset < bytesLength && bytes[offset] !== 1) {
  10501. ++offset;
  10502. }
  10503. if (offset >= bytesLength) {
  10504. throw new FormatError("Invalid CFF header");
  10505. }
  10506. if (offset !== 0) {
  10507. info("cff data is shifted");
  10508. bytes = bytes.subarray(offset);
  10509. this.bytes = bytes;
  10510. }
  10511. const major = bytes[0];
  10512. const minor = bytes[1];
  10513. const hdrSize = bytes[2];
  10514. const offSize = bytes[3];
  10515. const header = new CFFHeader(major, minor, hdrSize, offSize);
  10516. return {
  10517. obj: header,
  10518. endPos: hdrSize
  10519. };
  10520. }
  10521. parseDict(dict) {
  10522. let pos = 0;
  10523. function parseOperand() {
  10524. let value = dict[pos++];
  10525. if (value === 30) {
  10526. return parseFloatOperand();
  10527. } else if (value === 28) {
  10528. value = dict[pos++];
  10529. value = (value << 24 | dict[pos++] << 16) >> 16;
  10530. return value;
  10531. } else if (value === 29) {
  10532. value = dict[pos++];
  10533. value = value << 8 | dict[pos++];
  10534. value = value << 8 | dict[pos++];
  10535. value = value << 8 | dict[pos++];
  10536. return value;
  10537. } else if (value >= 32 && value <= 246) {
  10538. return value - 139;
  10539. } else if (value >= 247 && value <= 250) {
  10540. return (value - 247) * 256 + dict[pos++] + 108;
  10541. } else if (value >= 251 && value <= 254) {
  10542. return -((value - 251) * 256) - dict[pos++] - 108;
  10543. }
  10544. warn('CFFParser_parseDict: "' + value + '" is a reserved command.');
  10545. return NaN;
  10546. }
  10547. function parseFloatOperand() {
  10548. let str = "";
  10549. const eof = 15;
  10550. const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
  10551. const length = dict.length;
  10552. while (pos < length) {
  10553. const b = dict[pos++];
  10554. const b1 = b >> 4;
  10555. const b2 = b & 15;
  10556. if (b1 === eof) {
  10557. break;
  10558. }
  10559. str += lookup[b1];
  10560. if (b2 === eof) {
  10561. break;
  10562. }
  10563. str += lookup[b2];
  10564. }
  10565. return parseFloat(str);
  10566. }
  10567. let operands = [];
  10568. const entries = [];
  10569. pos = 0;
  10570. const end = dict.length;
  10571. while (pos < end) {
  10572. let b = dict[pos];
  10573. if (b <= 21) {
  10574. if (b === 12) {
  10575. b = b << 8 | dict[++pos];
  10576. }
  10577. entries.push([b, operands]);
  10578. operands = [];
  10579. ++pos;
  10580. } else {
  10581. operands.push(parseOperand());
  10582. }
  10583. }
  10584. return entries;
  10585. }
  10586. parseIndex(pos) {
  10587. const cffIndex = new CFFIndex();
  10588. const bytes = this.bytes;
  10589. const count = bytes[pos++] << 8 | bytes[pos++];
  10590. const offsets = [];
  10591. let end = pos;
  10592. let i, ii;
  10593. if (count !== 0) {
  10594. const offsetSize = bytes[pos++];
  10595. const startPos = pos + (count + 1) * offsetSize - 1;
  10596. for (i = 0, ii = count + 1; i < ii; ++i) {
  10597. let offset = 0;
  10598. for (let j = 0; j < offsetSize; ++j) {
  10599. offset <<= 8;
  10600. offset += bytes[pos++];
  10601. }
  10602. offsets.push(startPos + offset);
  10603. }
  10604. end = offsets[count];
  10605. }
  10606. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  10607. const offsetStart = offsets[i];
  10608. const offsetEnd = offsets[i + 1];
  10609. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  10610. }
  10611. return {
  10612. obj: cffIndex,
  10613. endPos: end
  10614. };
  10615. }
  10616. parseNameIndex(index) {
  10617. const names = [];
  10618. for (let i = 0, ii = index.count; i < ii; ++i) {
  10619. const name = index.get(i);
  10620. names.push(bytesToString(name));
  10621. }
  10622. return names;
  10623. }
  10624. parseStringIndex(index) {
  10625. const strings = new CFFStrings();
  10626. for (let i = 0, ii = index.count; i < ii; ++i) {
  10627. const data = index.get(i);
  10628. strings.add(bytesToString(data));
  10629. }
  10630. return strings;
  10631. }
  10632. createDict(Type, dict, strings) {
  10633. const cffDict = new Type(strings);
  10634. for (const [key, value] of dict) {
  10635. cffDict.setByKey(key, value);
  10636. }
  10637. return cffDict;
  10638. }
  10639. parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  10640. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  10641. return false;
  10642. }
  10643. let stackSize = state.stackSize;
  10644. const stack = state.stack;
  10645. let length = data.length;
  10646. for (let j = 0; j < length;) {
  10647. const value = data[j++];
  10648. let validationCommand = null;
  10649. if (value === 12) {
  10650. const q = data[j++];
  10651. if (q === 0) {
  10652. data[j - 2] = 139;
  10653. data[j - 1] = 22;
  10654. stackSize = 0;
  10655. } else {
  10656. validationCommand = CharstringValidationData12[q];
  10657. }
  10658. } else if (value === 28) {
  10659. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  10660. j += 2;
  10661. stackSize++;
  10662. } else if (value === 14) {
  10663. if (stackSize >= 4) {
  10664. stackSize -= 4;
  10665. if (this.seacAnalysisEnabled) {
  10666. state.seac = stack.slice(stackSize, stackSize + 4);
  10667. return false;
  10668. }
  10669. }
  10670. validationCommand = CharstringValidationData[value];
  10671. } else if (value >= 32 && value <= 246) {
  10672. stack[stackSize] = value - 139;
  10673. stackSize++;
  10674. } else if (value >= 247 && value <= 254) {
  10675. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  10676. j++;
  10677. stackSize++;
  10678. } else if (value === 255) {
  10679. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  10680. j += 4;
  10681. stackSize++;
  10682. } else if (value === 19 || value === 20) {
  10683. state.hints += stackSize >> 1;
  10684. if (state.hints === 0) {
  10685. data.copyWithin(j - 1, j, -1);
  10686. j -= 1;
  10687. length -= 1;
  10688. continue;
  10689. }
  10690. j += state.hints + 7 >> 3;
  10691. stackSize %= 2;
  10692. validationCommand = CharstringValidationData[value];
  10693. } else if (value === 10 || value === 29) {
  10694. const subrsIndex = value === 10 ? localSubrIndex : globalSubrIndex;
  10695. if (!subrsIndex) {
  10696. validationCommand = CharstringValidationData[value];
  10697. warn("Missing subrsIndex for " + validationCommand.id);
  10698. return false;
  10699. }
  10700. let bias = 32768;
  10701. if (subrsIndex.count < 1240) {
  10702. bias = 107;
  10703. } else if (subrsIndex.count < 33900) {
  10704. bias = 1131;
  10705. }
  10706. const subrNumber = stack[--stackSize] + bias;
  10707. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  10708. validationCommand = CharstringValidationData[value];
  10709. warn("Out of bounds subrIndex for " + validationCommand.id);
  10710. return false;
  10711. }
  10712. state.stackSize = stackSize;
  10713. state.callDepth++;
  10714. const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  10715. if (!valid) {
  10716. return false;
  10717. }
  10718. state.callDepth--;
  10719. stackSize = state.stackSize;
  10720. continue;
  10721. } else if (value === 11) {
  10722. state.stackSize = stackSize;
  10723. return true;
  10724. } else if (value === 0 && j === data.length) {
  10725. data[j - 1] = 14;
  10726. validationCommand = CharstringValidationData[14];
  10727. } else if (value === 9) {
  10728. data.copyWithin(j - 1, j, -1);
  10729. j -= 1;
  10730. length -= 1;
  10731. continue;
  10732. } else {
  10733. validationCommand = CharstringValidationData[value];
  10734. }
  10735. if (validationCommand) {
  10736. if (validationCommand.stem) {
  10737. state.hints += stackSize >> 1;
  10738. if (value === 3 || value === 23) {
  10739. state.hasVStems = true;
  10740. } else if (state.hasVStems && (value === 1 || value === 18)) {
  10741. warn("CFF stem hints are in wrong order");
  10742. data[j - 1] = value === 1 ? 3 : 23;
  10743. }
  10744. }
  10745. if ("min" in validationCommand) {
  10746. if (!state.undefStack && stackSize < validationCommand.min) {
  10747. warn("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
  10748. if (stackSize === 0) {
  10749. data[j - 1] = 14;
  10750. return true;
  10751. }
  10752. return false;
  10753. }
  10754. }
  10755. if (state.firstStackClearing && validationCommand.stackClearing) {
  10756. state.firstStackClearing = false;
  10757. stackSize -= validationCommand.min;
  10758. if (stackSize >= 2 && validationCommand.stem) {
  10759. stackSize %= 2;
  10760. } else if (stackSize > 1) {
  10761. warn("Found too many parameters for stack-clearing command");
  10762. }
  10763. if (stackSize > 0) {
  10764. state.width = stack[stackSize - 1];
  10765. }
  10766. }
  10767. if ("stackDelta" in validationCommand) {
  10768. if ("stackFn" in validationCommand) {
  10769. validationCommand.stackFn(stack, stackSize);
  10770. }
  10771. stackSize += validationCommand.stackDelta;
  10772. } else if (validationCommand.stackClearing) {
  10773. stackSize = 0;
  10774. } else if (validationCommand.resetStack) {
  10775. stackSize = 0;
  10776. state.undefStack = false;
  10777. } else if (validationCommand.undefStack) {
  10778. stackSize = 0;
  10779. state.undefStack = true;
  10780. state.firstStackClearing = false;
  10781. }
  10782. }
  10783. }
  10784. if (length < data.length) {
  10785. data.fill(14, length);
  10786. }
  10787. state.stackSize = stackSize;
  10788. return true;
  10789. }
  10790. parseCharStrings({
  10791. charStrings,
  10792. localSubrIndex,
  10793. globalSubrIndex,
  10794. fdSelect,
  10795. fdArray,
  10796. privateDict
  10797. }) {
  10798. const seacs = [];
  10799. const widths = [];
  10800. const count = charStrings.count;
  10801. for (let i = 0; i < count; i++) {
  10802. const charstring = charStrings.get(i);
  10803. const state = {
  10804. callDepth: 0,
  10805. stackSize: 0,
  10806. stack: [],
  10807. undefStack: true,
  10808. hints: 0,
  10809. firstStackClearing: true,
  10810. seac: null,
  10811. width: null,
  10812. hasVStems: false
  10813. };
  10814. let valid = true;
  10815. let localSubrToUse = null;
  10816. let privateDictToUse = privateDict;
  10817. if (fdSelect && fdArray.length) {
  10818. const fdIndex = fdSelect.getFDIndex(i);
  10819. if (fdIndex === -1) {
  10820. warn("Glyph index is not in fd select.");
  10821. valid = false;
  10822. }
  10823. if (fdIndex >= fdArray.length) {
  10824. warn("Invalid fd index for glyph index.");
  10825. valid = false;
  10826. }
  10827. if (valid) {
  10828. privateDictToUse = fdArray[fdIndex].privateDict;
  10829. localSubrToUse = privateDictToUse.subrsIndex;
  10830. }
  10831. } else if (localSubrIndex) {
  10832. localSubrToUse = localSubrIndex;
  10833. }
  10834. if (valid) {
  10835. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  10836. }
  10837. if (state.width !== null) {
  10838. const nominalWidth = privateDictToUse.getByName("nominalWidthX");
  10839. widths[i] = nominalWidth + state.width;
  10840. } else {
  10841. const defaultWidth = privateDictToUse.getByName("defaultWidthX");
  10842. widths[i] = defaultWidth;
  10843. }
  10844. if (state.seac !== null) {
  10845. seacs[i] = state.seac;
  10846. }
  10847. if (!valid) {
  10848. charStrings.set(i, new Uint8Array([14]));
  10849. }
  10850. }
  10851. return {
  10852. charStrings,
  10853. seacs,
  10854. widths
  10855. };
  10856. }
  10857. emptyPrivateDictionary(parentDict) {
  10858. const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  10859. parentDict.setByKey(18, [0, 0]);
  10860. parentDict.privateDict = privateDict;
  10861. }
  10862. parsePrivateDict(parentDict) {
  10863. if (!parentDict.hasName("Private")) {
  10864. this.emptyPrivateDictionary(parentDict);
  10865. return;
  10866. }
  10867. const privateOffset = parentDict.getByName("Private");
  10868. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  10869. parentDict.removeByName("Private");
  10870. return;
  10871. }
  10872. const size = privateOffset[0];
  10873. const offset = privateOffset[1];
  10874. if (size === 0 || offset >= this.bytes.length) {
  10875. this.emptyPrivateDictionary(parentDict);
  10876. return;
  10877. }
  10878. const privateDictEnd = offset + size;
  10879. const dictData = this.bytes.subarray(offset, privateDictEnd);
  10880. const dict = this.parseDict(dictData);
  10881. const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  10882. parentDict.privateDict = privateDict;
  10883. if (privateDict.getByName("ExpansionFactor") === 0) {
  10884. privateDict.setByName("ExpansionFactor", 0.06);
  10885. }
  10886. if (!privateDict.getByName("Subrs")) {
  10887. return;
  10888. }
  10889. const subrsOffset = privateDict.getByName("Subrs");
  10890. const relativeOffset = offset + subrsOffset;
  10891. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  10892. this.emptyPrivateDictionary(parentDict);
  10893. return;
  10894. }
  10895. const subrsIndex = this.parseIndex(relativeOffset);
  10896. privateDict.subrsIndex = subrsIndex.obj;
  10897. }
  10898. parseCharsets(pos, length, strings, cid) {
  10899. if (pos === 0) {
  10900. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, ISOAdobeCharset);
  10901. } else if (pos === 1) {
  10902. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, ExpertCharset);
  10903. } else if (pos === 2) {
  10904. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, ExpertSubsetCharset);
  10905. }
  10906. const bytes = this.bytes;
  10907. const start = pos;
  10908. const format = bytes[pos++];
  10909. const charset = [cid ? 0 : ".notdef"];
  10910. let id, count, i;
  10911. length -= 1;
  10912. switch (format) {
  10913. case 0:
  10914. for (i = 0; i < length; i++) {
  10915. id = bytes[pos++] << 8 | bytes[pos++];
  10916. charset.push(cid ? id : strings.get(id));
  10917. }
  10918. break;
  10919. case 1:
  10920. while (charset.length <= length) {
  10921. id = bytes[pos++] << 8 | bytes[pos++];
  10922. count = bytes[pos++];
  10923. for (i = 0; i <= count; i++) {
  10924. charset.push(cid ? id++ : strings.get(id++));
  10925. }
  10926. }
  10927. break;
  10928. case 2:
  10929. while (charset.length <= length) {
  10930. id = bytes[pos++] << 8 | bytes[pos++];
  10931. count = bytes[pos++] << 8 | bytes[pos++];
  10932. for (i = 0; i <= count; i++) {
  10933. charset.push(cid ? id++ : strings.get(id++));
  10934. }
  10935. }
  10936. break;
  10937. default:
  10938. throw new FormatError("Unknown charset format");
  10939. }
  10940. const end = pos;
  10941. const raw = bytes.subarray(start, end);
  10942. return new CFFCharset(false, format, charset, raw);
  10943. }
  10944. parseEncoding(pos, properties, strings, charset) {
  10945. const encoding = Object.create(null);
  10946. const bytes = this.bytes;
  10947. let predefined = false;
  10948. let format, i, ii;
  10949. let raw = null;
  10950. function readSupplement() {
  10951. const supplementsCount = bytes[pos++];
  10952. for (i = 0; i < supplementsCount; i++) {
  10953. const code = bytes[pos++];
  10954. const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  10955. encoding[code] = charset.indexOf(strings.get(sid));
  10956. }
  10957. }
  10958. if (pos === 0 || pos === 1) {
  10959. predefined = true;
  10960. format = pos;
  10961. const baseEncoding = pos ? ExpertEncoding : StandardEncoding;
  10962. for (i = 0, ii = charset.length; i < ii; i++) {
  10963. const index = baseEncoding.indexOf(charset[i]);
  10964. if (index !== -1) {
  10965. encoding[index] = i;
  10966. }
  10967. }
  10968. } else {
  10969. const dataStart = pos;
  10970. format = bytes[pos++];
  10971. switch (format & 0x7f) {
  10972. case 0:
  10973. const glyphsCount = bytes[pos++];
  10974. for (i = 1; i <= glyphsCount; i++) {
  10975. encoding[bytes[pos++]] = i;
  10976. }
  10977. break;
  10978. case 1:
  10979. const rangesCount = bytes[pos++];
  10980. let gid = 1;
  10981. for (i = 0; i < rangesCount; i++) {
  10982. const start = bytes[pos++];
  10983. const left = bytes[pos++];
  10984. for (let j = start; j <= start + left; j++) {
  10985. encoding[j] = gid++;
  10986. }
  10987. }
  10988. break;
  10989. default:
  10990. throw new FormatError(`Unknown encoding format: ${format} in CFF`);
  10991. }
  10992. const dataEnd = pos;
  10993. if (format & 0x80) {
  10994. bytes[dataStart] &= 0x7f;
  10995. readSupplement();
  10996. }
  10997. raw = bytes.subarray(dataStart, dataEnd);
  10998. }
  10999. format &= 0x7f;
  11000. return new CFFEncoding(predefined, format, encoding, raw);
  11001. }
  11002. parseFDSelect(pos, length) {
  11003. const bytes = this.bytes;
  11004. const format = bytes[pos++];
  11005. const fdSelect = [];
  11006. let i;
  11007. switch (format) {
  11008. case 0:
  11009. for (i = 0; i < length; ++i) {
  11010. const id = bytes[pos++];
  11011. fdSelect.push(id);
  11012. }
  11013. break;
  11014. case 3:
  11015. const rangesCount = bytes[pos++] << 8 | bytes[pos++];
  11016. for (i = 0; i < rangesCount; ++i) {
  11017. let first = bytes[pos++] << 8 | bytes[pos++];
  11018. if (i === 0 && first !== 0) {
  11019. warn("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
  11020. first = 0;
  11021. }
  11022. const fdIndex = bytes[pos++];
  11023. const next = bytes[pos] << 8 | bytes[pos + 1];
  11024. for (let j = first; j < next; ++j) {
  11025. fdSelect.push(fdIndex);
  11026. }
  11027. }
  11028. pos += 2;
  11029. break;
  11030. default:
  11031. throw new FormatError(`parseFDSelect: Unknown format "${format}".`);
  11032. }
  11033. if (fdSelect.length !== length) {
  11034. throw new FormatError("parseFDSelect: Invalid font data.");
  11035. }
  11036. return new CFFFDSelect(format, fdSelect);
  11037. }
  11038. }
  11039. class CFF {
  11040. constructor() {
  11041. this.header = null;
  11042. this.names = [];
  11043. this.topDict = null;
  11044. this.strings = new CFFStrings();
  11045. this.globalSubrIndex = null;
  11046. this.encoding = null;
  11047. this.charset = null;
  11048. this.charStrings = null;
  11049. this.fdArray = [];
  11050. this.fdSelect = null;
  11051. this.isCIDFont = false;
  11052. }
  11053. duplicateFirstGlyph() {
  11054. if (this.charStrings.count >= 65535) {
  11055. warn("Not enough space in charstrings to duplicate first glyph.");
  11056. return;
  11057. }
  11058. const glyphZero = this.charStrings.get(0);
  11059. this.charStrings.add(glyphZero);
  11060. if (this.isCIDFont) {
  11061. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  11062. }
  11063. }
  11064. hasGlyphId(id) {
  11065. if (id < 0 || id >= this.charStrings.count) {
  11066. return false;
  11067. }
  11068. const glyph = this.charStrings.get(id);
  11069. return glyph.length > 0;
  11070. }
  11071. }
  11072. class CFFHeader {
  11073. constructor(major, minor, hdrSize, offSize) {
  11074. this.major = major;
  11075. this.minor = minor;
  11076. this.hdrSize = hdrSize;
  11077. this.offSize = offSize;
  11078. }
  11079. }
  11080. class CFFStrings {
  11081. constructor() {
  11082. this.strings = [];
  11083. }
  11084. get(index) {
  11085. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  11086. return CFFStandardStrings[index];
  11087. }
  11088. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  11089. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  11090. }
  11091. return CFFStandardStrings[0];
  11092. }
  11093. getSID(str) {
  11094. let index = CFFStandardStrings.indexOf(str);
  11095. if (index !== -1) {
  11096. return index;
  11097. }
  11098. index = this.strings.indexOf(str);
  11099. if (index !== -1) {
  11100. return index + NUM_STANDARD_CFF_STRINGS;
  11101. }
  11102. return -1;
  11103. }
  11104. add(value) {
  11105. this.strings.push(value);
  11106. }
  11107. get count() {
  11108. return this.strings.length;
  11109. }
  11110. }
  11111. class CFFIndex {
  11112. constructor() {
  11113. this.objects = [];
  11114. this.length = 0;
  11115. }
  11116. add(data) {
  11117. this.length += data.length;
  11118. this.objects.push(data);
  11119. }
  11120. set(index, data) {
  11121. this.length += data.length - this.objects[index].length;
  11122. this.objects[index] = data;
  11123. }
  11124. get(index) {
  11125. return this.objects[index];
  11126. }
  11127. get count() {
  11128. return this.objects.length;
  11129. }
  11130. }
  11131. class CFFDict {
  11132. constructor(tables, strings) {
  11133. this.keyToNameMap = tables.keyToNameMap;
  11134. this.nameToKeyMap = tables.nameToKeyMap;
  11135. this.defaults = tables.defaults;
  11136. this.types = tables.types;
  11137. this.opcodes = tables.opcodes;
  11138. this.order = tables.order;
  11139. this.strings = strings;
  11140. this.values = Object.create(null);
  11141. }
  11142. setByKey(key, value) {
  11143. if (!(key in this.keyToNameMap)) {
  11144. return false;
  11145. }
  11146. if (value.length === 0) {
  11147. return true;
  11148. }
  11149. for (const val of value) {
  11150. if (isNaN(val)) {
  11151. warn(`Invalid CFFDict value: "${value}" for key "${key}".`);
  11152. return true;
  11153. }
  11154. }
  11155. const type = this.types[key];
  11156. if (type === "num" || type === "sid" || type === "offset") {
  11157. value = value[0];
  11158. }
  11159. this.values[key] = value;
  11160. return true;
  11161. }
  11162. setByName(name, value) {
  11163. if (!(name in this.nameToKeyMap)) {
  11164. throw new FormatError(`Invalid dictionary name "${name}"`);
  11165. }
  11166. this.values[this.nameToKeyMap[name]] = value;
  11167. }
  11168. hasName(name) {
  11169. return this.nameToKeyMap[name] in this.values;
  11170. }
  11171. getByName(name) {
  11172. if (!(name in this.nameToKeyMap)) {
  11173. throw new FormatError(`Invalid dictionary name ${name}"`);
  11174. }
  11175. const key = this.nameToKeyMap[name];
  11176. if (!(key in this.values)) {
  11177. return this.defaults[key];
  11178. }
  11179. return this.values[key];
  11180. }
  11181. removeByName(name) {
  11182. delete this.values[this.nameToKeyMap[name]];
  11183. }
  11184. static createTables(layout) {
  11185. const tables = {
  11186. keyToNameMap: {},
  11187. nameToKeyMap: {},
  11188. defaults: {},
  11189. types: {},
  11190. opcodes: {},
  11191. order: []
  11192. };
  11193. for (const entry of layout) {
  11194. const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  11195. tables.keyToNameMap[key] = entry[1];
  11196. tables.nameToKeyMap[entry[1]] = key;
  11197. tables.types[key] = entry[2];
  11198. tables.defaults[key] = entry[3];
  11199. tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
  11200. tables.order.push(key);
  11201. }
  11202. return tables;
  11203. }
  11204. }
  11205. const CFFTopDictLayout = [[[12, 30], "ROS", ["sid", "sid", "num"], null], [[12, 20], "SyntheticBase", "num", null], [0, "version", "sid", null], [1, "Notice", "sid", null], [[12, 0], "Copyright", "sid", null], [2, "FullName", "sid", null], [3, "FamilyName", "sid", null], [4, "Weight", "sid", null], [[12, 1], "isFixedPitch", "num", 0], [[12, 2], "ItalicAngle", "num", 0], [[12, 3], "UnderlinePosition", "num", -100], [[12, 4], "UnderlineThickness", "num", 50], [[12, 5], "PaintType", "num", 0], [[12, 6], "CharstringType", "num", 2], [[12, 7], "FontMatrix", ["num", "num", "num", "num", "num", "num"], [0.001, 0, 0, 0.001, 0, 0]], [13, "UniqueID", "num", null], [5, "FontBBox", ["num", "num", "num", "num"], [0, 0, 0, 0]], [[12, 8], "StrokeWidth", "num", 0], [14, "XUID", "array", null], [15, "charset", "offset", 0], [16, "Encoding", "offset", 0], [17, "CharStrings", "offset", 0], [18, "Private", ["offset", "offset"], null], [[12, 21], "PostScript", "sid", null], [[12, 22], "BaseFontName", "sid", null], [[12, 23], "BaseFontBlend", "delta", null], [[12, 31], "CIDFontVersion", "num", 0], [[12, 32], "CIDFontRevision", "num", 0], [[12, 33], "CIDFontType", "num", 0], [[12, 34], "CIDCount", "num", 8720], [[12, 35], "UIDBase", "num", null], [[12, 37], "FDSelect", "offset", null], [[12, 36], "FDArray", "offset", null], [[12, 38], "FontName", "sid", null]];
  11206. class CFFTopDict extends CFFDict {
  11207. static get tables() {
  11208. return shadow(this, "tables", this.createTables(CFFTopDictLayout));
  11209. }
  11210. constructor(strings) {
  11211. super(CFFTopDict.tables, strings);
  11212. this.privateDict = null;
  11213. }
  11214. }
  11215. const CFFPrivateDictLayout = [[6, "BlueValues", "delta", null], [7, "OtherBlues", "delta", null], [8, "FamilyBlues", "delta", null], [9, "FamilyOtherBlues", "delta", null], [[12, 9], "BlueScale", "num", 0.039625], [[12, 10], "BlueShift", "num", 7], [[12, 11], "BlueFuzz", "num", 1], [10, "StdHW", "num", null], [11, "StdVW", "num", null], [[12, 12], "StemSnapH", "delta", null], [[12, 13], "StemSnapV", "delta", null], [[12, 14], "ForceBold", "num", 0], [[12, 17], "LanguageGroup", "num", 0], [[12, 18], "ExpansionFactor", "num", 0.06], [[12, 19], "initialRandomSeed", "num", 0], [20, "defaultWidthX", "num", 0], [21, "nominalWidthX", "num", 0], [19, "Subrs", "offset", null]];
  11216. class CFFPrivateDict extends CFFDict {
  11217. static get tables() {
  11218. return shadow(this, "tables", this.createTables(CFFPrivateDictLayout));
  11219. }
  11220. constructor(strings) {
  11221. super(CFFPrivateDict.tables, strings);
  11222. this.subrsIndex = null;
  11223. }
  11224. }
  11225. const CFFCharsetPredefinedTypes = {
  11226. ISO_ADOBE: 0,
  11227. EXPERT: 1,
  11228. EXPERT_SUBSET: 2
  11229. };
  11230. class CFFCharset {
  11231. constructor(predefined, format, charset, raw) {
  11232. this.predefined = predefined;
  11233. this.format = format;
  11234. this.charset = charset;
  11235. this.raw = raw;
  11236. }
  11237. }
  11238. class CFFEncoding {
  11239. constructor(predefined, format, encoding, raw) {
  11240. this.predefined = predefined;
  11241. this.format = format;
  11242. this.encoding = encoding;
  11243. this.raw = raw;
  11244. }
  11245. }
  11246. class CFFFDSelect {
  11247. constructor(format, fdSelect) {
  11248. this.format = format;
  11249. this.fdSelect = fdSelect;
  11250. }
  11251. getFDIndex(glyphIndex) {
  11252. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  11253. return -1;
  11254. }
  11255. return this.fdSelect[glyphIndex];
  11256. }
  11257. }
  11258. class CFFOffsetTracker {
  11259. constructor() {
  11260. this.offsets = Object.create(null);
  11261. }
  11262. isTracking(key) {
  11263. return key in this.offsets;
  11264. }
  11265. track(key, location) {
  11266. if (key in this.offsets) {
  11267. throw new FormatError(`Already tracking location of ${key}`);
  11268. }
  11269. this.offsets[key] = location;
  11270. }
  11271. offset(value) {
  11272. for (const key in this.offsets) {
  11273. this.offsets[key] += value;
  11274. }
  11275. }
  11276. setEntryLocation(key, values, output) {
  11277. if (!(key in this.offsets)) {
  11278. throw new FormatError(`Not tracking location of ${key}`);
  11279. }
  11280. const data = output.data;
  11281. const dataOffset = this.offsets[key];
  11282. const size = 5;
  11283. for (let i = 0, ii = values.length; i < ii; ++i) {
  11284. const offset0 = i * size + dataOffset;
  11285. const offset1 = offset0 + 1;
  11286. const offset2 = offset0 + 2;
  11287. const offset3 = offset0 + 3;
  11288. const offset4 = offset0 + 4;
  11289. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  11290. throw new FormatError("writing to an offset that is not empty");
  11291. }
  11292. const value = values[i];
  11293. data[offset0] = 0x1d;
  11294. data[offset1] = value >> 24 & 0xff;
  11295. data[offset2] = value >> 16 & 0xff;
  11296. data[offset3] = value >> 8 & 0xff;
  11297. data[offset4] = value & 0xff;
  11298. }
  11299. }
  11300. }
  11301. class CFFCompiler {
  11302. constructor(cff) {
  11303. this.cff = cff;
  11304. }
  11305. compile() {
  11306. const cff = this.cff;
  11307. const output = {
  11308. data: [],
  11309. length: 0,
  11310. add(data) {
  11311. try {
  11312. this.data.push(...data);
  11313. } catch {
  11314. this.data = this.data.concat(data);
  11315. }
  11316. this.length = this.data.length;
  11317. }
  11318. };
  11319. const header = this.compileHeader(cff.header);
  11320. output.add(header);
  11321. const nameIndex = this.compileNameIndex(cff.names);
  11322. output.add(nameIndex);
  11323. if (cff.isCIDFont) {
  11324. if (cff.topDict.hasName("FontMatrix")) {
  11325. const base = cff.topDict.getByName("FontMatrix");
  11326. cff.topDict.removeByName("FontMatrix");
  11327. for (const subDict of cff.fdArray) {
  11328. let matrix = base.slice(0);
  11329. if (subDict.hasName("FontMatrix")) {
  11330. matrix = Util.transform(matrix, subDict.getByName("FontMatrix"));
  11331. }
  11332. subDict.setByName("FontMatrix", matrix);
  11333. }
  11334. }
  11335. }
  11336. const xuid = cff.topDict.getByName("XUID");
  11337. if (xuid?.length > 16) {
  11338. cff.topDict.removeByName("XUID");
  11339. }
  11340. cff.topDict.setByName("charset", 0);
  11341. let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  11342. output.add(compiled.output);
  11343. const topDictTracker = compiled.trackers[0];
  11344. const stringIndex = this.compileStringIndex(cff.strings.strings);
  11345. output.add(stringIndex);
  11346. const globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  11347. output.add(globalSubrIndex);
  11348. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  11349. if (cff.encoding.predefined) {
  11350. topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
  11351. } else {
  11352. const encoding = this.compileEncoding(cff.encoding);
  11353. topDictTracker.setEntryLocation("Encoding", [output.length], output);
  11354. output.add(encoding);
  11355. }
  11356. }
  11357. const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
  11358. topDictTracker.setEntryLocation("charset", [output.length], output);
  11359. output.add(charset);
  11360. const charStrings = this.compileCharStrings(cff.charStrings);
  11361. topDictTracker.setEntryLocation("CharStrings", [output.length], output);
  11362. output.add(charStrings);
  11363. if (cff.isCIDFont) {
  11364. topDictTracker.setEntryLocation("FDSelect", [output.length], output);
  11365. const fdSelect = this.compileFDSelect(cff.fdSelect);
  11366. output.add(fdSelect);
  11367. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  11368. topDictTracker.setEntryLocation("FDArray", [output.length], output);
  11369. output.add(compiled.output);
  11370. const fontDictTrackers = compiled.trackers;
  11371. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  11372. }
  11373. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  11374. output.add([0]);
  11375. return output.data;
  11376. }
  11377. encodeNumber(value) {
  11378. if (Number.isInteger(value)) {
  11379. return this.encodeInteger(value);
  11380. }
  11381. return this.encodeFloat(value);
  11382. }
  11383. static get EncodeFloatRegExp() {
  11384. return shadow(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/);
  11385. }
  11386. encodeFloat(num) {
  11387. let value = num.toString();
  11388. const m = CFFCompiler.EncodeFloatRegExp.exec(value);
  11389. if (m) {
  11390. const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
  11391. value = (Math.round(num * epsilon) / epsilon).toString();
  11392. }
  11393. let nibbles = "";
  11394. let i, ii;
  11395. for (i = 0, ii = value.length; i < ii; ++i) {
  11396. const a = value[i];
  11397. if (a === "e") {
  11398. nibbles += value[++i] === "-" ? "c" : "b";
  11399. } else if (a === ".") {
  11400. nibbles += "a";
  11401. } else if (a === "-") {
  11402. nibbles += "e";
  11403. } else {
  11404. nibbles += a;
  11405. }
  11406. }
  11407. nibbles += nibbles.length & 1 ? "f" : "ff";
  11408. const out = [30];
  11409. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  11410. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  11411. }
  11412. return out;
  11413. }
  11414. encodeInteger(value) {
  11415. let code;
  11416. if (value >= -107 && value <= 107) {
  11417. code = [value + 139];
  11418. } else if (value >= 108 && value <= 1131) {
  11419. value -= 108;
  11420. code = [(value >> 8) + 247, value & 0xff];
  11421. } else if (value >= -1131 && value <= -108) {
  11422. value = -value - 108;
  11423. code = [(value >> 8) + 251, value & 0xff];
  11424. } else if (value >= -32768 && value <= 32767) {
  11425. code = [0x1c, value >> 8 & 0xff, value & 0xff];
  11426. } else {
  11427. code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
  11428. }
  11429. return code;
  11430. }
  11431. compileHeader(header) {
  11432. return [header.major, header.minor, 4, header.offSize];
  11433. }
  11434. compileNameIndex(names) {
  11435. const nameIndex = new CFFIndex();
  11436. for (const name of names) {
  11437. const length = Math.min(name.length, 127);
  11438. let sanitizedName = new Array(length);
  11439. for (let j = 0; j < length; j++) {
  11440. let char = name[j];
  11441. if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
  11442. char = "_";
  11443. }
  11444. sanitizedName[j] = char;
  11445. }
  11446. sanitizedName = sanitizedName.join("");
  11447. if (sanitizedName === "") {
  11448. sanitizedName = "Bad_Font_Name";
  11449. }
  11450. nameIndex.add(stringToBytes(sanitizedName));
  11451. }
  11452. return this.compileIndex(nameIndex);
  11453. }
  11454. compileTopDicts(dicts, length, removeCidKeys) {
  11455. const fontDictTrackers = [];
  11456. let fdArrayIndex = new CFFIndex();
  11457. for (const fontDict of dicts) {
  11458. if (removeCidKeys) {
  11459. fontDict.removeByName("CIDFontVersion");
  11460. fontDict.removeByName("CIDFontRevision");
  11461. fontDict.removeByName("CIDFontType");
  11462. fontDict.removeByName("CIDCount");
  11463. fontDict.removeByName("UIDBase");
  11464. }
  11465. const fontDictTracker = new CFFOffsetTracker();
  11466. const fontDictData = this.compileDict(fontDict, fontDictTracker);
  11467. fontDictTrackers.push(fontDictTracker);
  11468. fdArrayIndex.add(fontDictData);
  11469. fontDictTracker.offset(length);
  11470. }
  11471. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  11472. return {
  11473. trackers: fontDictTrackers,
  11474. output: fdArrayIndex
  11475. };
  11476. }
  11477. compilePrivateDicts(dicts, trackers, output) {
  11478. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  11479. const fontDict = dicts[i];
  11480. const privateDict = fontDict.privateDict;
  11481. if (!privateDict || !fontDict.hasName("Private")) {
  11482. throw new FormatError("There must be a private dictionary.");
  11483. }
  11484. const privateDictTracker = new CFFOffsetTracker();
  11485. const privateDictData = this.compileDict(privateDict, privateDictTracker);
  11486. let outputLength = output.length;
  11487. privateDictTracker.offset(outputLength);
  11488. if (!privateDictData.length) {
  11489. outputLength = 0;
  11490. }
  11491. trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
  11492. output.add(privateDictData);
  11493. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  11494. const subrs = this.compileIndex(privateDict.subrsIndex);
  11495. privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
  11496. output.add(subrs);
  11497. }
  11498. }
  11499. }
  11500. compileDict(dict, offsetTracker) {
  11501. const out = [];
  11502. for (const key of dict.order) {
  11503. if (!(key in dict.values)) {
  11504. continue;
  11505. }
  11506. let values = dict.values[key];
  11507. let types = dict.types[key];
  11508. if (!Array.isArray(types)) {
  11509. types = [types];
  11510. }
  11511. if (!Array.isArray(values)) {
  11512. values = [values];
  11513. }
  11514. if (values.length === 0) {
  11515. continue;
  11516. }
  11517. for (let j = 0, jj = types.length; j < jj; ++j) {
  11518. const type = types[j];
  11519. const value = values[j];
  11520. switch (type) {
  11521. case "num":
  11522. case "sid":
  11523. out.push(...this.encodeNumber(value));
  11524. break;
  11525. case "offset":
  11526. const name = dict.keyToNameMap[key];
  11527. if (!offsetTracker.isTracking(name)) {
  11528. offsetTracker.track(name, out.length);
  11529. }
  11530. out.push(0x1d, 0, 0, 0, 0);
  11531. break;
  11532. case "array":
  11533. case "delta":
  11534. out.push(...this.encodeNumber(value));
  11535. for (let k = 1, kk = values.length; k < kk; ++k) {
  11536. out.push(...this.encodeNumber(values[k]));
  11537. }
  11538. break;
  11539. default:
  11540. throw new FormatError(`Unknown data type of ${type}`);
  11541. }
  11542. }
  11543. out.push(...dict.opcodes[key]);
  11544. }
  11545. return out;
  11546. }
  11547. compileStringIndex(strings) {
  11548. const stringIndex = new CFFIndex();
  11549. for (const string of strings) {
  11550. stringIndex.add(stringToBytes(string));
  11551. }
  11552. return this.compileIndex(stringIndex);
  11553. }
  11554. compileCharStrings(charStrings) {
  11555. const charStringsIndex = new CFFIndex();
  11556. for (let i = 0; i < charStrings.count; i++) {
  11557. const glyph = charStrings.get(i);
  11558. if (glyph.length === 0) {
  11559. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  11560. continue;
  11561. }
  11562. charStringsIndex.add(glyph);
  11563. }
  11564. return this.compileIndex(charStringsIndex);
  11565. }
  11566. compileCharset(charset, numGlyphs, strings, isCIDFont) {
  11567. let out;
  11568. const numGlyphsLessNotDef = numGlyphs - 1;
  11569. if (isCIDFont) {
  11570. out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
  11571. } else {
  11572. const length = 1 + numGlyphsLessNotDef * 2;
  11573. out = new Uint8Array(length);
  11574. out[0] = 0;
  11575. let charsetIndex = 0;
  11576. const numCharsets = charset.charset.length;
  11577. let warned = false;
  11578. for (let i = 1; i < out.length; i += 2) {
  11579. let sid = 0;
  11580. if (charsetIndex < numCharsets) {
  11581. const name = charset.charset[charsetIndex++];
  11582. sid = strings.getSID(name);
  11583. if (sid === -1) {
  11584. sid = 0;
  11585. if (!warned) {
  11586. warned = true;
  11587. warn(`Couldn't find ${name} in CFF strings`);
  11588. }
  11589. }
  11590. }
  11591. out[i] = sid >> 8 & 0xff;
  11592. out[i + 1] = sid & 0xff;
  11593. }
  11594. }
  11595. return this.compileTypedArray(out);
  11596. }
  11597. compileEncoding(encoding) {
  11598. return this.compileTypedArray(encoding.raw);
  11599. }
  11600. compileFDSelect(fdSelect) {
  11601. const format = fdSelect.format;
  11602. let out, i;
  11603. switch (format) {
  11604. case 0:
  11605. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  11606. out[0] = format;
  11607. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  11608. out[i + 1] = fdSelect.fdSelect[i];
  11609. }
  11610. break;
  11611. case 3:
  11612. const start = 0;
  11613. let lastFD = fdSelect.fdSelect[0];
  11614. const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
  11615. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  11616. const currentFD = fdSelect.fdSelect[i];
  11617. if (currentFD !== lastFD) {
  11618. ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
  11619. lastFD = currentFD;
  11620. }
  11621. }
  11622. const numRanges = (ranges.length - 3) / 3;
  11623. ranges[1] = numRanges >> 8 & 0xff;
  11624. ranges[2] = numRanges & 0xff;
  11625. ranges.push(i >> 8 & 0xff, i & 0xff);
  11626. out = new Uint8Array(ranges);
  11627. break;
  11628. }
  11629. return this.compileTypedArray(out);
  11630. }
  11631. compileTypedArray(data) {
  11632. return Array.from(data);
  11633. }
  11634. compileIndex(index, trackers = []) {
  11635. const objects = index.objects;
  11636. const count = objects.length;
  11637. if (count === 0) {
  11638. return [0, 0];
  11639. }
  11640. const data = [count >> 8 & 0xff, count & 0xff];
  11641. let lastOffset = 1,
  11642. i;
  11643. for (i = 0; i < count; ++i) {
  11644. lastOffset += objects[i].length;
  11645. }
  11646. let offsetSize;
  11647. if (lastOffset < 0x100) {
  11648. offsetSize = 1;
  11649. } else if (lastOffset < 0x10000) {
  11650. offsetSize = 2;
  11651. } else if (lastOffset < 0x1000000) {
  11652. offsetSize = 3;
  11653. } else {
  11654. offsetSize = 4;
  11655. }
  11656. data.push(offsetSize);
  11657. let relativeOffset = 1;
  11658. for (i = 0; i < count + 1; i++) {
  11659. if (offsetSize === 1) {
  11660. data.push(relativeOffset & 0xff);
  11661. } else if (offsetSize === 2) {
  11662. data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  11663. } else if (offsetSize === 3) {
  11664. data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  11665. } else {
  11666. data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  11667. }
  11668. if (objects[i]) {
  11669. relativeOffset += objects[i].length;
  11670. }
  11671. }
  11672. for (i = 0; i < count; i++) {
  11673. if (trackers[i]) {
  11674. trackers[i].offset(data.length);
  11675. }
  11676. data.push(...objects[i]);
  11677. }
  11678. return data;
  11679. }
  11680. }
  11681. ;// ./src/core/glyphlist.js
  11682. const getGlyphsUnicode = getLookupTableFactory(function (t) {
  11683. t.A = 0x0041;
  11684. t.AE = 0x00c6;
  11685. t.AEacute = 0x01fc;
  11686. t.AEmacron = 0x01e2;
  11687. t.AEsmall = 0xf7e6;
  11688. t.Aacute = 0x00c1;
  11689. t.Aacutesmall = 0xf7e1;
  11690. t.Abreve = 0x0102;
  11691. t.Abreveacute = 0x1eae;
  11692. t.Abrevecyrillic = 0x04d0;
  11693. t.Abrevedotbelow = 0x1eb6;
  11694. t.Abrevegrave = 0x1eb0;
  11695. t.Abrevehookabove = 0x1eb2;
  11696. t.Abrevetilde = 0x1eb4;
  11697. t.Acaron = 0x01cd;
  11698. t.Acircle = 0x24b6;
  11699. t.Acircumflex = 0x00c2;
  11700. t.Acircumflexacute = 0x1ea4;
  11701. t.Acircumflexdotbelow = 0x1eac;
  11702. t.Acircumflexgrave = 0x1ea6;
  11703. t.Acircumflexhookabove = 0x1ea8;
  11704. t.Acircumflexsmall = 0xf7e2;
  11705. t.Acircumflextilde = 0x1eaa;
  11706. t.Acute = 0xf6c9;
  11707. t.Acutesmall = 0xf7b4;
  11708. t.Acyrillic = 0x0410;
  11709. t.Adblgrave = 0x0200;
  11710. t.Adieresis = 0x00c4;
  11711. t.Adieresiscyrillic = 0x04d2;
  11712. t.Adieresismacron = 0x01de;
  11713. t.Adieresissmall = 0xf7e4;
  11714. t.Adotbelow = 0x1ea0;
  11715. t.Adotmacron = 0x01e0;
  11716. t.Agrave = 0x00c0;
  11717. t.Agravesmall = 0xf7e0;
  11718. t.Ahookabove = 0x1ea2;
  11719. t.Aiecyrillic = 0x04d4;
  11720. t.Ainvertedbreve = 0x0202;
  11721. t.Alpha = 0x0391;
  11722. t.Alphatonos = 0x0386;
  11723. t.Amacron = 0x0100;
  11724. t.Amonospace = 0xff21;
  11725. t.Aogonek = 0x0104;
  11726. t.Aring = 0x00c5;
  11727. t.Aringacute = 0x01fa;
  11728. t.Aringbelow = 0x1e00;
  11729. t.Aringsmall = 0xf7e5;
  11730. t.Asmall = 0xf761;
  11731. t.Atilde = 0x00c3;
  11732. t.Atildesmall = 0xf7e3;
  11733. t.Aybarmenian = 0x0531;
  11734. t.B = 0x0042;
  11735. t.Bcircle = 0x24b7;
  11736. t.Bdotaccent = 0x1e02;
  11737. t.Bdotbelow = 0x1e04;
  11738. t.Becyrillic = 0x0411;
  11739. t.Benarmenian = 0x0532;
  11740. t.Beta = 0x0392;
  11741. t.Bhook = 0x0181;
  11742. t.Blinebelow = 0x1e06;
  11743. t.Bmonospace = 0xff22;
  11744. t.Brevesmall = 0xf6f4;
  11745. t.Bsmall = 0xf762;
  11746. t.Btopbar = 0x0182;
  11747. t.C = 0x0043;
  11748. t.Caarmenian = 0x053e;
  11749. t.Cacute = 0x0106;
  11750. t.Caron = 0xf6ca;
  11751. t.Caronsmall = 0xf6f5;
  11752. t.Ccaron = 0x010c;
  11753. t.Ccedilla = 0x00c7;
  11754. t.Ccedillaacute = 0x1e08;
  11755. t.Ccedillasmall = 0xf7e7;
  11756. t.Ccircle = 0x24b8;
  11757. t.Ccircumflex = 0x0108;
  11758. t.Cdot = 0x010a;
  11759. t.Cdotaccent = 0x010a;
  11760. t.Cedillasmall = 0xf7b8;
  11761. t.Chaarmenian = 0x0549;
  11762. t.Cheabkhasiancyrillic = 0x04bc;
  11763. t.Checyrillic = 0x0427;
  11764. t.Chedescenderabkhasiancyrillic = 0x04be;
  11765. t.Chedescendercyrillic = 0x04b6;
  11766. t.Chedieresiscyrillic = 0x04f4;
  11767. t.Cheharmenian = 0x0543;
  11768. t.Chekhakassiancyrillic = 0x04cb;
  11769. t.Cheverticalstrokecyrillic = 0x04b8;
  11770. t.Chi = 0x03a7;
  11771. t.Chook = 0x0187;
  11772. t.Circumflexsmall = 0xf6f6;
  11773. t.Cmonospace = 0xff23;
  11774. t.Coarmenian = 0x0551;
  11775. t.Csmall = 0xf763;
  11776. t.D = 0x0044;
  11777. t.DZ = 0x01f1;
  11778. t.DZcaron = 0x01c4;
  11779. t.Daarmenian = 0x0534;
  11780. t.Dafrican = 0x0189;
  11781. t.Dcaron = 0x010e;
  11782. t.Dcedilla = 0x1e10;
  11783. t.Dcircle = 0x24b9;
  11784. t.Dcircumflexbelow = 0x1e12;
  11785. t.Dcroat = 0x0110;
  11786. t.Ddotaccent = 0x1e0a;
  11787. t.Ddotbelow = 0x1e0c;
  11788. t.Decyrillic = 0x0414;
  11789. t.Deicoptic = 0x03ee;
  11790. t.Delta = 0x2206;
  11791. t.Deltagreek = 0x0394;
  11792. t.Dhook = 0x018a;
  11793. t.Dieresis = 0xf6cb;
  11794. t.DieresisAcute = 0xf6cc;
  11795. t.DieresisGrave = 0xf6cd;
  11796. t.Dieresissmall = 0xf7a8;
  11797. t.Digammagreek = 0x03dc;
  11798. t.Djecyrillic = 0x0402;
  11799. t.Dlinebelow = 0x1e0e;
  11800. t.Dmonospace = 0xff24;
  11801. t.Dotaccentsmall = 0xf6f7;
  11802. t.Dslash = 0x0110;
  11803. t.Dsmall = 0xf764;
  11804. t.Dtopbar = 0x018b;
  11805. t.Dz = 0x01f2;
  11806. t.Dzcaron = 0x01c5;
  11807. t.Dzeabkhasiancyrillic = 0x04e0;
  11808. t.Dzecyrillic = 0x0405;
  11809. t.Dzhecyrillic = 0x040f;
  11810. t.E = 0x0045;
  11811. t.Eacute = 0x00c9;
  11812. t.Eacutesmall = 0xf7e9;
  11813. t.Ebreve = 0x0114;
  11814. t.Ecaron = 0x011a;
  11815. t.Ecedillabreve = 0x1e1c;
  11816. t.Echarmenian = 0x0535;
  11817. t.Ecircle = 0x24ba;
  11818. t.Ecircumflex = 0x00ca;
  11819. t.Ecircumflexacute = 0x1ebe;
  11820. t.Ecircumflexbelow = 0x1e18;
  11821. t.Ecircumflexdotbelow = 0x1ec6;
  11822. t.Ecircumflexgrave = 0x1ec0;
  11823. t.Ecircumflexhookabove = 0x1ec2;
  11824. t.Ecircumflexsmall = 0xf7ea;
  11825. t.Ecircumflextilde = 0x1ec4;
  11826. t.Ecyrillic = 0x0404;
  11827. t.Edblgrave = 0x0204;
  11828. t.Edieresis = 0x00cb;
  11829. t.Edieresissmall = 0xf7eb;
  11830. t.Edot = 0x0116;
  11831. t.Edotaccent = 0x0116;
  11832. t.Edotbelow = 0x1eb8;
  11833. t.Efcyrillic = 0x0424;
  11834. t.Egrave = 0x00c8;
  11835. t.Egravesmall = 0xf7e8;
  11836. t.Eharmenian = 0x0537;
  11837. t.Ehookabove = 0x1eba;
  11838. t.Eightroman = 0x2167;
  11839. t.Einvertedbreve = 0x0206;
  11840. t.Eiotifiedcyrillic = 0x0464;
  11841. t.Elcyrillic = 0x041b;
  11842. t.Elevenroman = 0x216a;
  11843. t.Emacron = 0x0112;
  11844. t.Emacronacute = 0x1e16;
  11845. t.Emacrongrave = 0x1e14;
  11846. t.Emcyrillic = 0x041c;
  11847. t.Emonospace = 0xff25;
  11848. t.Encyrillic = 0x041d;
  11849. t.Endescendercyrillic = 0x04a2;
  11850. t.Eng = 0x014a;
  11851. t.Enghecyrillic = 0x04a4;
  11852. t.Enhookcyrillic = 0x04c7;
  11853. t.Eogonek = 0x0118;
  11854. t.Eopen = 0x0190;
  11855. t.Epsilon = 0x0395;
  11856. t.Epsilontonos = 0x0388;
  11857. t.Ercyrillic = 0x0420;
  11858. t.Ereversed = 0x018e;
  11859. t.Ereversedcyrillic = 0x042d;
  11860. t.Escyrillic = 0x0421;
  11861. t.Esdescendercyrillic = 0x04aa;
  11862. t.Esh = 0x01a9;
  11863. t.Esmall = 0xf765;
  11864. t.Eta = 0x0397;
  11865. t.Etarmenian = 0x0538;
  11866. t.Etatonos = 0x0389;
  11867. t.Eth = 0x00d0;
  11868. t.Ethsmall = 0xf7f0;
  11869. t.Etilde = 0x1ebc;
  11870. t.Etildebelow = 0x1e1a;
  11871. t.Euro = 0x20ac;
  11872. t.Ezh = 0x01b7;
  11873. t.Ezhcaron = 0x01ee;
  11874. t.Ezhreversed = 0x01b8;
  11875. t.F = 0x0046;
  11876. t.Fcircle = 0x24bb;
  11877. t.Fdotaccent = 0x1e1e;
  11878. t.Feharmenian = 0x0556;
  11879. t.Feicoptic = 0x03e4;
  11880. t.Fhook = 0x0191;
  11881. t.Fitacyrillic = 0x0472;
  11882. t.Fiveroman = 0x2164;
  11883. t.Fmonospace = 0xff26;
  11884. t.Fourroman = 0x2163;
  11885. t.Fsmall = 0xf766;
  11886. t.G = 0x0047;
  11887. t.GBsquare = 0x3387;
  11888. t.Gacute = 0x01f4;
  11889. t.Gamma = 0x0393;
  11890. t.Gammaafrican = 0x0194;
  11891. t.Gangiacoptic = 0x03ea;
  11892. t.Gbreve = 0x011e;
  11893. t.Gcaron = 0x01e6;
  11894. t.Gcedilla = 0x0122;
  11895. t.Gcircle = 0x24bc;
  11896. t.Gcircumflex = 0x011c;
  11897. t.Gcommaaccent = 0x0122;
  11898. t.Gdot = 0x0120;
  11899. t.Gdotaccent = 0x0120;
  11900. t.Gecyrillic = 0x0413;
  11901. t.Ghadarmenian = 0x0542;
  11902. t.Ghemiddlehookcyrillic = 0x0494;
  11903. t.Ghestrokecyrillic = 0x0492;
  11904. t.Gheupturncyrillic = 0x0490;
  11905. t.Ghook = 0x0193;
  11906. t.Gimarmenian = 0x0533;
  11907. t.Gjecyrillic = 0x0403;
  11908. t.Gmacron = 0x1e20;
  11909. t.Gmonospace = 0xff27;
  11910. t.Grave = 0xf6ce;
  11911. t.Gravesmall = 0xf760;
  11912. t.Gsmall = 0xf767;
  11913. t.Gsmallhook = 0x029b;
  11914. t.Gstroke = 0x01e4;
  11915. t.H = 0x0048;
  11916. t.H18533 = 0x25cf;
  11917. t.H18543 = 0x25aa;
  11918. t.H18551 = 0x25ab;
  11919. t.H22073 = 0x25a1;
  11920. t.HPsquare = 0x33cb;
  11921. t.Haabkhasiancyrillic = 0x04a8;
  11922. t.Hadescendercyrillic = 0x04b2;
  11923. t.Hardsigncyrillic = 0x042a;
  11924. t.Hbar = 0x0126;
  11925. t.Hbrevebelow = 0x1e2a;
  11926. t.Hcedilla = 0x1e28;
  11927. t.Hcircle = 0x24bd;
  11928. t.Hcircumflex = 0x0124;
  11929. t.Hdieresis = 0x1e26;
  11930. t.Hdotaccent = 0x1e22;
  11931. t.Hdotbelow = 0x1e24;
  11932. t.Hmonospace = 0xff28;
  11933. t.Hoarmenian = 0x0540;
  11934. t.Horicoptic = 0x03e8;
  11935. t.Hsmall = 0xf768;
  11936. t.Hungarumlaut = 0xf6cf;
  11937. t.Hungarumlautsmall = 0xf6f8;
  11938. t.Hzsquare = 0x3390;
  11939. t.I = 0x0049;
  11940. t.IAcyrillic = 0x042f;
  11941. t.IJ = 0x0132;
  11942. t.IUcyrillic = 0x042e;
  11943. t.Iacute = 0x00cd;
  11944. t.Iacutesmall = 0xf7ed;
  11945. t.Ibreve = 0x012c;
  11946. t.Icaron = 0x01cf;
  11947. t.Icircle = 0x24be;
  11948. t.Icircumflex = 0x00ce;
  11949. t.Icircumflexsmall = 0xf7ee;
  11950. t.Icyrillic = 0x0406;
  11951. t.Idblgrave = 0x0208;
  11952. t.Idieresis = 0x00cf;
  11953. t.Idieresisacute = 0x1e2e;
  11954. t.Idieresiscyrillic = 0x04e4;
  11955. t.Idieresissmall = 0xf7ef;
  11956. t.Idot = 0x0130;
  11957. t.Idotaccent = 0x0130;
  11958. t.Idotbelow = 0x1eca;
  11959. t.Iebrevecyrillic = 0x04d6;
  11960. t.Iecyrillic = 0x0415;
  11961. t.Ifraktur = 0x2111;
  11962. t.Igrave = 0x00cc;
  11963. t.Igravesmall = 0xf7ec;
  11964. t.Ihookabove = 0x1ec8;
  11965. t.Iicyrillic = 0x0418;
  11966. t.Iinvertedbreve = 0x020a;
  11967. t.Iishortcyrillic = 0x0419;
  11968. t.Imacron = 0x012a;
  11969. t.Imacroncyrillic = 0x04e2;
  11970. t.Imonospace = 0xff29;
  11971. t.Iniarmenian = 0x053b;
  11972. t.Iocyrillic = 0x0401;
  11973. t.Iogonek = 0x012e;
  11974. t.Iota = 0x0399;
  11975. t.Iotaafrican = 0x0196;
  11976. t.Iotadieresis = 0x03aa;
  11977. t.Iotatonos = 0x038a;
  11978. t.Ismall = 0xf769;
  11979. t.Istroke = 0x0197;
  11980. t.Itilde = 0x0128;
  11981. t.Itildebelow = 0x1e2c;
  11982. t.Izhitsacyrillic = 0x0474;
  11983. t.Izhitsadblgravecyrillic = 0x0476;
  11984. t.J = 0x004a;
  11985. t.Jaarmenian = 0x0541;
  11986. t.Jcircle = 0x24bf;
  11987. t.Jcircumflex = 0x0134;
  11988. t.Jecyrillic = 0x0408;
  11989. t.Jheharmenian = 0x054b;
  11990. t.Jmonospace = 0xff2a;
  11991. t.Jsmall = 0xf76a;
  11992. t.K = 0x004b;
  11993. t.KBsquare = 0x3385;
  11994. t.KKsquare = 0x33cd;
  11995. t.Kabashkircyrillic = 0x04a0;
  11996. t.Kacute = 0x1e30;
  11997. t.Kacyrillic = 0x041a;
  11998. t.Kadescendercyrillic = 0x049a;
  11999. t.Kahookcyrillic = 0x04c3;
  12000. t.Kappa = 0x039a;
  12001. t.Kastrokecyrillic = 0x049e;
  12002. t.Kaverticalstrokecyrillic = 0x049c;
  12003. t.Kcaron = 0x01e8;
  12004. t.Kcedilla = 0x0136;
  12005. t.Kcircle = 0x24c0;
  12006. t.Kcommaaccent = 0x0136;
  12007. t.Kdotbelow = 0x1e32;
  12008. t.Keharmenian = 0x0554;
  12009. t.Kenarmenian = 0x053f;
  12010. t.Khacyrillic = 0x0425;
  12011. t.Kheicoptic = 0x03e6;
  12012. t.Khook = 0x0198;
  12013. t.Kjecyrillic = 0x040c;
  12014. t.Klinebelow = 0x1e34;
  12015. t.Kmonospace = 0xff2b;
  12016. t.Koppacyrillic = 0x0480;
  12017. t.Koppagreek = 0x03de;
  12018. t.Ksicyrillic = 0x046e;
  12019. t.Ksmall = 0xf76b;
  12020. t.L = 0x004c;
  12021. t.LJ = 0x01c7;
  12022. t.LL = 0xf6bf;
  12023. t.Lacute = 0x0139;
  12024. t.Lambda = 0x039b;
  12025. t.Lcaron = 0x013d;
  12026. t.Lcedilla = 0x013b;
  12027. t.Lcircle = 0x24c1;
  12028. t.Lcircumflexbelow = 0x1e3c;
  12029. t.Lcommaaccent = 0x013b;
  12030. t.Ldot = 0x013f;
  12031. t.Ldotaccent = 0x013f;
  12032. t.Ldotbelow = 0x1e36;
  12033. t.Ldotbelowmacron = 0x1e38;
  12034. t.Liwnarmenian = 0x053c;
  12035. t.Lj = 0x01c8;
  12036. t.Ljecyrillic = 0x0409;
  12037. t.Llinebelow = 0x1e3a;
  12038. t.Lmonospace = 0xff2c;
  12039. t.Lslash = 0x0141;
  12040. t.Lslashsmall = 0xf6f9;
  12041. t.Lsmall = 0xf76c;
  12042. t.M = 0x004d;
  12043. t.MBsquare = 0x3386;
  12044. t.Macron = 0xf6d0;
  12045. t.Macronsmall = 0xf7af;
  12046. t.Macute = 0x1e3e;
  12047. t.Mcircle = 0x24c2;
  12048. t.Mdotaccent = 0x1e40;
  12049. t.Mdotbelow = 0x1e42;
  12050. t.Menarmenian = 0x0544;
  12051. t.Mmonospace = 0xff2d;
  12052. t.Msmall = 0xf76d;
  12053. t.Mturned = 0x019c;
  12054. t.Mu = 0x039c;
  12055. t.N = 0x004e;
  12056. t.NJ = 0x01ca;
  12057. t.Nacute = 0x0143;
  12058. t.Ncaron = 0x0147;
  12059. t.Ncedilla = 0x0145;
  12060. t.Ncircle = 0x24c3;
  12061. t.Ncircumflexbelow = 0x1e4a;
  12062. t.Ncommaaccent = 0x0145;
  12063. t.Ndotaccent = 0x1e44;
  12064. t.Ndotbelow = 0x1e46;
  12065. t.Nhookleft = 0x019d;
  12066. t.Nineroman = 0x2168;
  12067. t.Nj = 0x01cb;
  12068. t.Njecyrillic = 0x040a;
  12069. t.Nlinebelow = 0x1e48;
  12070. t.Nmonospace = 0xff2e;
  12071. t.Nowarmenian = 0x0546;
  12072. t.Nsmall = 0xf76e;
  12073. t.Ntilde = 0x00d1;
  12074. t.Ntildesmall = 0xf7f1;
  12075. t.Nu = 0x039d;
  12076. t.O = 0x004f;
  12077. t.OE = 0x0152;
  12078. t.OEsmall = 0xf6fa;
  12079. t.Oacute = 0x00d3;
  12080. t.Oacutesmall = 0xf7f3;
  12081. t.Obarredcyrillic = 0x04e8;
  12082. t.Obarreddieresiscyrillic = 0x04ea;
  12083. t.Obreve = 0x014e;
  12084. t.Ocaron = 0x01d1;
  12085. t.Ocenteredtilde = 0x019f;
  12086. t.Ocircle = 0x24c4;
  12087. t.Ocircumflex = 0x00d4;
  12088. t.Ocircumflexacute = 0x1ed0;
  12089. t.Ocircumflexdotbelow = 0x1ed8;
  12090. t.Ocircumflexgrave = 0x1ed2;
  12091. t.Ocircumflexhookabove = 0x1ed4;
  12092. t.Ocircumflexsmall = 0xf7f4;
  12093. t.Ocircumflextilde = 0x1ed6;
  12094. t.Ocyrillic = 0x041e;
  12095. t.Odblacute = 0x0150;
  12096. t.Odblgrave = 0x020c;
  12097. t.Odieresis = 0x00d6;
  12098. t.Odieresiscyrillic = 0x04e6;
  12099. t.Odieresissmall = 0xf7f6;
  12100. t.Odotbelow = 0x1ecc;
  12101. t.Ogoneksmall = 0xf6fb;
  12102. t.Ograve = 0x00d2;
  12103. t.Ogravesmall = 0xf7f2;
  12104. t.Oharmenian = 0x0555;
  12105. t.Ohm = 0x2126;
  12106. t.Ohookabove = 0x1ece;
  12107. t.Ohorn = 0x01a0;
  12108. t.Ohornacute = 0x1eda;
  12109. t.Ohorndotbelow = 0x1ee2;
  12110. t.Ohorngrave = 0x1edc;
  12111. t.Ohornhookabove = 0x1ede;
  12112. t.Ohorntilde = 0x1ee0;
  12113. t.Ohungarumlaut = 0x0150;
  12114. t.Oi = 0x01a2;
  12115. t.Oinvertedbreve = 0x020e;
  12116. t.Omacron = 0x014c;
  12117. t.Omacronacute = 0x1e52;
  12118. t.Omacrongrave = 0x1e50;
  12119. t.Omega = 0x2126;
  12120. t.Omegacyrillic = 0x0460;
  12121. t.Omegagreek = 0x03a9;
  12122. t.Omegaroundcyrillic = 0x047a;
  12123. t.Omegatitlocyrillic = 0x047c;
  12124. t.Omegatonos = 0x038f;
  12125. t.Omicron = 0x039f;
  12126. t.Omicrontonos = 0x038c;
  12127. t.Omonospace = 0xff2f;
  12128. t.Oneroman = 0x2160;
  12129. t.Oogonek = 0x01ea;
  12130. t.Oogonekmacron = 0x01ec;
  12131. t.Oopen = 0x0186;
  12132. t.Oslash = 0x00d8;
  12133. t.Oslashacute = 0x01fe;
  12134. t.Oslashsmall = 0xf7f8;
  12135. t.Osmall = 0xf76f;
  12136. t.Ostrokeacute = 0x01fe;
  12137. t.Otcyrillic = 0x047e;
  12138. t.Otilde = 0x00d5;
  12139. t.Otildeacute = 0x1e4c;
  12140. t.Otildedieresis = 0x1e4e;
  12141. t.Otildesmall = 0xf7f5;
  12142. t.P = 0x0050;
  12143. t.Pacute = 0x1e54;
  12144. t.Pcircle = 0x24c5;
  12145. t.Pdotaccent = 0x1e56;
  12146. t.Pecyrillic = 0x041f;
  12147. t.Peharmenian = 0x054a;
  12148. t.Pemiddlehookcyrillic = 0x04a6;
  12149. t.Phi = 0x03a6;
  12150. t.Phook = 0x01a4;
  12151. t.Pi = 0x03a0;
  12152. t.Piwrarmenian = 0x0553;
  12153. t.Pmonospace = 0xff30;
  12154. t.Psi = 0x03a8;
  12155. t.Psicyrillic = 0x0470;
  12156. t.Psmall = 0xf770;
  12157. t.Q = 0x0051;
  12158. t.Qcircle = 0x24c6;
  12159. t.Qmonospace = 0xff31;
  12160. t.Qsmall = 0xf771;
  12161. t.R = 0x0052;
  12162. t.Raarmenian = 0x054c;
  12163. t.Racute = 0x0154;
  12164. t.Rcaron = 0x0158;
  12165. t.Rcedilla = 0x0156;
  12166. t.Rcircle = 0x24c7;
  12167. t.Rcommaaccent = 0x0156;
  12168. t.Rdblgrave = 0x0210;
  12169. t.Rdotaccent = 0x1e58;
  12170. t.Rdotbelow = 0x1e5a;
  12171. t.Rdotbelowmacron = 0x1e5c;
  12172. t.Reharmenian = 0x0550;
  12173. t.Rfraktur = 0x211c;
  12174. t.Rho = 0x03a1;
  12175. t.Ringsmall = 0xf6fc;
  12176. t.Rinvertedbreve = 0x0212;
  12177. t.Rlinebelow = 0x1e5e;
  12178. t.Rmonospace = 0xff32;
  12179. t.Rsmall = 0xf772;
  12180. t.Rsmallinverted = 0x0281;
  12181. t.Rsmallinvertedsuperior = 0x02b6;
  12182. t.S = 0x0053;
  12183. t.SF010000 = 0x250c;
  12184. t.SF020000 = 0x2514;
  12185. t.SF030000 = 0x2510;
  12186. t.SF040000 = 0x2518;
  12187. t.SF050000 = 0x253c;
  12188. t.SF060000 = 0x252c;
  12189. t.SF070000 = 0x2534;
  12190. t.SF080000 = 0x251c;
  12191. t.SF090000 = 0x2524;
  12192. t.SF100000 = 0x2500;
  12193. t.SF110000 = 0x2502;
  12194. t.SF190000 = 0x2561;
  12195. t.SF200000 = 0x2562;
  12196. t.SF210000 = 0x2556;
  12197. t.SF220000 = 0x2555;
  12198. t.SF230000 = 0x2563;
  12199. t.SF240000 = 0x2551;
  12200. t.SF250000 = 0x2557;
  12201. t.SF260000 = 0x255d;
  12202. t.SF270000 = 0x255c;
  12203. t.SF280000 = 0x255b;
  12204. t.SF360000 = 0x255e;
  12205. t.SF370000 = 0x255f;
  12206. t.SF380000 = 0x255a;
  12207. t.SF390000 = 0x2554;
  12208. t.SF400000 = 0x2569;
  12209. t.SF410000 = 0x2566;
  12210. t.SF420000 = 0x2560;
  12211. t.SF430000 = 0x2550;
  12212. t.SF440000 = 0x256c;
  12213. t.SF450000 = 0x2567;
  12214. t.SF460000 = 0x2568;
  12215. t.SF470000 = 0x2564;
  12216. t.SF480000 = 0x2565;
  12217. t.SF490000 = 0x2559;
  12218. t.SF500000 = 0x2558;
  12219. t.SF510000 = 0x2552;
  12220. t.SF520000 = 0x2553;
  12221. t.SF530000 = 0x256b;
  12222. t.SF540000 = 0x256a;
  12223. t.Sacute = 0x015a;
  12224. t.Sacutedotaccent = 0x1e64;
  12225. t.Sampigreek = 0x03e0;
  12226. t.Scaron = 0x0160;
  12227. t.Scarondotaccent = 0x1e66;
  12228. t.Scaronsmall = 0xf6fd;
  12229. t.Scedilla = 0x015e;
  12230. t.Schwa = 0x018f;
  12231. t.Schwacyrillic = 0x04d8;
  12232. t.Schwadieresiscyrillic = 0x04da;
  12233. t.Scircle = 0x24c8;
  12234. t.Scircumflex = 0x015c;
  12235. t.Scommaaccent = 0x0218;
  12236. t.Sdotaccent = 0x1e60;
  12237. t.Sdotbelow = 0x1e62;
  12238. t.Sdotbelowdotaccent = 0x1e68;
  12239. t.Seharmenian = 0x054d;
  12240. t.Sevenroman = 0x2166;
  12241. t.Shaarmenian = 0x0547;
  12242. t.Shacyrillic = 0x0428;
  12243. t.Shchacyrillic = 0x0429;
  12244. t.Sheicoptic = 0x03e2;
  12245. t.Shhacyrillic = 0x04ba;
  12246. t.Shimacoptic = 0x03ec;
  12247. t.Sigma = 0x03a3;
  12248. t.Sixroman = 0x2165;
  12249. t.Smonospace = 0xff33;
  12250. t.Softsigncyrillic = 0x042c;
  12251. t.Ssmall = 0xf773;
  12252. t.Stigmagreek = 0x03da;
  12253. t.T = 0x0054;
  12254. t.Tau = 0x03a4;
  12255. t.Tbar = 0x0166;
  12256. t.Tcaron = 0x0164;
  12257. t.Tcedilla = 0x0162;
  12258. t.Tcircle = 0x24c9;
  12259. t.Tcircumflexbelow = 0x1e70;
  12260. t.Tcommaaccent = 0x0162;
  12261. t.Tdotaccent = 0x1e6a;
  12262. t.Tdotbelow = 0x1e6c;
  12263. t.Tecyrillic = 0x0422;
  12264. t.Tedescendercyrillic = 0x04ac;
  12265. t.Tenroman = 0x2169;
  12266. t.Tetsecyrillic = 0x04b4;
  12267. t.Theta = 0x0398;
  12268. t.Thook = 0x01ac;
  12269. t.Thorn = 0x00de;
  12270. t.Thornsmall = 0xf7fe;
  12271. t.Threeroman = 0x2162;
  12272. t.Tildesmall = 0xf6fe;
  12273. t.Tiwnarmenian = 0x054f;
  12274. t.Tlinebelow = 0x1e6e;
  12275. t.Tmonospace = 0xff34;
  12276. t.Toarmenian = 0x0539;
  12277. t.Tonefive = 0x01bc;
  12278. t.Tonesix = 0x0184;
  12279. t.Tonetwo = 0x01a7;
  12280. t.Tretroflexhook = 0x01ae;
  12281. t.Tsecyrillic = 0x0426;
  12282. t.Tshecyrillic = 0x040b;
  12283. t.Tsmall = 0xf774;
  12284. t.Twelveroman = 0x216b;
  12285. t.Tworoman = 0x2161;
  12286. t.U = 0x0055;
  12287. t.Uacute = 0x00da;
  12288. t.Uacutesmall = 0xf7fa;
  12289. t.Ubreve = 0x016c;
  12290. t.Ucaron = 0x01d3;
  12291. t.Ucircle = 0x24ca;
  12292. t.Ucircumflex = 0x00db;
  12293. t.Ucircumflexbelow = 0x1e76;
  12294. t.Ucircumflexsmall = 0xf7fb;
  12295. t.Ucyrillic = 0x0423;
  12296. t.Udblacute = 0x0170;
  12297. t.Udblgrave = 0x0214;
  12298. t.Udieresis = 0x00dc;
  12299. t.Udieresisacute = 0x01d7;
  12300. t.Udieresisbelow = 0x1e72;
  12301. t.Udieresiscaron = 0x01d9;
  12302. t.Udieresiscyrillic = 0x04f0;
  12303. t.Udieresisgrave = 0x01db;
  12304. t.Udieresismacron = 0x01d5;
  12305. t.Udieresissmall = 0xf7fc;
  12306. t.Udotbelow = 0x1ee4;
  12307. t.Ugrave = 0x00d9;
  12308. t.Ugravesmall = 0xf7f9;
  12309. t.Uhookabove = 0x1ee6;
  12310. t.Uhorn = 0x01af;
  12311. t.Uhornacute = 0x1ee8;
  12312. t.Uhorndotbelow = 0x1ef0;
  12313. t.Uhorngrave = 0x1eea;
  12314. t.Uhornhookabove = 0x1eec;
  12315. t.Uhorntilde = 0x1eee;
  12316. t.Uhungarumlaut = 0x0170;
  12317. t.Uhungarumlautcyrillic = 0x04f2;
  12318. t.Uinvertedbreve = 0x0216;
  12319. t.Ukcyrillic = 0x0478;
  12320. t.Umacron = 0x016a;
  12321. t.Umacroncyrillic = 0x04ee;
  12322. t.Umacrondieresis = 0x1e7a;
  12323. t.Umonospace = 0xff35;
  12324. t.Uogonek = 0x0172;
  12325. t.Upsilon = 0x03a5;
  12326. t.Upsilon1 = 0x03d2;
  12327. t.Upsilonacutehooksymbolgreek = 0x03d3;
  12328. t.Upsilonafrican = 0x01b1;
  12329. t.Upsilondieresis = 0x03ab;
  12330. t.Upsilondieresishooksymbolgreek = 0x03d4;
  12331. t.Upsilonhooksymbol = 0x03d2;
  12332. t.Upsilontonos = 0x038e;
  12333. t.Uring = 0x016e;
  12334. t.Ushortcyrillic = 0x040e;
  12335. t.Usmall = 0xf775;
  12336. t.Ustraightcyrillic = 0x04ae;
  12337. t.Ustraightstrokecyrillic = 0x04b0;
  12338. t.Utilde = 0x0168;
  12339. t.Utildeacute = 0x1e78;
  12340. t.Utildebelow = 0x1e74;
  12341. t.V = 0x0056;
  12342. t.Vcircle = 0x24cb;
  12343. t.Vdotbelow = 0x1e7e;
  12344. t.Vecyrillic = 0x0412;
  12345. t.Vewarmenian = 0x054e;
  12346. t.Vhook = 0x01b2;
  12347. t.Vmonospace = 0xff36;
  12348. t.Voarmenian = 0x0548;
  12349. t.Vsmall = 0xf776;
  12350. t.Vtilde = 0x1e7c;
  12351. t.W = 0x0057;
  12352. t.Wacute = 0x1e82;
  12353. t.Wcircle = 0x24cc;
  12354. t.Wcircumflex = 0x0174;
  12355. t.Wdieresis = 0x1e84;
  12356. t.Wdotaccent = 0x1e86;
  12357. t.Wdotbelow = 0x1e88;
  12358. t.Wgrave = 0x1e80;
  12359. t.Wmonospace = 0xff37;
  12360. t.Wsmall = 0xf777;
  12361. t.X = 0x0058;
  12362. t.Xcircle = 0x24cd;
  12363. t.Xdieresis = 0x1e8c;
  12364. t.Xdotaccent = 0x1e8a;
  12365. t.Xeharmenian = 0x053d;
  12366. t.Xi = 0x039e;
  12367. t.Xmonospace = 0xff38;
  12368. t.Xsmall = 0xf778;
  12369. t.Y = 0x0059;
  12370. t.Yacute = 0x00dd;
  12371. t.Yacutesmall = 0xf7fd;
  12372. t.Yatcyrillic = 0x0462;
  12373. t.Ycircle = 0x24ce;
  12374. t.Ycircumflex = 0x0176;
  12375. t.Ydieresis = 0x0178;
  12376. t.Ydieresissmall = 0xf7ff;
  12377. t.Ydotaccent = 0x1e8e;
  12378. t.Ydotbelow = 0x1ef4;
  12379. t.Yericyrillic = 0x042b;
  12380. t.Yerudieresiscyrillic = 0x04f8;
  12381. t.Ygrave = 0x1ef2;
  12382. t.Yhook = 0x01b3;
  12383. t.Yhookabove = 0x1ef6;
  12384. t.Yiarmenian = 0x0545;
  12385. t.Yicyrillic = 0x0407;
  12386. t.Yiwnarmenian = 0x0552;
  12387. t.Ymonospace = 0xff39;
  12388. t.Ysmall = 0xf779;
  12389. t.Ytilde = 0x1ef8;
  12390. t.Yusbigcyrillic = 0x046a;
  12391. t.Yusbigiotifiedcyrillic = 0x046c;
  12392. t.Yuslittlecyrillic = 0x0466;
  12393. t.Yuslittleiotifiedcyrillic = 0x0468;
  12394. t.Z = 0x005a;
  12395. t.Zaarmenian = 0x0536;
  12396. t.Zacute = 0x0179;
  12397. t.Zcaron = 0x017d;
  12398. t.Zcaronsmall = 0xf6ff;
  12399. t.Zcircle = 0x24cf;
  12400. t.Zcircumflex = 0x1e90;
  12401. t.Zdot = 0x017b;
  12402. t.Zdotaccent = 0x017b;
  12403. t.Zdotbelow = 0x1e92;
  12404. t.Zecyrillic = 0x0417;
  12405. t.Zedescendercyrillic = 0x0498;
  12406. t.Zedieresiscyrillic = 0x04de;
  12407. t.Zeta = 0x0396;
  12408. t.Zhearmenian = 0x053a;
  12409. t.Zhebrevecyrillic = 0x04c1;
  12410. t.Zhecyrillic = 0x0416;
  12411. t.Zhedescendercyrillic = 0x0496;
  12412. t.Zhedieresiscyrillic = 0x04dc;
  12413. t.Zlinebelow = 0x1e94;
  12414. t.Zmonospace = 0xff3a;
  12415. t.Zsmall = 0xf77a;
  12416. t.Zstroke = 0x01b5;
  12417. t.a = 0x0061;
  12418. t.aabengali = 0x0986;
  12419. t.aacute = 0x00e1;
  12420. t.aadeva = 0x0906;
  12421. t.aagujarati = 0x0a86;
  12422. t.aagurmukhi = 0x0a06;
  12423. t.aamatragurmukhi = 0x0a3e;
  12424. t.aarusquare = 0x3303;
  12425. t.aavowelsignbengali = 0x09be;
  12426. t.aavowelsigndeva = 0x093e;
  12427. t.aavowelsigngujarati = 0x0abe;
  12428. t.abbreviationmarkarmenian = 0x055f;
  12429. t.abbreviationsigndeva = 0x0970;
  12430. t.abengali = 0x0985;
  12431. t.abopomofo = 0x311a;
  12432. t.abreve = 0x0103;
  12433. t.abreveacute = 0x1eaf;
  12434. t.abrevecyrillic = 0x04d1;
  12435. t.abrevedotbelow = 0x1eb7;
  12436. t.abrevegrave = 0x1eb1;
  12437. t.abrevehookabove = 0x1eb3;
  12438. t.abrevetilde = 0x1eb5;
  12439. t.acaron = 0x01ce;
  12440. t.acircle = 0x24d0;
  12441. t.acircumflex = 0x00e2;
  12442. t.acircumflexacute = 0x1ea5;
  12443. t.acircumflexdotbelow = 0x1ead;
  12444. t.acircumflexgrave = 0x1ea7;
  12445. t.acircumflexhookabove = 0x1ea9;
  12446. t.acircumflextilde = 0x1eab;
  12447. t.acute = 0x00b4;
  12448. t.acutebelowcmb = 0x0317;
  12449. t.acutecmb = 0x0301;
  12450. t.acutecomb = 0x0301;
  12451. t.acutedeva = 0x0954;
  12452. t.acutelowmod = 0x02cf;
  12453. t.acutetonecmb = 0x0341;
  12454. t.acyrillic = 0x0430;
  12455. t.adblgrave = 0x0201;
  12456. t.addakgurmukhi = 0x0a71;
  12457. t.adeva = 0x0905;
  12458. t.adieresis = 0x00e4;
  12459. t.adieresiscyrillic = 0x04d3;
  12460. t.adieresismacron = 0x01df;
  12461. t.adotbelow = 0x1ea1;
  12462. t.adotmacron = 0x01e1;
  12463. t.ae = 0x00e6;
  12464. t.aeacute = 0x01fd;
  12465. t.aekorean = 0x3150;
  12466. t.aemacron = 0x01e3;
  12467. t.afii00208 = 0x2015;
  12468. t.afii08941 = 0x20a4;
  12469. t.afii10017 = 0x0410;
  12470. t.afii10018 = 0x0411;
  12471. t.afii10019 = 0x0412;
  12472. t.afii10020 = 0x0413;
  12473. t.afii10021 = 0x0414;
  12474. t.afii10022 = 0x0415;
  12475. t.afii10023 = 0x0401;
  12476. t.afii10024 = 0x0416;
  12477. t.afii10025 = 0x0417;
  12478. t.afii10026 = 0x0418;
  12479. t.afii10027 = 0x0419;
  12480. t.afii10028 = 0x041a;
  12481. t.afii10029 = 0x041b;
  12482. t.afii10030 = 0x041c;
  12483. t.afii10031 = 0x041d;
  12484. t.afii10032 = 0x041e;
  12485. t.afii10033 = 0x041f;
  12486. t.afii10034 = 0x0420;
  12487. t.afii10035 = 0x0421;
  12488. t.afii10036 = 0x0422;
  12489. t.afii10037 = 0x0423;
  12490. t.afii10038 = 0x0424;
  12491. t.afii10039 = 0x0425;
  12492. t.afii10040 = 0x0426;
  12493. t.afii10041 = 0x0427;
  12494. t.afii10042 = 0x0428;
  12495. t.afii10043 = 0x0429;
  12496. t.afii10044 = 0x042a;
  12497. t.afii10045 = 0x042b;
  12498. t.afii10046 = 0x042c;
  12499. t.afii10047 = 0x042d;
  12500. t.afii10048 = 0x042e;
  12501. t.afii10049 = 0x042f;
  12502. t.afii10050 = 0x0490;
  12503. t.afii10051 = 0x0402;
  12504. t.afii10052 = 0x0403;
  12505. t.afii10053 = 0x0404;
  12506. t.afii10054 = 0x0405;
  12507. t.afii10055 = 0x0406;
  12508. t.afii10056 = 0x0407;
  12509. t.afii10057 = 0x0408;
  12510. t.afii10058 = 0x0409;
  12511. t.afii10059 = 0x040a;
  12512. t.afii10060 = 0x040b;
  12513. t.afii10061 = 0x040c;
  12514. t.afii10062 = 0x040e;
  12515. t.afii10063 = 0xf6c4;
  12516. t.afii10064 = 0xf6c5;
  12517. t.afii10065 = 0x0430;
  12518. t.afii10066 = 0x0431;
  12519. t.afii10067 = 0x0432;
  12520. t.afii10068 = 0x0433;
  12521. t.afii10069 = 0x0434;
  12522. t.afii10070 = 0x0435;
  12523. t.afii10071 = 0x0451;
  12524. t.afii10072 = 0x0436;
  12525. t.afii10073 = 0x0437;
  12526. t.afii10074 = 0x0438;
  12527. t.afii10075 = 0x0439;
  12528. t.afii10076 = 0x043a;
  12529. t.afii10077 = 0x043b;
  12530. t.afii10078 = 0x043c;
  12531. t.afii10079 = 0x043d;
  12532. t.afii10080 = 0x043e;
  12533. t.afii10081 = 0x043f;
  12534. t.afii10082 = 0x0440;
  12535. t.afii10083 = 0x0441;
  12536. t.afii10084 = 0x0442;
  12537. t.afii10085 = 0x0443;
  12538. t.afii10086 = 0x0444;
  12539. t.afii10087 = 0x0445;
  12540. t.afii10088 = 0x0446;
  12541. t.afii10089 = 0x0447;
  12542. t.afii10090 = 0x0448;
  12543. t.afii10091 = 0x0449;
  12544. t.afii10092 = 0x044a;
  12545. t.afii10093 = 0x044b;
  12546. t.afii10094 = 0x044c;
  12547. t.afii10095 = 0x044d;
  12548. t.afii10096 = 0x044e;
  12549. t.afii10097 = 0x044f;
  12550. t.afii10098 = 0x0491;
  12551. t.afii10099 = 0x0452;
  12552. t.afii10100 = 0x0453;
  12553. t.afii10101 = 0x0454;
  12554. t.afii10102 = 0x0455;
  12555. t.afii10103 = 0x0456;
  12556. t.afii10104 = 0x0457;
  12557. t.afii10105 = 0x0458;
  12558. t.afii10106 = 0x0459;
  12559. t.afii10107 = 0x045a;
  12560. t.afii10108 = 0x045b;
  12561. t.afii10109 = 0x045c;
  12562. t.afii10110 = 0x045e;
  12563. t.afii10145 = 0x040f;
  12564. t.afii10146 = 0x0462;
  12565. t.afii10147 = 0x0472;
  12566. t.afii10148 = 0x0474;
  12567. t.afii10192 = 0xf6c6;
  12568. t.afii10193 = 0x045f;
  12569. t.afii10194 = 0x0463;
  12570. t.afii10195 = 0x0473;
  12571. t.afii10196 = 0x0475;
  12572. t.afii10831 = 0xf6c7;
  12573. t.afii10832 = 0xf6c8;
  12574. t.afii10846 = 0x04d9;
  12575. t.afii299 = 0x200e;
  12576. t.afii300 = 0x200f;
  12577. t.afii301 = 0x200d;
  12578. t.afii57381 = 0x066a;
  12579. t.afii57388 = 0x060c;
  12580. t.afii57392 = 0x0660;
  12581. t.afii57393 = 0x0661;
  12582. t.afii57394 = 0x0662;
  12583. t.afii57395 = 0x0663;
  12584. t.afii57396 = 0x0664;
  12585. t.afii57397 = 0x0665;
  12586. t.afii57398 = 0x0666;
  12587. t.afii57399 = 0x0667;
  12588. t.afii57400 = 0x0668;
  12589. t.afii57401 = 0x0669;
  12590. t.afii57403 = 0x061b;
  12591. t.afii57407 = 0x061f;
  12592. t.afii57409 = 0x0621;
  12593. t.afii57410 = 0x0622;
  12594. t.afii57411 = 0x0623;
  12595. t.afii57412 = 0x0624;
  12596. t.afii57413 = 0x0625;
  12597. t.afii57414 = 0x0626;
  12598. t.afii57415 = 0x0627;
  12599. t.afii57416 = 0x0628;
  12600. t.afii57417 = 0x0629;
  12601. t.afii57418 = 0x062a;
  12602. t.afii57419 = 0x062b;
  12603. t.afii57420 = 0x062c;
  12604. t.afii57421 = 0x062d;
  12605. t.afii57422 = 0x062e;
  12606. t.afii57423 = 0x062f;
  12607. t.afii57424 = 0x0630;
  12608. t.afii57425 = 0x0631;
  12609. t.afii57426 = 0x0632;
  12610. t.afii57427 = 0x0633;
  12611. t.afii57428 = 0x0634;
  12612. t.afii57429 = 0x0635;
  12613. t.afii57430 = 0x0636;
  12614. t.afii57431 = 0x0637;
  12615. t.afii57432 = 0x0638;
  12616. t.afii57433 = 0x0639;
  12617. t.afii57434 = 0x063a;
  12618. t.afii57440 = 0x0640;
  12619. t.afii57441 = 0x0641;
  12620. t.afii57442 = 0x0642;
  12621. t.afii57443 = 0x0643;
  12622. t.afii57444 = 0x0644;
  12623. t.afii57445 = 0x0645;
  12624. t.afii57446 = 0x0646;
  12625. t.afii57448 = 0x0648;
  12626. t.afii57449 = 0x0649;
  12627. t.afii57450 = 0x064a;
  12628. t.afii57451 = 0x064b;
  12629. t.afii57452 = 0x064c;
  12630. t.afii57453 = 0x064d;
  12631. t.afii57454 = 0x064e;
  12632. t.afii57455 = 0x064f;
  12633. t.afii57456 = 0x0650;
  12634. t.afii57457 = 0x0651;
  12635. t.afii57458 = 0x0652;
  12636. t.afii57470 = 0x0647;
  12637. t.afii57505 = 0x06a4;
  12638. t.afii57506 = 0x067e;
  12639. t.afii57507 = 0x0686;
  12640. t.afii57508 = 0x0698;
  12641. t.afii57509 = 0x06af;
  12642. t.afii57511 = 0x0679;
  12643. t.afii57512 = 0x0688;
  12644. t.afii57513 = 0x0691;
  12645. t.afii57514 = 0x06ba;
  12646. t.afii57519 = 0x06d2;
  12647. t.afii57534 = 0x06d5;
  12648. t.afii57636 = 0x20aa;
  12649. t.afii57645 = 0x05be;
  12650. t.afii57658 = 0x05c3;
  12651. t.afii57664 = 0x05d0;
  12652. t.afii57665 = 0x05d1;
  12653. t.afii57666 = 0x05d2;
  12654. t.afii57667 = 0x05d3;
  12655. t.afii57668 = 0x05d4;
  12656. t.afii57669 = 0x05d5;
  12657. t.afii57670 = 0x05d6;
  12658. t.afii57671 = 0x05d7;
  12659. t.afii57672 = 0x05d8;
  12660. t.afii57673 = 0x05d9;
  12661. t.afii57674 = 0x05da;
  12662. t.afii57675 = 0x05db;
  12663. t.afii57676 = 0x05dc;
  12664. t.afii57677 = 0x05dd;
  12665. t.afii57678 = 0x05de;
  12666. t.afii57679 = 0x05df;
  12667. t.afii57680 = 0x05e0;
  12668. t.afii57681 = 0x05e1;
  12669. t.afii57682 = 0x05e2;
  12670. t.afii57683 = 0x05e3;
  12671. t.afii57684 = 0x05e4;
  12672. t.afii57685 = 0x05e5;
  12673. t.afii57686 = 0x05e6;
  12674. t.afii57687 = 0x05e7;
  12675. t.afii57688 = 0x05e8;
  12676. t.afii57689 = 0x05e9;
  12677. t.afii57690 = 0x05ea;
  12678. t.afii57694 = 0xfb2a;
  12679. t.afii57695 = 0xfb2b;
  12680. t.afii57700 = 0xfb4b;
  12681. t.afii57705 = 0xfb1f;
  12682. t.afii57716 = 0x05f0;
  12683. t.afii57717 = 0x05f1;
  12684. t.afii57718 = 0x05f2;
  12685. t.afii57723 = 0xfb35;
  12686. t.afii57793 = 0x05b4;
  12687. t.afii57794 = 0x05b5;
  12688. t.afii57795 = 0x05b6;
  12689. t.afii57796 = 0x05bb;
  12690. t.afii57797 = 0x05b8;
  12691. t.afii57798 = 0x05b7;
  12692. t.afii57799 = 0x05b0;
  12693. t.afii57800 = 0x05b2;
  12694. t.afii57801 = 0x05b1;
  12695. t.afii57802 = 0x05b3;
  12696. t.afii57803 = 0x05c2;
  12697. t.afii57804 = 0x05c1;
  12698. t.afii57806 = 0x05b9;
  12699. t.afii57807 = 0x05bc;
  12700. t.afii57839 = 0x05bd;
  12701. t.afii57841 = 0x05bf;
  12702. t.afii57842 = 0x05c0;
  12703. t.afii57929 = 0x02bc;
  12704. t.afii61248 = 0x2105;
  12705. t.afii61289 = 0x2113;
  12706. t.afii61352 = 0x2116;
  12707. t.afii61573 = 0x202c;
  12708. t.afii61574 = 0x202d;
  12709. t.afii61575 = 0x202e;
  12710. t.afii61664 = 0x200c;
  12711. t.afii63167 = 0x066d;
  12712. t.afii64937 = 0x02bd;
  12713. t.agrave = 0x00e0;
  12714. t.agujarati = 0x0a85;
  12715. t.agurmukhi = 0x0a05;
  12716. t.ahiragana = 0x3042;
  12717. t.ahookabove = 0x1ea3;
  12718. t.aibengali = 0x0990;
  12719. t.aibopomofo = 0x311e;
  12720. t.aideva = 0x0910;
  12721. t.aiecyrillic = 0x04d5;
  12722. t.aigujarati = 0x0a90;
  12723. t.aigurmukhi = 0x0a10;
  12724. t.aimatragurmukhi = 0x0a48;
  12725. t.ainarabic = 0x0639;
  12726. t.ainfinalarabic = 0xfeca;
  12727. t.aininitialarabic = 0xfecb;
  12728. t.ainmedialarabic = 0xfecc;
  12729. t.ainvertedbreve = 0x0203;
  12730. t.aivowelsignbengali = 0x09c8;
  12731. t.aivowelsigndeva = 0x0948;
  12732. t.aivowelsigngujarati = 0x0ac8;
  12733. t.akatakana = 0x30a2;
  12734. t.akatakanahalfwidth = 0xff71;
  12735. t.akorean = 0x314f;
  12736. t.alef = 0x05d0;
  12737. t.alefarabic = 0x0627;
  12738. t.alefdageshhebrew = 0xfb30;
  12739. t.aleffinalarabic = 0xfe8e;
  12740. t.alefhamzaabovearabic = 0x0623;
  12741. t.alefhamzaabovefinalarabic = 0xfe84;
  12742. t.alefhamzabelowarabic = 0x0625;
  12743. t.alefhamzabelowfinalarabic = 0xfe88;
  12744. t.alefhebrew = 0x05d0;
  12745. t.aleflamedhebrew = 0xfb4f;
  12746. t.alefmaddaabovearabic = 0x0622;
  12747. t.alefmaddaabovefinalarabic = 0xfe82;
  12748. t.alefmaksuraarabic = 0x0649;
  12749. t.alefmaksurafinalarabic = 0xfef0;
  12750. t.alefmaksurainitialarabic = 0xfef3;
  12751. t.alefmaksuramedialarabic = 0xfef4;
  12752. t.alefpatahhebrew = 0xfb2e;
  12753. t.alefqamatshebrew = 0xfb2f;
  12754. t.aleph = 0x2135;
  12755. t.allequal = 0x224c;
  12756. t.alpha = 0x03b1;
  12757. t.alphatonos = 0x03ac;
  12758. t.amacron = 0x0101;
  12759. t.amonospace = 0xff41;
  12760. t.ampersand = 0x0026;
  12761. t.ampersandmonospace = 0xff06;
  12762. t.ampersandsmall = 0xf726;
  12763. t.amsquare = 0x33c2;
  12764. t.anbopomofo = 0x3122;
  12765. t.angbopomofo = 0x3124;
  12766. t.angbracketleft = 0x3008;
  12767. t.angbracketright = 0x3009;
  12768. t.angkhankhuthai = 0x0e5a;
  12769. t.angle = 0x2220;
  12770. t.anglebracketleft = 0x3008;
  12771. t.anglebracketleftvertical = 0xfe3f;
  12772. t.anglebracketright = 0x3009;
  12773. t.anglebracketrightvertical = 0xfe40;
  12774. t.angleleft = 0x2329;
  12775. t.angleright = 0x232a;
  12776. t.angstrom = 0x212b;
  12777. t.anoteleia = 0x0387;
  12778. t.anudattadeva = 0x0952;
  12779. t.anusvarabengali = 0x0982;
  12780. t.anusvaradeva = 0x0902;
  12781. t.anusvaragujarati = 0x0a82;
  12782. t.aogonek = 0x0105;
  12783. t.apaatosquare = 0x3300;
  12784. t.aparen = 0x249c;
  12785. t.apostrophearmenian = 0x055a;
  12786. t.apostrophemod = 0x02bc;
  12787. t.apple = 0xf8ff;
  12788. t.approaches = 0x2250;
  12789. t.approxequal = 0x2248;
  12790. t.approxequalorimage = 0x2252;
  12791. t.approximatelyequal = 0x2245;
  12792. t.araeaekorean = 0x318e;
  12793. t.araeakorean = 0x318d;
  12794. t.arc = 0x2312;
  12795. t.arighthalfring = 0x1e9a;
  12796. t.aring = 0x00e5;
  12797. t.aringacute = 0x01fb;
  12798. t.aringbelow = 0x1e01;
  12799. t.arrowboth = 0x2194;
  12800. t.arrowdashdown = 0x21e3;
  12801. t.arrowdashleft = 0x21e0;
  12802. t.arrowdashright = 0x21e2;
  12803. t.arrowdashup = 0x21e1;
  12804. t.arrowdblboth = 0x21d4;
  12805. t.arrowdbldown = 0x21d3;
  12806. t.arrowdblleft = 0x21d0;
  12807. t.arrowdblright = 0x21d2;
  12808. t.arrowdblup = 0x21d1;
  12809. t.arrowdown = 0x2193;
  12810. t.arrowdownleft = 0x2199;
  12811. t.arrowdownright = 0x2198;
  12812. t.arrowdownwhite = 0x21e9;
  12813. t.arrowheaddownmod = 0x02c5;
  12814. t.arrowheadleftmod = 0x02c2;
  12815. t.arrowheadrightmod = 0x02c3;
  12816. t.arrowheadupmod = 0x02c4;
  12817. t.arrowhorizex = 0xf8e7;
  12818. t.arrowleft = 0x2190;
  12819. t.arrowleftdbl = 0x21d0;
  12820. t.arrowleftdblstroke = 0x21cd;
  12821. t.arrowleftoverright = 0x21c6;
  12822. t.arrowleftwhite = 0x21e6;
  12823. t.arrowright = 0x2192;
  12824. t.arrowrightdblstroke = 0x21cf;
  12825. t.arrowrightheavy = 0x279e;
  12826. t.arrowrightoverleft = 0x21c4;
  12827. t.arrowrightwhite = 0x21e8;
  12828. t.arrowtableft = 0x21e4;
  12829. t.arrowtabright = 0x21e5;
  12830. t.arrowup = 0x2191;
  12831. t.arrowupdn = 0x2195;
  12832. t.arrowupdnbse = 0x21a8;
  12833. t.arrowupdownbase = 0x21a8;
  12834. t.arrowupleft = 0x2196;
  12835. t.arrowupleftofdown = 0x21c5;
  12836. t.arrowupright = 0x2197;
  12837. t.arrowupwhite = 0x21e7;
  12838. t.arrowvertex = 0xf8e6;
  12839. t.asciicircum = 0x005e;
  12840. t.asciicircummonospace = 0xff3e;
  12841. t.asciitilde = 0x007e;
  12842. t.asciitildemonospace = 0xff5e;
  12843. t.ascript = 0x0251;
  12844. t.ascriptturned = 0x0252;
  12845. t.asmallhiragana = 0x3041;
  12846. t.asmallkatakana = 0x30a1;
  12847. t.asmallkatakanahalfwidth = 0xff67;
  12848. t.asterisk = 0x002a;
  12849. t.asteriskaltonearabic = 0x066d;
  12850. t.asteriskarabic = 0x066d;
  12851. t.asteriskmath = 0x2217;
  12852. t.asteriskmonospace = 0xff0a;
  12853. t.asterisksmall = 0xfe61;
  12854. t.asterism = 0x2042;
  12855. t.asuperior = 0xf6e9;
  12856. t.asymptoticallyequal = 0x2243;
  12857. t.at = 0x0040;
  12858. t.atilde = 0x00e3;
  12859. t.atmonospace = 0xff20;
  12860. t.atsmall = 0xfe6b;
  12861. t.aturned = 0x0250;
  12862. t.aubengali = 0x0994;
  12863. t.aubopomofo = 0x3120;
  12864. t.audeva = 0x0914;
  12865. t.augujarati = 0x0a94;
  12866. t.augurmukhi = 0x0a14;
  12867. t.aulengthmarkbengali = 0x09d7;
  12868. t.aumatragurmukhi = 0x0a4c;
  12869. t.auvowelsignbengali = 0x09cc;
  12870. t.auvowelsigndeva = 0x094c;
  12871. t.auvowelsigngujarati = 0x0acc;
  12872. t.avagrahadeva = 0x093d;
  12873. t.aybarmenian = 0x0561;
  12874. t.ayin = 0x05e2;
  12875. t.ayinaltonehebrew = 0xfb20;
  12876. t.ayinhebrew = 0x05e2;
  12877. t.b = 0x0062;
  12878. t.babengali = 0x09ac;
  12879. t.backslash = 0x005c;
  12880. t.backslashmonospace = 0xff3c;
  12881. t.badeva = 0x092c;
  12882. t.bagujarati = 0x0aac;
  12883. t.bagurmukhi = 0x0a2c;
  12884. t.bahiragana = 0x3070;
  12885. t.bahtthai = 0x0e3f;
  12886. t.bakatakana = 0x30d0;
  12887. t.bar = 0x007c;
  12888. t.barmonospace = 0xff5c;
  12889. t.bbopomofo = 0x3105;
  12890. t.bcircle = 0x24d1;
  12891. t.bdotaccent = 0x1e03;
  12892. t.bdotbelow = 0x1e05;
  12893. t.beamedsixteenthnotes = 0x266c;
  12894. t.because = 0x2235;
  12895. t.becyrillic = 0x0431;
  12896. t.beharabic = 0x0628;
  12897. t.behfinalarabic = 0xfe90;
  12898. t.behinitialarabic = 0xfe91;
  12899. t.behiragana = 0x3079;
  12900. t.behmedialarabic = 0xfe92;
  12901. t.behmeeminitialarabic = 0xfc9f;
  12902. t.behmeemisolatedarabic = 0xfc08;
  12903. t.behnoonfinalarabic = 0xfc6d;
  12904. t.bekatakana = 0x30d9;
  12905. t.benarmenian = 0x0562;
  12906. t.bet = 0x05d1;
  12907. t.beta = 0x03b2;
  12908. t.betasymbolgreek = 0x03d0;
  12909. t.betdagesh = 0xfb31;
  12910. t.betdageshhebrew = 0xfb31;
  12911. t.bethebrew = 0x05d1;
  12912. t.betrafehebrew = 0xfb4c;
  12913. t.bhabengali = 0x09ad;
  12914. t.bhadeva = 0x092d;
  12915. t.bhagujarati = 0x0aad;
  12916. t.bhagurmukhi = 0x0a2d;
  12917. t.bhook = 0x0253;
  12918. t.bihiragana = 0x3073;
  12919. t.bikatakana = 0x30d3;
  12920. t.bilabialclick = 0x0298;
  12921. t.bindigurmukhi = 0x0a02;
  12922. t.birusquare = 0x3331;
  12923. t.blackcircle = 0x25cf;
  12924. t.blackdiamond = 0x25c6;
  12925. t.blackdownpointingtriangle = 0x25bc;
  12926. t.blackleftpointingpointer = 0x25c4;
  12927. t.blackleftpointingtriangle = 0x25c0;
  12928. t.blacklenticularbracketleft = 0x3010;
  12929. t.blacklenticularbracketleftvertical = 0xfe3b;
  12930. t.blacklenticularbracketright = 0x3011;
  12931. t.blacklenticularbracketrightvertical = 0xfe3c;
  12932. t.blacklowerlefttriangle = 0x25e3;
  12933. t.blacklowerrighttriangle = 0x25e2;
  12934. t.blackrectangle = 0x25ac;
  12935. t.blackrightpointingpointer = 0x25ba;
  12936. t.blackrightpointingtriangle = 0x25b6;
  12937. t.blacksmallsquare = 0x25aa;
  12938. t.blacksmilingface = 0x263b;
  12939. t.blacksquare = 0x25a0;
  12940. t.blackstar = 0x2605;
  12941. t.blackupperlefttriangle = 0x25e4;
  12942. t.blackupperrighttriangle = 0x25e5;
  12943. t.blackuppointingsmalltriangle = 0x25b4;
  12944. t.blackuppointingtriangle = 0x25b2;
  12945. t.blank = 0x2423;
  12946. t.blinebelow = 0x1e07;
  12947. t.block = 0x2588;
  12948. t.bmonospace = 0xff42;
  12949. t.bobaimaithai = 0x0e1a;
  12950. t.bohiragana = 0x307c;
  12951. t.bokatakana = 0x30dc;
  12952. t.bparen = 0x249d;
  12953. t.bqsquare = 0x33c3;
  12954. t.braceex = 0xf8f4;
  12955. t.braceleft = 0x007b;
  12956. t.braceleftbt = 0xf8f3;
  12957. t.braceleftmid = 0xf8f2;
  12958. t.braceleftmonospace = 0xff5b;
  12959. t.braceleftsmall = 0xfe5b;
  12960. t.bracelefttp = 0xf8f1;
  12961. t.braceleftvertical = 0xfe37;
  12962. t.braceright = 0x007d;
  12963. t.bracerightbt = 0xf8fe;
  12964. t.bracerightmid = 0xf8fd;
  12965. t.bracerightmonospace = 0xff5d;
  12966. t.bracerightsmall = 0xfe5c;
  12967. t.bracerighttp = 0xf8fc;
  12968. t.bracerightvertical = 0xfe38;
  12969. t.bracketleft = 0x005b;
  12970. t.bracketleftbt = 0xf8f0;
  12971. t.bracketleftex = 0xf8ef;
  12972. t.bracketleftmonospace = 0xff3b;
  12973. t.bracketlefttp = 0xf8ee;
  12974. t.bracketright = 0x005d;
  12975. t.bracketrightbt = 0xf8fb;
  12976. t.bracketrightex = 0xf8fa;
  12977. t.bracketrightmonospace = 0xff3d;
  12978. t.bracketrighttp = 0xf8f9;
  12979. t.breve = 0x02d8;
  12980. t.brevebelowcmb = 0x032e;
  12981. t.brevecmb = 0x0306;
  12982. t.breveinvertedbelowcmb = 0x032f;
  12983. t.breveinvertedcmb = 0x0311;
  12984. t.breveinverteddoublecmb = 0x0361;
  12985. t.bridgebelowcmb = 0x032a;
  12986. t.bridgeinvertedbelowcmb = 0x033a;
  12987. t.brokenbar = 0x00a6;
  12988. t.bstroke = 0x0180;
  12989. t.bsuperior = 0xf6ea;
  12990. t.btopbar = 0x0183;
  12991. t.buhiragana = 0x3076;
  12992. t.bukatakana = 0x30d6;
  12993. t.bullet = 0x2022;
  12994. t.bulletinverse = 0x25d8;
  12995. t.bulletoperator = 0x2219;
  12996. t.bullseye = 0x25ce;
  12997. t.c = 0x0063;
  12998. t.caarmenian = 0x056e;
  12999. t.cabengali = 0x099a;
  13000. t.cacute = 0x0107;
  13001. t.cadeva = 0x091a;
  13002. t.cagujarati = 0x0a9a;
  13003. t.cagurmukhi = 0x0a1a;
  13004. t.calsquare = 0x3388;
  13005. t.candrabindubengali = 0x0981;
  13006. t.candrabinducmb = 0x0310;
  13007. t.candrabindudeva = 0x0901;
  13008. t.candrabindugujarati = 0x0a81;
  13009. t.capslock = 0x21ea;
  13010. t.careof = 0x2105;
  13011. t.caron = 0x02c7;
  13012. t.caronbelowcmb = 0x032c;
  13013. t.caroncmb = 0x030c;
  13014. t.carriagereturn = 0x21b5;
  13015. t.cbopomofo = 0x3118;
  13016. t.ccaron = 0x010d;
  13017. t.ccedilla = 0x00e7;
  13018. t.ccedillaacute = 0x1e09;
  13019. t.ccircle = 0x24d2;
  13020. t.ccircumflex = 0x0109;
  13021. t.ccurl = 0x0255;
  13022. t.cdot = 0x010b;
  13023. t.cdotaccent = 0x010b;
  13024. t.cdsquare = 0x33c5;
  13025. t.cedilla = 0x00b8;
  13026. t.cedillacmb = 0x0327;
  13027. t.cent = 0x00a2;
  13028. t.centigrade = 0x2103;
  13029. t.centinferior = 0xf6df;
  13030. t.centmonospace = 0xffe0;
  13031. t.centoldstyle = 0xf7a2;
  13032. t.centsuperior = 0xf6e0;
  13033. t.chaarmenian = 0x0579;
  13034. t.chabengali = 0x099b;
  13035. t.chadeva = 0x091b;
  13036. t.chagujarati = 0x0a9b;
  13037. t.chagurmukhi = 0x0a1b;
  13038. t.chbopomofo = 0x3114;
  13039. t.cheabkhasiancyrillic = 0x04bd;
  13040. t.checkmark = 0x2713;
  13041. t.checyrillic = 0x0447;
  13042. t.chedescenderabkhasiancyrillic = 0x04bf;
  13043. t.chedescendercyrillic = 0x04b7;
  13044. t.chedieresiscyrillic = 0x04f5;
  13045. t.cheharmenian = 0x0573;
  13046. t.chekhakassiancyrillic = 0x04cc;
  13047. t.cheverticalstrokecyrillic = 0x04b9;
  13048. t.chi = 0x03c7;
  13049. t.chieuchacirclekorean = 0x3277;
  13050. t.chieuchaparenkorean = 0x3217;
  13051. t.chieuchcirclekorean = 0x3269;
  13052. t.chieuchkorean = 0x314a;
  13053. t.chieuchparenkorean = 0x3209;
  13054. t.chochangthai = 0x0e0a;
  13055. t.chochanthai = 0x0e08;
  13056. t.chochingthai = 0x0e09;
  13057. t.chochoethai = 0x0e0c;
  13058. t.chook = 0x0188;
  13059. t.cieucacirclekorean = 0x3276;
  13060. t.cieucaparenkorean = 0x3216;
  13061. t.cieuccirclekorean = 0x3268;
  13062. t.cieuckorean = 0x3148;
  13063. t.cieucparenkorean = 0x3208;
  13064. t.cieucuparenkorean = 0x321c;
  13065. t.circle = 0x25cb;
  13066. t.circlecopyrt = 0x00a9;
  13067. t.circlemultiply = 0x2297;
  13068. t.circleot = 0x2299;
  13069. t.circleplus = 0x2295;
  13070. t.circlepostalmark = 0x3036;
  13071. t.circlewithlefthalfblack = 0x25d0;
  13072. t.circlewithrighthalfblack = 0x25d1;
  13073. t.circumflex = 0x02c6;
  13074. t.circumflexbelowcmb = 0x032d;
  13075. t.circumflexcmb = 0x0302;
  13076. t.clear = 0x2327;
  13077. t.clickalveolar = 0x01c2;
  13078. t.clickdental = 0x01c0;
  13079. t.clicklateral = 0x01c1;
  13080. t.clickretroflex = 0x01c3;
  13081. t.club = 0x2663;
  13082. t.clubsuitblack = 0x2663;
  13083. t.clubsuitwhite = 0x2667;
  13084. t.cmcubedsquare = 0x33a4;
  13085. t.cmonospace = 0xff43;
  13086. t.cmsquaredsquare = 0x33a0;
  13087. t.coarmenian = 0x0581;
  13088. t.colon = 0x003a;
  13089. t.colonmonetary = 0x20a1;
  13090. t.colonmonospace = 0xff1a;
  13091. t.colonsign = 0x20a1;
  13092. t.colonsmall = 0xfe55;
  13093. t.colontriangularhalfmod = 0x02d1;
  13094. t.colontriangularmod = 0x02d0;
  13095. t.comma = 0x002c;
  13096. t.commaabovecmb = 0x0313;
  13097. t.commaaboverightcmb = 0x0315;
  13098. t.commaaccent = 0xf6c3;
  13099. t.commaarabic = 0x060c;
  13100. t.commaarmenian = 0x055d;
  13101. t.commainferior = 0xf6e1;
  13102. t.commamonospace = 0xff0c;
  13103. t.commareversedabovecmb = 0x0314;
  13104. t.commareversedmod = 0x02bd;
  13105. t.commasmall = 0xfe50;
  13106. t.commasuperior = 0xf6e2;
  13107. t.commaturnedabovecmb = 0x0312;
  13108. t.commaturnedmod = 0x02bb;
  13109. t.compass = 0x263c;
  13110. t.congruent = 0x2245;
  13111. t.contourintegral = 0x222e;
  13112. t.control = 0x2303;
  13113. t.controlACK = 0x0006;
  13114. t.controlBEL = 0x0007;
  13115. t.controlBS = 0x0008;
  13116. t.controlCAN = 0x0018;
  13117. t.controlCR = 0x000d;
  13118. t.controlDC1 = 0x0011;
  13119. t.controlDC2 = 0x0012;
  13120. t.controlDC3 = 0x0013;
  13121. t.controlDC4 = 0x0014;
  13122. t.controlDEL = 0x007f;
  13123. t.controlDLE = 0x0010;
  13124. t.controlEM = 0x0019;
  13125. t.controlENQ = 0x0005;
  13126. t.controlEOT = 0x0004;
  13127. t.controlESC = 0x001b;
  13128. t.controlETB = 0x0017;
  13129. t.controlETX = 0x0003;
  13130. t.controlFF = 0x000c;
  13131. t.controlFS = 0x001c;
  13132. t.controlGS = 0x001d;
  13133. t.controlHT = 0x0009;
  13134. t.controlLF = 0x000a;
  13135. t.controlNAK = 0x0015;
  13136. t.controlNULL = 0x0000;
  13137. t.controlRS = 0x001e;
  13138. t.controlSI = 0x000f;
  13139. t.controlSO = 0x000e;
  13140. t.controlSOT = 0x0002;
  13141. t.controlSTX = 0x0001;
  13142. t.controlSUB = 0x001a;
  13143. t.controlSYN = 0x0016;
  13144. t.controlUS = 0x001f;
  13145. t.controlVT = 0x000b;
  13146. t.copyright = 0x00a9;
  13147. t.copyrightsans = 0xf8e9;
  13148. t.copyrightserif = 0xf6d9;
  13149. t.cornerbracketleft = 0x300c;
  13150. t.cornerbracketlefthalfwidth = 0xff62;
  13151. t.cornerbracketleftvertical = 0xfe41;
  13152. t.cornerbracketright = 0x300d;
  13153. t.cornerbracketrighthalfwidth = 0xff63;
  13154. t.cornerbracketrightvertical = 0xfe42;
  13155. t.corporationsquare = 0x337f;
  13156. t.cosquare = 0x33c7;
  13157. t.coverkgsquare = 0x33c6;
  13158. t.cparen = 0x249e;
  13159. t.cruzeiro = 0x20a2;
  13160. t.cstretched = 0x0297;
  13161. t.curlyand = 0x22cf;
  13162. t.curlyor = 0x22ce;
  13163. t.currency = 0x00a4;
  13164. t.cyrBreve = 0xf6d1;
  13165. t.cyrFlex = 0xf6d2;
  13166. t.cyrbreve = 0xf6d4;
  13167. t.cyrflex = 0xf6d5;
  13168. t.d = 0x0064;
  13169. t.daarmenian = 0x0564;
  13170. t.dabengali = 0x09a6;
  13171. t.dadarabic = 0x0636;
  13172. t.dadeva = 0x0926;
  13173. t.dadfinalarabic = 0xfebe;
  13174. t.dadinitialarabic = 0xfebf;
  13175. t.dadmedialarabic = 0xfec0;
  13176. t.dagesh = 0x05bc;
  13177. t.dageshhebrew = 0x05bc;
  13178. t.dagger = 0x2020;
  13179. t.daggerdbl = 0x2021;
  13180. t.dagujarati = 0x0aa6;
  13181. t.dagurmukhi = 0x0a26;
  13182. t.dahiragana = 0x3060;
  13183. t.dakatakana = 0x30c0;
  13184. t.dalarabic = 0x062f;
  13185. t.dalet = 0x05d3;
  13186. t.daletdagesh = 0xfb33;
  13187. t.daletdageshhebrew = 0xfb33;
  13188. t.dalethebrew = 0x05d3;
  13189. t.dalfinalarabic = 0xfeaa;
  13190. t.dammaarabic = 0x064f;
  13191. t.dammalowarabic = 0x064f;
  13192. t.dammatanaltonearabic = 0x064c;
  13193. t.dammatanarabic = 0x064c;
  13194. t.danda = 0x0964;
  13195. t.dargahebrew = 0x05a7;
  13196. t.dargalefthebrew = 0x05a7;
  13197. t.dasiapneumatacyrilliccmb = 0x0485;
  13198. t.dblGrave = 0xf6d3;
  13199. t.dblanglebracketleft = 0x300a;
  13200. t.dblanglebracketleftvertical = 0xfe3d;
  13201. t.dblanglebracketright = 0x300b;
  13202. t.dblanglebracketrightvertical = 0xfe3e;
  13203. t.dblarchinvertedbelowcmb = 0x032b;
  13204. t.dblarrowleft = 0x21d4;
  13205. t.dblarrowright = 0x21d2;
  13206. t.dbldanda = 0x0965;
  13207. t.dblgrave = 0xf6d6;
  13208. t.dblgravecmb = 0x030f;
  13209. t.dblintegral = 0x222c;
  13210. t.dbllowline = 0x2017;
  13211. t.dbllowlinecmb = 0x0333;
  13212. t.dbloverlinecmb = 0x033f;
  13213. t.dblprimemod = 0x02ba;
  13214. t.dblverticalbar = 0x2016;
  13215. t.dblverticallineabovecmb = 0x030e;
  13216. t.dbopomofo = 0x3109;
  13217. t.dbsquare = 0x33c8;
  13218. t.dcaron = 0x010f;
  13219. t.dcedilla = 0x1e11;
  13220. t.dcircle = 0x24d3;
  13221. t.dcircumflexbelow = 0x1e13;
  13222. t.dcroat = 0x0111;
  13223. t.ddabengali = 0x09a1;
  13224. t.ddadeva = 0x0921;
  13225. t.ddagujarati = 0x0aa1;
  13226. t.ddagurmukhi = 0x0a21;
  13227. t.ddalarabic = 0x0688;
  13228. t.ddalfinalarabic = 0xfb89;
  13229. t.dddhadeva = 0x095c;
  13230. t.ddhabengali = 0x09a2;
  13231. t.ddhadeva = 0x0922;
  13232. t.ddhagujarati = 0x0aa2;
  13233. t.ddhagurmukhi = 0x0a22;
  13234. t.ddotaccent = 0x1e0b;
  13235. t.ddotbelow = 0x1e0d;
  13236. t.decimalseparatorarabic = 0x066b;
  13237. t.decimalseparatorpersian = 0x066b;
  13238. t.decyrillic = 0x0434;
  13239. t.degree = 0x00b0;
  13240. t.dehihebrew = 0x05ad;
  13241. t.dehiragana = 0x3067;
  13242. t.deicoptic = 0x03ef;
  13243. t.dekatakana = 0x30c7;
  13244. t.deleteleft = 0x232b;
  13245. t.deleteright = 0x2326;
  13246. t.delta = 0x03b4;
  13247. t.deltaturned = 0x018d;
  13248. t.denominatorminusonenumeratorbengali = 0x09f8;
  13249. t.dezh = 0x02a4;
  13250. t.dhabengali = 0x09a7;
  13251. t.dhadeva = 0x0927;
  13252. t.dhagujarati = 0x0aa7;
  13253. t.dhagurmukhi = 0x0a27;
  13254. t.dhook = 0x0257;
  13255. t.dialytikatonos = 0x0385;
  13256. t.dialytikatonoscmb = 0x0344;
  13257. t.diamond = 0x2666;
  13258. t.diamondsuitwhite = 0x2662;
  13259. t.dieresis = 0x00a8;
  13260. t.dieresisacute = 0xf6d7;
  13261. t.dieresisbelowcmb = 0x0324;
  13262. t.dieresiscmb = 0x0308;
  13263. t.dieresisgrave = 0xf6d8;
  13264. t.dieresistonos = 0x0385;
  13265. t.dihiragana = 0x3062;
  13266. t.dikatakana = 0x30c2;
  13267. t.dittomark = 0x3003;
  13268. t.divide = 0x00f7;
  13269. t.divides = 0x2223;
  13270. t.divisionslash = 0x2215;
  13271. t.djecyrillic = 0x0452;
  13272. t.dkshade = 0x2593;
  13273. t.dlinebelow = 0x1e0f;
  13274. t.dlsquare = 0x3397;
  13275. t.dmacron = 0x0111;
  13276. t.dmonospace = 0xff44;
  13277. t.dnblock = 0x2584;
  13278. t.dochadathai = 0x0e0e;
  13279. t.dodekthai = 0x0e14;
  13280. t.dohiragana = 0x3069;
  13281. t.dokatakana = 0x30c9;
  13282. t.dollar = 0x0024;
  13283. t.dollarinferior = 0xf6e3;
  13284. t.dollarmonospace = 0xff04;
  13285. t.dollaroldstyle = 0xf724;
  13286. t.dollarsmall = 0xfe69;
  13287. t.dollarsuperior = 0xf6e4;
  13288. t.dong = 0x20ab;
  13289. t.dorusquare = 0x3326;
  13290. t.dotaccent = 0x02d9;
  13291. t.dotaccentcmb = 0x0307;
  13292. t.dotbelowcmb = 0x0323;
  13293. t.dotbelowcomb = 0x0323;
  13294. t.dotkatakana = 0x30fb;
  13295. t.dotlessi = 0x0131;
  13296. t.dotlessj = 0xf6be;
  13297. t.dotlessjstrokehook = 0x0284;
  13298. t.dotmath = 0x22c5;
  13299. t.dottedcircle = 0x25cc;
  13300. t.doubleyodpatah = 0xfb1f;
  13301. t.doubleyodpatahhebrew = 0xfb1f;
  13302. t.downtackbelowcmb = 0x031e;
  13303. t.downtackmod = 0x02d5;
  13304. t.dparen = 0x249f;
  13305. t.dsuperior = 0xf6eb;
  13306. t.dtail = 0x0256;
  13307. t.dtopbar = 0x018c;
  13308. t.duhiragana = 0x3065;
  13309. t.dukatakana = 0x30c5;
  13310. t.dz = 0x01f3;
  13311. t.dzaltone = 0x02a3;
  13312. t.dzcaron = 0x01c6;
  13313. t.dzcurl = 0x02a5;
  13314. t.dzeabkhasiancyrillic = 0x04e1;
  13315. t.dzecyrillic = 0x0455;
  13316. t.dzhecyrillic = 0x045f;
  13317. t.e = 0x0065;
  13318. t.eacute = 0x00e9;
  13319. t.earth = 0x2641;
  13320. t.ebengali = 0x098f;
  13321. t.ebopomofo = 0x311c;
  13322. t.ebreve = 0x0115;
  13323. t.ecandradeva = 0x090d;
  13324. t.ecandragujarati = 0x0a8d;
  13325. t.ecandravowelsigndeva = 0x0945;
  13326. t.ecandravowelsigngujarati = 0x0ac5;
  13327. t.ecaron = 0x011b;
  13328. t.ecedillabreve = 0x1e1d;
  13329. t.echarmenian = 0x0565;
  13330. t.echyiwnarmenian = 0x0587;
  13331. t.ecircle = 0x24d4;
  13332. t.ecircumflex = 0x00ea;
  13333. t.ecircumflexacute = 0x1ebf;
  13334. t.ecircumflexbelow = 0x1e19;
  13335. t.ecircumflexdotbelow = 0x1ec7;
  13336. t.ecircumflexgrave = 0x1ec1;
  13337. t.ecircumflexhookabove = 0x1ec3;
  13338. t.ecircumflextilde = 0x1ec5;
  13339. t.ecyrillic = 0x0454;
  13340. t.edblgrave = 0x0205;
  13341. t.edeva = 0x090f;
  13342. t.edieresis = 0x00eb;
  13343. t.edot = 0x0117;
  13344. t.edotaccent = 0x0117;
  13345. t.edotbelow = 0x1eb9;
  13346. t.eegurmukhi = 0x0a0f;
  13347. t.eematragurmukhi = 0x0a47;
  13348. t.efcyrillic = 0x0444;
  13349. t.egrave = 0x00e8;
  13350. t.egujarati = 0x0a8f;
  13351. t.eharmenian = 0x0567;
  13352. t.ehbopomofo = 0x311d;
  13353. t.ehiragana = 0x3048;
  13354. t.ehookabove = 0x1ebb;
  13355. t.eibopomofo = 0x311f;
  13356. t.eight = 0x0038;
  13357. t.eightarabic = 0x0668;
  13358. t.eightbengali = 0x09ee;
  13359. t.eightcircle = 0x2467;
  13360. t.eightcircleinversesansserif = 0x2791;
  13361. t.eightdeva = 0x096e;
  13362. t.eighteencircle = 0x2471;
  13363. t.eighteenparen = 0x2485;
  13364. t.eighteenperiod = 0x2499;
  13365. t.eightgujarati = 0x0aee;
  13366. t.eightgurmukhi = 0x0a6e;
  13367. t.eighthackarabic = 0x0668;
  13368. t.eighthangzhou = 0x3028;
  13369. t.eighthnotebeamed = 0x266b;
  13370. t.eightideographicparen = 0x3227;
  13371. t.eightinferior = 0x2088;
  13372. t.eightmonospace = 0xff18;
  13373. t.eightoldstyle = 0xf738;
  13374. t.eightparen = 0x247b;
  13375. t.eightperiod = 0x248f;
  13376. t.eightpersian = 0x06f8;
  13377. t.eightroman = 0x2177;
  13378. t.eightsuperior = 0x2078;
  13379. t.eightthai = 0x0e58;
  13380. t.einvertedbreve = 0x0207;
  13381. t.eiotifiedcyrillic = 0x0465;
  13382. t.ekatakana = 0x30a8;
  13383. t.ekatakanahalfwidth = 0xff74;
  13384. t.ekonkargurmukhi = 0x0a74;
  13385. t.ekorean = 0x3154;
  13386. t.elcyrillic = 0x043b;
  13387. t.element = 0x2208;
  13388. t.elevencircle = 0x246a;
  13389. t.elevenparen = 0x247e;
  13390. t.elevenperiod = 0x2492;
  13391. t.elevenroman = 0x217a;
  13392. t.ellipsis = 0x2026;
  13393. t.ellipsisvertical = 0x22ee;
  13394. t.emacron = 0x0113;
  13395. t.emacronacute = 0x1e17;
  13396. t.emacrongrave = 0x1e15;
  13397. t.emcyrillic = 0x043c;
  13398. t.emdash = 0x2014;
  13399. t.emdashvertical = 0xfe31;
  13400. t.emonospace = 0xff45;
  13401. t.emphasismarkarmenian = 0x055b;
  13402. t.emptyset = 0x2205;
  13403. t.enbopomofo = 0x3123;
  13404. t.encyrillic = 0x043d;
  13405. t.endash = 0x2013;
  13406. t.endashvertical = 0xfe32;
  13407. t.endescendercyrillic = 0x04a3;
  13408. t.eng = 0x014b;
  13409. t.engbopomofo = 0x3125;
  13410. t.enghecyrillic = 0x04a5;
  13411. t.enhookcyrillic = 0x04c8;
  13412. t.enspace = 0x2002;
  13413. t.eogonek = 0x0119;
  13414. t.eokorean = 0x3153;
  13415. t.eopen = 0x025b;
  13416. t.eopenclosed = 0x029a;
  13417. t.eopenreversed = 0x025c;
  13418. t.eopenreversedclosed = 0x025e;
  13419. t.eopenreversedhook = 0x025d;
  13420. t.eparen = 0x24a0;
  13421. t.epsilon = 0x03b5;
  13422. t.epsilontonos = 0x03ad;
  13423. t.equal = 0x003d;
  13424. t.equalmonospace = 0xff1d;
  13425. t.equalsmall = 0xfe66;
  13426. t.equalsuperior = 0x207c;
  13427. t.equivalence = 0x2261;
  13428. t.erbopomofo = 0x3126;
  13429. t.ercyrillic = 0x0440;
  13430. t.ereversed = 0x0258;
  13431. t.ereversedcyrillic = 0x044d;
  13432. t.escyrillic = 0x0441;
  13433. t.esdescendercyrillic = 0x04ab;
  13434. t.esh = 0x0283;
  13435. t.eshcurl = 0x0286;
  13436. t.eshortdeva = 0x090e;
  13437. t.eshortvowelsigndeva = 0x0946;
  13438. t.eshreversedloop = 0x01aa;
  13439. t.eshsquatreversed = 0x0285;
  13440. t.esmallhiragana = 0x3047;
  13441. t.esmallkatakana = 0x30a7;
  13442. t.esmallkatakanahalfwidth = 0xff6a;
  13443. t.estimated = 0x212e;
  13444. t.esuperior = 0xf6ec;
  13445. t.eta = 0x03b7;
  13446. t.etarmenian = 0x0568;
  13447. t.etatonos = 0x03ae;
  13448. t.eth = 0x00f0;
  13449. t.etilde = 0x1ebd;
  13450. t.etildebelow = 0x1e1b;
  13451. t.etnahtafoukhhebrew = 0x0591;
  13452. t.etnahtafoukhlefthebrew = 0x0591;
  13453. t.etnahtahebrew = 0x0591;
  13454. t.etnahtalefthebrew = 0x0591;
  13455. t.eturned = 0x01dd;
  13456. t.eukorean = 0x3161;
  13457. t.euro = 0x20ac;
  13458. t.evowelsignbengali = 0x09c7;
  13459. t.evowelsigndeva = 0x0947;
  13460. t.evowelsigngujarati = 0x0ac7;
  13461. t.exclam = 0x0021;
  13462. t.exclamarmenian = 0x055c;
  13463. t.exclamdbl = 0x203c;
  13464. t.exclamdown = 0x00a1;
  13465. t.exclamdownsmall = 0xf7a1;
  13466. t.exclammonospace = 0xff01;
  13467. t.exclamsmall = 0xf721;
  13468. t.existential = 0x2203;
  13469. t.ezh = 0x0292;
  13470. t.ezhcaron = 0x01ef;
  13471. t.ezhcurl = 0x0293;
  13472. t.ezhreversed = 0x01b9;
  13473. t.ezhtail = 0x01ba;
  13474. t.f = 0x0066;
  13475. t.fadeva = 0x095e;
  13476. t.fagurmukhi = 0x0a5e;
  13477. t.fahrenheit = 0x2109;
  13478. t.fathaarabic = 0x064e;
  13479. t.fathalowarabic = 0x064e;
  13480. t.fathatanarabic = 0x064b;
  13481. t.fbopomofo = 0x3108;
  13482. t.fcircle = 0x24d5;
  13483. t.fdotaccent = 0x1e1f;
  13484. t.feharabic = 0x0641;
  13485. t.feharmenian = 0x0586;
  13486. t.fehfinalarabic = 0xfed2;
  13487. t.fehinitialarabic = 0xfed3;
  13488. t.fehmedialarabic = 0xfed4;
  13489. t.feicoptic = 0x03e5;
  13490. t.female = 0x2640;
  13491. t.ff = 0xfb00;
  13492. t.f_f = 0xfb00;
  13493. t.ffi = 0xfb03;
  13494. t.f_f_i = 0xfb03;
  13495. t.ffl = 0xfb04;
  13496. t.f_f_l = 0xfb04;
  13497. t.fi = 0xfb01;
  13498. t.f_i = 0xfb01;
  13499. t.fifteencircle = 0x246e;
  13500. t.fifteenparen = 0x2482;
  13501. t.fifteenperiod = 0x2496;
  13502. t.figuredash = 0x2012;
  13503. t.filledbox = 0x25a0;
  13504. t.filledrect = 0x25ac;
  13505. t.finalkaf = 0x05da;
  13506. t.finalkafdagesh = 0xfb3a;
  13507. t.finalkafdageshhebrew = 0xfb3a;
  13508. t.finalkafhebrew = 0x05da;
  13509. t.finalmem = 0x05dd;
  13510. t.finalmemhebrew = 0x05dd;
  13511. t.finalnun = 0x05df;
  13512. t.finalnunhebrew = 0x05df;
  13513. t.finalpe = 0x05e3;
  13514. t.finalpehebrew = 0x05e3;
  13515. t.finaltsadi = 0x05e5;
  13516. t.finaltsadihebrew = 0x05e5;
  13517. t.firsttonechinese = 0x02c9;
  13518. t.fisheye = 0x25c9;
  13519. t.fitacyrillic = 0x0473;
  13520. t.five = 0x0035;
  13521. t.fivearabic = 0x0665;
  13522. t.fivebengali = 0x09eb;
  13523. t.fivecircle = 0x2464;
  13524. t.fivecircleinversesansserif = 0x278e;
  13525. t.fivedeva = 0x096b;
  13526. t.fiveeighths = 0x215d;
  13527. t.fivegujarati = 0x0aeb;
  13528. t.fivegurmukhi = 0x0a6b;
  13529. t.fivehackarabic = 0x0665;
  13530. t.fivehangzhou = 0x3025;
  13531. t.fiveideographicparen = 0x3224;
  13532. t.fiveinferior = 0x2085;
  13533. t.fivemonospace = 0xff15;
  13534. t.fiveoldstyle = 0xf735;
  13535. t.fiveparen = 0x2478;
  13536. t.fiveperiod = 0x248c;
  13537. t.fivepersian = 0x06f5;
  13538. t.fiveroman = 0x2174;
  13539. t.fivesuperior = 0x2075;
  13540. t.fivethai = 0x0e55;
  13541. t.fl = 0xfb02;
  13542. t.f_l = 0xfb02;
  13543. t.florin = 0x0192;
  13544. t.fmonospace = 0xff46;
  13545. t.fmsquare = 0x3399;
  13546. t.fofanthai = 0x0e1f;
  13547. t.fofathai = 0x0e1d;
  13548. t.fongmanthai = 0x0e4f;
  13549. t.forall = 0x2200;
  13550. t.four = 0x0034;
  13551. t.fourarabic = 0x0664;
  13552. t.fourbengali = 0x09ea;
  13553. t.fourcircle = 0x2463;
  13554. t.fourcircleinversesansserif = 0x278d;
  13555. t.fourdeva = 0x096a;
  13556. t.fourgujarati = 0x0aea;
  13557. t.fourgurmukhi = 0x0a6a;
  13558. t.fourhackarabic = 0x0664;
  13559. t.fourhangzhou = 0x3024;
  13560. t.fourideographicparen = 0x3223;
  13561. t.fourinferior = 0x2084;
  13562. t.fourmonospace = 0xff14;
  13563. t.fournumeratorbengali = 0x09f7;
  13564. t.fouroldstyle = 0xf734;
  13565. t.fourparen = 0x2477;
  13566. t.fourperiod = 0x248b;
  13567. t.fourpersian = 0x06f4;
  13568. t.fourroman = 0x2173;
  13569. t.foursuperior = 0x2074;
  13570. t.fourteencircle = 0x246d;
  13571. t.fourteenparen = 0x2481;
  13572. t.fourteenperiod = 0x2495;
  13573. t.fourthai = 0x0e54;
  13574. t.fourthtonechinese = 0x02cb;
  13575. t.fparen = 0x24a1;
  13576. t.fraction = 0x2044;
  13577. t.franc = 0x20a3;
  13578. t.g = 0x0067;
  13579. t.gabengali = 0x0997;
  13580. t.gacute = 0x01f5;
  13581. t.gadeva = 0x0917;
  13582. t.gafarabic = 0x06af;
  13583. t.gaffinalarabic = 0xfb93;
  13584. t.gafinitialarabic = 0xfb94;
  13585. t.gafmedialarabic = 0xfb95;
  13586. t.gagujarati = 0x0a97;
  13587. t.gagurmukhi = 0x0a17;
  13588. t.gahiragana = 0x304c;
  13589. t.gakatakana = 0x30ac;
  13590. t.gamma = 0x03b3;
  13591. t.gammalatinsmall = 0x0263;
  13592. t.gammasuperior = 0x02e0;
  13593. t.gangiacoptic = 0x03eb;
  13594. t.gbopomofo = 0x310d;
  13595. t.gbreve = 0x011f;
  13596. t.gcaron = 0x01e7;
  13597. t.gcedilla = 0x0123;
  13598. t.gcircle = 0x24d6;
  13599. t.gcircumflex = 0x011d;
  13600. t.gcommaaccent = 0x0123;
  13601. t.gdot = 0x0121;
  13602. t.gdotaccent = 0x0121;
  13603. t.gecyrillic = 0x0433;
  13604. t.gehiragana = 0x3052;
  13605. t.gekatakana = 0x30b2;
  13606. t.geometricallyequal = 0x2251;
  13607. t.gereshaccenthebrew = 0x059c;
  13608. t.gereshhebrew = 0x05f3;
  13609. t.gereshmuqdamhebrew = 0x059d;
  13610. t.germandbls = 0x00df;
  13611. t.gershayimaccenthebrew = 0x059e;
  13612. t.gershayimhebrew = 0x05f4;
  13613. t.getamark = 0x3013;
  13614. t.ghabengali = 0x0998;
  13615. t.ghadarmenian = 0x0572;
  13616. t.ghadeva = 0x0918;
  13617. t.ghagujarati = 0x0a98;
  13618. t.ghagurmukhi = 0x0a18;
  13619. t.ghainarabic = 0x063a;
  13620. t.ghainfinalarabic = 0xfece;
  13621. t.ghaininitialarabic = 0xfecf;
  13622. t.ghainmedialarabic = 0xfed0;
  13623. t.ghemiddlehookcyrillic = 0x0495;
  13624. t.ghestrokecyrillic = 0x0493;
  13625. t.gheupturncyrillic = 0x0491;
  13626. t.ghhadeva = 0x095a;
  13627. t.ghhagurmukhi = 0x0a5a;
  13628. t.ghook = 0x0260;
  13629. t.ghzsquare = 0x3393;
  13630. t.gihiragana = 0x304e;
  13631. t.gikatakana = 0x30ae;
  13632. t.gimarmenian = 0x0563;
  13633. t.gimel = 0x05d2;
  13634. t.gimeldagesh = 0xfb32;
  13635. t.gimeldageshhebrew = 0xfb32;
  13636. t.gimelhebrew = 0x05d2;
  13637. t.gjecyrillic = 0x0453;
  13638. t.glottalinvertedstroke = 0x01be;
  13639. t.glottalstop = 0x0294;
  13640. t.glottalstopinverted = 0x0296;
  13641. t.glottalstopmod = 0x02c0;
  13642. t.glottalstopreversed = 0x0295;
  13643. t.glottalstopreversedmod = 0x02c1;
  13644. t.glottalstopreversedsuperior = 0x02e4;
  13645. t.glottalstopstroke = 0x02a1;
  13646. t.glottalstopstrokereversed = 0x02a2;
  13647. t.gmacron = 0x1e21;
  13648. t.gmonospace = 0xff47;
  13649. t.gohiragana = 0x3054;
  13650. t.gokatakana = 0x30b4;
  13651. t.gparen = 0x24a2;
  13652. t.gpasquare = 0x33ac;
  13653. t.gradient = 0x2207;
  13654. t.grave = 0x0060;
  13655. t.gravebelowcmb = 0x0316;
  13656. t.gravecmb = 0x0300;
  13657. t.gravecomb = 0x0300;
  13658. t.gravedeva = 0x0953;
  13659. t.gravelowmod = 0x02ce;
  13660. t.gravemonospace = 0xff40;
  13661. t.gravetonecmb = 0x0340;
  13662. t.greater = 0x003e;
  13663. t.greaterequal = 0x2265;
  13664. t.greaterequalorless = 0x22db;
  13665. t.greatermonospace = 0xff1e;
  13666. t.greaterorequivalent = 0x2273;
  13667. t.greaterorless = 0x2277;
  13668. t.greateroverequal = 0x2267;
  13669. t.greatersmall = 0xfe65;
  13670. t.gscript = 0x0261;
  13671. t.gstroke = 0x01e5;
  13672. t.guhiragana = 0x3050;
  13673. t.guillemotleft = 0x00ab;
  13674. t.guillemotright = 0x00bb;
  13675. t.guilsinglleft = 0x2039;
  13676. t.guilsinglright = 0x203a;
  13677. t.gukatakana = 0x30b0;
  13678. t.guramusquare = 0x3318;
  13679. t.gysquare = 0x33c9;
  13680. t.h = 0x0068;
  13681. t.haabkhasiancyrillic = 0x04a9;
  13682. t.haaltonearabic = 0x06c1;
  13683. t.habengali = 0x09b9;
  13684. t.hadescendercyrillic = 0x04b3;
  13685. t.hadeva = 0x0939;
  13686. t.hagujarati = 0x0ab9;
  13687. t.hagurmukhi = 0x0a39;
  13688. t.haharabic = 0x062d;
  13689. t.hahfinalarabic = 0xfea2;
  13690. t.hahinitialarabic = 0xfea3;
  13691. t.hahiragana = 0x306f;
  13692. t.hahmedialarabic = 0xfea4;
  13693. t.haitusquare = 0x332a;
  13694. t.hakatakana = 0x30cf;
  13695. t.hakatakanahalfwidth = 0xff8a;
  13696. t.halantgurmukhi = 0x0a4d;
  13697. t.hamzaarabic = 0x0621;
  13698. t.hamzalowarabic = 0x0621;
  13699. t.hangulfiller = 0x3164;
  13700. t.hardsigncyrillic = 0x044a;
  13701. t.harpoonleftbarbup = 0x21bc;
  13702. t.harpoonrightbarbup = 0x21c0;
  13703. t.hasquare = 0x33ca;
  13704. t.hatafpatah = 0x05b2;
  13705. t.hatafpatah16 = 0x05b2;
  13706. t.hatafpatah23 = 0x05b2;
  13707. t.hatafpatah2f = 0x05b2;
  13708. t.hatafpatahhebrew = 0x05b2;
  13709. t.hatafpatahnarrowhebrew = 0x05b2;
  13710. t.hatafpatahquarterhebrew = 0x05b2;
  13711. t.hatafpatahwidehebrew = 0x05b2;
  13712. t.hatafqamats = 0x05b3;
  13713. t.hatafqamats1b = 0x05b3;
  13714. t.hatafqamats28 = 0x05b3;
  13715. t.hatafqamats34 = 0x05b3;
  13716. t.hatafqamatshebrew = 0x05b3;
  13717. t.hatafqamatsnarrowhebrew = 0x05b3;
  13718. t.hatafqamatsquarterhebrew = 0x05b3;
  13719. t.hatafqamatswidehebrew = 0x05b3;
  13720. t.hatafsegol = 0x05b1;
  13721. t.hatafsegol17 = 0x05b1;
  13722. t.hatafsegol24 = 0x05b1;
  13723. t.hatafsegol30 = 0x05b1;
  13724. t.hatafsegolhebrew = 0x05b1;
  13725. t.hatafsegolnarrowhebrew = 0x05b1;
  13726. t.hatafsegolquarterhebrew = 0x05b1;
  13727. t.hatafsegolwidehebrew = 0x05b1;
  13728. t.hbar = 0x0127;
  13729. t.hbopomofo = 0x310f;
  13730. t.hbrevebelow = 0x1e2b;
  13731. t.hcedilla = 0x1e29;
  13732. t.hcircle = 0x24d7;
  13733. t.hcircumflex = 0x0125;
  13734. t.hdieresis = 0x1e27;
  13735. t.hdotaccent = 0x1e23;
  13736. t.hdotbelow = 0x1e25;
  13737. t.he = 0x05d4;
  13738. t.heart = 0x2665;
  13739. t.heartsuitblack = 0x2665;
  13740. t.heartsuitwhite = 0x2661;
  13741. t.hedagesh = 0xfb34;
  13742. t.hedageshhebrew = 0xfb34;
  13743. t.hehaltonearabic = 0x06c1;
  13744. t.heharabic = 0x0647;
  13745. t.hehebrew = 0x05d4;
  13746. t.hehfinalaltonearabic = 0xfba7;
  13747. t.hehfinalalttwoarabic = 0xfeea;
  13748. t.hehfinalarabic = 0xfeea;
  13749. t.hehhamzaabovefinalarabic = 0xfba5;
  13750. t.hehhamzaaboveisolatedarabic = 0xfba4;
  13751. t.hehinitialaltonearabic = 0xfba8;
  13752. t.hehinitialarabic = 0xfeeb;
  13753. t.hehiragana = 0x3078;
  13754. t.hehmedialaltonearabic = 0xfba9;
  13755. t.hehmedialarabic = 0xfeec;
  13756. t.heiseierasquare = 0x337b;
  13757. t.hekatakana = 0x30d8;
  13758. t.hekatakanahalfwidth = 0xff8d;
  13759. t.hekutaarusquare = 0x3336;
  13760. t.henghook = 0x0267;
  13761. t.herutusquare = 0x3339;
  13762. t.het = 0x05d7;
  13763. t.hethebrew = 0x05d7;
  13764. t.hhook = 0x0266;
  13765. t.hhooksuperior = 0x02b1;
  13766. t.hieuhacirclekorean = 0x327b;
  13767. t.hieuhaparenkorean = 0x321b;
  13768. t.hieuhcirclekorean = 0x326d;
  13769. t.hieuhkorean = 0x314e;
  13770. t.hieuhparenkorean = 0x320d;
  13771. t.hihiragana = 0x3072;
  13772. t.hikatakana = 0x30d2;
  13773. t.hikatakanahalfwidth = 0xff8b;
  13774. t.hiriq = 0x05b4;
  13775. t.hiriq14 = 0x05b4;
  13776. t.hiriq21 = 0x05b4;
  13777. t.hiriq2d = 0x05b4;
  13778. t.hiriqhebrew = 0x05b4;
  13779. t.hiriqnarrowhebrew = 0x05b4;
  13780. t.hiriqquarterhebrew = 0x05b4;
  13781. t.hiriqwidehebrew = 0x05b4;
  13782. t.hlinebelow = 0x1e96;
  13783. t.hmonospace = 0xff48;
  13784. t.hoarmenian = 0x0570;
  13785. t.hohipthai = 0x0e2b;
  13786. t.hohiragana = 0x307b;
  13787. t.hokatakana = 0x30db;
  13788. t.hokatakanahalfwidth = 0xff8e;
  13789. t.holam = 0x05b9;
  13790. t.holam19 = 0x05b9;
  13791. t.holam26 = 0x05b9;
  13792. t.holam32 = 0x05b9;
  13793. t.holamhebrew = 0x05b9;
  13794. t.holamnarrowhebrew = 0x05b9;
  13795. t.holamquarterhebrew = 0x05b9;
  13796. t.holamwidehebrew = 0x05b9;
  13797. t.honokhukthai = 0x0e2e;
  13798. t.hookabovecomb = 0x0309;
  13799. t.hookcmb = 0x0309;
  13800. t.hookpalatalizedbelowcmb = 0x0321;
  13801. t.hookretroflexbelowcmb = 0x0322;
  13802. t.hoonsquare = 0x3342;
  13803. t.horicoptic = 0x03e9;
  13804. t.horizontalbar = 0x2015;
  13805. t.horncmb = 0x031b;
  13806. t.hotsprings = 0x2668;
  13807. t.house = 0x2302;
  13808. t.hparen = 0x24a3;
  13809. t.hsuperior = 0x02b0;
  13810. t.hturned = 0x0265;
  13811. t.huhiragana = 0x3075;
  13812. t.huiitosquare = 0x3333;
  13813. t.hukatakana = 0x30d5;
  13814. t.hukatakanahalfwidth = 0xff8c;
  13815. t.hungarumlaut = 0x02dd;
  13816. t.hungarumlautcmb = 0x030b;
  13817. t.hv = 0x0195;
  13818. t.hyphen = 0x002d;
  13819. t.hypheninferior = 0xf6e5;
  13820. t.hyphenmonospace = 0xff0d;
  13821. t.hyphensmall = 0xfe63;
  13822. t.hyphensuperior = 0xf6e6;
  13823. t.hyphentwo = 0x2010;
  13824. t.i = 0x0069;
  13825. t.iacute = 0x00ed;
  13826. t.iacyrillic = 0x044f;
  13827. t.ibengali = 0x0987;
  13828. t.ibopomofo = 0x3127;
  13829. t.ibreve = 0x012d;
  13830. t.icaron = 0x01d0;
  13831. t.icircle = 0x24d8;
  13832. t.icircumflex = 0x00ee;
  13833. t.icyrillic = 0x0456;
  13834. t.idblgrave = 0x0209;
  13835. t.ideographearthcircle = 0x328f;
  13836. t.ideographfirecircle = 0x328b;
  13837. t.ideographicallianceparen = 0x323f;
  13838. t.ideographiccallparen = 0x323a;
  13839. t.ideographiccentrecircle = 0x32a5;
  13840. t.ideographicclose = 0x3006;
  13841. t.ideographiccomma = 0x3001;
  13842. t.ideographiccommaleft = 0xff64;
  13843. t.ideographiccongratulationparen = 0x3237;
  13844. t.ideographiccorrectcircle = 0x32a3;
  13845. t.ideographicearthparen = 0x322f;
  13846. t.ideographicenterpriseparen = 0x323d;
  13847. t.ideographicexcellentcircle = 0x329d;
  13848. t.ideographicfestivalparen = 0x3240;
  13849. t.ideographicfinancialcircle = 0x3296;
  13850. t.ideographicfinancialparen = 0x3236;
  13851. t.ideographicfireparen = 0x322b;
  13852. t.ideographichaveparen = 0x3232;
  13853. t.ideographichighcircle = 0x32a4;
  13854. t.ideographiciterationmark = 0x3005;
  13855. t.ideographiclaborcircle = 0x3298;
  13856. t.ideographiclaborparen = 0x3238;
  13857. t.ideographicleftcircle = 0x32a7;
  13858. t.ideographiclowcircle = 0x32a6;
  13859. t.ideographicmedicinecircle = 0x32a9;
  13860. t.ideographicmetalparen = 0x322e;
  13861. t.ideographicmoonparen = 0x322a;
  13862. t.ideographicnameparen = 0x3234;
  13863. t.ideographicperiod = 0x3002;
  13864. t.ideographicprintcircle = 0x329e;
  13865. t.ideographicreachparen = 0x3243;
  13866. t.ideographicrepresentparen = 0x3239;
  13867. t.ideographicresourceparen = 0x323e;
  13868. t.ideographicrightcircle = 0x32a8;
  13869. t.ideographicsecretcircle = 0x3299;
  13870. t.ideographicselfparen = 0x3242;
  13871. t.ideographicsocietyparen = 0x3233;
  13872. t.ideographicspace = 0x3000;
  13873. t.ideographicspecialparen = 0x3235;
  13874. t.ideographicstockparen = 0x3231;
  13875. t.ideographicstudyparen = 0x323b;
  13876. t.ideographicsunparen = 0x3230;
  13877. t.ideographicsuperviseparen = 0x323c;
  13878. t.ideographicwaterparen = 0x322c;
  13879. t.ideographicwoodparen = 0x322d;
  13880. t.ideographiczero = 0x3007;
  13881. t.ideographmetalcircle = 0x328e;
  13882. t.ideographmooncircle = 0x328a;
  13883. t.ideographnamecircle = 0x3294;
  13884. t.ideographsuncircle = 0x3290;
  13885. t.ideographwatercircle = 0x328c;
  13886. t.ideographwoodcircle = 0x328d;
  13887. t.ideva = 0x0907;
  13888. t.idieresis = 0x00ef;
  13889. t.idieresisacute = 0x1e2f;
  13890. t.idieresiscyrillic = 0x04e5;
  13891. t.idotbelow = 0x1ecb;
  13892. t.iebrevecyrillic = 0x04d7;
  13893. t.iecyrillic = 0x0435;
  13894. t.ieungacirclekorean = 0x3275;
  13895. t.ieungaparenkorean = 0x3215;
  13896. t.ieungcirclekorean = 0x3267;
  13897. t.ieungkorean = 0x3147;
  13898. t.ieungparenkorean = 0x3207;
  13899. t.igrave = 0x00ec;
  13900. t.igujarati = 0x0a87;
  13901. t.igurmukhi = 0x0a07;
  13902. t.ihiragana = 0x3044;
  13903. t.ihookabove = 0x1ec9;
  13904. t.iibengali = 0x0988;
  13905. t.iicyrillic = 0x0438;
  13906. t.iideva = 0x0908;
  13907. t.iigujarati = 0x0a88;
  13908. t.iigurmukhi = 0x0a08;
  13909. t.iimatragurmukhi = 0x0a40;
  13910. t.iinvertedbreve = 0x020b;
  13911. t.iishortcyrillic = 0x0439;
  13912. t.iivowelsignbengali = 0x09c0;
  13913. t.iivowelsigndeva = 0x0940;
  13914. t.iivowelsigngujarati = 0x0ac0;
  13915. t.ij = 0x0133;
  13916. t.ikatakana = 0x30a4;
  13917. t.ikatakanahalfwidth = 0xff72;
  13918. t.ikorean = 0x3163;
  13919. t.ilde = 0x02dc;
  13920. t.iluyhebrew = 0x05ac;
  13921. t.imacron = 0x012b;
  13922. t.imacroncyrillic = 0x04e3;
  13923. t.imageorapproximatelyequal = 0x2253;
  13924. t.imatragurmukhi = 0x0a3f;
  13925. t.imonospace = 0xff49;
  13926. t.increment = 0x2206;
  13927. t.infinity = 0x221e;
  13928. t.iniarmenian = 0x056b;
  13929. t.integral = 0x222b;
  13930. t.integralbottom = 0x2321;
  13931. t.integralbt = 0x2321;
  13932. t.integralex = 0xf8f5;
  13933. t.integraltop = 0x2320;
  13934. t.integraltp = 0x2320;
  13935. t.intersection = 0x2229;
  13936. t.intisquare = 0x3305;
  13937. t.invbullet = 0x25d8;
  13938. t.invcircle = 0x25d9;
  13939. t.invsmileface = 0x263b;
  13940. t.iocyrillic = 0x0451;
  13941. t.iogonek = 0x012f;
  13942. t.iota = 0x03b9;
  13943. t.iotadieresis = 0x03ca;
  13944. t.iotadieresistonos = 0x0390;
  13945. t.iotalatin = 0x0269;
  13946. t.iotatonos = 0x03af;
  13947. t.iparen = 0x24a4;
  13948. t.irigurmukhi = 0x0a72;
  13949. t.ismallhiragana = 0x3043;
  13950. t.ismallkatakana = 0x30a3;
  13951. t.ismallkatakanahalfwidth = 0xff68;
  13952. t.issharbengali = 0x09fa;
  13953. t.istroke = 0x0268;
  13954. t.isuperior = 0xf6ed;
  13955. t.iterationhiragana = 0x309d;
  13956. t.iterationkatakana = 0x30fd;
  13957. t.itilde = 0x0129;
  13958. t.itildebelow = 0x1e2d;
  13959. t.iubopomofo = 0x3129;
  13960. t.iucyrillic = 0x044e;
  13961. t.ivowelsignbengali = 0x09bf;
  13962. t.ivowelsigndeva = 0x093f;
  13963. t.ivowelsigngujarati = 0x0abf;
  13964. t.izhitsacyrillic = 0x0475;
  13965. t.izhitsadblgravecyrillic = 0x0477;
  13966. t.j = 0x006a;
  13967. t.jaarmenian = 0x0571;
  13968. t.jabengali = 0x099c;
  13969. t.jadeva = 0x091c;
  13970. t.jagujarati = 0x0a9c;
  13971. t.jagurmukhi = 0x0a1c;
  13972. t.jbopomofo = 0x3110;
  13973. t.jcaron = 0x01f0;
  13974. t.jcircle = 0x24d9;
  13975. t.jcircumflex = 0x0135;
  13976. t.jcrossedtail = 0x029d;
  13977. t.jdotlessstroke = 0x025f;
  13978. t.jecyrillic = 0x0458;
  13979. t.jeemarabic = 0x062c;
  13980. t.jeemfinalarabic = 0xfe9e;
  13981. t.jeeminitialarabic = 0xfe9f;
  13982. t.jeemmedialarabic = 0xfea0;
  13983. t.jeharabic = 0x0698;
  13984. t.jehfinalarabic = 0xfb8b;
  13985. t.jhabengali = 0x099d;
  13986. t.jhadeva = 0x091d;
  13987. t.jhagujarati = 0x0a9d;
  13988. t.jhagurmukhi = 0x0a1d;
  13989. t.jheharmenian = 0x057b;
  13990. t.jis = 0x3004;
  13991. t.jmonospace = 0xff4a;
  13992. t.jparen = 0x24a5;
  13993. t.jsuperior = 0x02b2;
  13994. t.k = 0x006b;
  13995. t.kabashkircyrillic = 0x04a1;
  13996. t.kabengali = 0x0995;
  13997. t.kacute = 0x1e31;
  13998. t.kacyrillic = 0x043a;
  13999. t.kadescendercyrillic = 0x049b;
  14000. t.kadeva = 0x0915;
  14001. t.kaf = 0x05db;
  14002. t.kafarabic = 0x0643;
  14003. t.kafdagesh = 0xfb3b;
  14004. t.kafdageshhebrew = 0xfb3b;
  14005. t.kaffinalarabic = 0xfeda;
  14006. t.kafhebrew = 0x05db;
  14007. t.kafinitialarabic = 0xfedb;
  14008. t.kafmedialarabic = 0xfedc;
  14009. t.kafrafehebrew = 0xfb4d;
  14010. t.kagujarati = 0x0a95;
  14011. t.kagurmukhi = 0x0a15;
  14012. t.kahiragana = 0x304b;
  14013. t.kahookcyrillic = 0x04c4;
  14014. t.kakatakana = 0x30ab;
  14015. t.kakatakanahalfwidth = 0xff76;
  14016. t.kappa = 0x03ba;
  14017. t.kappasymbolgreek = 0x03f0;
  14018. t.kapyeounmieumkorean = 0x3171;
  14019. t.kapyeounphieuphkorean = 0x3184;
  14020. t.kapyeounpieupkorean = 0x3178;
  14021. t.kapyeounssangpieupkorean = 0x3179;
  14022. t.karoriisquare = 0x330d;
  14023. t.kashidaautoarabic = 0x0640;
  14024. t.kashidaautonosidebearingarabic = 0x0640;
  14025. t.kasmallkatakana = 0x30f5;
  14026. t.kasquare = 0x3384;
  14027. t.kasraarabic = 0x0650;
  14028. t.kasratanarabic = 0x064d;
  14029. t.kastrokecyrillic = 0x049f;
  14030. t.katahiraprolongmarkhalfwidth = 0xff70;
  14031. t.kaverticalstrokecyrillic = 0x049d;
  14032. t.kbopomofo = 0x310e;
  14033. t.kcalsquare = 0x3389;
  14034. t.kcaron = 0x01e9;
  14035. t.kcedilla = 0x0137;
  14036. t.kcircle = 0x24da;
  14037. t.kcommaaccent = 0x0137;
  14038. t.kdotbelow = 0x1e33;
  14039. t.keharmenian = 0x0584;
  14040. t.kehiragana = 0x3051;
  14041. t.kekatakana = 0x30b1;
  14042. t.kekatakanahalfwidth = 0xff79;
  14043. t.kenarmenian = 0x056f;
  14044. t.kesmallkatakana = 0x30f6;
  14045. t.kgreenlandic = 0x0138;
  14046. t.khabengali = 0x0996;
  14047. t.khacyrillic = 0x0445;
  14048. t.khadeva = 0x0916;
  14049. t.khagujarati = 0x0a96;
  14050. t.khagurmukhi = 0x0a16;
  14051. t.khaharabic = 0x062e;
  14052. t.khahfinalarabic = 0xfea6;
  14053. t.khahinitialarabic = 0xfea7;
  14054. t.khahmedialarabic = 0xfea8;
  14055. t.kheicoptic = 0x03e7;
  14056. t.khhadeva = 0x0959;
  14057. t.khhagurmukhi = 0x0a59;
  14058. t.khieukhacirclekorean = 0x3278;
  14059. t.khieukhaparenkorean = 0x3218;
  14060. t.khieukhcirclekorean = 0x326a;
  14061. t.khieukhkorean = 0x314b;
  14062. t.khieukhparenkorean = 0x320a;
  14063. t.khokhaithai = 0x0e02;
  14064. t.khokhonthai = 0x0e05;
  14065. t.khokhuatthai = 0x0e03;
  14066. t.khokhwaithai = 0x0e04;
  14067. t.khomutthai = 0x0e5b;
  14068. t.khook = 0x0199;
  14069. t.khorakhangthai = 0x0e06;
  14070. t.khzsquare = 0x3391;
  14071. t.kihiragana = 0x304d;
  14072. t.kikatakana = 0x30ad;
  14073. t.kikatakanahalfwidth = 0xff77;
  14074. t.kiroguramusquare = 0x3315;
  14075. t.kiromeetorusquare = 0x3316;
  14076. t.kirosquare = 0x3314;
  14077. t.kiyeokacirclekorean = 0x326e;
  14078. t.kiyeokaparenkorean = 0x320e;
  14079. t.kiyeokcirclekorean = 0x3260;
  14080. t.kiyeokkorean = 0x3131;
  14081. t.kiyeokparenkorean = 0x3200;
  14082. t.kiyeoksioskorean = 0x3133;
  14083. t.kjecyrillic = 0x045c;
  14084. t.klinebelow = 0x1e35;
  14085. t.klsquare = 0x3398;
  14086. t.kmcubedsquare = 0x33a6;
  14087. t.kmonospace = 0xff4b;
  14088. t.kmsquaredsquare = 0x33a2;
  14089. t.kohiragana = 0x3053;
  14090. t.kohmsquare = 0x33c0;
  14091. t.kokaithai = 0x0e01;
  14092. t.kokatakana = 0x30b3;
  14093. t.kokatakanahalfwidth = 0xff7a;
  14094. t.kooposquare = 0x331e;
  14095. t.koppacyrillic = 0x0481;
  14096. t.koreanstandardsymbol = 0x327f;
  14097. t.koroniscmb = 0x0343;
  14098. t.kparen = 0x24a6;
  14099. t.kpasquare = 0x33aa;
  14100. t.ksicyrillic = 0x046f;
  14101. t.ktsquare = 0x33cf;
  14102. t.kturned = 0x029e;
  14103. t.kuhiragana = 0x304f;
  14104. t.kukatakana = 0x30af;
  14105. t.kukatakanahalfwidth = 0xff78;
  14106. t.kvsquare = 0x33b8;
  14107. t.kwsquare = 0x33be;
  14108. t.l = 0x006c;
  14109. t.labengali = 0x09b2;
  14110. t.lacute = 0x013a;
  14111. t.ladeva = 0x0932;
  14112. t.lagujarati = 0x0ab2;
  14113. t.lagurmukhi = 0x0a32;
  14114. t.lakkhangyaothai = 0x0e45;
  14115. t.lamaleffinalarabic = 0xfefc;
  14116. t.lamalefhamzaabovefinalarabic = 0xfef8;
  14117. t.lamalefhamzaaboveisolatedarabic = 0xfef7;
  14118. t.lamalefhamzabelowfinalarabic = 0xfefa;
  14119. t.lamalefhamzabelowisolatedarabic = 0xfef9;
  14120. t.lamalefisolatedarabic = 0xfefb;
  14121. t.lamalefmaddaabovefinalarabic = 0xfef6;
  14122. t.lamalefmaddaaboveisolatedarabic = 0xfef5;
  14123. t.lamarabic = 0x0644;
  14124. t.lambda = 0x03bb;
  14125. t.lambdastroke = 0x019b;
  14126. t.lamed = 0x05dc;
  14127. t.lameddagesh = 0xfb3c;
  14128. t.lameddageshhebrew = 0xfb3c;
  14129. t.lamedhebrew = 0x05dc;
  14130. t.lamfinalarabic = 0xfede;
  14131. t.lamhahinitialarabic = 0xfcca;
  14132. t.laminitialarabic = 0xfedf;
  14133. t.lamjeeminitialarabic = 0xfcc9;
  14134. t.lamkhahinitialarabic = 0xfccb;
  14135. t.lamlamhehisolatedarabic = 0xfdf2;
  14136. t.lammedialarabic = 0xfee0;
  14137. t.lammeemhahinitialarabic = 0xfd88;
  14138. t.lammeeminitialarabic = 0xfccc;
  14139. t.largecircle = 0x25ef;
  14140. t.lbar = 0x019a;
  14141. t.lbelt = 0x026c;
  14142. t.lbopomofo = 0x310c;
  14143. t.lcaron = 0x013e;
  14144. t.lcedilla = 0x013c;
  14145. t.lcircle = 0x24db;
  14146. t.lcircumflexbelow = 0x1e3d;
  14147. t.lcommaaccent = 0x013c;
  14148. t.ldot = 0x0140;
  14149. t.ldotaccent = 0x0140;
  14150. t.ldotbelow = 0x1e37;
  14151. t.ldotbelowmacron = 0x1e39;
  14152. t.leftangleabovecmb = 0x031a;
  14153. t.lefttackbelowcmb = 0x0318;
  14154. t.less = 0x003c;
  14155. t.lessequal = 0x2264;
  14156. t.lessequalorgreater = 0x22da;
  14157. t.lessmonospace = 0xff1c;
  14158. t.lessorequivalent = 0x2272;
  14159. t.lessorgreater = 0x2276;
  14160. t.lessoverequal = 0x2266;
  14161. t.lesssmall = 0xfe64;
  14162. t.lezh = 0x026e;
  14163. t.lfblock = 0x258c;
  14164. t.lhookretroflex = 0x026d;
  14165. t.lira = 0x20a4;
  14166. t.liwnarmenian = 0x056c;
  14167. t.lj = 0x01c9;
  14168. t.ljecyrillic = 0x0459;
  14169. t.ll = 0xf6c0;
  14170. t.lladeva = 0x0933;
  14171. t.llagujarati = 0x0ab3;
  14172. t.llinebelow = 0x1e3b;
  14173. t.llladeva = 0x0934;
  14174. t.llvocalicbengali = 0x09e1;
  14175. t.llvocalicdeva = 0x0961;
  14176. t.llvocalicvowelsignbengali = 0x09e3;
  14177. t.llvocalicvowelsigndeva = 0x0963;
  14178. t.lmiddletilde = 0x026b;
  14179. t.lmonospace = 0xff4c;
  14180. t.lmsquare = 0x33d0;
  14181. t.lochulathai = 0x0e2c;
  14182. t.logicaland = 0x2227;
  14183. t.logicalnot = 0x00ac;
  14184. t.logicalnotreversed = 0x2310;
  14185. t.logicalor = 0x2228;
  14186. t.lolingthai = 0x0e25;
  14187. t.longs = 0x017f;
  14188. t.lowlinecenterline = 0xfe4e;
  14189. t.lowlinecmb = 0x0332;
  14190. t.lowlinedashed = 0xfe4d;
  14191. t.lozenge = 0x25ca;
  14192. t.lparen = 0x24a7;
  14193. t.lslash = 0x0142;
  14194. t.lsquare = 0x2113;
  14195. t.lsuperior = 0xf6ee;
  14196. t.ltshade = 0x2591;
  14197. t.luthai = 0x0e26;
  14198. t.lvocalicbengali = 0x098c;
  14199. t.lvocalicdeva = 0x090c;
  14200. t.lvocalicvowelsignbengali = 0x09e2;
  14201. t.lvocalicvowelsigndeva = 0x0962;
  14202. t.lxsquare = 0x33d3;
  14203. t.m = 0x006d;
  14204. t.mabengali = 0x09ae;
  14205. t.macron = 0x00af;
  14206. t.macronbelowcmb = 0x0331;
  14207. t.macroncmb = 0x0304;
  14208. t.macronlowmod = 0x02cd;
  14209. t.macronmonospace = 0xffe3;
  14210. t.macute = 0x1e3f;
  14211. t.madeva = 0x092e;
  14212. t.magujarati = 0x0aae;
  14213. t.magurmukhi = 0x0a2e;
  14214. t.mahapakhhebrew = 0x05a4;
  14215. t.mahapakhlefthebrew = 0x05a4;
  14216. t.mahiragana = 0x307e;
  14217. t.maichattawalowleftthai = 0xf895;
  14218. t.maichattawalowrightthai = 0xf894;
  14219. t.maichattawathai = 0x0e4b;
  14220. t.maichattawaupperleftthai = 0xf893;
  14221. t.maieklowleftthai = 0xf88c;
  14222. t.maieklowrightthai = 0xf88b;
  14223. t.maiekthai = 0x0e48;
  14224. t.maiekupperleftthai = 0xf88a;
  14225. t.maihanakatleftthai = 0xf884;
  14226. t.maihanakatthai = 0x0e31;
  14227. t.maitaikhuleftthai = 0xf889;
  14228. t.maitaikhuthai = 0x0e47;
  14229. t.maitholowleftthai = 0xf88f;
  14230. t.maitholowrightthai = 0xf88e;
  14231. t.maithothai = 0x0e49;
  14232. t.maithoupperleftthai = 0xf88d;
  14233. t.maitrilowleftthai = 0xf892;
  14234. t.maitrilowrightthai = 0xf891;
  14235. t.maitrithai = 0x0e4a;
  14236. t.maitriupperleftthai = 0xf890;
  14237. t.maiyamokthai = 0x0e46;
  14238. t.makatakana = 0x30de;
  14239. t.makatakanahalfwidth = 0xff8f;
  14240. t.male = 0x2642;
  14241. t.mansyonsquare = 0x3347;
  14242. t.maqafhebrew = 0x05be;
  14243. t.mars = 0x2642;
  14244. t.masoracirclehebrew = 0x05af;
  14245. t.masquare = 0x3383;
  14246. t.mbopomofo = 0x3107;
  14247. t.mbsquare = 0x33d4;
  14248. t.mcircle = 0x24dc;
  14249. t.mcubedsquare = 0x33a5;
  14250. t.mdotaccent = 0x1e41;
  14251. t.mdotbelow = 0x1e43;
  14252. t.meemarabic = 0x0645;
  14253. t.meemfinalarabic = 0xfee2;
  14254. t.meeminitialarabic = 0xfee3;
  14255. t.meemmedialarabic = 0xfee4;
  14256. t.meemmeeminitialarabic = 0xfcd1;
  14257. t.meemmeemisolatedarabic = 0xfc48;
  14258. t.meetorusquare = 0x334d;
  14259. t.mehiragana = 0x3081;
  14260. t.meizierasquare = 0x337e;
  14261. t.mekatakana = 0x30e1;
  14262. t.mekatakanahalfwidth = 0xff92;
  14263. t.mem = 0x05de;
  14264. t.memdagesh = 0xfb3e;
  14265. t.memdageshhebrew = 0xfb3e;
  14266. t.memhebrew = 0x05de;
  14267. t.menarmenian = 0x0574;
  14268. t.merkhahebrew = 0x05a5;
  14269. t.merkhakefulahebrew = 0x05a6;
  14270. t.merkhakefulalefthebrew = 0x05a6;
  14271. t.merkhalefthebrew = 0x05a5;
  14272. t.mhook = 0x0271;
  14273. t.mhzsquare = 0x3392;
  14274. t.middledotkatakanahalfwidth = 0xff65;
  14275. t.middot = 0x00b7;
  14276. t.mieumacirclekorean = 0x3272;
  14277. t.mieumaparenkorean = 0x3212;
  14278. t.mieumcirclekorean = 0x3264;
  14279. t.mieumkorean = 0x3141;
  14280. t.mieumpansioskorean = 0x3170;
  14281. t.mieumparenkorean = 0x3204;
  14282. t.mieumpieupkorean = 0x316e;
  14283. t.mieumsioskorean = 0x316f;
  14284. t.mihiragana = 0x307f;
  14285. t.mikatakana = 0x30df;
  14286. t.mikatakanahalfwidth = 0xff90;
  14287. t.minus = 0x2212;
  14288. t.minusbelowcmb = 0x0320;
  14289. t.minuscircle = 0x2296;
  14290. t.minusmod = 0x02d7;
  14291. t.minusplus = 0x2213;
  14292. t.minute = 0x2032;
  14293. t.miribaarusquare = 0x334a;
  14294. t.mirisquare = 0x3349;
  14295. t.mlonglegturned = 0x0270;
  14296. t.mlsquare = 0x3396;
  14297. t.mmcubedsquare = 0x33a3;
  14298. t.mmonospace = 0xff4d;
  14299. t.mmsquaredsquare = 0x339f;
  14300. t.mohiragana = 0x3082;
  14301. t.mohmsquare = 0x33c1;
  14302. t.mokatakana = 0x30e2;
  14303. t.mokatakanahalfwidth = 0xff93;
  14304. t.molsquare = 0x33d6;
  14305. t.momathai = 0x0e21;
  14306. t.moverssquare = 0x33a7;
  14307. t.moverssquaredsquare = 0x33a8;
  14308. t.mparen = 0x24a8;
  14309. t.mpasquare = 0x33ab;
  14310. t.mssquare = 0x33b3;
  14311. t.msuperior = 0xf6ef;
  14312. t.mturned = 0x026f;
  14313. t.mu = 0x00b5;
  14314. t.mu1 = 0x00b5;
  14315. t.muasquare = 0x3382;
  14316. t.muchgreater = 0x226b;
  14317. t.muchless = 0x226a;
  14318. t.mufsquare = 0x338c;
  14319. t.mugreek = 0x03bc;
  14320. t.mugsquare = 0x338d;
  14321. t.muhiragana = 0x3080;
  14322. t.mukatakana = 0x30e0;
  14323. t.mukatakanahalfwidth = 0xff91;
  14324. t.mulsquare = 0x3395;
  14325. t.multiply = 0x00d7;
  14326. t.mumsquare = 0x339b;
  14327. t.munahhebrew = 0x05a3;
  14328. t.munahlefthebrew = 0x05a3;
  14329. t.musicalnote = 0x266a;
  14330. t.musicalnotedbl = 0x266b;
  14331. t.musicflatsign = 0x266d;
  14332. t.musicsharpsign = 0x266f;
  14333. t.mussquare = 0x33b2;
  14334. t.muvsquare = 0x33b6;
  14335. t.muwsquare = 0x33bc;
  14336. t.mvmegasquare = 0x33b9;
  14337. t.mvsquare = 0x33b7;
  14338. t.mwmegasquare = 0x33bf;
  14339. t.mwsquare = 0x33bd;
  14340. t.n = 0x006e;
  14341. t.nabengali = 0x09a8;
  14342. t.nabla = 0x2207;
  14343. t.nacute = 0x0144;
  14344. t.nadeva = 0x0928;
  14345. t.nagujarati = 0x0aa8;
  14346. t.nagurmukhi = 0x0a28;
  14347. t.nahiragana = 0x306a;
  14348. t.nakatakana = 0x30ca;
  14349. t.nakatakanahalfwidth = 0xff85;
  14350. t.napostrophe = 0x0149;
  14351. t.nasquare = 0x3381;
  14352. t.nbopomofo = 0x310b;
  14353. t.nbspace = 0x00a0;
  14354. t.ncaron = 0x0148;
  14355. t.ncedilla = 0x0146;
  14356. t.ncircle = 0x24dd;
  14357. t.ncircumflexbelow = 0x1e4b;
  14358. t.ncommaaccent = 0x0146;
  14359. t.ndotaccent = 0x1e45;
  14360. t.ndotbelow = 0x1e47;
  14361. t.nehiragana = 0x306d;
  14362. t.nekatakana = 0x30cd;
  14363. t.nekatakanahalfwidth = 0xff88;
  14364. t.newsheqelsign = 0x20aa;
  14365. t.nfsquare = 0x338b;
  14366. t.ngabengali = 0x0999;
  14367. t.ngadeva = 0x0919;
  14368. t.ngagujarati = 0x0a99;
  14369. t.ngagurmukhi = 0x0a19;
  14370. t.ngonguthai = 0x0e07;
  14371. t.nhiragana = 0x3093;
  14372. t.nhookleft = 0x0272;
  14373. t.nhookretroflex = 0x0273;
  14374. t.nieunacirclekorean = 0x326f;
  14375. t.nieunaparenkorean = 0x320f;
  14376. t.nieuncieuckorean = 0x3135;
  14377. t.nieuncirclekorean = 0x3261;
  14378. t.nieunhieuhkorean = 0x3136;
  14379. t.nieunkorean = 0x3134;
  14380. t.nieunpansioskorean = 0x3168;
  14381. t.nieunparenkorean = 0x3201;
  14382. t.nieunsioskorean = 0x3167;
  14383. t.nieuntikeutkorean = 0x3166;
  14384. t.nihiragana = 0x306b;
  14385. t.nikatakana = 0x30cb;
  14386. t.nikatakanahalfwidth = 0xff86;
  14387. t.nikhahitleftthai = 0xf899;
  14388. t.nikhahitthai = 0x0e4d;
  14389. t.nine = 0x0039;
  14390. t.ninearabic = 0x0669;
  14391. t.ninebengali = 0x09ef;
  14392. t.ninecircle = 0x2468;
  14393. t.ninecircleinversesansserif = 0x2792;
  14394. t.ninedeva = 0x096f;
  14395. t.ninegujarati = 0x0aef;
  14396. t.ninegurmukhi = 0x0a6f;
  14397. t.ninehackarabic = 0x0669;
  14398. t.ninehangzhou = 0x3029;
  14399. t.nineideographicparen = 0x3228;
  14400. t.nineinferior = 0x2089;
  14401. t.ninemonospace = 0xff19;
  14402. t.nineoldstyle = 0xf739;
  14403. t.nineparen = 0x247c;
  14404. t.nineperiod = 0x2490;
  14405. t.ninepersian = 0x06f9;
  14406. t.nineroman = 0x2178;
  14407. t.ninesuperior = 0x2079;
  14408. t.nineteencircle = 0x2472;
  14409. t.nineteenparen = 0x2486;
  14410. t.nineteenperiod = 0x249a;
  14411. t.ninethai = 0x0e59;
  14412. t.nj = 0x01cc;
  14413. t.njecyrillic = 0x045a;
  14414. t.nkatakana = 0x30f3;
  14415. t.nkatakanahalfwidth = 0xff9d;
  14416. t.nlegrightlong = 0x019e;
  14417. t.nlinebelow = 0x1e49;
  14418. t.nmonospace = 0xff4e;
  14419. t.nmsquare = 0x339a;
  14420. t.nnabengali = 0x09a3;
  14421. t.nnadeva = 0x0923;
  14422. t.nnagujarati = 0x0aa3;
  14423. t.nnagurmukhi = 0x0a23;
  14424. t.nnnadeva = 0x0929;
  14425. t.nohiragana = 0x306e;
  14426. t.nokatakana = 0x30ce;
  14427. t.nokatakanahalfwidth = 0xff89;
  14428. t.nonbreakingspace = 0x00a0;
  14429. t.nonenthai = 0x0e13;
  14430. t.nonuthai = 0x0e19;
  14431. t.noonarabic = 0x0646;
  14432. t.noonfinalarabic = 0xfee6;
  14433. t.noonghunnaarabic = 0x06ba;
  14434. t.noonghunnafinalarabic = 0xfb9f;
  14435. t.nooninitialarabic = 0xfee7;
  14436. t.noonjeeminitialarabic = 0xfcd2;
  14437. t.noonjeemisolatedarabic = 0xfc4b;
  14438. t.noonmedialarabic = 0xfee8;
  14439. t.noonmeeminitialarabic = 0xfcd5;
  14440. t.noonmeemisolatedarabic = 0xfc4e;
  14441. t.noonnoonfinalarabic = 0xfc8d;
  14442. t.notcontains = 0x220c;
  14443. t.notelement = 0x2209;
  14444. t.notelementof = 0x2209;
  14445. t.notequal = 0x2260;
  14446. t.notgreater = 0x226f;
  14447. t.notgreaternorequal = 0x2271;
  14448. t.notgreaternorless = 0x2279;
  14449. t.notidentical = 0x2262;
  14450. t.notless = 0x226e;
  14451. t.notlessnorequal = 0x2270;
  14452. t.notparallel = 0x2226;
  14453. t.notprecedes = 0x2280;
  14454. t.notsubset = 0x2284;
  14455. t.notsucceeds = 0x2281;
  14456. t.notsuperset = 0x2285;
  14457. t.nowarmenian = 0x0576;
  14458. t.nparen = 0x24a9;
  14459. t.nssquare = 0x33b1;
  14460. t.nsuperior = 0x207f;
  14461. t.ntilde = 0x00f1;
  14462. t.nu = 0x03bd;
  14463. t.nuhiragana = 0x306c;
  14464. t.nukatakana = 0x30cc;
  14465. t.nukatakanahalfwidth = 0xff87;
  14466. t.nuktabengali = 0x09bc;
  14467. t.nuktadeva = 0x093c;
  14468. t.nuktagujarati = 0x0abc;
  14469. t.nuktagurmukhi = 0x0a3c;
  14470. t.numbersign = 0x0023;
  14471. t.numbersignmonospace = 0xff03;
  14472. t.numbersignsmall = 0xfe5f;
  14473. t.numeralsigngreek = 0x0374;
  14474. t.numeralsignlowergreek = 0x0375;
  14475. t.numero = 0x2116;
  14476. t.nun = 0x05e0;
  14477. t.nundagesh = 0xfb40;
  14478. t.nundageshhebrew = 0xfb40;
  14479. t.nunhebrew = 0x05e0;
  14480. t.nvsquare = 0x33b5;
  14481. t.nwsquare = 0x33bb;
  14482. t.nyabengali = 0x099e;
  14483. t.nyadeva = 0x091e;
  14484. t.nyagujarati = 0x0a9e;
  14485. t.nyagurmukhi = 0x0a1e;
  14486. t.o = 0x006f;
  14487. t.oacute = 0x00f3;
  14488. t.oangthai = 0x0e2d;
  14489. t.obarred = 0x0275;
  14490. t.obarredcyrillic = 0x04e9;
  14491. t.obarreddieresiscyrillic = 0x04eb;
  14492. t.obengali = 0x0993;
  14493. t.obopomofo = 0x311b;
  14494. t.obreve = 0x014f;
  14495. t.ocandradeva = 0x0911;
  14496. t.ocandragujarati = 0x0a91;
  14497. t.ocandravowelsigndeva = 0x0949;
  14498. t.ocandravowelsigngujarati = 0x0ac9;
  14499. t.ocaron = 0x01d2;
  14500. t.ocircle = 0x24de;
  14501. t.ocircumflex = 0x00f4;
  14502. t.ocircumflexacute = 0x1ed1;
  14503. t.ocircumflexdotbelow = 0x1ed9;
  14504. t.ocircumflexgrave = 0x1ed3;
  14505. t.ocircumflexhookabove = 0x1ed5;
  14506. t.ocircumflextilde = 0x1ed7;
  14507. t.ocyrillic = 0x043e;
  14508. t.odblacute = 0x0151;
  14509. t.odblgrave = 0x020d;
  14510. t.odeva = 0x0913;
  14511. t.odieresis = 0x00f6;
  14512. t.odieresiscyrillic = 0x04e7;
  14513. t.odotbelow = 0x1ecd;
  14514. t.oe = 0x0153;
  14515. t.oekorean = 0x315a;
  14516. t.ogonek = 0x02db;
  14517. t.ogonekcmb = 0x0328;
  14518. t.ograve = 0x00f2;
  14519. t.ogujarati = 0x0a93;
  14520. t.oharmenian = 0x0585;
  14521. t.ohiragana = 0x304a;
  14522. t.ohookabove = 0x1ecf;
  14523. t.ohorn = 0x01a1;
  14524. t.ohornacute = 0x1edb;
  14525. t.ohorndotbelow = 0x1ee3;
  14526. t.ohorngrave = 0x1edd;
  14527. t.ohornhookabove = 0x1edf;
  14528. t.ohorntilde = 0x1ee1;
  14529. t.ohungarumlaut = 0x0151;
  14530. t.oi = 0x01a3;
  14531. t.oinvertedbreve = 0x020f;
  14532. t.okatakana = 0x30aa;
  14533. t.okatakanahalfwidth = 0xff75;
  14534. t.okorean = 0x3157;
  14535. t.olehebrew = 0x05ab;
  14536. t.omacron = 0x014d;
  14537. t.omacronacute = 0x1e53;
  14538. t.omacrongrave = 0x1e51;
  14539. t.omdeva = 0x0950;
  14540. t.omega = 0x03c9;
  14541. t.omega1 = 0x03d6;
  14542. t.omegacyrillic = 0x0461;
  14543. t.omegalatinclosed = 0x0277;
  14544. t.omegaroundcyrillic = 0x047b;
  14545. t.omegatitlocyrillic = 0x047d;
  14546. t.omegatonos = 0x03ce;
  14547. t.omgujarati = 0x0ad0;
  14548. t.omicron = 0x03bf;
  14549. t.omicrontonos = 0x03cc;
  14550. t.omonospace = 0xff4f;
  14551. t.one = 0x0031;
  14552. t.onearabic = 0x0661;
  14553. t.onebengali = 0x09e7;
  14554. t.onecircle = 0x2460;
  14555. t.onecircleinversesansserif = 0x278a;
  14556. t.onedeva = 0x0967;
  14557. t.onedotenleader = 0x2024;
  14558. t.oneeighth = 0x215b;
  14559. t.onefitted = 0xf6dc;
  14560. t.onegujarati = 0x0ae7;
  14561. t.onegurmukhi = 0x0a67;
  14562. t.onehackarabic = 0x0661;
  14563. t.onehalf = 0x00bd;
  14564. t.onehangzhou = 0x3021;
  14565. t.oneideographicparen = 0x3220;
  14566. t.oneinferior = 0x2081;
  14567. t.onemonospace = 0xff11;
  14568. t.onenumeratorbengali = 0x09f4;
  14569. t.oneoldstyle = 0xf731;
  14570. t.oneparen = 0x2474;
  14571. t.oneperiod = 0x2488;
  14572. t.onepersian = 0x06f1;
  14573. t.onequarter = 0x00bc;
  14574. t.oneroman = 0x2170;
  14575. t.onesuperior = 0x00b9;
  14576. t.onethai = 0x0e51;
  14577. t.onethird = 0x2153;
  14578. t.oogonek = 0x01eb;
  14579. t.oogonekmacron = 0x01ed;
  14580. t.oogurmukhi = 0x0a13;
  14581. t.oomatragurmukhi = 0x0a4b;
  14582. t.oopen = 0x0254;
  14583. t.oparen = 0x24aa;
  14584. t.openbullet = 0x25e6;
  14585. t.option = 0x2325;
  14586. t.ordfeminine = 0x00aa;
  14587. t.ordmasculine = 0x00ba;
  14588. t.orthogonal = 0x221f;
  14589. t.oshortdeva = 0x0912;
  14590. t.oshortvowelsigndeva = 0x094a;
  14591. t.oslash = 0x00f8;
  14592. t.oslashacute = 0x01ff;
  14593. t.osmallhiragana = 0x3049;
  14594. t.osmallkatakana = 0x30a9;
  14595. t.osmallkatakanahalfwidth = 0xff6b;
  14596. t.ostrokeacute = 0x01ff;
  14597. t.osuperior = 0xf6f0;
  14598. t.otcyrillic = 0x047f;
  14599. t.otilde = 0x00f5;
  14600. t.otildeacute = 0x1e4d;
  14601. t.otildedieresis = 0x1e4f;
  14602. t.oubopomofo = 0x3121;
  14603. t.overline = 0x203e;
  14604. t.overlinecenterline = 0xfe4a;
  14605. t.overlinecmb = 0x0305;
  14606. t.overlinedashed = 0xfe49;
  14607. t.overlinedblwavy = 0xfe4c;
  14608. t.overlinewavy = 0xfe4b;
  14609. t.overscore = 0x00af;
  14610. t.ovowelsignbengali = 0x09cb;
  14611. t.ovowelsigndeva = 0x094b;
  14612. t.ovowelsigngujarati = 0x0acb;
  14613. t.p = 0x0070;
  14614. t.paampssquare = 0x3380;
  14615. t.paasentosquare = 0x332b;
  14616. t.pabengali = 0x09aa;
  14617. t.pacute = 0x1e55;
  14618. t.padeva = 0x092a;
  14619. t.pagedown = 0x21df;
  14620. t.pageup = 0x21de;
  14621. t.pagujarati = 0x0aaa;
  14622. t.pagurmukhi = 0x0a2a;
  14623. t.pahiragana = 0x3071;
  14624. t.paiyannoithai = 0x0e2f;
  14625. t.pakatakana = 0x30d1;
  14626. t.palatalizationcyrilliccmb = 0x0484;
  14627. t.palochkacyrillic = 0x04c0;
  14628. t.pansioskorean = 0x317f;
  14629. t.paragraph = 0x00b6;
  14630. t.parallel = 0x2225;
  14631. t.parenleft = 0x0028;
  14632. t.parenleftaltonearabic = 0xfd3e;
  14633. t.parenleftbt = 0xf8ed;
  14634. t.parenleftex = 0xf8ec;
  14635. t.parenleftinferior = 0x208d;
  14636. t.parenleftmonospace = 0xff08;
  14637. t.parenleftsmall = 0xfe59;
  14638. t.parenleftsuperior = 0x207d;
  14639. t.parenlefttp = 0xf8eb;
  14640. t.parenleftvertical = 0xfe35;
  14641. t.parenright = 0x0029;
  14642. t.parenrightaltonearabic = 0xfd3f;
  14643. t.parenrightbt = 0xf8f8;
  14644. t.parenrightex = 0xf8f7;
  14645. t.parenrightinferior = 0x208e;
  14646. t.parenrightmonospace = 0xff09;
  14647. t.parenrightsmall = 0xfe5a;
  14648. t.parenrightsuperior = 0x207e;
  14649. t.parenrighttp = 0xf8f6;
  14650. t.parenrightvertical = 0xfe36;
  14651. t.partialdiff = 0x2202;
  14652. t.paseqhebrew = 0x05c0;
  14653. t.pashtahebrew = 0x0599;
  14654. t.pasquare = 0x33a9;
  14655. t.patah = 0x05b7;
  14656. t.patah11 = 0x05b7;
  14657. t.patah1d = 0x05b7;
  14658. t.patah2a = 0x05b7;
  14659. t.patahhebrew = 0x05b7;
  14660. t.patahnarrowhebrew = 0x05b7;
  14661. t.patahquarterhebrew = 0x05b7;
  14662. t.patahwidehebrew = 0x05b7;
  14663. t.pazerhebrew = 0x05a1;
  14664. t.pbopomofo = 0x3106;
  14665. t.pcircle = 0x24df;
  14666. t.pdotaccent = 0x1e57;
  14667. t.pe = 0x05e4;
  14668. t.pecyrillic = 0x043f;
  14669. t.pedagesh = 0xfb44;
  14670. t.pedageshhebrew = 0xfb44;
  14671. t.peezisquare = 0x333b;
  14672. t.pefinaldageshhebrew = 0xfb43;
  14673. t.peharabic = 0x067e;
  14674. t.peharmenian = 0x057a;
  14675. t.pehebrew = 0x05e4;
  14676. t.pehfinalarabic = 0xfb57;
  14677. t.pehinitialarabic = 0xfb58;
  14678. t.pehiragana = 0x307a;
  14679. t.pehmedialarabic = 0xfb59;
  14680. t.pekatakana = 0x30da;
  14681. t.pemiddlehookcyrillic = 0x04a7;
  14682. t.perafehebrew = 0xfb4e;
  14683. t.percent = 0x0025;
  14684. t.percentarabic = 0x066a;
  14685. t.percentmonospace = 0xff05;
  14686. t.percentsmall = 0xfe6a;
  14687. t.period = 0x002e;
  14688. t.periodarmenian = 0x0589;
  14689. t.periodcentered = 0x00b7;
  14690. t.periodhalfwidth = 0xff61;
  14691. t.periodinferior = 0xf6e7;
  14692. t.periodmonospace = 0xff0e;
  14693. t.periodsmall = 0xfe52;
  14694. t.periodsuperior = 0xf6e8;
  14695. t.perispomenigreekcmb = 0x0342;
  14696. t.perpendicular = 0x22a5;
  14697. t.perthousand = 0x2030;
  14698. t.peseta = 0x20a7;
  14699. t.pfsquare = 0x338a;
  14700. t.phabengali = 0x09ab;
  14701. t.phadeva = 0x092b;
  14702. t.phagujarati = 0x0aab;
  14703. t.phagurmukhi = 0x0a2b;
  14704. t.phi = 0x03c6;
  14705. t.phi1 = 0x03d5;
  14706. t.phieuphacirclekorean = 0x327a;
  14707. t.phieuphaparenkorean = 0x321a;
  14708. t.phieuphcirclekorean = 0x326c;
  14709. t.phieuphkorean = 0x314d;
  14710. t.phieuphparenkorean = 0x320c;
  14711. t.philatin = 0x0278;
  14712. t.phinthuthai = 0x0e3a;
  14713. t.phisymbolgreek = 0x03d5;
  14714. t.phook = 0x01a5;
  14715. t.phophanthai = 0x0e1e;
  14716. t.phophungthai = 0x0e1c;
  14717. t.phosamphaothai = 0x0e20;
  14718. t.pi = 0x03c0;
  14719. t.pieupacirclekorean = 0x3273;
  14720. t.pieupaparenkorean = 0x3213;
  14721. t.pieupcieuckorean = 0x3176;
  14722. t.pieupcirclekorean = 0x3265;
  14723. t.pieupkiyeokkorean = 0x3172;
  14724. t.pieupkorean = 0x3142;
  14725. t.pieupparenkorean = 0x3205;
  14726. t.pieupsioskiyeokkorean = 0x3174;
  14727. t.pieupsioskorean = 0x3144;
  14728. t.pieupsiostikeutkorean = 0x3175;
  14729. t.pieupthieuthkorean = 0x3177;
  14730. t.pieuptikeutkorean = 0x3173;
  14731. t.pihiragana = 0x3074;
  14732. t.pikatakana = 0x30d4;
  14733. t.pisymbolgreek = 0x03d6;
  14734. t.piwrarmenian = 0x0583;
  14735. t.planckover2pi = 0x210f;
  14736. t.planckover2pi1 = 0x210f;
  14737. t.plus = 0x002b;
  14738. t.plusbelowcmb = 0x031f;
  14739. t.pluscircle = 0x2295;
  14740. t.plusminus = 0x00b1;
  14741. t.plusmod = 0x02d6;
  14742. t.plusmonospace = 0xff0b;
  14743. t.plussmall = 0xfe62;
  14744. t.plussuperior = 0x207a;
  14745. t.pmonospace = 0xff50;
  14746. t.pmsquare = 0x33d8;
  14747. t.pohiragana = 0x307d;
  14748. t.pointingindexdownwhite = 0x261f;
  14749. t.pointingindexleftwhite = 0x261c;
  14750. t.pointingindexrightwhite = 0x261e;
  14751. t.pointingindexupwhite = 0x261d;
  14752. t.pokatakana = 0x30dd;
  14753. t.poplathai = 0x0e1b;
  14754. t.postalmark = 0x3012;
  14755. t.postalmarkface = 0x3020;
  14756. t.pparen = 0x24ab;
  14757. t.precedes = 0x227a;
  14758. t.prescription = 0x211e;
  14759. t.primemod = 0x02b9;
  14760. t.primereversed = 0x2035;
  14761. t.product = 0x220f;
  14762. t.projective = 0x2305;
  14763. t.prolongedkana = 0x30fc;
  14764. t.propellor = 0x2318;
  14765. t.propersubset = 0x2282;
  14766. t.propersuperset = 0x2283;
  14767. t.proportion = 0x2237;
  14768. t.proportional = 0x221d;
  14769. t.psi = 0x03c8;
  14770. t.psicyrillic = 0x0471;
  14771. t.psilipneumatacyrilliccmb = 0x0486;
  14772. t.pssquare = 0x33b0;
  14773. t.puhiragana = 0x3077;
  14774. t.pukatakana = 0x30d7;
  14775. t.pvsquare = 0x33b4;
  14776. t.pwsquare = 0x33ba;
  14777. t.q = 0x0071;
  14778. t.qadeva = 0x0958;
  14779. t.qadmahebrew = 0x05a8;
  14780. t.qafarabic = 0x0642;
  14781. t.qaffinalarabic = 0xfed6;
  14782. t.qafinitialarabic = 0xfed7;
  14783. t.qafmedialarabic = 0xfed8;
  14784. t.qamats = 0x05b8;
  14785. t.qamats10 = 0x05b8;
  14786. t.qamats1a = 0x05b8;
  14787. t.qamats1c = 0x05b8;
  14788. t.qamats27 = 0x05b8;
  14789. t.qamats29 = 0x05b8;
  14790. t.qamats33 = 0x05b8;
  14791. t.qamatsde = 0x05b8;
  14792. t.qamatshebrew = 0x05b8;
  14793. t.qamatsnarrowhebrew = 0x05b8;
  14794. t.qamatsqatanhebrew = 0x05b8;
  14795. t.qamatsqatannarrowhebrew = 0x05b8;
  14796. t.qamatsqatanquarterhebrew = 0x05b8;
  14797. t.qamatsqatanwidehebrew = 0x05b8;
  14798. t.qamatsquarterhebrew = 0x05b8;
  14799. t.qamatswidehebrew = 0x05b8;
  14800. t.qarneyparahebrew = 0x059f;
  14801. t.qbopomofo = 0x3111;
  14802. t.qcircle = 0x24e0;
  14803. t.qhook = 0x02a0;
  14804. t.qmonospace = 0xff51;
  14805. t.qof = 0x05e7;
  14806. t.qofdagesh = 0xfb47;
  14807. t.qofdageshhebrew = 0xfb47;
  14808. t.qofhebrew = 0x05e7;
  14809. t.qparen = 0x24ac;
  14810. t.quarternote = 0x2669;
  14811. t.qubuts = 0x05bb;
  14812. t.qubuts18 = 0x05bb;
  14813. t.qubuts25 = 0x05bb;
  14814. t.qubuts31 = 0x05bb;
  14815. t.qubutshebrew = 0x05bb;
  14816. t.qubutsnarrowhebrew = 0x05bb;
  14817. t.qubutsquarterhebrew = 0x05bb;
  14818. t.qubutswidehebrew = 0x05bb;
  14819. t.question = 0x003f;
  14820. t.questionarabic = 0x061f;
  14821. t.questionarmenian = 0x055e;
  14822. t.questiondown = 0x00bf;
  14823. t.questiondownsmall = 0xf7bf;
  14824. t.questiongreek = 0x037e;
  14825. t.questionmonospace = 0xff1f;
  14826. t.questionsmall = 0xf73f;
  14827. t.quotedbl = 0x0022;
  14828. t.quotedblbase = 0x201e;
  14829. t.quotedblleft = 0x201c;
  14830. t.quotedblmonospace = 0xff02;
  14831. t.quotedblprime = 0x301e;
  14832. t.quotedblprimereversed = 0x301d;
  14833. t.quotedblright = 0x201d;
  14834. t.quoteleft = 0x2018;
  14835. t.quoteleftreversed = 0x201b;
  14836. t.quotereversed = 0x201b;
  14837. t.quoteright = 0x2019;
  14838. t.quoterightn = 0x0149;
  14839. t.quotesinglbase = 0x201a;
  14840. t.quotesingle = 0x0027;
  14841. t.quotesinglemonospace = 0xff07;
  14842. t.r = 0x0072;
  14843. t.raarmenian = 0x057c;
  14844. t.rabengali = 0x09b0;
  14845. t.racute = 0x0155;
  14846. t.radeva = 0x0930;
  14847. t.radical = 0x221a;
  14848. t.radicalex = 0xf8e5;
  14849. t.radoverssquare = 0x33ae;
  14850. t.radoverssquaredsquare = 0x33af;
  14851. t.radsquare = 0x33ad;
  14852. t.rafe = 0x05bf;
  14853. t.rafehebrew = 0x05bf;
  14854. t.ragujarati = 0x0ab0;
  14855. t.ragurmukhi = 0x0a30;
  14856. t.rahiragana = 0x3089;
  14857. t.rakatakana = 0x30e9;
  14858. t.rakatakanahalfwidth = 0xff97;
  14859. t.ralowerdiagonalbengali = 0x09f1;
  14860. t.ramiddlediagonalbengali = 0x09f0;
  14861. t.ramshorn = 0x0264;
  14862. t.ratio = 0x2236;
  14863. t.rbopomofo = 0x3116;
  14864. t.rcaron = 0x0159;
  14865. t.rcedilla = 0x0157;
  14866. t.rcircle = 0x24e1;
  14867. t.rcommaaccent = 0x0157;
  14868. t.rdblgrave = 0x0211;
  14869. t.rdotaccent = 0x1e59;
  14870. t.rdotbelow = 0x1e5b;
  14871. t.rdotbelowmacron = 0x1e5d;
  14872. t.referencemark = 0x203b;
  14873. t.reflexsubset = 0x2286;
  14874. t.reflexsuperset = 0x2287;
  14875. t.registered = 0x00ae;
  14876. t.registersans = 0xf8e8;
  14877. t.registerserif = 0xf6da;
  14878. t.reharabic = 0x0631;
  14879. t.reharmenian = 0x0580;
  14880. t.rehfinalarabic = 0xfeae;
  14881. t.rehiragana = 0x308c;
  14882. t.rekatakana = 0x30ec;
  14883. t.rekatakanahalfwidth = 0xff9a;
  14884. t.resh = 0x05e8;
  14885. t.reshdageshhebrew = 0xfb48;
  14886. t.reshhebrew = 0x05e8;
  14887. t.reversedtilde = 0x223d;
  14888. t.reviahebrew = 0x0597;
  14889. t.reviamugrashhebrew = 0x0597;
  14890. t.revlogicalnot = 0x2310;
  14891. t.rfishhook = 0x027e;
  14892. t.rfishhookreversed = 0x027f;
  14893. t.rhabengali = 0x09dd;
  14894. t.rhadeva = 0x095d;
  14895. t.rho = 0x03c1;
  14896. t.rhook = 0x027d;
  14897. t.rhookturned = 0x027b;
  14898. t.rhookturnedsuperior = 0x02b5;
  14899. t.rhosymbolgreek = 0x03f1;
  14900. t.rhotichookmod = 0x02de;
  14901. t.rieulacirclekorean = 0x3271;
  14902. t.rieulaparenkorean = 0x3211;
  14903. t.rieulcirclekorean = 0x3263;
  14904. t.rieulhieuhkorean = 0x3140;
  14905. t.rieulkiyeokkorean = 0x313a;
  14906. t.rieulkiyeoksioskorean = 0x3169;
  14907. t.rieulkorean = 0x3139;
  14908. t.rieulmieumkorean = 0x313b;
  14909. t.rieulpansioskorean = 0x316c;
  14910. t.rieulparenkorean = 0x3203;
  14911. t.rieulphieuphkorean = 0x313f;
  14912. t.rieulpieupkorean = 0x313c;
  14913. t.rieulpieupsioskorean = 0x316b;
  14914. t.rieulsioskorean = 0x313d;
  14915. t.rieulthieuthkorean = 0x313e;
  14916. t.rieultikeutkorean = 0x316a;
  14917. t.rieulyeorinhieuhkorean = 0x316d;
  14918. t.rightangle = 0x221f;
  14919. t.righttackbelowcmb = 0x0319;
  14920. t.righttriangle = 0x22bf;
  14921. t.rihiragana = 0x308a;
  14922. t.rikatakana = 0x30ea;
  14923. t.rikatakanahalfwidth = 0xff98;
  14924. t.ring = 0x02da;
  14925. t.ringbelowcmb = 0x0325;
  14926. t.ringcmb = 0x030a;
  14927. t.ringhalfleft = 0x02bf;
  14928. t.ringhalfleftarmenian = 0x0559;
  14929. t.ringhalfleftbelowcmb = 0x031c;
  14930. t.ringhalfleftcentered = 0x02d3;
  14931. t.ringhalfright = 0x02be;
  14932. t.ringhalfrightbelowcmb = 0x0339;
  14933. t.ringhalfrightcentered = 0x02d2;
  14934. t.rinvertedbreve = 0x0213;
  14935. t.rittorusquare = 0x3351;
  14936. t.rlinebelow = 0x1e5f;
  14937. t.rlongleg = 0x027c;
  14938. t.rlonglegturned = 0x027a;
  14939. t.rmonospace = 0xff52;
  14940. t.rohiragana = 0x308d;
  14941. t.rokatakana = 0x30ed;
  14942. t.rokatakanahalfwidth = 0xff9b;
  14943. t.roruathai = 0x0e23;
  14944. t.rparen = 0x24ad;
  14945. t.rrabengali = 0x09dc;
  14946. t.rradeva = 0x0931;
  14947. t.rragurmukhi = 0x0a5c;
  14948. t.rreharabic = 0x0691;
  14949. t.rrehfinalarabic = 0xfb8d;
  14950. t.rrvocalicbengali = 0x09e0;
  14951. t.rrvocalicdeva = 0x0960;
  14952. t.rrvocalicgujarati = 0x0ae0;
  14953. t.rrvocalicvowelsignbengali = 0x09c4;
  14954. t.rrvocalicvowelsigndeva = 0x0944;
  14955. t.rrvocalicvowelsigngujarati = 0x0ac4;
  14956. t.rsuperior = 0xf6f1;
  14957. t.rtblock = 0x2590;
  14958. t.rturned = 0x0279;
  14959. t.rturnedsuperior = 0x02b4;
  14960. t.ruhiragana = 0x308b;
  14961. t.rukatakana = 0x30eb;
  14962. t.rukatakanahalfwidth = 0xff99;
  14963. t.rupeemarkbengali = 0x09f2;
  14964. t.rupeesignbengali = 0x09f3;
  14965. t.rupiah = 0xf6dd;
  14966. t.ruthai = 0x0e24;
  14967. t.rvocalicbengali = 0x098b;
  14968. t.rvocalicdeva = 0x090b;
  14969. t.rvocalicgujarati = 0x0a8b;
  14970. t.rvocalicvowelsignbengali = 0x09c3;
  14971. t.rvocalicvowelsigndeva = 0x0943;
  14972. t.rvocalicvowelsigngujarati = 0x0ac3;
  14973. t.s = 0x0073;
  14974. t.sabengali = 0x09b8;
  14975. t.sacute = 0x015b;
  14976. t.sacutedotaccent = 0x1e65;
  14977. t.sadarabic = 0x0635;
  14978. t.sadeva = 0x0938;
  14979. t.sadfinalarabic = 0xfeba;
  14980. t.sadinitialarabic = 0xfebb;
  14981. t.sadmedialarabic = 0xfebc;
  14982. t.sagujarati = 0x0ab8;
  14983. t.sagurmukhi = 0x0a38;
  14984. t.sahiragana = 0x3055;
  14985. t.sakatakana = 0x30b5;
  14986. t.sakatakanahalfwidth = 0xff7b;
  14987. t.sallallahoualayhewasallamarabic = 0xfdfa;
  14988. t.samekh = 0x05e1;
  14989. t.samekhdagesh = 0xfb41;
  14990. t.samekhdageshhebrew = 0xfb41;
  14991. t.samekhhebrew = 0x05e1;
  14992. t.saraaathai = 0x0e32;
  14993. t.saraaethai = 0x0e41;
  14994. t.saraaimaimalaithai = 0x0e44;
  14995. t.saraaimaimuanthai = 0x0e43;
  14996. t.saraamthai = 0x0e33;
  14997. t.saraathai = 0x0e30;
  14998. t.saraethai = 0x0e40;
  14999. t.saraiileftthai = 0xf886;
  15000. t.saraiithai = 0x0e35;
  15001. t.saraileftthai = 0xf885;
  15002. t.saraithai = 0x0e34;
  15003. t.saraothai = 0x0e42;
  15004. t.saraueeleftthai = 0xf888;
  15005. t.saraueethai = 0x0e37;
  15006. t.saraueleftthai = 0xf887;
  15007. t.sarauethai = 0x0e36;
  15008. t.sarauthai = 0x0e38;
  15009. t.sarauuthai = 0x0e39;
  15010. t.sbopomofo = 0x3119;
  15011. t.scaron = 0x0161;
  15012. t.scarondotaccent = 0x1e67;
  15013. t.scedilla = 0x015f;
  15014. t.schwa = 0x0259;
  15015. t.schwacyrillic = 0x04d9;
  15016. t.schwadieresiscyrillic = 0x04db;
  15017. t.schwahook = 0x025a;
  15018. t.scircle = 0x24e2;
  15019. t.scircumflex = 0x015d;
  15020. t.scommaaccent = 0x0219;
  15021. t.sdotaccent = 0x1e61;
  15022. t.sdotbelow = 0x1e63;
  15023. t.sdotbelowdotaccent = 0x1e69;
  15024. t.seagullbelowcmb = 0x033c;
  15025. t.second = 0x2033;
  15026. t.secondtonechinese = 0x02ca;
  15027. t.section = 0x00a7;
  15028. t.seenarabic = 0x0633;
  15029. t.seenfinalarabic = 0xfeb2;
  15030. t.seeninitialarabic = 0xfeb3;
  15031. t.seenmedialarabic = 0xfeb4;
  15032. t.segol = 0x05b6;
  15033. t.segol13 = 0x05b6;
  15034. t.segol1f = 0x05b6;
  15035. t.segol2c = 0x05b6;
  15036. t.segolhebrew = 0x05b6;
  15037. t.segolnarrowhebrew = 0x05b6;
  15038. t.segolquarterhebrew = 0x05b6;
  15039. t.segoltahebrew = 0x0592;
  15040. t.segolwidehebrew = 0x05b6;
  15041. t.seharmenian = 0x057d;
  15042. t.sehiragana = 0x305b;
  15043. t.sekatakana = 0x30bb;
  15044. t.sekatakanahalfwidth = 0xff7e;
  15045. t.semicolon = 0x003b;
  15046. t.semicolonarabic = 0x061b;
  15047. t.semicolonmonospace = 0xff1b;
  15048. t.semicolonsmall = 0xfe54;
  15049. t.semivoicedmarkkana = 0x309c;
  15050. t.semivoicedmarkkanahalfwidth = 0xff9f;
  15051. t.sentisquare = 0x3322;
  15052. t.sentosquare = 0x3323;
  15053. t.seven = 0x0037;
  15054. t.sevenarabic = 0x0667;
  15055. t.sevenbengali = 0x09ed;
  15056. t.sevencircle = 0x2466;
  15057. t.sevencircleinversesansserif = 0x2790;
  15058. t.sevendeva = 0x096d;
  15059. t.seveneighths = 0x215e;
  15060. t.sevengujarati = 0x0aed;
  15061. t.sevengurmukhi = 0x0a6d;
  15062. t.sevenhackarabic = 0x0667;
  15063. t.sevenhangzhou = 0x3027;
  15064. t.sevenideographicparen = 0x3226;
  15065. t.seveninferior = 0x2087;
  15066. t.sevenmonospace = 0xff17;
  15067. t.sevenoldstyle = 0xf737;
  15068. t.sevenparen = 0x247a;
  15069. t.sevenperiod = 0x248e;
  15070. t.sevenpersian = 0x06f7;
  15071. t.sevenroman = 0x2176;
  15072. t.sevensuperior = 0x2077;
  15073. t.seventeencircle = 0x2470;
  15074. t.seventeenparen = 0x2484;
  15075. t.seventeenperiod = 0x2498;
  15076. t.seventhai = 0x0e57;
  15077. t.sfthyphen = 0x00ad;
  15078. t.shaarmenian = 0x0577;
  15079. t.shabengali = 0x09b6;
  15080. t.shacyrillic = 0x0448;
  15081. t.shaddaarabic = 0x0651;
  15082. t.shaddadammaarabic = 0xfc61;
  15083. t.shaddadammatanarabic = 0xfc5e;
  15084. t.shaddafathaarabic = 0xfc60;
  15085. t.shaddakasraarabic = 0xfc62;
  15086. t.shaddakasratanarabic = 0xfc5f;
  15087. t.shade = 0x2592;
  15088. t.shadedark = 0x2593;
  15089. t.shadelight = 0x2591;
  15090. t.shademedium = 0x2592;
  15091. t.shadeva = 0x0936;
  15092. t.shagujarati = 0x0ab6;
  15093. t.shagurmukhi = 0x0a36;
  15094. t.shalshelethebrew = 0x0593;
  15095. t.shbopomofo = 0x3115;
  15096. t.shchacyrillic = 0x0449;
  15097. t.sheenarabic = 0x0634;
  15098. t.sheenfinalarabic = 0xfeb6;
  15099. t.sheeninitialarabic = 0xfeb7;
  15100. t.sheenmedialarabic = 0xfeb8;
  15101. t.sheicoptic = 0x03e3;
  15102. t.sheqel = 0x20aa;
  15103. t.sheqelhebrew = 0x20aa;
  15104. t.sheva = 0x05b0;
  15105. t.sheva115 = 0x05b0;
  15106. t.sheva15 = 0x05b0;
  15107. t.sheva22 = 0x05b0;
  15108. t.sheva2e = 0x05b0;
  15109. t.shevahebrew = 0x05b0;
  15110. t.shevanarrowhebrew = 0x05b0;
  15111. t.shevaquarterhebrew = 0x05b0;
  15112. t.shevawidehebrew = 0x05b0;
  15113. t.shhacyrillic = 0x04bb;
  15114. t.shimacoptic = 0x03ed;
  15115. t.shin = 0x05e9;
  15116. t.shindagesh = 0xfb49;
  15117. t.shindageshhebrew = 0xfb49;
  15118. t.shindageshshindot = 0xfb2c;
  15119. t.shindageshshindothebrew = 0xfb2c;
  15120. t.shindageshsindot = 0xfb2d;
  15121. t.shindageshsindothebrew = 0xfb2d;
  15122. t.shindothebrew = 0x05c1;
  15123. t.shinhebrew = 0x05e9;
  15124. t.shinshindot = 0xfb2a;
  15125. t.shinshindothebrew = 0xfb2a;
  15126. t.shinsindot = 0xfb2b;
  15127. t.shinsindothebrew = 0xfb2b;
  15128. t.shook = 0x0282;
  15129. t.sigma = 0x03c3;
  15130. t.sigma1 = 0x03c2;
  15131. t.sigmafinal = 0x03c2;
  15132. t.sigmalunatesymbolgreek = 0x03f2;
  15133. t.sihiragana = 0x3057;
  15134. t.sikatakana = 0x30b7;
  15135. t.sikatakanahalfwidth = 0xff7c;
  15136. t.siluqhebrew = 0x05bd;
  15137. t.siluqlefthebrew = 0x05bd;
  15138. t.similar = 0x223c;
  15139. t.sindothebrew = 0x05c2;
  15140. t.siosacirclekorean = 0x3274;
  15141. t.siosaparenkorean = 0x3214;
  15142. t.sioscieuckorean = 0x317e;
  15143. t.sioscirclekorean = 0x3266;
  15144. t.sioskiyeokkorean = 0x317a;
  15145. t.sioskorean = 0x3145;
  15146. t.siosnieunkorean = 0x317b;
  15147. t.siosparenkorean = 0x3206;
  15148. t.siospieupkorean = 0x317d;
  15149. t.siostikeutkorean = 0x317c;
  15150. t.six = 0x0036;
  15151. t.sixarabic = 0x0666;
  15152. t.sixbengali = 0x09ec;
  15153. t.sixcircle = 0x2465;
  15154. t.sixcircleinversesansserif = 0x278f;
  15155. t.sixdeva = 0x096c;
  15156. t.sixgujarati = 0x0aec;
  15157. t.sixgurmukhi = 0x0a6c;
  15158. t.sixhackarabic = 0x0666;
  15159. t.sixhangzhou = 0x3026;
  15160. t.sixideographicparen = 0x3225;
  15161. t.sixinferior = 0x2086;
  15162. t.sixmonospace = 0xff16;
  15163. t.sixoldstyle = 0xf736;
  15164. t.sixparen = 0x2479;
  15165. t.sixperiod = 0x248d;
  15166. t.sixpersian = 0x06f6;
  15167. t.sixroman = 0x2175;
  15168. t.sixsuperior = 0x2076;
  15169. t.sixteencircle = 0x246f;
  15170. t.sixteencurrencydenominatorbengali = 0x09f9;
  15171. t.sixteenparen = 0x2483;
  15172. t.sixteenperiod = 0x2497;
  15173. t.sixthai = 0x0e56;
  15174. t.slash = 0x002f;
  15175. t.slashmonospace = 0xff0f;
  15176. t.slong = 0x017f;
  15177. t.slongdotaccent = 0x1e9b;
  15178. t.smileface = 0x263a;
  15179. t.smonospace = 0xff53;
  15180. t.sofpasuqhebrew = 0x05c3;
  15181. t.softhyphen = 0x00ad;
  15182. t.softsigncyrillic = 0x044c;
  15183. t.sohiragana = 0x305d;
  15184. t.sokatakana = 0x30bd;
  15185. t.sokatakanahalfwidth = 0xff7f;
  15186. t.soliduslongoverlaycmb = 0x0338;
  15187. t.solidusshortoverlaycmb = 0x0337;
  15188. t.sorusithai = 0x0e29;
  15189. t.sosalathai = 0x0e28;
  15190. t.sosothai = 0x0e0b;
  15191. t.sosuathai = 0x0e2a;
  15192. t.space = 0x0020;
  15193. t.spacehackarabic = 0x0020;
  15194. t.spade = 0x2660;
  15195. t.spadesuitblack = 0x2660;
  15196. t.spadesuitwhite = 0x2664;
  15197. t.sparen = 0x24ae;
  15198. t.squarebelowcmb = 0x033b;
  15199. t.squarecc = 0x33c4;
  15200. t.squarecm = 0x339d;
  15201. t.squarediagonalcrosshatchfill = 0x25a9;
  15202. t.squarehorizontalfill = 0x25a4;
  15203. t.squarekg = 0x338f;
  15204. t.squarekm = 0x339e;
  15205. t.squarekmcapital = 0x33ce;
  15206. t.squareln = 0x33d1;
  15207. t.squarelog = 0x33d2;
  15208. t.squaremg = 0x338e;
  15209. t.squaremil = 0x33d5;
  15210. t.squaremm = 0x339c;
  15211. t.squaremsquared = 0x33a1;
  15212. t.squareorthogonalcrosshatchfill = 0x25a6;
  15213. t.squareupperlefttolowerrightfill = 0x25a7;
  15214. t.squareupperrighttolowerleftfill = 0x25a8;
  15215. t.squareverticalfill = 0x25a5;
  15216. t.squarewhitewithsmallblack = 0x25a3;
  15217. t.srsquare = 0x33db;
  15218. t.ssabengali = 0x09b7;
  15219. t.ssadeva = 0x0937;
  15220. t.ssagujarati = 0x0ab7;
  15221. t.ssangcieuckorean = 0x3149;
  15222. t.ssanghieuhkorean = 0x3185;
  15223. t.ssangieungkorean = 0x3180;
  15224. t.ssangkiyeokkorean = 0x3132;
  15225. t.ssangnieunkorean = 0x3165;
  15226. t.ssangpieupkorean = 0x3143;
  15227. t.ssangsioskorean = 0x3146;
  15228. t.ssangtikeutkorean = 0x3138;
  15229. t.ssuperior = 0xf6f2;
  15230. t.sterling = 0x00a3;
  15231. t.sterlingmonospace = 0xffe1;
  15232. t.strokelongoverlaycmb = 0x0336;
  15233. t.strokeshortoverlaycmb = 0x0335;
  15234. t.subset = 0x2282;
  15235. t.subsetnotequal = 0x228a;
  15236. t.subsetorequal = 0x2286;
  15237. t.succeeds = 0x227b;
  15238. t.suchthat = 0x220b;
  15239. t.suhiragana = 0x3059;
  15240. t.sukatakana = 0x30b9;
  15241. t.sukatakanahalfwidth = 0xff7d;
  15242. t.sukunarabic = 0x0652;
  15243. t.summation = 0x2211;
  15244. t.sun = 0x263c;
  15245. t.superset = 0x2283;
  15246. t.supersetnotequal = 0x228b;
  15247. t.supersetorequal = 0x2287;
  15248. t.svsquare = 0x33dc;
  15249. t.syouwaerasquare = 0x337c;
  15250. t.t = 0x0074;
  15251. t.tabengali = 0x09a4;
  15252. t.tackdown = 0x22a4;
  15253. t.tackleft = 0x22a3;
  15254. t.tadeva = 0x0924;
  15255. t.tagujarati = 0x0aa4;
  15256. t.tagurmukhi = 0x0a24;
  15257. t.taharabic = 0x0637;
  15258. t.tahfinalarabic = 0xfec2;
  15259. t.tahinitialarabic = 0xfec3;
  15260. t.tahiragana = 0x305f;
  15261. t.tahmedialarabic = 0xfec4;
  15262. t.taisyouerasquare = 0x337d;
  15263. t.takatakana = 0x30bf;
  15264. t.takatakanahalfwidth = 0xff80;
  15265. t.tatweelarabic = 0x0640;
  15266. t.tau = 0x03c4;
  15267. t.tav = 0x05ea;
  15268. t.tavdages = 0xfb4a;
  15269. t.tavdagesh = 0xfb4a;
  15270. t.tavdageshhebrew = 0xfb4a;
  15271. t.tavhebrew = 0x05ea;
  15272. t.tbar = 0x0167;
  15273. t.tbopomofo = 0x310a;
  15274. t.tcaron = 0x0165;
  15275. t.tccurl = 0x02a8;
  15276. t.tcedilla = 0x0163;
  15277. t.tcheharabic = 0x0686;
  15278. t.tchehfinalarabic = 0xfb7b;
  15279. t.tchehinitialarabic = 0xfb7c;
  15280. t.tchehmedialarabic = 0xfb7d;
  15281. t.tcircle = 0x24e3;
  15282. t.tcircumflexbelow = 0x1e71;
  15283. t.tcommaaccent = 0x0163;
  15284. t.tdieresis = 0x1e97;
  15285. t.tdotaccent = 0x1e6b;
  15286. t.tdotbelow = 0x1e6d;
  15287. t.tecyrillic = 0x0442;
  15288. t.tedescendercyrillic = 0x04ad;
  15289. t.teharabic = 0x062a;
  15290. t.tehfinalarabic = 0xfe96;
  15291. t.tehhahinitialarabic = 0xfca2;
  15292. t.tehhahisolatedarabic = 0xfc0c;
  15293. t.tehinitialarabic = 0xfe97;
  15294. t.tehiragana = 0x3066;
  15295. t.tehjeeminitialarabic = 0xfca1;
  15296. t.tehjeemisolatedarabic = 0xfc0b;
  15297. t.tehmarbutaarabic = 0x0629;
  15298. t.tehmarbutafinalarabic = 0xfe94;
  15299. t.tehmedialarabic = 0xfe98;
  15300. t.tehmeeminitialarabic = 0xfca4;
  15301. t.tehmeemisolatedarabic = 0xfc0e;
  15302. t.tehnoonfinalarabic = 0xfc73;
  15303. t.tekatakana = 0x30c6;
  15304. t.tekatakanahalfwidth = 0xff83;
  15305. t.telephone = 0x2121;
  15306. t.telephoneblack = 0x260e;
  15307. t.telishagedolahebrew = 0x05a0;
  15308. t.telishaqetanahebrew = 0x05a9;
  15309. t.tencircle = 0x2469;
  15310. t.tenideographicparen = 0x3229;
  15311. t.tenparen = 0x247d;
  15312. t.tenperiod = 0x2491;
  15313. t.tenroman = 0x2179;
  15314. t.tesh = 0x02a7;
  15315. t.tet = 0x05d8;
  15316. t.tetdagesh = 0xfb38;
  15317. t.tetdageshhebrew = 0xfb38;
  15318. t.tethebrew = 0x05d8;
  15319. t.tetsecyrillic = 0x04b5;
  15320. t.tevirhebrew = 0x059b;
  15321. t.tevirlefthebrew = 0x059b;
  15322. t.thabengali = 0x09a5;
  15323. t.thadeva = 0x0925;
  15324. t.thagujarati = 0x0aa5;
  15325. t.thagurmukhi = 0x0a25;
  15326. t.thalarabic = 0x0630;
  15327. t.thalfinalarabic = 0xfeac;
  15328. t.thanthakhatlowleftthai = 0xf898;
  15329. t.thanthakhatlowrightthai = 0xf897;
  15330. t.thanthakhatthai = 0x0e4c;
  15331. t.thanthakhatupperleftthai = 0xf896;
  15332. t.theharabic = 0x062b;
  15333. t.thehfinalarabic = 0xfe9a;
  15334. t.thehinitialarabic = 0xfe9b;
  15335. t.thehmedialarabic = 0xfe9c;
  15336. t.thereexists = 0x2203;
  15337. t.therefore = 0x2234;
  15338. t.theta = 0x03b8;
  15339. t.theta1 = 0x03d1;
  15340. t.thetasymbolgreek = 0x03d1;
  15341. t.thieuthacirclekorean = 0x3279;
  15342. t.thieuthaparenkorean = 0x3219;
  15343. t.thieuthcirclekorean = 0x326b;
  15344. t.thieuthkorean = 0x314c;
  15345. t.thieuthparenkorean = 0x320b;
  15346. t.thirteencircle = 0x246c;
  15347. t.thirteenparen = 0x2480;
  15348. t.thirteenperiod = 0x2494;
  15349. t.thonangmonthothai = 0x0e11;
  15350. t.thook = 0x01ad;
  15351. t.thophuthaothai = 0x0e12;
  15352. t.thorn = 0x00fe;
  15353. t.thothahanthai = 0x0e17;
  15354. t.thothanthai = 0x0e10;
  15355. t.thothongthai = 0x0e18;
  15356. t.thothungthai = 0x0e16;
  15357. t.thousandcyrillic = 0x0482;
  15358. t.thousandsseparatorarabic = 0x066c;
  15359. t.thousandsseparatorpersian = 0x066c;
  15360. t.three = 0x0033;
  15361. t.threearabic = 0x0663;
  15362. t.threebengali = 0x09e9;
  15363. t.threecircle = 0x2462;
  15364. t.threecircleinversesansserif = 0x278c;
  15365. t.threedeva = 0x0969;
  15366. t.threeeighths = 0x215c;
  15367. t.threegujarati = 0x0ae9;
  15368. t.threegurmukhi = 0x0a69;
  15369. t.threehackarabic = 0x0663;
  15370. t.threehangzhou = 0x3023;
  15371. t.threeideographicparen = 0x3222;
  15372. t.threeinferior = 0x2083;
  15373. t.threemonospace = 0xff13;
  15374. t.threenumeratorbengali = 0x09f6;
  15375. t.threeoldstyle = 0xf733;
  15376. t.threeparen = 0x2476;
  15377. t.threeperiod = 0x248a;
  15378. t.threepersian = 0x06f3;
  15379. t.threequarters = 0x00be;
  15380. t.threequartersemdash = 0xf6de;
  15381. t.threeroman = 0x2172;
  15382. t.threesuperior = 0x00b3;
  15383. t.threethai = 0x0e53;
  15384. t.thzsquare = 0x3394;
  15385. t.tihiragana = 0x3061;
  15386. t.tikatakana = 0x30c1;
  15387. t.tikatakanahalfwidth = 0xff81;
  15388. t.tikeutacirclekorean = 0x3270;
  15389. t.tikeutaparenkorean = 0x3210;
  15390. t.tikeutcirclekorean = 0x3262;
  15391. t.tikeutkorean = 0x3137;
  15392. t.tikeutparenkorean = 0x3202;
  15393. t.tilde = 0x02dc;
  15394. t.tildebelowcmb = 0x0330;
  15395. t.tildecmb = 0x0303;
  15396. t.tildecomb = 0x0303;
  15397. t.tildedoublecmb = 0x0360;
  15398. t.tildeoperator = 0x223c;
  15399. t.tildeoverlaycmb = 0x0334;
  15400. t.tildeverticalcmb = 0x033e;
  15401. t.timescircle = 0x2297;
  15402. t.tipehahebrew = 0x0596;
  15403. t.tipehalefthebrew = 0x0596;
  15404. t.tippigurmukhi = 0x0a70;
  15405. t.titlocyrilliccmb = 0x0483;
  15406. t.tiwnarmenian = 0x057f;
  15407. t.tlinebelow = 0x1e6f;
  15408. t.tmonospace = 0xff54;
  15409. t.toarmenian = 0x0569;
  15410. t.tohiragana = 0x3068;
  15411. t.tokatakana = 0x30c8;
  15412. t.tokatakanahalfwidth = 0xff84;
  15413. t.tonebarextrahighmod = 0x02e5;
  15414. t.tonebarextralowmod = 0x02e9;
  15415. t.tonebarhighmod = 0x02e6;
  15416. t.tonebarlowmod = 0x02e8;
  15417. t.tonebarmidmod = 0x02e7;
  15418. t.tonefive = 0x01bd;
  15419. t.tonesix = 0x0185;
  15420. t.tonetwo = 0x01a8;
  15421. t.tonos = 0x0384;
  15422. t.tonsquare = 0x3327;
  15423. t.topatakthai = 0x0e0f;
  15424. t.tortoiseshellbracketleft = 0x3014;
  15425. t.tortoiseshellbracketleftsmall = 0xfe5d;
  15426. t.tortoiseshellbracketleftvertical = 0xfe39;
  15427. t.tortoiseshellbracketright = 0x3015;
  15428. t.tortoiseshellbracketrightsmall = 0xfe5e;
  15429. t.tortoiseshellbracketrightvertical = 0xfe3a;
  15430. t.totaothai = 0x0e15;
  15431. t.tpalatalhook = 0x01ab;
  15432. t.tparen = 0x24af;
  15433. t.trademark = 0x2122;
  15434. t.trademarksans = 0xf8ea;
  15435. t.trademarkserif = 0xf6db;
  15436. t.tretroflexhook = 0x0288;
  15437. t.triagdn = 0x25bc;
  15438. t.triaglf = 0x25c4;
  15439. t.triagrt = 0x25ba;
  15440. t.triagup = 0x25b2;
  15441. t.ts = 0x02a6;
  15442. t.tsadi = 0x05e6;
  15443. t.tsadidagesh = 0xfb46;
  15444. t.tsadidageshhebrew = 0xfb46;
  15445. t.tsadihebrew = 0x05e6;
  15446. t.tsecyrillic = 0x0446;
  15447. t.tsere = 0x05b5;
  15448. t.tsere12 = 0x05b5;
  15449. t.tsere1e = 0x05b5;
  15450. t.tsere2b = 0x05b5;
  15451. t.tserehebrew = 0x05b5;
  15452. t.tserenarrowhebrew = 0x05b5;
  15453. t.tserequarterhebrew = 0x05b5;
  15454. t.tserewidehebrew = 0x05b5;
  15455. t.tshecyrillic = 0x045b;
  15456. t.tsuperior = 0xf6f3;
  15457. t.ttabengali = 0x099f;
  15458. t.ttadeva = 0x091f;
  15459. t.ttagujarati = 0x0a9f;
  15460. t.ttagurmukhi = 0x0a1f;
  15461. t.tteharabic = 0x0679;
  15462. t.ttehfinalarabic = 0xfb67;
  15463. t.ttehinitialarabic = 0xfb68;
  15464. t.ttehmedialarabic = 0xfb69;
  15465. t.tthabengali = 0x09a0;
  15466. t.tthadeva = 0x0920;
  15467. t.tthagujarati = 0x0aa0;
  15468. t.tthagurmukhi = 0x0a20;
  15469. t.tturned = 0x0287;
  15470. t.tuhiragana = 0x3064;
  15471. t.tukatakana = 0x30c4;
  15472. t.tukatakanahalfwidth = 0xff82;
  15473. t.tusmallhiragana = 0x3063;
  15474. t.tusmallkatakana = 0x30c3;
  15475. t.tusmallkatakanahalfwidth = 0xff6f;
  15476. t.twelvecircle = 0x246b;
  15477. t.twelveparen = 0x247f;
  15478. t.twelveperiod = 0x2493;
  15479. t.twelveroman = 0x217b;
  15480. t.twentycircle = 0x2473;
  15481. t.twentyhangzhou = 0x5344;
  15482. t.twentyparen = 0x2487;
  15483. t.twentyperiod = 0x249b;
  15484. t.two = 0x0032;
  15485. t.twoarabic = 0x0662;
  15486. t.twobengali = 0x09e8;
  15487. t.twocircle = 0x2461;
  15488. t.twocircleinversesansserif = 0x278b;
  15489. t.twodeva = 0x0968;
  15490. t.twodotenleader = 0x2025;
  15491. t.twodotleader = 0x2025;
  15492. t.twodotleadervertical = 0xfe30;
  15493. t.twogujarati = 0x0ae8;
  15494. t.twogurmukhi = 0x0a68;
  15495. t.twohackarabic = 0x0662;
  15496. t.twohangzhou = 0x3022;
  15497. t.twoideographicparen = 0x3221;
  15498. t.twoinferior = 0x2082;
  15499. t.twomonospace = 0xff12;
  15500. t.twonumeratorbengali = 0x09f5;
  15501. t.twooldstyle = 0xf732;
  15502. t.twoparen = 0x2475;
  15503. t.twoperiod = 0x2489;
  15504. t.twopersian = 0x06f2;
  15505. t.tworoman = 0x2171;
  15506. t.twostroke = 0x01bb;
  15507. t.twosuperior = 0x00b2;
  15508. t.twothai = 0x0e52;
  15509. t.twothirds = 0x2154;
  15510. t.u = 0x0075;
  15511. t.uacute = 0x00fa;
  15512. t.ubar = 0x0289;
  15513. t.ubengali = 0x0989;
  15514. t.ubopomofo = 0x3128;
  15515. t.ubreve = 0x016d;
  15516. t.ucaron = 0x01d4;
  15517. t.ucircle = 0x24e4;
  15518. t.ucircumflex = 0x00fb;
  15519. t.ucircumflexbelow = 0x1e77;
  15520. t.ucyrillic = 0x0443;
  15521. t.udattadeva = 0x0951;
  15522. t.udblacute = 0x0171;
  15523. t.udblgrave = 0x0215;
  15524. t.udeva = 0x0909;
  15525. t.udieresis = 0x00fc;
  15526. t.udieresisacute = 0x01d8;
  15527. t.udieresisbelow = 0x1e73;
  15528. t.udieresiscaron = 0x01da;
  15529. t.udieresiscyrillic = 0x04f1;
  15530. t.udieresisgrave = 0x01dc;
  15531. t.udieresismacron = 0x01d6;
  15532. t.udotbelow = 0x1ee5;
  15533. t.ugrave = 0x00f9;
  15534. t.ugujarati = 0x0a89;
  15535. t.ugurmukhi = 0x0a09;
  15536. t.uhiragana = 0x3046;
  15537. t.uhookabove = 0x1ee7;
  15538. t.uhorn = 0x01b0;
  15539. t.uhornacute = 0x1ee9;
  15540. t.uhorndotbelow = 0x1ef1;
  15541. t.uhorngrave = 0x1eeb;
  15542. t.uhornhookabove = 0x1eed;
  15543. t.uhorntilde = 0x1eef;
  15544. t.uhungarumlaut = 0x0171;
  15545. t.uhungarumlautcyrillic = 0x04f3;
  15546. t.uinvertedbreve = 0x0217;
  15547. t.ukatakana = 0x30a6;
  15548. t.ukatakanahalfwidth = 0xff73;
  15549. t.ukcyrillic = 0x0479;
  15550. t.ukorean = 0x315c;
  15551. t.umacron = 0x016b;
  15552. t.umacroncyrillic = 0x04ef;
  15553. t.umacrondieresis = 0x1e7b;
  15554. t.umatragurmukhi = 0x0a41;
  15555. t.umonospace = 0xff55;
  15556. t.underscore = 0x005f;
  15557. t.underscoredbl = 0x2017;
  15558. t.underscoremonospace = 0xff3f;
  15559. t.underscorevertical = 0xfe33;
  15560. t.underscorewavy = 0xfe4f;
  15561. t.union = 0x222a;
  15562. t.universal = 0x2200;
  15563. t.uogonek = 0x0173;
  15564. t.uparen = 0x24b0;
  15565. t.upblock = 0x2580;
  15566. t.upperdothebrew = 0x05c4;
  15567. t.upsilon = 0x03c5;
  15568. t.upsilondieresis = 0x03cb;
  15569. t.upsilondieresistonos = 0x03b0;
  15570. t.upsilonlatin = 0x028a;
  15571. t.upsilontonos = 0x03cd;
  15572. t.uptackbelowcmb = 0x031d;
  15573. t.uptackmod = 0x02d4;
  15574. t.uragurmukhi = 0x0a73;
  15575. t.uring = 0x016f;
  15576. t.ushortcyrillic = 0x045e;
  15577. t.usmallhiragana = 0x3045;
  15578. t.usmallkatakana = 0x30a5;
  15579. t.usmallkatakanahalfwidth = 0xff69;
  15580. t.ustraightcyrillic = 0x04af;
  15581. t.ustraightstrokecyrillic = 0x04b1;
  15582. t.utilde = 0x0169;
  15583. t.utildeacute = 0x1e79;
  15584. t.utildebelow = 0x1e75;
  15585. t.uubengali = 0x098a;
  15586. t.uudeva = 0x090a;
  15587. t.uugujarati = 0x0a8a;
  15588. t.uugurmukhi = 0x0a0a;
  15589. t.uumatragurmukhi = 0x0a42;
  15590. t.uuvowelsignbengali = 0x09c2;
  15591. t.uuvowelsigndeva = 0x0942;
  15592. t.uuvowelsigngujarati = 0x0ac2;
  15593. t.uvowelsignbengali = 0x09c1;
  15594. t.uvowelsigndeva = 0x0941;
  15595. t.uvowelsigngujarati = 0x0ac1;
  15596. t.v = 0x0076;
  15597. t.vadeva = 0x0935;
  15598. t.vagujarati = 0x0ab5;
  15599. t.vagurmukhi = 0x0a35;
  15600. t.vakatakana = 0x30f7;
  15601. t.vav = 0x05d5;
  15602. t.vavdagesh = 0xfb35;
  15603. t.vavdagesh65 = 0xfb35;
  15604. t.vavdageshhebrew = 0xfb35;
  15605. t.vavhebrew = 0x05d5;
  15606. t.vavholam = 0xfb4b;
  15607. t.vavholamhebrew = 0xfb4b;
  15608. t.vavvavhebrew = 0x05f0;
  15609. t.vavyodhebrew = 0x05f1;
  15610. t.vcircle = 0x24e5;
  15611. t.vdotbelow = 0x1e7f;
  15612. t.vecyrillic = 0x0432;
  15613. t.veharabic = 0x06a4;
  15614. t.vehfinalarabic = 0xfb6b;
  15615. t.vehinitialarabic = 0xfb6c;
  15616. t.vehmedialarabic = 0xfb6d;
  15617. t.vekatakana = 0x30f9;
  15618. t.venus = 0x2640;
  15619. t.verticalbar = 0x007c;
  15620. t.verticallineabovecmb = 0x030d;
  15621. t.verticallinebelowcmb = 0x0329;
  15622. t.verticallinelowmod = 0x02cc;
  15623. t.verticallinemod = 0x02c8;
  15624. t.vewarmenian = 0x057e;
  15625. t.vhook = 0x028b;
  15626. t.vikatakana = 0x30f8;
  15627. t.viramabengali = 0x09cd;
  15628. t.viramadeva = 0x094d;
  15629. t.viramagujarati = 0x0acd;
  15630. t.visargabengali = 0x0983;
  15631. t.visargadeva = 0x0903;
  15632. t.visargagujarati = 0x0a83;
  15633. t.vmonospace = 0xff56;
  15634. t.voarmenian = 0x0578;
  15635. t.voicediterationhiragana = 0x309e;
  15636. t.voicediterationkatakana = 0x30fe;
  15637. t.voicedmarkkana = 0x309b;
  15638. t.voicedmarkkanahalfwidth = 0xff9e;
  15639. t.vokatakana = 0x30fa;
  15640. t.vparen = 0x24b1;
  15641. t.vtilde = 0x1e7d;
  15642. t.vturned = 0x028c;
  15643. t.vuhiragana = 0x3094;
  15644. t.vukatakana = 0x30f4;
  15645. t.w = 0x0077;
  15646. t.wacute = 0x1e83;
  15647. t.waekorean = 0x3159;
  15648. t.wahiragana = 0x308f;
  15649. t.wakatakana = 0x30ef;
  15650. t.wakatakanahalfwidth = 0xff9c;
  15651. t.wakorean = 0x3158;
  15652. t.wasmallhiragana = 0x308e;
  15653. t.wasmallkatakana = 0x30ee;
  15654. t.wattosquare = 0x3357;
  15655. t.wavedash = 0x301c;
  15656. t.wavyunderscorevertical = 0xfe34;
  15657. t.wawarabic = 0x0648;
  15658. t.wawfinalarabic = 0xfeee;
  15659. t.wawhamzaabovearabic = 0x0624;
  15660. t.wawhamzaabovefinalarabic = 0xfe86;
  15661. t.wbsquare = 0x33dd;
  15662. t.wcircle = 0x24e6;
  15663. t.wcircumflex = 0x0175;
  15664. t.wdieresis = 0x1e85;
  15665. t.wdotaccent = 0x1e87;
  15666. t.wdotbelow = 0x1e89;
  15667. t.wehiragana = 0x3091;
  15668. t.weierstrass = 0x2118;
  15669. t.wekatakana = 0x30f1;
  15670. t.wekorean = 0x315e;
  15671. t.weokorean = 0x315d;
  15672. t.wgrave = 0x1e81;
  15673. t.whitebullet = 0x25e6;
  15674. t.whitecircle = 0x25cb;
  15675. t.whitecircleinverse = 0x25d9;
  15676. t.whitecornerbracketleft = 0x300e;
  15677. t.whitecornerbracketleftvertical = 0xfe43;
  15678. t.whitecornerbracketright = 0x300f;
  15679. t.whitecornerbracketrightvertical = 0xfe44;
  15680. t.whitediamond = 0x25c7;
  15681. t.whitediamondcontainingblacksmalldiamond = 0x25c8;
  15682. t.whitedownpointingsmalltriangle = 0x25bf;
  15683. t.whitedownpointingtriangle = 0x25bd;
  15684. t.whiteleftpointingsmalltriangle = 0x25c3;
  15685. t.whiteleftpointingtriangle = 0x25c1;
  15686. t.whitelenticularbracketleft = 0x3016;
  15687. t.whitelenticularbracketright = 0x3017;
  15688. t.whiterightpointingsmalltriangle = 0x25b9;
  15689. t.whiterightpointingtriangle = 0x25b7;
  15690. t.whitesmallsquare = 0x25ab;
  15691. t.whitesmilingface = 0x263a;
  15692. t.whitesquare = 0x25a1;
  15693. t.whitestar = 0x2606;
  15694. t.whitetelephone = 0x260f;
  15695. t.whitetortoiseshellbracketleft = 0x3018;
  15696. t.whitetortoiseshellbracketright = 0x3019;
  15697. t.whiteuppointingsmalltriangle = 0x25b5;
  15698. t.whiteuppointingtriangle = 0x25b3;
  15699. t.wihiragana = 0x3090;
  15700. t.wikatakana = 0x30f0;
  15701. t.wikorean = 0x315f;
  15702. t.wmonospace = 0xff57;
  15703. t.wohiragana = 0x3092;
  15704. t.wokatakana = 0x30f2;
  15705. t.wokatakanahalfwidth = 0xff66;
  15706. t.won = 0x20a9;
  15707. t.wonmonospace = 0xffe6;
  15708. t.wowaenthai = 0x0e27;
  15709. t.wparen = 0x24b2;
  15710. t.wring = 0x1e98;
  15711. t.wsuperior = 0x02b7;
  15712. t.wturned = 0x028d;
  15713. t.wynn = 0x01bf;
  15714. t.x = 0x0078;
  15715. t.xabovecmb = 0x033d;
  15716. t.xbopomofo = 0x3112;
  15717. t.xcircle = 0x24e7;
  15718. t.xdieresis = 0x1e8d;
  15719. t.xdotaccent = 0x1e8b;
  15720. t.xeharmenian = 0x056d;
  15721. t.xi = 0x03be;
  15722. t.xmonospace = 0xff58;
  15723. t.xparen = 0x24b3;
  15724. t.xsuperior = 0x02e3;
  15725. t.y = 0x0079;
  15726. t.yaadosquare = 0x334e;
  15727. t.yabengali = 0x09af;
  15728. t.yacute = 0x00fd;
  15729. t.yadeva = 0x092f;
  15730. t.yaekorean = 0x3152;
  15731. t.yagujarati = 0x0aaf;
  15732. t.yagurmukhi = 0x0a2f;
  15733. t.yahiragana = 0x3084;
  15734. t.yakatakana = 0x30e4;
  15735. t.yakatakanahalfwidth = 0xff94;
  15736. t.yakorean = 0x3151;
  15737. t.yamakkanthai = 0x0e4e;
  15738. t.yasmallhiragana = 0x3083;
  15739. t.yasmallkatakana = 0x30e3;
  15740. t.yasmallkatakanahalfwidth = 0xff6c;
  15741. t.yatcyrillic = 0x0463;
  15742. t.ycircle = 0x24e8;
  15743. t.ycircumflex = 0x0177;
  15744. t.ydieresis = 0x00ff;
  15745. t.ydotaccent = 0x1e8f;
  15746. t.ydotbelow = 0x1ef5;
  15747. t.yeharabic = 0x064a;
  15748. t.yehbarreearabic = 0x06d2;
  15749. t.yehbarreefinalarabic = 0xfbaf;
  15750. t.yehfinalarabic = 0xfef2;
  15751. t.yehhamzaabovearabic = 0x0626;
  15752. t.yehhamzaabovefinalarabic = 0xfe8a;
  15753. t.yehhamzaaboveinitialarabic = 0xfe8b;
  15754. t.yehhamzaabovemedialarabic = 0xfe8c;
  15755. t.yehinitialarabic = 0xfef3;
  15756. t.yehmedialarabic = 0xfef4;
  15757. t.yehmeeminitialarabic = 0xfcdd;
  15758. t.yehmeemisolatedarabic = 0xfc58;
  15759. t.yehnoonfinalarabic = 0xfc94;
  15760. t.yehthreedotsbelowarabic = 0x06d1;
  15761. t.yekorean = 0x3156;
  15762. t.yen = 0x00a5;
  15763. t.yenmonospace = 0xffe5;
  15764. t.yeokorean = 0x3155;
  15765. t.yeorinhieuhkorean = 0x3186;
  15766. t.yerahbenyomohebrew = 0x05aa;
  15767. t.yerahbenyomolefthebrew = 0x05aa;
  15768. t.yericyrillic = 0x044b;
  15769. t.yerudieresiscyrillic = 0x04f9;
  15770. t.yesieungkorean = 0x3181;
  15771. t.yesieungpansioskorean = 0x3183;
  15772. t.yesieungsioskorean = 0x3182;
  15773. t.yetivhebrew = 0x059a;
  15774. t.ygrave = 0x1ef3;
  15775. t.yhook = 0x01b4;
  15776. t.yhookabove = 0x1ef7;
  15777. t.yiarmenian = 0x0575;
  15778. t.yicyrillic = 0x0457;
  15779. t.yikorean = 0x3162;
  15780. t.yinyang = 0x262f;
  15781. t.yiwnarmenian = 0x0582;
  15782. t.ymonospace = 0xff59;
  15783. t.yod = 0x05d9;
  15784. t.yoddagesh = 0xfb39;
  15785. t.yoddageshhebrew = 0xfb39;
  15786. t.yodhebrew = 0x05d9;
  15787. t.yodyodhebrew = 0x05f2;
  15788. t.yodyodpatahhebrew = 0xfb1f;
  15789. t.yohiragana = 0x3088;
  15790. t.yoikorean = 0x3189;
  15791. t.yokatakana = 0x30e8;
  15792. t.yokatakanahalfwidth = 0xff96;
  15793. t.yokorean = 0x315b;
  15794. t.yosmallhiragana = 0x3087;
  15795. t.yosmallkatakana = 0x30e7;
  15796. t.yosmallkatakanahalfwidth = 0xff6e;
  15797. t.yotgreek = 0x03f3;
  15798. t.yoyaekorean = 0x3188;
  15799. t.yoyakorean = 0x3187;
  15800. t.yoyakthai = 0x0e22;
  15801. t.yoyingthai = 0x0e0d;
  15802. t.yparen = 0x24b4;
  15803. t.ypogegrammeni = 0x037a;
  15804. t.ypogegrammenigreekcmb = 0x0345;
  15805. t.yr = 0x01a6;
  15806. t.yring = 0x1e99;
  15807. t.ysuperior = 0x02b8;
  15808. t.ytilde = 0x1ef9;
  15809. t.yturned = 0x028e;
  15810. t.yuhiragana = 0x3086;
  15811. t.yuikorean = 0x318c;
  15812. t.yukatakana = 0x30e6;
  15813. t.yukatakanahalfwidth = 0xff95;
  15814. t.yukorean = 0x3160;
  15815. t.yusbigcyrillic = 0x046b;
  15816. t.yusbigiotifiedcyrillic = 0x046d;
  15817. t.yuslittlecyrillic = 0x0467;
  15818. t.yuslittleiotifiedcyrillic = 0x0469;
  15819. t.yusmallhiragana = 0x3085;
  15820. t.yusmallkatakana = 0x30e5;
  15821. t.yusmallkatakanahalfwidth = 0xff6d;
  15822. t.yuyekorean = 0x318b;
  15823. t.yuyeokorean = 0x318a;
  15824. t.yyabengali = 0x09df;
  15825. t.yyadeva = 0x095f;
  15826. t.z = 0x007a;
  15827. t.zaarmenian = 0x0566;
  15828. t.zacute = 0x017a;
  15829. t.zadeva = 0x095b;
  15830. t.zagurmukhi = 0x0a5b;
  15831. t.zaharabic = 0x0638;
  15832. t.zahfinalarabic = 0xfec6;
  15833. t.zahinitialarabic = 0xfec7;
  15834. t.zahiragana = 0x3056;
  15835. t.zahmedialarabic = 0xfec8;
  15836. t.zainarabic = 0x0632;
  15837. t.zainfinalarabic = 0xfeb0;
  15838. t.zakatakana = 0x30b6;
  15839. t.zaqefgadolhebrew = 0x0595;
  15840. t.zaqefqatanhebrew = 0x0594;
  15841. t.zarqahebrew = 0x0598;
  15842. t.zayin = 0x05d6;
  15843. t.zayindagesh = 0xfb36;
  15844. t.zayindageshhebrew = 0xfb36;
  15845. t.zayinhebrew = 0x05d6;
  15846. t.zbopomofo = 0x3117;
  15847. t.zcaron = 0x017e;
  15848. t.zcircle = 0x24e9;
  15849. t.zcircumflex = 0x1e91;
  15850. t.zcurl = 0x0291;
  15851. t.zdot = 0x017c;
  15852. t.zdotaccent = 0x017c;
  15853. t.zdotbelow = 0x1e93;
  15854. t.zecyrillic = 0x0437;
  15855. t.zedescendercyrillic = 0x0499;
  15856. t.zedieresiscyrillic = 0x04df;
  15857. t.zehiragana = 0x305c;
  15858. t.zekatakana = 0x30bc;
  15859. t.zero = 0x0030;
  15860. t.zeroarabic = 0x0660;
  15861. t.zerobengali = 0x09e6;
  15862. t.zerodeva = 0x0966;
  15863. t.zerogujarati = 0x0ae6;
  15864. t.zerogurmukhi = 0x0a66;
  15865. t.zerohackarabic = 0x0660;
  15866. t.zeroinferior = 0x2080;
  15867. t.zeromonospace = 0xff10;
  15868. t.zerooldstyle = 0xf730;
  15869. t.zeropersian = 0x06f0;
  15870. t.zerosuperior = 0x2070;
  15871. t.zerothai = 0x0e50;
  15872. t.zerowidthjoiner = 0xfeff;
  15873. t.zerowidthnonjoiner = 0x200c;
  15874. t.zerowidthspace = 0x200b;
  15875. t.zeta = 0x03b6;
  15876. t.zhbopomofo = 0x3113;
  15877. t.zhearmenian = 0x056a;
  15878. t.zhebrevecyrillic = 0x04c2;
  15879. t.zhecyrillic = 0x0436;
  15880. t.zhedescendercyrillic = 0x0497;
  15881. t.zhedieresiscyrillic = 0x04dd;
  15882. t.zihiragana = 0x3058;
  15883. t.zikatakana = 0x30b8;
  15884. t.zinorhebrew = 0x05ae;
  15885. t.zlinebelow = 0x1e95;
  15886. t.zmonospace = 0xff5a;
  15887. t.zohiragana = 0x305e;
  15888. t.zokatakana = 0x30be;
  15889. t.zparen = 0x24b5;
  15890. t.zretroflexhook = 0x0290;
  15891. t.zstroke = 0x01b6;
  15892. t.zuhiragana = 0x305a;
  15893. t.zukatakana = 0x30ba;
  15894. t[".notdef"] = 0x0000;
  15895. t.angbracketleftbig = 0x2329;
  15896. t.angbracketleftBig = 0x2329;
  15897. t.angbracketleftbigg = 0x2329;
  15898. t.angbracketleftBigg = 0x2329;
  15899. t.angbracketrightBig = 0x232a;
  15900. t.angbracketrightbig = 0x232a;
  15901. t.angbracketrightBigg = 0x232a;
  15902. t.angbracketrightbigg = 0x232a;
  15903. t.arrowhookleft = 0x21aa;
  15904. t.arrowhookright = 0x21a9;
  15905. t.arrowlefttophalf = 0x21bc;
  15906. t.arrowleftbothalf = 0x21bd;
  15907. t.arrownortheast = 0x2197;
  15908. t.arrownorthwest = 0x2196;
  15909. t.arrowrighttophalf = 0x21c0;
  15910. t.arrowrightbothalf = 0x21c1;
  15911. t.arrowsoutheast = 0x2198;
  15912. t.arrowsouthwest = 0x2199;
  15913. t.backslashbig = 0x2216;
  15914. t.backslashBig = 0x2216;
  15915. t.backslashBigg = 0x2216;
  15916. t.backslashbigg = 0x2216;
  15917. t.bardbl = 0x2016;
  15918. t.bracehtipdownleft = 0xfe37;
  15919. t.bracehtipdownright = 0xfe37;
  15920. t.bracehtipupleft = 0xfe38;
  15921. t.bracehtipupright = 0xfe38;
  15922. t.braceleftBig = 0x007b;
  15923. t.braceleftbig = 0x007b;
  15924. t.braceleftbigg = 0x007b;
  15925. t.braceleftBigg = 0x007b;
  15926. t.bracerightBig = 0x007d;
  15927. t.bracerightbig = 0x007d;
  15928. t.bracerightbigg = 0x007d;
  15929. t.bracerightBigg = 0x007d;
  15930. t.bracketleftbig = 0x005b;
  15931. t.bracketleftBig = 0x005b;
  15932. t.bracketleftbigg = 0x005b;
  15933. t.bracketleftBigg = 0x005b;
  15934. t.bracketrightBig = 0x005d;
  15935. t.bracketrightbig = 0x005d;
  15936. t.bracketrightbigg = 0x005d;
  15937. t.bracketrightBigg = 0x005d;
  15938. t.ceilingleftbig = 0x2308;
  15939. t.ceilingleftBig = 0x2308;
  15940. t.ceilingleftBigg = 0x2308;
  15941. t.ceilingleftbigg = 0x2308;
  15942. t.ceilingrightbig = 0x2309;
  15943. t.ceilingrightBig = 0x2309;
  15944. t.ceilingrightbigg = 0x2309;
  15945. t.ceilingrightBigg = 0x2309;
  15946. t.circledotdisplay = 0x2299;
  15947. t.circledottext = 0x2299;
  15948. t.circlemultiplydisplay = 0x2297;
  15949. t.circlemultiplytext = 0x2297;
  15950. t.circleplusdisplay = 0x2295;
  15951. t.circleplustext = 0x2295;
  15952. t.contintegraldisplay = 0x222e;
  15953. t.contintegraltext = 0x222e;
  15954. t.coproductdisplay = 0x2210;
  15955. t.coproducttext = 0x2210;
  15956. t.floorleftBig = 0x230a;
  15957. t.floorleftbig = 0x230a;
  15958. t.floorleftbigg = 0x230a;
  15959. t.floorleftBigg = 0x230a;
  15960. t.floorrightbig = 0x230b;
  15961. t.floorrightBig = 0x230b;
  15962. t.floorrightBigg = 0x230b;
  15963. t.floorrightbigg = 0x230b;
  15964. t.hatwide = 0x0302;
  15965. t.hatwider = 0x0302;
  15966. t.hatwidest = 0x0302;
  15967. t.intercal = 0x1d40;
  15968. t.integraldisplay = 0x222b;
  15969. t.integraltext = 0x222b;
  15970. t.intersectiondisplay = 0x22c2;
  15971. t.intersectiontext = 0x22c2;
  15972. t.logicalanddisplay = 0x2227;
  15973. t.logicalandtext = 0x2227;
  15974. t.logicalordisplay = 0x2228;
  15975. t.logicalortext = 0x2228;
  15976. t.parenleftBig = 0x0028;
  15977. t.parenleftbig = 0x0028;
  15978. t.parenleftBigg = 0x0028;
  15979. t.parenleftbigg = 0x0028;
  15980. t.parenrightBig = 0x0029;
  15981. t.parenrightbig = 0x0029;
  15982. t.parenrightBigg = 0x0029;
  15983. t.parenrightbigg = 0x0029;
  15984. t.prime = 0x2032;
  15985. t.productdisplay = 0x220f;
  15986. t.producttext = 0x220f;
  15987. t.radicalbig = 0x221a;
  15988. t.radicalBig = 0x221a;
  15989. t.radicalBigg = 0x221a;
  15990. t.radicalbigg = 0x221a;
  15991. t.radicalbt = 0x221a;
  15992. t.radicaltp = 0x221a;
  15993. t.radicalvertex = 0x221a;
  15994. t.slashbig = 0x002f;
  15995. t.slashBig = 0x002f;
  15996. t.slashBigg = 0x002f;
  15997. t.slashbigg = 0x002f;
  15998. t.summationdisplay = 0x2211;
  15999. t.summationtext = 0x2211;
  16000. t.tildewide = 0x02dc;
  16001. t.tildewider = 0x02dc;
  16002. t.tildewidest = 0x02dc;
  16003. t.uniondisplay = 0x22c3;
  16004. t.unionmultidisplay = 0x228e;
  16005. t.unionmultitext = 0x228e;
  16006. t.unionsqdisplay = 0x2294;
  16007. t.unionsqtext = 0x2294;
  16008. t.uniontext = 0x22c3;
  16009. t.vextenddouble = 0x2225;
  16010. t.vextendsingle = 0x2223;
  16011. });
  16012. const getDingbatsGlyphsUnicode = getLookupTableFactory(function (t) {
  16013. t.space = 0x0020;
  16014. t.a1 = 0x2701;
  16015. t.a2 = 0x2702;
  16016. t.a202 = 0x2703;
  16017. t.a3 = 0x2704;
  16018. t.a4 = 0x260e;
  16019. t.a5 = 0x2706;
  16020. t.a119 = 0x2707;
  16021. t.a118 = 0x2708;
  16022. t.a117 = 0x2709;
  16023. t.a11 = 0x261b;
  16024. t.a12 = 0x261e;
  16025. t.a13 = 0x270c;
  16026. t.a14 = 0x270d;
  16027. t.a15 = 0x270e;
  16028. t.a16 = 0x270f;
  16029. t.a105 = 0x2710;
  16030. t.a17 = 0x2711;
  16031. t.a18 = 0x2712;
  16032. t.a19 = 0x2713;
  16033. t.a20 = 0x2714;
  16034. t.a21 = 0x2715;
  16035. t.a22 = 0x2716;
  16036. t.a23 = 0x2717;
  16037. t.a24 = 0x2718;
  16038. t.a25 = 0x2719;
  16039. t.a26 = 0x271a;
  16040. t.a27 = 0x271b;
  16041. t.a28 = 0x271c;
  16042. t.a6 = 0x271d;
  16043. t.a7 = 0x271e;
  16044. t.a8 = 0x271f;
  16045. t.a9 = 0x2720;
  16046. t.a10 = 0x2721;
  16047. t.a29 = 0x2722;
  16048. t.a30 = 0x2723;
  16049. t.a31 = 0x2724;
  16050. t.a32 = 0x2725;
  16051. t.a33 = 0x2726;
  16052. t.a34 = 0x2727;
  16053. t.a35 = 0x2605;
  16054. t.a36 = 0x2729;
  16055. t.a37 = 0x272a;
  16056. t.a38 = 0x272b;
  16057. t.a39 = 0x272c;
  16058. t.a40 = 0x272d;
  16059. t.a41 = 0x272e;
  16060. t.a42 = 0x272f;
  16061. t.a43 = 0x2730;
  16062. t.a44 = 0x2731;
  16063. t.a45 = 0x2732;
  16064. t.a46 = 0x2733;
  16065. t.a47 = 0x2734;
  16066. t.a48 = 0x2735;
  16067. t.a49 = 0x2736;
  16068. t.a50 = 0x2737;
  16069. t.a51 = 0x2738;
  16070. t.a52 = 0x2739;
  16071. t.a53 = 0x273a;
  16072. t.a54 = 0x273b;
  16073. t.a55 = 0x273c;
  16074. t.a56 = 0x273d;
  16075. t.a57 = 0x273e;
  16076. t.a58 = 0x273f;
  16077. t.a59 = 0x2740;
  16078. t.a60 = 0x2741;
  16079. t.a61 = 0x2742;
  16080. t.a62 = 0x2743;
  16081. t.a63 = 0x2744;
  16082. t.a64 = 0x2745;
  16083. t.a65 = 0x2746;
  16084. t.a66 = 0x2747;
  16085. t.a67 = 0x2748;
  16086. t.a68 = 0x2749;
  16087. t.a69 = 0x274a;
  16088. t.a70 = 0x274b;
  16089. t.a71 = 0x25cf;
  16090. t.a72 = 0x274d;
  16091. t.a73 = 0x25a0;
  16092. t.a74 = 0x274f;
  16093. t.a203 = 0x2750;
  16094. t.a75 = 0x2751;
  16095. t.a204 = 0x2752;
  16096. t.a76 = 0x25b2;
  16097. t.a77 = 0x25bc;
  16098. t.a78 = 0x25c6;
  16099. t.a79 = 0x2756;
  16100. t.a81 = 0x25d7;
  16101. t.a82 = 0x2758;
  16102. t.a83 = 0x2759;
  16103. t.a84 = 0x275a;
  16104. t.a97 = 0x275b;
  16105. t.a98 = 0x275c;
  16106. t.a99 = 0x275d;
  16107. t.a100 = 0x275e;
  16108. t.a101 = 0x2761;
  16109. t.a102 = 0x2762;
  16110. t.a103 = 0x2763;
  16111. t.a104 = 0x2764;
  16112. t.a106 = 0x2765;
  16113. t.a107 = 0x2766;
  16114. t.a108 = 0x2767;
  16115. t.a112 = 0x2663;
  16116. t.a111 = 0x2666;
  16117. t.a110 = 0x2665;
  16118. t.a109 = 0x2660;
  16119. t.a120 = 0x2460;
  16120. t.a121 = 0x2461;
  16121. t.a122 = 0x2462;
  16122. t.a123 = 0x2463;
  16123. t.a124 = 0x2464;
  16124. t.a125 = 0x2465;
  16125. t.a126 = 0x2466;
  16126. t.a127 = 0x2467;
  16127. t.a128 = 0x2468;
  16128. t.a129 = 0x2469;
  16129. t.a130 = 0x2776;
  16130. t.a131 = 0x2777;
  16131. t.a132 = 0x2778;
  16132. t.a133 = 0x2779;
  16133. t.a134 = 0x277a;
  16134. t.a135 = 0x277b;
  16135. t.a136 = 0x277c;
  16136. t.a137 = 0x277d;
  16137. t.a138 = 0x277e;
  16138. t.a139 = 0x277f;
  16139. t.a140 = 0x2780;
  16140. t.a141 = 0x2781;
  16141. t.a142 = 0x2782;
  16142. t.a143 = 0x2783;
  16143. t.a144 = 0x2784;
  16144. t.a145 = 0x2785;
  16145. t.a146 = 0x2786;
  16146. t.a147 = 0x2787;
  16147. t.a148 = 0x2788;
  16148. t.a149 = 0x2789;
  16149. t.a150 = 0x278a;
  16150. t.a151 = 0x278b;
  16151. t.a152 = 0x278c;
  16152. t.a153 = 0x278d;
  16153. t.a154 = 0x278e;
  16154. t.a155 = 0x278f;
  16155. t.a156 = 0x2790;
  16156. t.a157 = 0x2791;
  16157. t.a158 = 0x2792;
  16158. t.a159 = 0x2793;
  16159. t.a160 = 0x2794;
  16160. t.a161 = 0x2192;
  16161. t.a163 = 0x2194;
  16162. t.a164 = 0x2195;
  16163. t.a196 = 0x2798;
  16164. t.a165 = 0x2799;
  16165. t.a192 = 0x279a;
  16166. t.a166 = 0x279b;
  16167. t.a167 = 0x279c;
  16168. t.a168 = 0x279d;
  16169. t.a169 = 0x279e;
  16170. t.a170 = 0x279f;
  16171. t.a171 = 0x27a0;
  16172. t.a172 = 0x27a1;
  16173. t.a173 = 0x27a2;
  16174. t.a162 = 0x27a3;
  16175. t.a174 = 0x27a4;
  16176. t.a175 = 0x27a5;
  16177. t.a176 = 0x27a6;
  16178. t.a177 = 0x27a7;
  16179. t.a178 = 0x27a8;
  16180. t.a179 = 0x27a9;
  16181. t.a193 = 0x27aa;
  16182. t.a180 = 0x27ab;
  16183. t.a199 = 0x27ac;
  16184. t.a181 = 0x27ad;
  16185. t.a200 = 0x27ae;
  16186. t.a182 = 0x27af;
  16187. t.a201 = 0x27b1;
  16188. t.a183 = 0x27b2;
  16189. t.a184 = 0x27b3;
  16190. t.a197 = 0x27b4;
  16191. t.a185 = 0x27b5;
  16192. t.a194 = 0x27b6;
  16193. t.a198 = 0x27b7;
  16194. t.a186 = 0x27b8;
  16195. t.a195 = 0x27b9;
  16196. t.a187 = 0x27ba;
  16197. t.a188 = 0x27bb;
  16198. t.a189 = 0x27bc;
  16199. t.a190 = 0x27bd;
  16200. t.a191 = 0x27be;
  16201. t.a89 = 0x2768;
  16202. t.a90 = 0x2769;
  16203. t.a93 = 0x276a;
  16204. t.a94 = 0x276b;
  16205. t.a91 = 0x276c;
  16206. t.a92 = 0x276d;
  16207. t.a205 = 0x276e;
  16208. t.a85 = 0x276f;
  16209. t.a206 = 0x2770;
  16210. t.a86 = 0x2771;
  16211. t.a87 = 0x2772;
  16212. t.a88 = 0x2773;
  16213. t.a95 = 0x2774;
  16214. t.a96 = 0x2775;
  16215. t[".notdef"] = 0x0000;
  16216. });
  16217. ;// ./src/core/unicode.js
  16218. const getSpecialPUASymbols = getLookupTableFactory(function (t) {
  16219. t[63721] = 0x00a9;
  16220. t[63193] = 0x00a9;
  16221. t[63720] = 0x00ae;
  16222. t[63194] = 0x00ae;
  16223. t[63722] = 0x2122;
  16224. t[63195] = 0x2122;
  16225. t[63729] = 0x23a7;
  16226. t[63730] = 0x23a8;
  16227. t[63731] = 0x23a9;
  16228. t[63740] = 0x23ab;
  16229. t[63741] = 0x23ac;
  16230. t[63742] = 0x23ad;
  16231. t[63726] = 0x23a1;
  16232. t[63727] = 0x23a2;
  16233. t[63728] = 0x23a3;
  16234. t[63737] = 0x23a4;
  16235. t[63738] = 0x23a5;
  16236. t[63739] = 0x23a6;
  16237. t[63723] = 0x239b;
  16238. t[63724] = 0x239c;
  16239. t[63725] = 0x239d;
  16240. t[63734] = 0x239e;
  16241. t[63735] = 0x239f;
  16242. t[63736] = 0x23a0;
  16243. });
  16244. function mapSpecialUnicodeValues(code) {
  16245. if (code >= 0xfff0 && code <= 0xffff) {
  16246. return 0;
  16247. } else if (code >= 0xf600 && code <= 0xf8ff) {
  16248. return getSpecialPUASymbols()[code] || code;
  16249. } else if (code === 0x00ad) {
  16250. return 0x002d;
  16251. }
  16252. return code;
  16253. }
  16254. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  16255. let unicode = glyphsUnicodeMap[name];
  16256. if (unicode !== undefined) {
  16257. return unicode;
  16258. }
  16259. if (!name) {
  16260. return -1;
  16261. }
  16262. if (name[0] === "u") {
  16263. const nameLen = name.length;
  16264. let hexStr;
  16265. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  16266. hexStr = name.substring(3);
  16267. } else if (nameLen >= 5 && nameLen <= 7) {
  16268. hexStr = name.substring(1);
  16269. } else {
  16270. return -1;
  16271. }
  16272. if (hexStr === hexStr.toUpperCase()) {
  16273. unicode = parseInt(hexStr, 16);
  16274. if (unicode >= 0) {
  16275. return unicode;
  16276. }
  16277. }
  16278. }
  16279. return -1;
  16280. }
  16281. const UnicodeRanges = [[0x0000, 0x007f], [0x0080, 0x00ff], [0x0100, 0x017f], [0x0180, 0x024f], [0x0250, 0x02af, 0x1d00, 0x1d7f, 0x1d80, 0x1dbf], [0x02b0, 0x02ff, 0xa700, 0xa71f], [0x0300, 0x036f, 0x1dc0, 0x1dff], [0x0370, 0x03ff], [0x2c80, 0x2cff], [0x0400, 0x04ff, 0x0500, 0x052f, 0x2de0, 0x2dff, 0xa640, 0xa69f], [0x0530, 0x058f], [0x0590, 0x05ff], [0xa500, 0xa63f], [0x0600, 0x06ff, 0x0750, 0x077f], [0x07c0, 0x07ff], [0x0900, 0x097f], [0x0980, 0x09ff], [0x0a00, 0x0a7f], [0x0a80, 0x0aff], [0x0b00, 0x0b7f], [0x0b80, 0x0bff], [0x0c00, 0x0c7f], [0x0c80, 0x0cff], [0x0d00, 0x0d7f], [0x0e00, 0x0e7f], [0x0e80, 0x0eff], [0x10a0, 0x10ff, 0x2d00, 0x2d2f], [0x1b00, 0x1b7f], [0x1100, 0x11ff], [0x1e00, 0x1eff, 0x2c60, 0x2c7f, 0xa720, 0xa7ff], [0x1f00, 0x1fff], [0x2000, 0x206f, 0x2e00, 0x2e7f], [0x2070, 0x209f], [0x20a0, 0x20cf], [0x20d0, 0x20ff], [0x2100, 0x214f], [0x2150, 0x218f], [0x2190, 0x21ff, 0x27f0, 0x27ff, 0x2900, 0x297f, 0x2b00, 0x2bff], [0x2200, 0x22ff, 0x2a00, 0x2aff, 0x27c0, 0x27ef, 0x2980, 0x29ff], [0x2300, 0x23ff], [0x2400, 0x243f], [0x2440, 0x245f], [0x2460, 0x24ff], [0x2500, 0x257f], [0x2580, 0x259f], [0x25a0, 0x25ff], [0x2600, 0x26ff], [0x2700, 0x27bf], [0x3000, 0x303f], [0x3040, 0x309f], [0x30a0, 0x30ff, 0x31f0, 0x31ff], [0x3100, 0x312f, 0x31a0, 0x31bf], [0x3130, 0x318f], [0xa840, 0xa87f], [0x3200, 0x32ff], [0x3300, 0x33ff], [0xac00, 0xd7af], [0xd800, 0xdfff], [0x10900, 0x1091f], [0x4e00, 0x9fff, 0x2e80, 0x2eff, 0x2f00, 0x2fdf, 0x2ff0, 0x2fff, 0x3400, 0x4dbf, 0x20000, 0x2a6df, 0x3190, 0x319f], [0xe000, 0xf8ff], [0x31c0, 0x31ef, 0xf900, 0xfaff, 0x2f800, 0x2fa1f], [0xfb00, 0xfb4f], [0xfb50, 0xfdff], [0xfe20, 0xfe2f], [0xfe10, 0xfe1f], [0xfe50, 0xfe6f], [0xfe70, 0xfeff], [0xff00, 0xffef], [0xfff0, 0xffff], [0x0f00, 0x0fff], [0x0700, 0x074f], [0x0780, 0x07bf], [0x0d80, 0x0dff], [0x1000, 0x109f], [0x1200, 0x137f, 0x1380, 0x139f, 0x2d80, 0x2ddf], [0x13a0, 0x13ff], [0x1400, 0x167f], [0x1680, 0x169f], [0x16a0, 0x16ff], [0x1780, 0x17ff], [0x1800, 0x18af], [0x2800, 0x28ff], [0xa000, 0xa48f], [0x1700, 0x171f, 0x1720, 0x173f, 0x1740, 0x175f, 0x1760, 0x177f], [0x10300, 0x1032f], [0x10330, 0x1034f], [0x10400, 0x1044f], [0x1d000, 0x1d0ff, 0x1d100, 0x1d1ff, 0x1d200, 0x1d24f], [0x1d400, 0x1d7ff], [0xff000, 0xffffd], [0xfe00, 0xfe0f, 0xe0100, 0xe01ef], [0xe0000, 0xe007f], [0x1900, 0x194f], [0x1950, 0x197f], [0x1980, 0x19df], [0x1a00, 0x1a1f], [0x2c00, 0x2c5f], [0x2d30, 0x2d7f], [0x4dc0, 0x4dff], [0xa800, 0xa82f], [0x10000, 0x1007f, 0x10080, 0x100ff, 0x10100, 0x1013f], [0x10140, 0x1018f], [0x10380, 0x1039f], [0x103a0, 0x103df], [0x10450, 0x1047f], [0x10480, 0x104af], [0x10800, 0x1083f], [0x10a00, 0x10a5f], [0x1d300, 0x1d35f], [0x12000, 0x123ff, 0x12400, 0x1247f], [0x1d360, 0x1d37f], [0x1b80, 0x1bbf], [0x1c00, 0x1c4f], [0x1c50, 0x1c7f], [0xa880, 0xa8df], [0xa900, 0xa92f], [0xa930, 0xa95f], [0xaa00, 0xaa5f], [0x10190, 0x101cf], [0x101d0, 0x101ff], [0x102a0, 0x102df, 0x10280, 0x1029f, 0x10920, 0x1093f], [0x1f030, 0x1f09f, 0x1f000, 0x1f02f]];
  16282. function getUnicodeRangeFor(value, lastPosition = -1) {
  16283. if (lastPosition !== -1) {
  16284. const range = UnicodeRanges[lastPosition];
  16285. for (let i = 0, ii = range.length; i < ii; i += 2) {
  16286. if (value >= range[i] && value <= range[i + 1]) {
  16287. return lastPosition;
  16288. }
  16289. }
  16290. }
  16291. for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  16292. const range = UnicodeRanges[i];
  16293. for (let j = 0, jj = range.length; j < jj; j += 2) {
  16294. if (value >= range[j] && value <= range[j + 1]) {
  16295. return i;
  16296. }
  16297. }
  16298. }
  16299. return -1;
  16300. }
  16301. const SpecialCharRegExp = new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$", "u");
  16302. const CategoryCache = new Map();
  16303. function getCharUnicodeCategory(char) {
  16304. const cachedCategory = CategoryCache.get(char);
  16305. if (cachedCategory) {
  16306. return cachedCategory;
  16307. }
  16308. const groups = char.match(SpecialCharRegExp);
  16309. const category = {
  16310. isWhitespace: !!groups?.[1],
  16311. isZeroWidthDiacritic: !!groups?.[2],
  16312. isInvisibleFormatMark: !!groups?.[3]
  16313. };
  16314. CategoryCache.set(char, category);
  16315. return category;
  16316. }
  16317. function clearUnicodeCaches() {
  16318. CategoryCache.clear();
  16319. }
  16320. ;// ./src/core/fonts_utils.js
  16321. const SEAC_ANALYSIS_ENABLED = true;
  16322. const FontFlags = {
  16323. FixedPitch: 1,
  16324. Serif: 2,
  16325. Symbolic: 4,
  16326. Script: 8,
  16327. Nonsymbolic: 32,
  16328. Italic: 64,
  16329. AllCap: 65536,
  16330. SmallCap: 131072,
  16331. ForceBold: 262144
  16332. };
  16333. const MacStandardGlyphOrdering = [".notdef", ".null", "nonmarkingreturn", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", "section", "bullet", "paragraph", "germandbls", "registered", "copyright", "trademark", "acute", "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", "mu", "partialdiff", "summation", "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", "florin", "approxequal", "Delta", "guillemotleft", "guillemotright", "ellipsis", "nonbreakingspace", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "Lslash", "lslash", "Scaron", "scaron", "Zcaron", "zcaron", "brokenbar", "Eth", "eth", "Yacute", "yacute", "Thorn", "thorn", "minus", "multiply", "onesuperior", "twosuperior", "threesuperior", "onehalf", "onequarter", "threequarters", "franc", "Gbreve", "gbreve", "Idotaccent", "Scedilla", "scedilla", "Cacute", "cacute", "Ccaron", "ccaron", "dcroat"];
  16334. function recoverGlyphName(name, glyphsUnicodeMap) {
  16335. if (glyphsUnicodeMap[name] !== undefined) {
  16336. return name;
  16337. }
  16338. const unicode = getUnicodeForGlyph(name, glyphsUnicodeMap);
  16339. if (unicode !== -1) {
  16340. for (const key in glyphsUnicodeMap) {
  16341. if (glyphsUnicodeMap[key] === unicode) {
  16342. return key;
  16343. }
  16344. }
  16345. }
  16346. info("Unable to recover a standard glyph name for: " + name);
  16347. return name;
  16348. }
  16349. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  16350. const charCodeToGlyphId = Object.create(null);
  16351. let glyphId, charCode, baseEncoding;
  16352. const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  16353. if (properties.isInternalFont) {
  16354. baseEncoding = builtInEncoding;
  16355. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  16356. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  16357. charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0;
  16358. }
  16359. } else if (properties.baseEncodingName) {
  16360. baseEncoding = getEncoding(properties.baseEncodingName);
  16361. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  16362. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  16363. charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0;
  16364. }
  16365. } else if (isSymbolicFont) {
  16366. for (charCode in builtInEncoding) {
  16367. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  16368. }
  16369. } else {
  16370. baseEncoding = StandardEncoding;
  16371. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  16372. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  16373. charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0;
  16374. }
  16375. }
  16376. const differences = properties.differences;
  16377. let glyphsUnicodeMap;
  16378. if (differences) {
  16379. for (charCode in differences) {
  16380. const glyphName = differences[charCode];
  16381. glyphId = glyphNames.indexOf(glyphName);
  16382. if (glyphId === -1) {
  16383. if (!glyphsUnicodeMap) {
  16384. glyphsUnicodeMap = getGlyphsUnicode();
  16385. }
  16386. const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  16387. if (standardGlyphName !== glyphName) {
  16388. glyphId = glyphNames.indexOf(standardGlyphName);
  16389. }
  16390. }
  16391. charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0;
  16392. }
  16393. }
  16394. return charCodeToGlyphId;
  16395. }
  16396. function normalizeFontName(name) {
  16397. return name.replaceAll(/[,_]/g, "-").replaceAll(/\s/g, "");
  16398. }
  16399. const getVerticalPresentationForm = getLookupTableFactory(t => {
  16400. t[0x2013] = 0xfe32;
  16401. t[0x2014] = 0xfe31;
  16402. t[0x2025] = 0xfe30;
  16403. t[0x2026] = 0xfe19;
  16404. t[0x3001] = 0xfe11;
  16405. t[0x3002] = 0xfe12;
  16406. t[0x3008] = 0xfe3f;
  16407. t[0x3009] = 0xfe40;
  16408. t[0x300a] = 0xfe3d;
  16409. t[0x300b] = 0xfe3e;
  16410. t[0x300c] = 0xfe41;
  16411. t[0x300d] = 0xfe42;
  16412. t[0x300e] = 0xfe43;
  16413. t[0x300f] = 0xfe44;
  16414. t[0x3010] = 0xfe3b;
  16415. t[0x3011] = 0xfe3c;
  16416. t[0x3014] = 0xfe39;
  16417. t[0x3015] = 0xfe3a;
  16418. t[0x3016] = 0xfe17;
  16419. t[0x3017] = 0xfe18;
  16420. t[0xfe4f] = 0xfe34;
  16421. t[0xff01] = 0xfe15;
  16422. t[0xff08] = 0xfe35;
  16423. t[0xff09] = 0xfe36;
  16424. t[0xff0c] = 0xfe10;
  16425. t[0xff1a] = 0xfe13;
  16426. t[0xff1b] = 0xfe14;
  16427. t[0xff1f] = 0xfe16;
  16428. t[0xff3b] = 0xfe47;
  16429. t[0xff3d] = 0xfe48;
  16430. t[0xff3f] = 0xfe33;
  16431. t[0xff5b] = 0xfe37;
  16432. t[0xff5d] = 0xfe38;
  16433. });
  16434. ;// ./src/core/standard_fonts.js
  16435. const getStdFontMap = getLookupTableFactory(function (t) {
  16436. t["Times-Roman"] = "Times-Roman";
  16437. t.Helvetica = "Helvetica";
  16438. t.Courier = "Courier";
  16439. t.Symbol = "Symbol";
  16440. t["Times-Bold"] = "Times-Bold";
  16441. t["Helvetica-Bold"] = "Helvetica-Bold";
  16442. t["Courier-Bold"] = "Courier-Bold";
  16443. t.ZapfDingbats = "ZapfDingbats";
  16444. t["Times-Italic"] = "Times-Italic";
  16445. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  16446. t["Courier-Oblique"] = "Courier-Oblique";
  16447. t["Times-BoldItalic"] = "Times-BoldItalic";
  16448. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  16449. t["Courier-BoldOblique"] = "Courier-BoldOblique";
  16450. t.ArialNarrow = "Helvetica";
  16451. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  16452. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  16453. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  16454. t.ArialBlack = "Helvetica";
  16455. t["ArialBlack-Bold"] = "Helvetica-Bold";
  16456. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  16457. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  16458. t["Arial-Black"] = "Helvetica";
  16459. t["Arial-Black-Bold"] = "Helvetica-Bold";
  16460. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  16461. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  16462. t.Arial = "Helvetica";
  16463. t["Arial-Bold"] = "Helvetica-Bold";
  16464. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  16465. t["Arial-Italic"] = "Helvetica-Oblique";
  16466. t.ArialMT = "Helvetica";
  16467. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  16468. t["Arial-BoldMT"] = "Helvetica-Bold";
  16469. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  16470. t["Arial-BoldItalicMT-BoldItalic"] = "Helvetica-BoldOblique";
  16471. t["Arial-BoldMT-Bold"] = "Helvetica-Bold";
  16472. t["Arial-ItalicMT-Italic"] = "Helvetica-Oblique";
  16473. t.ArialUnicodeMS = "Helvetica";
  16474. t["ArialUnicodeMS-Bold"] = "Helvetica-Bold";
  16475. t["ArialUnicodeMS-BoldItalic"] = "Helvetica-BoldOblique";
  16476. t["ArialUnicodeMS-Italic"] = "Helvetica-Oblique";
  16477. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  16478. t["Courier-Italic"] = "Courier-Oblique";
  16479. t.CourierNew = "Courier";
  16480. t["CourierNew-Bold"] = "Courier-Bold";
  16481. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  16482. t["CourierNew-Italic"] = "Courier-Oblique";
  16483. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  16484. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  16485. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  16486. t.CourierNewPSMT = "Courier";
  16487. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  16488. t["Helvetica-Italic"] = "Helvetica-Oblique";
  16489. t["Symbol-Bold"] = "Symbol";
  16490. t["Symbol-BoldItalic"] = "Symbol";
  16491. t["Symbol-Italic"] = "Symbol";
  16492. t.TimesNewRoman = "Times-Roman";
  16493. t["TimesNewRoman-Bold"] = "Times-Bold";
  16494. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  16495. t["TimesNewRoman-Italic"] = "Times-Italic";
  16496. t.TimesNewRomanPS = "Times-Roman";
  16497. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  16498. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  16499. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  16500. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  16501. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  16502. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  16503. t.TimesNewRomanPSMT = "Times-Roman";
  16504. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  16505. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  16506. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  16507. });
  16508. const getFontNameToFileMap = getLookupTableFactory(function (t) {
  16509. t.Courier = "FoxitFixed.pfb";
  16510. t["Courier-Bold"] = "FoxitFixedBold.pfb";
  16511. t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb";
  16512. t["Courier-Oblique"] = "FoxitFixedItalic.pfb";
  16513. t.Helvetica = "LiberationSans-Regular.ttf";
  16514. t["Helvetica-Bold"] = "LiberationSans-Bold.ttf";
  16515. t["Helvetica-BoldOblique"] = "LiberationSans-BoldItalic.ttf";
  16516. t["Helvetica-Oblique"] = "LiberationSans-Italic.ttf";
  16517. t["Times-Roman"] = "FoxitSerif.pfb";
  16518. t["Times-Bold"] = "FoxitSerifBold.pfb";
  16519. t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb";
  16520. t["Times-Italic"] = "FoxitSerifItalic.pfb";
  16521. t.Symbol = "FoxitSymbol.pfb";
  16522. t.ZapfDingbats = "FoxitDingbats.pfb";
  16523. t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf";
  16524. t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf";
  16525. t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf";
  16526. t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf";
  16527. });
  16528. const getNonStdFontMap = getLookupTableFactory(function (t) {
  16529. t.Calibri = "Helvetica";
  16530. t["Calibri-Bold"] = "Helvetica-Bold";
  16531. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  16532. t["Calibri-Italic"] = "Helvetica-Oblique";
  16533. t.CenturyGothic = "Helvetica";
  16534. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  16535. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  16536. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  16537. t.ComicSansMS = "Comic Sans MS";
  16538. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  16539. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  16540. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  16541. t.GillSansMT = "Helvetica";
  16542. t["GillSansMT-Bold"] = "Helvetica-Bold";
  16543. t["GillSansMT-BoldItalic"] = "Helvetica-BoldOblique";
  16544. t["GillSansMT-Italic"] = "Helvetica-Oblique";
  16545. t.Impact = "Helvetica";
  16546. t["ItcSymbol-Bold"] = "Helvetica-Bold";
  16547. t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique";
  16548. t["ItcSymbol-Book"] = "Helvetica";
  16549. t["ItcSymbol-BookItalic"] = "Helvetica-Oblique";
  16550. t["ItcSymbol-Medium"] = "Helvetica";
  16551. t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique";
  16552. t.LucidaConsole = "Courier";
  16553. t["LucidaConsole-Bold"] = "Courier-Bold";
  16554. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  16555. t["LucidaConsole-Italic"] = "Courier-Oblique";
  16556. t["LucidaSans-Demi"] = "Helvetica-Bold";
  16557. t["MS-Gothic"] = "MS Gothic";
  16558. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  16559. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  16560. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  16561. t["MS-Mincho"] = "MS Mincho";
  16562. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  16563. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  16564. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  16565. t["MS-PGothic"] = "MS PGothic";
  16566. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  16567. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  16568. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  16569. t["MS-PMincho"] = "MS PMincho";
  16570. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  16571. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  16572. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  16573. t.NuptialScript = "Times-Italic";
  16574. t.SegoeUISymbol = "Helvetica";
  16575. });
  16576. const getSerifFonts = getLookupTableFactory(function (t) {
  16577. t["Adobe Jenson"] = true;
  16578. t["Adobe Text"] = true;
  16579. t.Albertus = true;
  16580. t.Aldus = true;
  16581. t.Alexandria = true;
  16582. t.Algerian = true;
  16583. t["American Typewriter"] = true;
  16584. t.Antiqua = true;
  16585. t.Apex = true;
  16586. t.Arno = true;
  16587. t.Aster = true;
  16588. t.Aurora = true;
  16589. t.Baskerville = true;
  16590. t.Bell = true;
  16591. t.Bembo = true;
  16592. t["Bembo Schoolbook"] = true;
  16593. t.Benguiat = true;
  16594. t["Berkeley Old Style"] = true;
  16595. t["Bernhard Modern"] = true;
  16596. t["Berthold City"] = true;
  16597. t.Bodoni = true;
  16598. t["Bauer Bodoni"] = true;
  16599. t["Book Antiqua"] = true;
  16600. t.Bookman = true;
  16601. t["Bordeaux Roman"] = true;
  16602. t["Californian FB"] = true;
  16603. t.Calisto = true;
  16604. t.Calvert = true;
  16605. t.Capitals = true;
  16606. t.Cambria = true;
  16607. t.Cartier = true;
  16608. t.Caslon = true;
  16609. t.Catull = true;
  16610. t.Centaur = true;
  16611. t["Century Old Style"] = true;
  16612. t["Century Schoolbook"] = true;
  16613. t.Chaparral = true;
  16614. t["Charis SIL"] = true;
  16615. t.Cheltenham = true;
  16616. t["Cholla Slab"] = true;
  16617. t.Clarendon = true;
  16618. t.Clearface = true;
  16619. t.Cochin = true;
  16620. t.Colonna = true;
  16621. t["Computer Modern"] = true;
  16622. t["Concrete Roman"] = true;
  16623. t.Constantia = true;
  16624. t["Cooper Black"] = true;
  16625. t.Corona = true;
  16626. t.Ecotype = true;
  16627. t.Egyptienne = true;
  16628. t.Elephant = true;
  16629. t.Excelsior = true;
  16630. t.Fairfield = true;
  16631. t["FF Scala"] = true;
  16632. t.Folkard = true;
  16633. t.Footlight = true;
  16634. t.FreeSerif = true;
  16635. t["Friz Quadrata"] = true;
  16636. t.Garamond = true;
  16637. t.Gentium = true;
  16638. t.Georgia = true;
  16639. t.Gloucester = true;
  16640. t["Goudy Old Style"] = true;
  16641. t["Goudy Schoolbook"] = true;
  16642. t["Goudy Pro Font"] = true;
  16643. t.Granjon = true;
  16644. t["Guardian Egyptian"] = true;
  16645. t.Heather = true;
  16646. t.Hercules = true;
  16647. t["High Tower Text"] = true;
  16648. t.Hiroshige = true;
  16649. t["Hoefler Text"] = true;
  16650. t["Humana Serif"] = true;
  16651. t.Imprint = true;
  16652. t["Ionic No. 5"] = true;
  16653. t.Janson = true;
  16654. t.Joanna = true;
  16655. t.Korinna = true;
  16656. t.Lexicon = true;
  16657. t.LiberationSerif = true;
  16658. t["Liberation Serif"] = true;
  16659. t["Linux Libertine"] = true;
  16660. t.Literaturnaya = true;
  16661. t.Lucida = true;
  16662. t["Lucida Bright"] = true;
  16663. t.Melior = true;
  16664. t.Memphis = true;
  16665. t.Miller = true;
  16666. t.Minion = true;
  16667. t.Modern = true;
  16668. t["Mona Lisa"] = true;
  16669. t["Mrs Eaves"] = true;
  16670. t["MS Serif"] = true;
  16671. t["Museo Slab"] = true;
  16672. t["New York"] = true;
  16673. t["Nimbus Roman"] = true;
  16674. t["NPS Rawlinson Roadway"] = true;
  16675. t.NuptialScript = true;
  16676. t.Palatino = true;
  16677. t.Perpetua = true;
  16678. t.Plantin = true;
  16679. t["Plantin Schoolbook"] = true;
  16680. t.Playbill = true;
  16681. t["Poor Richard"] = true;
  16682. t["Rawlinson Roadway"] = true;
  16683. t.Renault = true;
  16684. t.Requiem = true;
  16685. t.Rockwell = true;
  16686. t.Roman = true;
  16687. t["Rotis Serif"] = true;
  16688. t.Sabon = true;
  16689. t.Scala = true;
  16690. t.Seagull = true;
  16691. t.Sistina = true;
  16692. t.Souvenir = true;
  16693. t.STIX = true;
  16694. t["Stone Informal"] = true;
  16695. t["Stone Serif"] = true;
  16696. t.Sylfaen = true;
  16697. t.Times = true;
  16698. t.Trajan = true;
  16699. t["Trinité"] = true;
  16700. t["Trump Mediaeval"] = true;
  16701. t.Utopia = true;
  16702. t["Vale Type"] = true;
  16703. t["Bitstream Vera"] = true;
  16704. t["Vera Serif"] = true;
  16705. t.Versailles = true;
  16706. t.Wanted = true;
  16707. t.Weiss = true;
  16708. t["Wide Latin"] = true;
  16709. t.Windsor = true;
  16710. t.XITS = true;
  16711. });
  16712. const getSymbolsFonts = getLookupTableFactory(function (t) {
  16713. t.Dingbats = true;
  16714. t.Symbol = true;
  16715. t.ZapfDingbats = true;
  16716. t.Wingdings = true;
  16717. t["Wingdings-Bold"] = true;
  16718. t["Wingdings-Regular"] = true;
  16719. });
  16720. const getGlyphMapForStandardFonts = getLookupTableFactory(function (t) {
  16721. t[2] = 10;
  16722. t[3] = 32;
  16723. t[4] = 33;
  16724. t[5] = 34;
  16725. t[6] = 35;
  16726. t[7] = 36;
  16727. t[8] = 37;
  16728. t[9] = 38;
  16729. t[10] = 39;
  16730. t[11] = 40;
  16731. t[12] = 41;
  16732. t[13] = 42;
  16733. t[14] = 43;
  16734. t[15] = 44;
  16735. t[16] = 45;
  16736. t[17] = 46;
  16737. t[18] = 47;
  16738. t[19] = 48;
  16739. t[20] = 49;
  16740. t[21] = 50;
  16741. t[22] = 51;
  16742. t[23] = 52;
  16743. t[24] = 53;
  16744. t[25] = 54;
  16745. t[26] = 55;
  16746. t[27] = 56;
  16747. t[28] = 57;
  16748. t[29] = 58;
  16749. t[30] = 894;
  16750. t[31] = 60;
  16751. t[32] = 61;
  16752. t[33] = 62;
  16753. t[34] = 63;
  16754. t[35] = 64;
  16755. t[36] = 65;
  16756. t[37] = 66;
  16757. t[38] = 67;
  16758. t[39] = 68;
  16759. t[40] = 69;
  16760. t[41] = 70;
  16761. t[42] = 71;
  16762. t[43] = 72;
  16763. t[44] = 73;
  16764. t[45] = 74;
  16765. t[46] = 75;
  16766. t[47] = 76;
  16767. t[48] = 77;
  16768. t[49] = 78;
  16769. t[50] = 79;
  16770. t[51] = 80;
  16771. t[52] = 81;
  16772. t[53] = 82;
  16773. t[54] = 83;
  16774. t[55] = 84;
  16775. t[56] = 85;
  16776. t[57] = 86;
  16777. t[58] = 87;
  16778. t[59] = 88;
  16779. t[60] = 89;
  16780. t[61] = 90;
  16781. t[62] = 91;
  16782. t[63] = 92;
  16783. t[64] = 93;
  16784. t[65] = 94;
  16785. t[66] = 95;
  16786. t[67] = 96;
  16787. t[68] = 97;
  16788. t[69] = 98;
  16789. t[70] = 99;
  16790. t[71] = 100;
  16791. t[72] = 101;
  16792. t[73] = 102;
  16793. t[74] = 103;
  16794. t[75] = 104;
  16795. t[76] = 105;
  16796. t[77] = 106;
  16797. t[78] = 107;
  16798. t[79] = 108;
  16799. t[80] = 109;
  16800. t[81] = 110;
  16801. t[82] = 111;
  16802. t[83] = 112;
  16803. t[84] = 113;
  16804. t[85] = 114;
  16805. t[86] = 115;
  16806. t[87] = 116;
  16807. t[88] = 117;
  16808. t[89] = 118;
  16809. t[90] = 119;
  16810. t[91] = 120;
  16811. t[92] = 121;
  16812. t[93] = 122;
  16813. t[94] = 123;
  16814. t[95] = 124;
  16815. t[96] = 125;
  16816. t[97] = 126;
  16817. t[98] = 196;
  16818. t[99] = 197;
  16819. t[100] = 199;
  16820. t[101] = 201;
  16821. t[102] = 209;
  16822. t[103] = 214;
  16823. t[104] = 220;
  16824. t[105] = 225;
  16825. t[106] = 224;
  16826. t[107] = 226;
  16827. t[108] = 228;
  16828. t[109] = 227;
  16829. t[110] = 229;
  16830. t[111] = 231;
  16831. t[112] = 233;
  16832. t[113] = 232;
  16833. t[114] = 234;
  16834. t[115] = 235;
  16835. t[116] = 237;
  16836. t[117] = 236;
  16837. t[118] = 238;
  16838. t[119] = 239;
  16839. t[120] = 241;
  16840. t[121] = 243;
  16841. t[122] = 242;
  16842. t[123] = 244;
  16843. t[124] = 246;
  16844. t[125] = 245;
  16845. t[126] = 250;
  16846. t[127] = 249;
  16847. t[128] = 251;
  16848. t[129] = 252;
  16849. t[130] = 8224;
  16850. t[131] = 176;
  16851. t[132] = 162;
  16852. t[133] = 163;
  16853. t[134] = 167;
  16854. t[135] = 8226;
  16855. t[136] = 182;
  16856. t[137] = 223;
  16857. t[138] = 174;
  16858. t[139] = 169;
  16859. t[140] = 8482;
  16860. t[141] = 180;
  16861. t[142] = 168;
  16862. t[143] = 8800;
  16863. t[144] = 198;
  16864. t[145] = 216;
  16865. t[146] = 8734;
  16866. t[147] = 177;
  16867. t[148] = 8804;
  16868. t[149] = 8805;
  16869. t[150] = 165;
  16870. t[151] = 181;
  16871. t[152] = 8706;
  16872. t[153] = 8721;
  16873. t[154] = 8719;
  16874. t[156] = 8747;
  16875. t[157] = 170;
  16876. t[158] = 186;
  16877. t[159] = 8486;
  16878. t[160] = 230;
  16879. t[161] = 248;
  16880. t[162] = 191;
  16881. t[163] = 161;
  16882. t[164] = 172;
  16883. t[165] = 8730;
  16884. t[166] = 402;
  16885. t[167] = 8776;
  16886. t[168] = 8710;
  16887. t[169] = 171;
  16888. t[170] = 187;
  16889. t[171] = 8230;
  16890. t[179] = 8220;
  16891. t[180] = 8221;
  16892. t[181] = 8216;
  16893. t[182] = 8217;
  16894. t[200] = 193;
  16895. t[203] = 205;
  16896. t[207] = 211;
  16897. t[210] = 218;
  16898. t[223] = 711;
  16899. t[224] = 321;
  16900. t[225] = 322;
  16901. t[226] = 352;
  16902. t[227] = 353;
  16903. t[228] = 381;
  16904. t[229] = 382;
  16905. t[233] = 221;
  16906. t[234] = 253;
  16907. t[252] = 263;
  16908. t[253] = 268;
  16909. t[254] = 269;
  16910. t[258] = 258;
  16911. t[260] = 260;
  16912. t[261] = 261;
  16913. t[265] = 280;
  16914. t[266] = 281;
  16915. t[267] = 282;
  16916. t[268] = 283;
  16917. t[269] = 313;
  16918. t[275] = 323;
  16919. t[276] = 324;
  16920. t[278] = 328;
  16921. t[283] = 344;
  16922. t[284] = 345;
  16923. t[285] = 346;
  16924. t[286] = 347;
  16925. t[292] = 367;
  16926. t[295] = 377;
  16927. t[296] = 378;
  16928. t[298] = 380;
  16929. t[305] = 963;
  16930. t[306] = 964;
  16931. t[307] = 966;
  16932. t[308] = 8215;
  16933. t[309] = 8252;
  16934. t[310] = 8319;
  16935. t[311] = 8359;
  16936. t[312] = 8592;
  16937. t[313] = 8593;
  16938. t[337] = 9552;
  16939. t[493] = 1039;
  16940. t[494] = 1040;
  16941. t[672] = 1488;
  16942. t[673] = 1489;
  16943. t[674] = 1490;
  16944. t[675] = 1491;
  16945. t[676] = 1492;
  16946. t[677] = 1493;
  16947. t[678] = 1494;
  16948. t[679] = 1495;
  16949. t[680] = 1496;
  16950. t[681] = 1497;
  16951. t[682] = 1498;
  16952. t[683] = 1499;
  16953. t[684] = 1500;
  16954. t[685] = 1501;
  16955. t[686] = 1502;
  16956. t[687] = 1503;
  16957. t[688] = 1504;
  16958. t[689] = 1505;
  16959. t[690] = 1506;
  16960. t[691] = 1507;
  16961. t[692] = 1508;
  16962. t[693] = 1509;
  16963. t[694] = 1510;
  16964. t[695] = 1511;
  16965. t[696] = 1512;
  16966. t[697] = 1513;
  16967. t[698] = 1514;
  16968. t[705] = 1524;
  16969. t[706] = 8362;
  16970. t[710] = 64288;
  16971. t[711] = 64298;
  16972. t[759] = 1617;
  16973. t[761] = 1776;
  16974. t[763] = 1778;
  16975. t[775] = 1652;
  16976. t[777] = 1764;
  16977. t[778] = 1780;
  16978. t[779] = 1781;
  16979. t[780] = 1782;
  16980. t[782] = 771;
  16981. t[783] = 64726;
  16982. t[786] = 8363;
  16983. t[788] = 8532;
  16984. t[790] = 768;
  16985. t[791] = 769;
  16986. t[792] = 768;
  16987. t[795] = 803;
  16988. t[797] = 64336;
  16989. t[798] = 64337;
  16990. t[799] = 64342;
  16991. t[800] = 64343;
  16992. t[801] = 64344;
  16993. t[802] = 64345;
  16994. t[803] = 64362;
  16995. t[804] = 64363;
  16996. t[805] = 64364;
  16997. t[2424] = 7821;
  16998. t[2425] = 7822;
  16999. t[2426] = 7823;
  17000. t[2427] = 7824;
  17001. t[2428] = 7825;
  17002. t[2429] = 7826;
  17003. t[2430] = 7827;
  17004. t[2433] = 7682;
  17005. t[2678] = 8045;
  17006. t[2679] = 8046;
  17007. t[2830] = 1552;
  17008. t[2838] = 686;
  17009. t[2840] = 751;
  17010. t[2842] = 753;
  17011. t[2843] = 754;
  17012. t[2844] = 755;
  17013. t[2846] = 757;
  17014. t[2856] = 767;
  17015. t[2857] = 848;
  17016. t[2858] = 849;
  17017. t[2862] = 853;
  17018. t[2863] = 854;
  17019. t[2864] = 855;
  17020. t[2865] = 861;
  17021. t[2866] = 862;
  17022. t[2906] = 7460;
  17023. t[2908] = 7462;
  17024. t[2909] = 7463;
  17025. t[2910] = 7464;
  17026. t[2912] = 7466;
  17027. t[2913] = 7467;
  17028. t[2914] = 7468;
  17029. t[2916] = 7470;
  17030. t[2917] = 7471;
  17031. t[2918] = 7472;
  17032. t[2920] = 7474;
  17033. t[2921] = 7475;
  17034. t[2922] = 7476;
  17035. t[2924] = 7478;
  17036. t[2925] = 7479;
  17037. t[2926] = 7480;
  17038. t[2928] = 7482;
  17039. t[2929] = 7483;
  17040. t[2930] = 7484;
  17041. t[2932] = 7486;
  17042. t[2933] = 7487;
  17043. t[2934] = 7488;
  17044. t[2936] = 7490;
  17045. t[2937] = 7491;
  17046. t[2938] = 7492;
  17047. t[2940] = 7494;
  17048. t[2941] = 7495;
  17049. t[2942] = 7496;
  17050. t[2944] = 7498;
  17051. t[2946] = 7500;
  17052. t[2948] = 7502;
  17053. t[2950] = 7504;
  17054. t[2951] = 7505;
  17055. t[2952] = 7506;
  17056. t[2954] = 7508;
  17057. t[2955] = 7509;
  17058. t[2956] = 7510;
  17059. t[2958] = 7512;
  17060. t[2959] = 7513;
  17061. t[2960] = 7514;
  17062. t[2962] = 7516;
  17063. t[2963] = 7517;
  17064. t[2964] = 7518;
  17065. t[2966] = 7520;
  17066. t[2967] = 7521;
  17067. t[2968] = 7522;
  17068. t[2970] = 7524;
  17069. t[2971] = 7525;
  17070. t[2972] = 7526;
  17071. t[2974] = 7528;
  17072. t[2975] = 7529;
  17073. t[2976] = 7530;
  17074. t[2978] = 1537;
  17075. t[2979] = 1538;
  17076. t[2980] = 1539;
  17077. t[2982] = 1549;
  17078. t[2983] = 1551;
  17079. t[2984] = 1552;
  17080. t[2986] = 1554;
  17081. t[2987] = 1555;
  17082. t[2988] = 1556;
  17083. t[2990] = 1623;
  17084. t[2991] = 1624;
  17085. t[2995] = 1775;
  17086. t[2999] = 1791;
  17087. t[3002] = 64290;
  17088. t[3003] = 64291;
  17089. t[3004] = 64292;
  17090. t[3006] = 64294;
  17091. t[3007] = 64295;
  17092. t[3008] = 64296;
  17093. t[3011] = 1900;
  17094. t[3014] = 8223;
  17095. t[3015] = 8244;
  17096. t[3017] = 7532;
  17097. t[3018] = 7533;
  17098. t[3019] = 7534;
  17099. t[3075] = 7590;
  17100. t[3076] = 7591;
  17101. t[3079] = 7594;
  17102. t[3080] = 7595;
  17103. t[3083] = 7598;
  17104. t[3084] = 7599;
  17105. t[3087] = 7602;
  17106. t[3088] = 7603;
  17107. t[3091] = 7606;
  17108. t[3092] = 7607;
  17109. t[3095] = 7610;
  17110. t[3096] = 7611;
  17111. t[3099] = 7614;
  17112. t[3100] = 7615;
  17113. t[3103] = 7618;
  17114. t[3104] = 7619;
  17115. t[3107] = 8337;
  17116. t[3108] = 8338;
  17117. t[3116] = 1884;
  17118. t[3119] = 1885;
  17119. t[3120] = 1885;
  17120. t[3123] = 1886;
  17121. t[3124] = 1886;
  17122. t[3127] = 1887;
  17123. t[3128] = 1887;
  17124. t[3131] = 1888;
  17125. t[3132] = 1888;
  17126. t[3135] = 1889;
  17127. t[3136] = 1889;
  17128. t[3139] = 1890;
  17129. t[3140] = 1890;
  17130. t[3143] = 1891;
  17131. t[3144] = 1891;
  17132. t[3147] = 1892;
  17133. t[3148] = 1892;
  17134. t[3153] = 580;
  17135. t[3154] = 581;
  17136. t[3157] = 584;
  17137. t[3158] = 585;
  17138. t[3161] = 588;
  17139. t[3162] = 589;
  17140. t[3165] = 891;
  17141. t[3166] = 892;
  17142. t[3169] = 1274;
  17143. t[3170] = 1275;
  17144. t[3173] = 1278;
  17145. t[3174] = 1279;
  17146. t[3181] = 7622;
  17147. t[3182] = 7623;
  17148. t[3282] = 11799;
  17149. t[3316] = 578;
  17150. t[3379] = 42785;
  17151. t[3393] = 1159;
  17152. t[3416] = 8377;
  17153. });
  17154. const getSupplementalGlyphMapForArialBlack = getLookupTableFactory(function (t) {
  17155. t[227] = 322;
  17156. t[264] = 261;
  17157. t[291] = 346;
  17158. });
  17159. const getSupplementalGlyphMapForCalibri = getLookupTableFactory(function (t) {
  17160. t[1] = 32;
  17161. t[4] = 65;
  17162. t[5] = 192;
  17163. t[6] = 193;
  17164. t[9] = 196;
  17165. t[17] = 66;
  17166. t[18] = 67;
  17167. t[21] = 268;
  17168. t[24] = 68;
  17169. t[28] = 69;
  17170. t[29] = 200;
  17171. t[30] = 201;
  17172. t[32] = 282;
  17173. t[38] = 70;
  17174. t[39] = 71;
  17175. t[44] = 72;
  17176. t[47] = 73;
  17177. t[48] = 204;
  17178. t[49] = 205;
  17179. t[58] = 74;
  17180. t[60] = 75;
  17181. t[62] = 76;
  17182. t[68] = 77;
  17183. t[69] = 78;
  17184. t[75] = 79;
  17185. t[76] = 210;
  17186. t[80] = 214;
  17187. t[87] = 80;
  17188. t[89] = 81;
  17189. t[90] = 82;
  17190. t[92] = 344;
  17191. t[94] = 83;
  17192. t[97] = 352;
  17193. t[100] = 84;
  17194. t[104] = 85;
  17195. t[109] = 220;
  17196. t[115] = 86;
  17197. t[116] = 87;
  17198. t[121] = 88;
  17199. t[122] = 89;
  17200. t[124] = 221;
  17201. t[127] = 90;
  17202. t[129] = 381;
  17203. t[258] = 97;
  17204. t[259] = 224;
  17205. t[260] = 225;
  17206. t[263] = 228;
  17207. t[268] = 261;
  17208. t[271] = 98;
  17209. t[272] = 99;
  17210. t[273] = 263;
  17211. t[275] = 269;
  17212. t[282] = 100;
  17213. t[286] = 101;
  17214. t[287] = 232;
  17215. t[288] = 233;
  17216. t[290] = 283;
  17217. t[295] = 281;
  17218. t[296] = 102;
  17219. t[336] = 103;
  17220. t[346] = 104;
  17221. t[349] = 105;
  17222. t[350] = 236;
  17223. t[351] = 237;
  17224. t[361] = 106;
  17225. t[364] = 107;
  17226. t[367] = 108;
  17227. t[371] = 322;
  17228. t[373] = 109;
  17229. t[374] = 110;
  17230. t[381] = 111;
  17231. t[382] = 242;
  17232. t[383] = 243;
  17233. t[386] = 246;
  17234. t[393] = 112;
  17235. t[395] = 113;
  17236. t[396] = 114;
  17237. t[398] = 345;
  17238. t[400] = 115;
  17239. t[401] = 347;
  17240. t[403] = 353;
  17241. t[410] = 116;
  17242. t[437] = 117;
  17243. t[442] = 252;
  17244. t[448] = 118;
  17245. t[449] = 119;
  17246. t[454] = 120;
  17247. t[455] = 121;
  17248. t[457] = 253;
  17249. t[460] = 122;
  17250. t[462] = 382;
  17251. t[463] = 380;
  17252. t[853] = 44;
  17253. t[855] = 58;
  17254. t[856] = 46;
  17255. t[876] = 47;
  17256. t[878] = 45;
  17257. t[882] = 45;
  17258. t[894] = 40;
  17259. t[895] = 41;
  17260. t[896] = 91;
  17261. t[897] = 93;
  17262. t[923] = 64;
  17263. t[1004] = 48;
  17264. t[1005] = 49;
  17265. t[1006] = 50;
  17266. t[1007] = 51;
  17267. t[1008] = 52;
  17268. t[1009] = 53;
  17269. t[1010] = 54;
  17270. t[1011] = 55;
  17271. t[1012] = 56;
  17272. t[1013] = 57;
  17273. t[1081] = 37;
  17274. t[1085] = 43;
  17275. t[1086] = 45;
  17276. });
  17277. function getStandardFontName(name) {
  17278. const fontName = normalizeFontName(name);
  17279. const stdFontMap = getStdFontMap();
  17280. return stdFontMap[fontName];
  17281. }
  17282. function isKnownFontName(name) {
  17283. const fontName = normalizeFontName(name);
  17284. return !!(getStdFontMap()[fontName] || getNonStdFontMap()[fontName] || getSerifFonts()[fontName] || getSymbolsFonts()[fontName]);
  17285. }
  17286. ;// ./src/core/to_unicode_map.js
  17287. class ToUnicodeMap {
  17288. constructor(cmap = []) {
  17289. this._map = cmap;
  17290. }
  17291. get length() {
  17292. return this._map.length;
  17293. }
  17294. forEach(callback) {
  17295. for (const charCode in this._map) {
  17296. callback(charCode, this._map[charCode].charCodeAt(0));
  17297. }
  17298. }
  17299. has(i) {
  17300. return this._map[i] !== undefined;
  17301. }
  17302. get(i) {
  17303. return this._map[i];
  17304. }
  17305. charCodeOf(value) {
  17306. const map = this._map;
  17307. if (map.length <= 0x10000) {
  17308. return map.indexOf(value);
  17309. }
  17310. for (const charCode in map) {
  17311. if (map[charCode] === value) {
  17312. return charCode | 0;
  17313. }
  17314. }
  17315. return -1;
  17316. }
  17317. amend(map) {
  17318. for (const charCode in map) {
  17319. this._map[charCode] = map[charCode];
  17320. }
  17321. }
  17322. }
  17323. class IdentityToUnicodeMap {
  17324. constructor(firstChar, lastChar) {
  17325. this.firstChar = firstChar;
  17326. this.lastChar = lastChar;
  17327. }
  17328. get length() {
  17329. return this.lastChar + 1 - this.firstChar;
  17330. }
  17331. forEach(callback) {
  17332. for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  17333. callback(i, i);
  17334. }
  17335. }
  17336. has(i) {
  17337. return this.firstChar <= i && i <= this.lastChar;
  17338. }
  17339. get(i) {
  17340. if (this.firstChar <= i && i <= this.lastChar) {
  17341. return String.fromCharCode(i);
  17342. }
  17343. return undefined;
  17344. }
  17345. charCodeOf(v) {
  17346. return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  17347. }
  17348. amend(map) {
  17349. unreachable("Should not call amend()");
  17350. }
  17351. }
  17352. ;// ./src/core/cff_font.js
  17353. class CFFFont {
  17354. constructor(file, properties) {
  17355. this.properties = properties;
  17356. const parser = new CFFParser(file, properties, SEAC_ANALYSIS_ENABLED);
  17357. this.cff = parser.parse();
  17358. this.cff.duplicateFirstGlyph();
  17359. const compiler = new CFFCompiler(this.cff);
  17360. this.seacs = this.cff.seacs;
  17361. try {
  17362. this.data = compiler.compile();
  17363. } catch {
  17364. warn("Failed to compile font " + properties.loadedName);
  17365. this.data = file;
  17366. }
  17367. this._createBuiltInEncoding();
  17368. }
  17369. get numGlyphs() {
  17370. return this.cff.charStrings.count;
  17371. }
  17372. getCharset() {
  17373. return this.cff.charset.charset;
  17374. }
  17375. getGlyphMapping() {
  17376. const cff = this.cff;
  17377. const properties = this.properties;
  17378. const {
  17379. cidToGidMap,
  17380. cMap
  17381. } = properties;
  17382. const charsets = cff.charset.charset;
  17383. let charCodeToGlyphId;
  17384. let glyphId;
  17385. if (properties.composite) {
  17386. let invCidToGidMap;
  17387. if (cidToGidMap?.length > 0) {
  17388. invCidToGidMap = Object.create(null);
  17389. for (let i = 0, ii = cidToGidMap.length; i < ii; i++) {
  17390. const gid = cidToGidMap[i];
  17391. if (gid !== undefined) {
  17392. invCidToGidMap[gid] = i;
  17393. }
  17394. }
  17395. }
  17396. charCodeToGlyphId = Object.create(null);
  17397. let charCode;
  17398. if (cff.isCIDFont) {
  17399. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  17400. const cid = charsets[glyphId];
  17401. charCode = cMap.charCodeOf(cid);
  17402. if (invCidToGidMap?.[charCode] !== undefined) {
  17403. charCode = invCidToGidMap[charCode];
  17404. }
  17405. charCodeToGlyphId[charCode] = glyphId;
  17406. }
  17407. } else {
  17408. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  17409. charCode = cMap.charCodeOf(glyphId);
  17410. charCodeToGlyphId[charCode] = glyphId;
  17411. }
  17412. }
  17413. return charCodeToGlyphId;
  17414. }
  17415. let encoding = cff.encoding ? cff.encoding.encoding : null;
  17416. if (properties.isInternalFont) {
  17417. encoding = properties.defaultEncoding;
  17418. }
  17419. charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets);
  17420. return charCodeToGlyphId;
  17421. }
  17422. hasGlyphId(id) {
  17423. return this.cff.hasGlyphId(id);
  17424. }
  17425. _createBuiltInEncoding() {
  17426. const {
  17427. charset,
  17428. encoding
  17429. } = this.cff;
  17430. if (!charset || !encoding) {
  17431. return;
  17432. }
  17433. const charsets = charset.charset,
  17434. encodings = encoding.encoding;
  17435. const map = [];
  17436. for (const charCode in encodings) {
  17437. const glyphId = encodings[charCode];
  17438. if (glyphId >= 0) {
  17439. const glyphName = charsets[glyphId];
  17440. if (glyphName) {
  17441. map[charCode] = glyphName;
  17442. }
  17443. }
  17444. }
  17445. if (map.length > 0) {
  17446. this.properties.builtInEncoding = map;
  17447. }
  17448. }
  17449. }
  17450. ;// ./src/core/font_renderer.js
  17451. function getUint32(data, offset) {
  17452. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  17453. }
  17454. function getUint16(data, offset) {
  17455. return data[offset] << 8 | data[offset + 1];
  17456. }
  17457. function getInt16(data, offset) {
  17458. return (data[offset] << 24 | data[offset + 1] << 16) >> 16;
  17459. }
  17460. function getInt8(data, offset) {
  17461. return data[offset] << 24 >> 24;
  17462. }
  17463. function getFloat214(data, offset) {
  17464. return getInt16(data, offset) / 16384;
  17465. }
  17466. function getSubroutineBias(subrs) {
  17467. const numSubrs = subrs.length;
  17468. let bias = 32768;
  17469. if (numSubrs < 1240) {
  17470. bias = 107;
  17471. } else if (numSubrs < 33900) {
  17472. bias = 1131;
  17473. }
  17474. return bias;
  17475. }
  17476. function parseCmap(data, start, end) {
  17477. const offset = getUint16(data, start + 2) === 1 ? getUint32(data, start + 8) : getUint32(data, start + 16);
  17478. const format = getUint16(data, start + offset);
  17479. let ranges, p, i;
  17480. if (format === 4) {
  17481. getUint16(data, start + offset + 2);
  17482. const segCount = getUint16(data, start + offset + 6) >> 1;
  17483. p = start + offset + 14;
  17484. ranges = [];
  17485. for (i = 0; i < segCount; i++, p += 2) {
  17486. ranges[i] = {
  17487. end: getUint16(data, p)
  17488. };
  17489. }
  17490. p += 2;
  17491. for (i = 0; i < segCount; i++, p += 2) {
  17492. ranges[i].start = getUint16(data, p);
  17493. }
  17494. for (i = 0; i < segCount; i++, p += 2) {
  17495. ranges[i].idDelta = getUint16(data, p);
  17496. }
  17497. for (i = 0; i < segCount; i++, p += 2) {
  17498. let idOffset = getUint16(data, p);
  17499. if (idOffset === 0) {
  17500. continue;
  17501. }
  17502. ranges[i].ids = [];
  17503. for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  17504. ranges[i].ids[j] = getUint16(data, p + idOffset);
  17505. idOffset += 2;
  17506. }
  17507. }
  17508. return ranges;
  17509. } else if (format === 12) {
  17510. const groups = getUint32(data, start + offset + 12);
  17511. p = start + offset + 16;
  17512. ranges = [];
  17513. for (i = 0; i < groups; i++) {
  17514. start = getUint32(data, p);
  17515. ranges.push({
  17516. start,
  17517. end: getUint32(data, p + 4),
  17518. idDelta: getUint32(data, p + 8) - start
  17519. });
  17520. p += 12;
  17521. }
  17522. return ranges;
  17523. }
  17524. throw new FormatError(`unsupported cmap: ${format}`);
  17525. }
  17526. function parseCff(data, start, end, seacAnalysisEnabled) {
  17527. const properties = {};
  17528. const parser = new CFFParser(new Stream(data, start, end - start), properties, seacAnalysisEnabled);
  17529. const cff = parser.parse();
  17530. return {
  17531. glyphs: cff.charStrings.objects,
  17532. subrs: cff.topDict.privateDict?.subrsIndex?.objects,
  17533. gsubrs: cff.globalSubrIndex?.objects,
  17534. isCFFCIDFont: cff.isCIDFont,
  17535. fdSelect: cff.fdSelect,
  17536. fdArray: cff.fdArray
  17537. };
  17538. }
  17539. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  17540. let itemSize, itemDecode;
  17541. if (isGlyphLocationsLong) {
  17542. itemSize = 4;
  17543. itemDecode = getUint32;
  17544. } else {
  17545. itemSize = 2;
  17546. itemDecode = (data, offset) => 2 * getUint16(data, offset);
  17547. }
  17548. const glyphs = [];
  17549. let startOffset = itemDecode(loca, 0);
  17550. for (let j = itemSize; j < loca.length; j += itemSize) {
  17551. const endOffset = itemDecode(loca, j);
  17552. glyphs.push(glyf.subarray(startOffset, endOffset));
  17553. startOffset = endOffset;
  17554. }
  17555. return glyphs;
  17556. }
  17557. function lookupCmap(ranges, unicode) {
  17558. const code = unicode.codePointAt(0);
  17559. let gid = 0,
  17560. l = 0,
  17561. r = ranges.length - 1;
  17562. while (l < r) {
  17563. const c = l + r + 1 >> 1;
  17564. if (code < ranges[c].start) {
  17565. r = c - 1;
  17566. } else {
  17567. l = c;
  17568. }
  17569. }
  17570. if (ranges[l].start <= code && code <= ranges[l].end) {
  17571. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
  17572. }
  17573. return {
  17574. charCode: code,
  17575. glyphId: gid
  17576. };
  17577. }
  17578. function compileGlyf(code, cmds, font) {
  17579. function moveTo(x, y) {
  17580. cmds.add(FontRenderOps.MOVE_TO, [x, y]);
  17581. }
  17582. function lineTo(x, y) {
  17583. cmds.add(FontRenderOps.LINE_TO, [x, y]);
  17584. }
  17585. function quadraticCurveTo(xa, ya, x, y) {
  17586. cmds.add(FontRenderOps.QUADRATIC_CURVE_TO, [xa, ya, x, y]);
  17587. }
  17588. let i = 0;
  17589. const numberOfContours = getInt16(code, i);
  17590. let flags;
  17591. let x = 0,
  17592. y = 0;
  17593. i += 10;
  17594. if (numberOfContours < 0) {
  17595. do {
  17596. flags = getUint16(code, i);
  17597. const glyphIndex = getUint16(code, i + 2);
  17598. i += 4;
  17599. let arg1, arg2;
  17600. if (flags & 0x01) {
  17601. if (flags & 0x02) {
  17602. arg1 = getInt16(code, i);
  17603. arg2 = getInt16(code, i + 2);
  17604. } else {
  17605. arg1 = getUint16(code, i);
  17606. arg2 = getUint16(code, i + 2);
  17607. }
  17608. i += 4;
  17609. } else if (flags & 0x02) {
  17610. arg1 = getInt8(code, i++);
  17611. arg2 = getInt8(code, i++);
  17612. } else {
  17613. arg1 = code[i++];
  17614. arg2 = code[i++];
  17615. }
  17616. if (flags & 0x02) {
  17617. x = arg1;
  17618. y = arg2;
  17619. } else {
  17620. x = 0;
  17621. y = 0;
  17622. }
  17623. let scaleX = 1,
  17624. scaleY = 1,
  17625. scale01 = 0,
  17626. scale10 = 0;
  17627. if (flags & 0x08) {
  17628. scaleX = scaleY = getFloat214(code, i);
  17629. i += 2;
  17630. } else if (flags & 0x40) {
  17631. scaleX = getFloat214(code, i);
  17632. scaleY = getFloat214(code, i + 2);
  17633. i += 4;
  17634. } else if (flags & 0x80) {
  17635. scaleX = getFloat214(code, i);
  17636. scale01 = getFloat214(code, i + 2);
  17637. scale10 = getFloat214(code, i + 4);
  17638. scaleY = getFloat214(code, i + 6);
  17639. i += 8;
  17640. }
  17641. const subglyph = font.glyphs[glyphIndex];
  17642. if (subglyph) {
  17643. cmds.add(FontRenderOps.SAVE);
  17644. cmds.add(FontRenderOps.TRANSFORM, [scaleX, scale01, scale10, scaleY, x, y]);
  17645. if (!(flags & 0x02)) {}
  17646. compileGlyf(subglyph, cmds, font);
  17647. cmds.add(FontRenderOps.RESTORE);
  17648. }
  17649. } while (flags & 0x20);
  17650. } else {
  17651. const endPtsOfContours = [];
  17652. let j, jj;
  17653. for (j = 0; j < numberOfContours; j++) {
  17654. endPtsOfContours.push(getUint16(code, i));
  17655. i += 2;
  17656. }
  17657. const instructionLength = getUint16(code, i);
  17658. i += 2 + instructionLength;
  17659. const numberOfPoints = endPtsOfContours.at(-1) + 1;
  17660. const points = [];
  17661. while (points.length < numberOfPoints) {
  17662. flags = code[i++];
  17663. let repeat = 1;
  17664. if (flags & 0x08) {
  17665. repeat += code[i++];
  17666. }
  17667. while (repeat-- > 0) {
  17668. points.push({
  17669. flags
  17670. });
  17671. }
  17672. }
  17673. for (j = 0; j < numberOfPoints; j++) {
  17674. switch (points[j].flags & 0x12) {
  17675. case 0x00:
  17676. x += getInt16(code, i);
  17677. i += 2;
  17678. break;
  17679. case 0x02:
  17680. x -= code[i++];
  17681. break;
  17682. case 0x12:
  17683. x += code[i++];
  17684. break;
  17685. }
  17686. points[j].x = x;
  17687. }
  17688. for (j = 0; j < numberOfPoints; j++) {
  17689. switch (points[j].flags & 0x24) {
  17690. case 0x00:
  17691. y += getInt16(code, i);
  17692. i += 2;
  17693. break;
  17694. case 0x04:
  17695. y -= code[i++];
  17696. break;
  17697. case 0x24:
  17698. y += code[i++];
  17699. break;
  17700. }
  17701. points[j].y = y;
  17702. }
  17703. let startPoint = 0;
  17704. for (i = 0; i < numberOfContours; i++) {
  17705. const endPoint = endPtsOfContours[i];
  17706. const contour = points.slice(startPoint, endPoint + 1);
  17707. if (contour[0].flags & 1) {
  17708. contour.push(contour[0]);
  17709. } else if (contour.at(-1).flags & 1) {
  17710. contour.unshift(contour.at(-1));
  17711. } else {
  17712. const p = {
  17713. flags: 1,
  17714. x: (contour[0].x + contour.at(-1).x) / 2,
  17715. y: (contour[0].y + contour.at(-1).y) / 2
  17716. };
  17717. contour.unshift(p);
  17718. contour.push(p);
  17719. }
  17720. moveTo(contour[0].x, contour[0].y);
  17721. for (j = 1, jj = contour.length; j < jj; j++) {
  17722. if (contour[j].flags & 1) {
  17723. lineTo(contour[j].x, contour[j].y);
  17724. } else if (contour[j + 1].flags & 1) {
  17725. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  17726. j++;
  17727. } else {
  17728. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  17729. }
  17730. }
  17731. startPoint = endPoint + 1;
  17732. }
  17733. }
  17734. }
  17735. function compileCharString(charStringCode, cmds, font, glyphId) {
  17736. function moveTo(x, y) {
  17737. cmds.add(FontRenderOps.MOVE_TO, [x, y]);
  17738. }
  17739. function lineTo(x, y) {
  17740. cmds.add(FontRenderOps.LINE_TO, [x, y]);
  17741. }
  17742. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  17743. cmds.add(FontRenderOps.BEZIER_CURVE_TO, [x1, y1, x2, y2, x, y]);
  17744. }
  17745. const stack = [];
  17746. let x = 0,
  17747. y = 0;
  17748. let stems = 0;
  17749. function parse(code) {
  17750. let i = 0;
  17751. while (i < code.length) {
  17752. let stackClean = false;
  17753. let v = code[i++];
  17754. let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  17755. switch (v) {
  17756. case 1:
  17757. stems += stack.length >> 1;
  17758. stackClean = true;
  17759. break;
  17760. case 3:
  17761. stems += stack.length >> 1;
  17762. stackClean = true;
  17763. break;
  17764. case 4:
  17765. y += stack.pop();
  17766. moveTo(x, y);
  17767. stackClean = true;
  17768. break;
  17769. case 5:
  17770. while (stack.length > 0) {
  17771. x += stack.shift();
  17772. y += stack.shift();
  17773. lineTo(x, y);
  17774. }
  17775. break;
  17776. case 6:
  17777. while (stack.length > 0) {
  17778. x += stack.shift();
  17779. lineTo(x, y);
  17780. if (stack.length === 0) {
  17781. break;
  17782. }
  17783. y += stack.shift();
  17784. lineTo(x, y);
  17785. }
  17786. break;
  17787. case 7:
  17788. while (stack.length > 0) {
  17789. y += stack.shift();
  17790. lineTo(x, y);
  17791. if (stack.length === 0) {
  17792. break;
  17793. }
  17794. x += stack.shift();
  17795. lineTo(x, y);
  17796. }
  17797. break;
  17798. case 8:
  17799. while (stack.length > 0) {
  17800. xa = x + stack.shift();
  17801. ya = y + stack.shift();
  17802. xb = xa + stack.shift();
  17803. yb = ya + stack.shift();
  17804. x = xb + stack.shift();
  17805. y = yb + stack.shift();
  17806. bezierCurveTo(xa, ya, xb, yb, x, y);
  17807. }
  17808. break;
  17809. case 10:
  17810. n = stack.pop();
  17811. subrCode = null;
  17812. if (font.isCFFCIDFont) {
  17813. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  17814. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  17815. const fontDict = font.fdArray[fdIndex];
  17816. let subrs;
  17817. if (fontDict.privateDict?.subrsIndex) {
  17818. subrs = fontDict.privateDict.subrsIndex.objects;
  17819. }
  17820. if (subrs) {
  17821. n += getSubroutineBias(subrs);
  17822. subrCode = subrs[n];
  17823. }
  17824. } else {
  17825. warn("Invalid fd index for glyph index.");
  17826. }
  17827. } else {
  17828. subrCode = font.subrs[n + font.subrsBias];
  17829. }
  17830. if (subrCode) {
  17831. parse(subrCode);
  17832. }
  17833. break;
  17834. case 11:
  17835. return;
  17836. case 12:
  17837. v = code[i++];
  17838. switch (v) {
  17839. case 34:
  17840. xa = x + stack.shift();
  17841. xb = xa + stack.shift();
  17842. y1 = y + stack.shift();
  17843. x = xb + stack.shift();
  17844. bezierCurveTo(xa, y, xb, y1, x, y1);
  17845. xa = x + stack.shift();
  17846. xb = xa + stack.shift();
  17847. x = xb + stack.shift();
  17848. bezierCurveTo(xa, y1, xb, y, x, y);
  17849. break;
  17850. case 35:
  17851. xa = x + stack.shift();
  17852. ya = y + stack.shift();
  17853. xb = xa + stack.shift();
  17854. yb = ya + stack.shift();
  17855. x = xb + stack.shift();
  17856. y = yb + stack.shift();
  17857. bezierCurveTo(xa, ya, xb, yb, x, y);
  17858. xa = x + stack.shift();
  17859. ya = y + stack.shift();
  17860. xb = xa + stack.shift();
  17861. yb = ya + stack.shift();
  17862. x = xb + stack.shift();
  17863. y = yb + stack.shift();
  17864. bezierCurveTo(xa, ya, xb, yb, x, y);
  17865. stack.pop();
  17866. break;
  17867. case 36:
  17868. xa = x + stack.shift();
  17869. y1 = y + stack.shift();
  17870. xb = xa + stack.shift();
  17871. y2 = y1 + stack.shift();
  17872. x = xb + stack.shift();
  17873. bezierCurveTo(xa, y1, xb, y2, x, y2);
  17874. xa = x + stack.shift();
  17875. xb = xa + stack.shift();
  17876. y3 = y2 + stack.shift();
  17877. x = xb + stack.shift();
  17878. bezierCurveTo(xa, y2, xb, y3, x, y);
  17879. break;
  17880. case 37:
  17881. const x0 = x,
  17882. y0 = y;
  17883. xa = x + stack.shift();
  17884. ya = y + stack.shift();
  17885. xb = xa + stack.shift();
  17886. yb = ya + stack.shift();
  17887. x = xb + stack.shift();
  17888. y = yb + stack.shift();
  17889. bezierCurveTo(xa, ya, xb, yb, x, y);
  17890. xa = x + stack.shift();
  17891. ya = y + stack.shift();
  17892. xb = xa + stack.shift();
  17893. yb = ya + stack.shift();
  17894. x = xb;
  17895. y = yb;
  17896. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  17897. x += stack.shift();
  17898. } else {
  17899. y += stack.shift();
  17900. }
  17901. bezierCurveTo(xa, ya, xb, yb, x, y);
  17902. break;
  17903. default:
  17904. throw new FormatError(`unknown operator: 12 ${v}`);
  17905. }
  17906. break;
  17907. case 14:
  17908. if (stack.length >= 4) {
  17909. const achar = stack.pop();
  17910. const bchar = stack.pop();
  17911. y = stack.pop();
  17912. x = stack.pop();
  17913. cmds.add(FontRenderOps.SAVE);
  17914. cmds.add(FontRenderOps.TRANSLATE, [x, y]);
  17915. let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[achar]]));
  17916. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  17917. cmds.add(FontRenderOps.RESTORE);
  17918. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[bchar]]));
  17919. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  17920. }
  17921. return;
  17922. case 18:
  17923. stems += stack.length >> 1;
  17924. stackClean = true;
  17925. break;
  17926. case 19:
  17927. stems += stack.length >> 1;
  17928. i += stems + 7 >> 3;
  17929. stackClean = true;
  17930. break;
  17931. case 20:
  17932. stems += stack.length >> 1;
  17933. i += stems + 7 >> 3;
  17934. stackClean = true;
  17935. break;
  17936. case 21:
  17937. y += stack.pop();
  17938. x += stack.pop();
  17939. moveTo(x, y);
  17940. stackClean = true;
  17941. break;
  17942. case 22:
  17943. x += stack.pop();
  17944. moveTo(x, y);
  17945. stackClean = true;
  17946. break;
  17947. case 23:
  17948. stems += stack.length >> 1;
  17949. stackClean = true;
  17950. break;
  17951. case 24:
  17952. while (stack.length > 2) {
  17953. xa = x + stack.shift();
  17954. ya = y + stack.shift();
  17955. xb = xa + stack.shift();
  17956. yb = ya + stack.shift();
  17957. x = xb + stack.shift();
  17958. y = yb + stack.shift();
  17959. bezierCurveTo(xa, ya, xb, yb, x, y);
  17960. }
  17961. x += stack.shift();
  17962. y += stack.shift();
  17963. lineTo(x, y);
  17964. break;
  17965. case 25:
  17966. while (stack.length > 6) {
  17967. x += stack.shift();
  17968. y += stack.shift();
  17969. lineTo(x, y);
  17970. }
  17971. xa = x + stack.shift();
  17972. ya = y + stack.shift();
  17973. xb = xa + stack.shift();
  17974. yb = ya + stack.shift();
  17975. x = xb + stack.shift();
  17976. y = yb + stack.shift();
  17977. bezierCurveTo(xa, ya, xb, yb, x, y);
  17978. break;
  17979. case 26:
  17980. if (stack.length % 2) {
  17981. x += stack.shift();
  17982. }
  17983. while (stack.length > 0) {
  17984. xa = x;
  17985. ya = y + stack.shift();
  17986. xb = xa + stack.shift();
  17987. yb = ya + stack.shift();
  17988. x = xb;
  17989. y = yb + stack.shift();
  17990. bezierCurveTo(xa, ya, xb, yb, x, y);
  17991. }
  17992. break;
  17993. case 27:
  17994. if (stack.length % 2) {
  17995. y += stack.shift();
  17996. }
  17997. while (stack.length > 0) {
  17998. xa = x + stack.shift();
  17999. ya = y;
  18000. xb = xa + stack.shift();
  18001. yb = ya + stack.shift();
  18002. x = xb + stack.shift();
  18003. y = yb;
  18004. bezierCurveTo(xa, ya, xb, yb, x, y);
  18005. }
  18006. break;
  18007. case 28:
  18008. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  18009. i += 2;
  18010. break;
  18011. case 29:
  18012. n = stack.pop() + font.gsubrsBias;
  18013. subrCode = font.gsubrs[n];
  18014. if (subrCode) {
  18015. parse(subrCode);
  18016. }
  18017. break;
  18018. case 30:
  18019. while (stack.length > 0) {
  18020. xa = x;
  18021. ya = y + stack.shift();
  18022. xb = xa + stack.shift();
  18023. yb = ya + stack.shift();
  18024. x = xb + stack.shift();
  18025. y = yb + (stack.length === 1 ? stack.shift() : 0);
  18026. bezierCurveTo(xa, ya, xb, yb, x, y);
  18027. if (stack.length === 0) {
  18028. break;
  18029. }
  18030. xa = x + stack.shift();
  18031. ya = y;
  18032. xb = xa + stack.shift();
  18033. yb = ya + stack.shift();
  18034. y = yb + stack.shift();
  18035. x = xb + (stack.length === 1 ? stack.shift() : 0);
  18036. bezierCurveTo(xa, ya, xb, yb, x, y);
  18037. }
  18038. break;
  18039. case 31:
  18040. while (stack.length > 0) {
  18041. xa = x + stack.shift();
  18042. ya = y;
  18043. xb = xa + stack.shift();
  18044. yb = ya + stack.shift();
  18045. y = yb + stack.shift();
  18046. x = xb + (stack.length === 1 ? stack.shift() : 0);
  18047. bezierCurveTo(xa, ya, xb, yb, x, y);
  18048. if (stack.length === 0) {
  18049. break;
  18050. }
  18051. xa = x;
  18052. ya = y + stack.shift();
  18053. xb = xa + stack.shift();
  18054. yb = ya + stack.shift();
  18055. x = xb + stack.shift();
  18056. y = yb + (stack.length === 1 ? stack.shift() : 0);
  18057. bezierCurveTo(xa, ya, xb, yb, x, y);
  18058. }
  18059. break;
  18060. default:
  18061. if (v < 32) {
  18062. throw new FormatError(`unknown operator: ${v}`);
  18063. }
  18064. if (v < 247) {
  18065. stack.push(v - 139);
  18066. } else if (v < 251) {
  18067. stack.push((v - 247) * 256 + code[i++] + 108);
  18068. } else if (v < 255) {
  18069. stack.push(-(v - 251) * 256 - code[i++] - 108);
  18070. } else {
  18071. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  18072. i += 4;
  18073. }
  18074. break;
  18075. }
  18076. if (stackClean) {
  18077. stack.length = 0;
  18078. }
  18079. }
  18080. }
  18081. parse(charStringCode);
  18082. }
  18083. const NOOP = [];
  18084. class Commands {
  18085. cmds = [];
  18086. add(cmd, args) {
  18087. if (args) {
  18088. if (!isNumberArray(args, null)) {
  18089. warn(`Commands.add - "${cmd}" has at least one non-number arg: "${args}".`);
  18090. const newArgs = args.map(arg => typeof arg === "number" ? arg : 0);
  18091. this.cmds.push(cmd, ...newArgs);
  18092. } else {
  18093. this.cmds.push(cmd, ...args);
  18094. }
  18095. } else {
  18096. this.cmds.push(cmd);
  18097. }
  18098. }
  18099. }
  18100. class CompiledFont {
  18101. constructor(fontMatrix) {
  18102. this.fontMatrix = fontMatrix;
  18103. this.compiledGlyphs = Object.create(null);
  18104. this.compiledCharCodeToGlyphId = Object.create(null);
  18105. }
  18106. getPathJs(unicode) {
  18107. const {
  18108. charCode,
  18109. glyphId
  18110. } = lookupCmap(this.cmap, unicode);
  18111. let fn = this.compiledGlyphs[glyphId],
  18112. compileEx;
  18113. if (!fn) {
  18114. try {
  18115. fn = this.compileGlyph(this.glyphs[glyphId], glyphId);
  18116. } catch (ex) {
  18117. fn = NOOP;
  18118. compileEx = ex;
  18119. }
  18120. this.compiledGlyphs[glyphId] = fn;
  18121. }
  18122. this.compiledCharCodeToGlyphId[charCode] ??= glyphId;
  18123. if (compileEx) {
  18124. throw compileEx;
  18125. }
  18126. return fn;
  18127. }
  18128. compileGlyph(code, glyphId) {
  18129. if (!code || code.length === 0 || code[0] === 14) {
  18130. return NOOP;
  18131. }
  18132. let fontMatrix = this.fontMatrix;
  18133. if (this.isCFFCIDFont) {
  18134. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  18135. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  18136. const fontDict = this.fdArray[fdIndex];
  18137. fontMatrix = fontDict.getByName("FontMatrix") || FONT_IDENTITY_MATRIX;
  18138. } else {
  18139. warn("Invalid fd index for glyph index.");
  18140. }
  18141. }
  18142. const cmds = new Commands();
  18143. cmds.add(FontRenderOps.SAVE);
  18144. cmds.add(FontRenderOps.TRANSFORM, fontMatrix.slice());
  18145. cmds.add(FontRenderOps.SCALE);
  18146. this.compileGlyphImpl(code, cmds, glyphId);
  18147. cmds.add(FontRenderOps.RESTORE);
  18148. return cmds.cmds;
  18149. }
  18150. compileGlyphImpl() {
  18151. unreachable("Children classes should implement this.");
  18152. }
  18153. hasBuiltPath(unicode) {
  18154. const {
  18155. charCode,
  18156. glyphId
  18157. } = lookupCmap(this.cmap, unicode);
  18158. return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined;
  18159. }
  18160. }
  18161. class TrueTypeCompiled extends CompiledFont {
  18162. constructor(glyphs, cmap, fontMatrix) {
  18163. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  18164. this.glyphs = glyphs;
  18165. this.cmap = cmap;
  18166. }
  18167. compileGlyphImpl(code, cmds) {
  18168. compileGlyf(code, cmds, this);
  18169. }
  18170. }
  18171. class Type2Compiled extends CompiledFont {
  18172. constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
  18173. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  18174. this.glyphs = cffInfo.glyphs;
  18175. this.gsubrs = cffInfo.gsubrs || [];
  18176. this.subrs = cffInfo.subrs || [];
  18177. this.cmap = cmap;
  18178. this.glyphNameMap = glyphNameMap || getGlyphsUnicode();
  18179. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  18180. this.subrsBias = getSubroutineBias(this.subrs);
  18181. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  18182. this.fdSelect = cffInfo.fdSelect;
  18183. this.fdArray = cffInfo.fdArray;
  18184. }
  18185. compileGlyphImpl(code, cmds, glyphId) {
  18186. compileCharString(code, cmds, this, glyphId);
  18187. }
  18188. }
  18189. class FontRendererFactory {
  18190. static create(font, seacAnalysisEnabled) {
  18191. const data = new Uint8Array(font.data);
  18192. let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  18193. const numTables = getUint16(data, 4);
  18194. for (let i = 0, p = 12; i < numTables; i++, p += 16) {
  18195. const tag = bytesToString(data.subarray(p, p + 4));
  18196. const offset = getUint32(data, p + 8);
  18197. const length = getUint32(data, p + 12);
  18198. switch (tag) {
  18199. case "cmap":
  18200. cmap = parseCmap(data, offset, offset + length);
  18201. break;
  18202. case "glyf":
  18203. glyf = data.subarray(offset, offset + length);
  18204. break;
  18205. case "loca":
  18206. loca = data.subarray(offset, offset + length);
  18207. break;
  18208. case "head":
  18209. unitsPerEm = getUint16(data, offset + 18);
  18210. indexToLocFormat = getUint16(data, offset + 50);
  18211. break;
  18212. case "CFF ":
  18213. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  18214. break;
  18215. }
  18216. }
  18217. if (glyf) {
  18218. const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  18219. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  18220. }
  18221. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  18222. }
  18223. }
  18224. ;// ./src/core/metrics.js
  18225. const getMetrics = getLookupTableFactory(function (t) {
  18226. t.Courier = 600;
  18227. t["Courier-Bold"] = 600;
  18228. t["Courier-BoldOblique"] = 600;
  18229. t["Courier-Oblique"] = 600;
  18230. t.Helvetica = getLookupTableFactory(function (t) {
  18231. t.space = 278;
  18232. t.exclam = 278;
  18233. t.quotedbl = 355;
  18234. t.numbersign = 556;
  18235. t.dollar = 556;
  18236. t.percent = 889;
  18237. t.ampersand = 667;
  18238. t.quoteright = 222;
  18239. t.parenleft = 333;
  18240. t.parenright = 333;
  18241. t.asterisk = 389;
  18242. t.plus = 584;
  18243. t.comma = 278;
  18244. t.hyphen = 333;
  18245. t.period = 278;
  18246. t.slash = 278;
  18247. t.zero = 556;
  18248. t.one = 556;
  18249. t.two = 556;
  18250. t.three = 556;
  18251. t.four = 556;
  18252. t.five = 556;
  18253. t.six = 556;
  18254. t.seven = 556;
  18255. t.eight = 556;
  18256. t.nine = 556;
  18257. t.colon = 278;
  18258. t.semicolon = 278;
  18259. t.less = 584;
  18260. t.equal = 584;
  18261. t.greater = 584;
  18262. t.question = 556;
  18263. t.at = 1015;
  18264. t.A = 667;
  18265. t.B = 667;
  18266. t.C = 722;
  18267. t.D = 722;
  18268. t.E = 667;
  18269. t.F = 611;
  18270. t.G = 778;
  18271. t.H = 722;
  18272. t.I = 278;
  18273. t.J = 500;
  18274. t.K = 667;
  18275. t.L = 556;
  18276. t.M = 833;
  18277. t.N = 722;
  18278. t.O = 778;
  18279. t.P = 667;
  18280. t.Q = 778;
  18281. t.R = 722;
  18282. t.S = 667;
  18283. t.T = 611;
  18284. t.U = 722;
  18285. t.V = 667;
  18286. t.W = 944;
  18287. t.X = 667;
  18288. t.Y = 667;
  18289. t.Z = 611;
  18290. t.bracketleft = 278;
  18291. t.backslash = 278;
  18292. t.bracketright = 278;
  18293. t.asciicircum = 469;
  18294. t.underscore = 556;
  18295. t.quoteleft = 222;
  18296. t.a = 556;
  18297. t.b = 556;
  18298. t.c = 500;
  18299. t.d = 556;
  18300. t.e = 556;
  18301. t.f = 278;
  18302. t.g = 556;
  18303. t.h = 556;
  18304. t.i = 222;
  18305. t.j = 222;
  18306. t.k = 500;
  18307. t.l = 222;
  18308. t.m = 833;
  18309. t.n = 556;
  18310. t.o = 556;
  18311. t.p = 556;
  18312. t.q = 556;
  18313. t.r = 333;
  18314. t.s = 500;
  18315. t.t = 278;
  18316. t.u = 556;
  18317. t.v = 500;
  18318. t.w = 722;
  18319. t.x = 500;
  18320. t.y = 500;
  18321. t.z = 500;
  18322. t.braceleft = 334;
  18323. t.bar = 260;
  18324. t.braceright = 334;
  18325. t.asciitilde = 584;
  18326. t.exclamdown = 333;
  18327. t.cent = 556;
  18328. t.sterling = 556;
  18329. t.fraction = 167;
  18330. t.yen = 556;
  18331. t.florin = 556;
  18332. t.section = 556;
  18333. t.currency = 556;
  18334. t.quotesingle = 191;
  18335. t.quotedblleft = 333;
  18336. t.guillemotleft = 556;
  18337. t.guilsinglleft = 333;
  18338. t.guilsinglright = 333;
  18339. t.fi = 500;
  18340. t.fl = 500;
  18341. t.endash = 556;
  18342. t.dagger = 556;
  18343. t.daggerdbl = 556;
  18344. t.periodcentered = 278;
  18345. t.paragraph = 537;
  18346. t.bullet = 350;
  18347. t.quotesinglbase = 222;
  18348. t.quotedblbase = 333;
  18349. t.quotedblright = 333;
  18350. t.guillemotright = 556;
  18351. t.ellipsis = 1000;
  18352. t.perthousand = 1000;
  18353. t.questiondown = 611;
  18354. t.grave = 333;
  18355. t.acute = 333;
  18356. t.circumflex = 333;
  18357. t.tilde = 333;
  18358. t.macron = 333;
  18359. t.breve = 333;
  18360. t.dotaccent = 333;
  18361. t.dieresis = 333;
  18362. t.ring = 333;
  18363. t.cedilla = 333;
  18364. t.hungarumlaut = 333;
  18365. t.ogonek = 333;
  18366. t.caron = 333;
  18367. t.emdash = 1000;
  18368. t.AE = 1000;
  18369. t.ordfeminine = 370;
  18370. t.Lslash = 556;
  18371. t.Oslash = 778;
  18372. t.OE = 1000;
  18373. t.ordmasculine = 365;
  18374. t.ae = 889;
  18375. t.dotlessi = 278;
  18376. t.lslash = 222;
  18377. t.oslash = 611;
  18378. t.oe = 944;
  18379. t.germandbls = 611;
  18380. t.Idieresis = 278;
  18381. t.eacute = 556;
  18382. t.abreve = 556;
  18383. t.uhungarumlaut = 556;
  18384. t.ecaron = 556;
  18385. t.Ydieresis = 667;
  18386. t.divide = 584;
  18387. t.Yacute = 667;
  18388. t.Acircumflex = 667;
  18389. t.aacute = 556;
  18390. t.Ucircumflex = 722;
  18391. t.yacute = 500;
  18392. t.scommaaccent = 500;
  18393. t.ecircumflex = 556;
  18394. t.Uring = 722;
  18395. t.Udieresis = 722;
  18396. t.aogonek = 556;
  18397. t.Uacute = 722;
  18398. t.uogonek = 556;
  18399. t.Edieresis = 667;
  18400. t.Dcroat = 722;
  18401. t.commaaccent = 250;
  18402. t.copyright = 737;
  18403. t.Emacron = 667;
  18404. t.ccaron = 500;
  18405. t.aring = 556;
  18406. t.Ncommaaccent = 722;
  18407. t.lacute = 222;
  18408. t.agrave = 556;
  18409. t.Tcommaaccent = 611;
  18410. t.Cacute = 722;
  18411. t.atilde = 556;
  18412. t.Edotaccent = 667;
  18413. t.scaron = 500;
  18414. t.scedilla = 500;
  18415. t.iacute = 278;
  18416. t.lozenge = 471;
  18417. t.Rcaron = 722;
  18418. t.Gcommaaccent = 778;
  18419. t.ucircumflex = 556;
  18420. t.acircumflex = 556;
  18421. t.Amacron = 667;
  18422. t.rcaron = 333;
  18423. t.ccedilla = 500;
  18424. t.Zdotaccent = 611;
  18425. t.Thorn = 667;
  18426. t.Omacron = 778;
  18427. t.Racute = 722;
  18428. t.Sacute = 667;
  18429. t.dcaron = 643;
  18430. t.Umacron = 722;
  18431. t.uring = 556;
  18432. t.threesuperior = 333;
  18433. t.Ograve = 778;
  18434. t.Agrave = 667;
  18435. t.Abreve = 667;
  18436. t.multiply = 584;
  18437. t.uacute = 556;
  18438. t.Tcaron = 611;
  18439. t.partialdiff = 476;
  18440. t.ydieresis = 500;
  18441. t.Nacute = 722;
  18442. t.icircumflex = 278;
  18443. t.Ecircumflex = 667;
  18444. t.adieresis = 556;
  18445. t.edieresis = 556;
  18446. t.cacute = 500;
  18447. t.nacute = 556;
  18448. t.umacron = 556;
  18449. t.Ncaron = 722;
  18450. t.Iacute = 278;
  18451. t.plusminus = 584;
  18452. t.brokenbar = 260;
  18453. t.registered = 737;
  18454. t.Gbreve = 778;
  18455. t.Idotaccent = 278;
  18456. t.summation = 600;
  18457. t.Egrave = 667;
  18458. t.racute = 333;
  18459. t.omacron = 556;
  18460. t.Zacute = 611;
  18461. t.Zcaron = 611;
  18462. t.greaterequal = 549;
  18463. t.Eth = 722;
  18464. t.Ccedilla = 722;
  18465. t.lcommaaccent = 222;
  18466. t.tcaron = 317;
  18467. t.eogonek = 556;
  18468. t.Uogonek = 722;
  18469. t.Aacute = 667;
  18470. t.Adieresis = 667;
  18471. t.egrave = 556;
  18472. t.zacute = 500;
  18473. t.iogonek = 222;
  18474. t.Oacute = 778;
  18475. t.oacute = 556;
  18476. t.amacron = 556;
  18477. t.sacute = 500;
  18478. t.idieresis = 278;
  18479. t.Ocircumflex = 778;
  18480. t.Ugrave = 722;
  18481. t.Delta = 612;
  18482. t.thorn = 556;
  18483. t.twosuperior = 333;
  18484. t.Odieresis = 778;
  18485. t.mu = 556;
  18486. t.igrave = 278;
  18487. t.ohungarumlaut = 556;
  18488. t.Eogonek = 667;
  18489. t.dcroat = 556;
  18490. t.threequarters = 834;
  18491. t.Scedilla = 667;
  18492. t.lcaron = 299;
  18493. t.Kcommaaccent = 667;
  18494. t.Lacute = 556;
  18495. t.trademark = 1000;
  18496. t.edotaccent = 556;
  18497. t.Igrave = 278;
  18498. t.Imacron = 278;
  18499. t.Lcaron = 556;
  18500. t.onehalf = 834;
  18501. t.lessequal = 549;
  18502. t.ocircumflex = 556;
  18503. t.ntilde = 556;
  18504. t.Uhungarumlaut = 722;
  18505. t.Eacute = 667;
  18506. t.emacron = 556;
  18507. t.gbreve = 556;
  18508. t.onequarter = 834;
  18509. t.Scaron = 667;
  18510. t.Scommaaccent = 667;
  18511. t.Ohungarumlaut = 778;
  18512. t.degree = 400;
  18513. t.ograve = 556;
  18514. t.Ccaron = 722;
  18515. t.ugrave = 556;
  18516. t.radical = 453;
  18517. t.Dcaron = 722;
  18518. t.rcommaaccent = 333;
  18519. t.Ntilde = 722;
  18520. t.otilde = 556;
  18521. t.Rcommaaccent = 722;
  18522. t.Lcommaaccent = 556;
  18523. t.Atilde = 667;
  18524. t.Aogonek = 667;
  18525. t.Aring = 667;
  18526. t.Otilde = 778;
  18527. t.zdotaccent = 500;
  18528. t.Ecaron = 667;
  18529. t.Iogonek = 278;
  18530. t.kcommaaccent = 500;
  18531. t.minus = 584;
  18532. t.Icircumflex = 278;
  18533. t.ncaron = 556;
  18534. t.tcommaaccent = 278;
  18535. t.logicalnot = 584;
  18536. t.odieresis = 556;
  18537. t.udieresis = 556;
  18538. t.notequal = 549;
  18539. t.gcommaaccent = 556;
  18540. t.eth = 556;
  18541. t.zcaron = 500;
  18542. t.ncommaaccent = 556;
  18543. t.onesuperior = 333;
  18544. t.imacron = 278;
  18545. t.Euro = 556;
  18546. });
  18547. t["Helvetica-Bold"] = getLookupTableFactory(function (t) {
  18548. t.space = 278;
  18549. t.exclam = 333;
  18550. t.quotedbl = 474;
  18551. t.numbersign = 556;
  18552. t.dollar = 556;
  18553. t.percent = 889;
  18554. t.ampersand = 722;
  18555. t.quoteright = 278;
  18556. t.parenleft = 333;
  18557. t.parenright = 333;
  18558. t.asterisk = 389;
  18559. t.plus = 584;
  18560. t.comma = 278;
  18561. t.hyphen = 333;
  18562. t.period = 278;
  18563. t.slash = 278;
  18564. t.zero = 556;
  18565. t.one = 556;
  18566. t.two = 556;
  18567. t.three = 556;
  18568. t.four = 556;
  18569. t.five = 556;
  18570. t.six = 556;
  18571. t.seven = 556;
  18572. t.eight = 556;
  18573. t.nine = 556;
  18574. t.colon = 333;
  18575. t.semicolon = 333;
  18576. t.less = 584;
  18577. t.equal = 584;
  18578. t.greater = 584;
  18579. t.question = 611;
  18580. t.at = 975;
  18581. t.A = 722;
  18582. t.B = 722;
  18583. t.C = 722;
  18584. t.D = 722;
  18585. t.E = 667;
  18586. t.F = 611;
  18587. t.G = 778;
  18588. t.H = 722;
  18589. t.I = 278;
  18590. t.J = 556;
  18591. t.K = 722;
  18592. t.L = 611;
  18593. t.M = 833;
  18594. t.N = 722;
  18595. t.O = 778;
  18596. t.P = 667;
  18597. t.Q = 778;
  18598. t.R = 722;
  18599. t.S = 667;
  18600. t.T = 611;
  18601. t.U = 722;
  18602. t.V = 667;
  18603. t.W = 944;
  18604. t.X = 667;
  18605. t.Y = 667;
  18606. t.Z = 611;
  18607. t.bracketleft = 333;
  18608. t.backslash = 278;
  18609. t.bracketright = 333;
  18610. t.asciicircum = 584;
  18611. t.underscore = 556;
  18612. t.quoteleft = 278;
  18613. t.a = 556;
  18614. t.b = 611;
  18615. t.c = 556;
  18616. t.d = 611;
  18617. t.e = 556;
  18618. t.f = 333;
  18619. t.g = 611;
  18620. t.h = 611;
  18621. t.i = 278;
  18622. t.j = 278;
  18623. t.k = 556;
  18624. t.l = 278;
  18625. t.m = 889;
  18626. t.n = 611;
  18627. t.o = 611;
  18628. t.p = 611;
  18629. t.q = 611;
  18630. t.r = 389;
  18631. t.s = 556;
  18632. t.t = 333;
  18633. t.u = 611;
  18634. t.v = 556;
  18635. t.w = 778;
  18636. t.x = 556;
  18637. t.y = 556;
  18638. t.z = 500;
  18639. t.braceleft = 389;
  18640. t.bar = 280;
  18641. t.braceright = 389;
  18642. t.asciitilde = 584;
  18643. t.exclamdown = 333;
  18644. t.cent = 556;
  18645. t.sterling = 556;
  18646. t.fraction = 167;
  18647. t.yen = 556;
  18648. t.florin = 556;
  18649. t.section = 556;
  18650. t.currency = 556;
  18651. t.quotesingle = 238;
  18652. t.quotedblleft = 500;
  18653. t.guillemotleft = 556;
  18654. t.guilsinglleft = 333;
  18655. t.guilsinglright = 333;
  18656. t.fi = 611;
  18657. t.fl = 611;
  18658. t.endash = 556;
  18659. t.dagger = 556;
  18660. t.daggerdbl = 556;
  18661. t.periodcentered = 278;
  18662. t.paragraph = 556;
  18663. t.bullet = 350;
  18664. t.quotesinglbase = 278;
  18665. t.quotedblbase = 500;
  18666. t.quotedblright = 500;
  18667. t.guillemotright = 556;
  18668. t.ellipsis = 1000;
  18669. t.perthousand = 1000;
  18670. t.questiondown = 611;
  18671. t.grave = 333;
  18672. t.acute = 333;
  18673. t.circumflex = 333;
  18674. t.tilde = 333;
  18675. t.macron = 333;
  18676. t.breve = 333;
  18677. t.dotaccent = 333;
  18678. t.dieresis = 333;
  18679. t.ring = 333;
  18680. t.cedilla = 333;
  18681. t.hungarumlaut = 333;
  18682. t.ogonek = 333;
  18683. t.caron = 333;
  18684. t.emdash = 1000;
  18685. t.AE = 1000;
  18686. t.ordfeminine = 370;
  18687. t.Lslash = 611;
  18688. t.Oslash = 778;
  18689. t.OE = 1000;
  18690. t.ordmasculine = 365;
  18691. t.ae = 889;
  18692. t.dotlessi = 278;
  18693. t.lslash = 278;
  18694. t.oslash = 611;
  18695. t.oe = 944;
  18696. t.germandbls = 611;
  18697. t.Idieresis = 278;
  18698. t.eacute = 556;
  18699. t.abreve = 556;
  18700. t.uhungarumlaut = 611;
  18701. t.ecaron = 556;
  18702. t.Ydieresis = 667;
  18703. t.divide = 584;
  18704. t.Yacute = 667;
  18705. t.Acircumflex = 722;
  18706. t.aacute = 556;
  18707. t.Ucircumflex = 722;
  18708. t.yacute = 556;
  18709. t.scommaaccent = 556;
  18710. t.ecircumflex = 556;
  18711. t.Uring = 722;
  18712. t.Udieresis = 722;
  18713. t.aogonek = 556;
  18714. t.Uacute = 722;
  18715. t.uogonek = 611;
  18716. t.Edieresis = 667;
  18717. t.Dcroat = 722;
  18718. t.commaaccent = 250;
  18719. t.copyright = 737;
  18720. t.Emacron = 667;
  18721. t.ccaron = 556;
  18722. t.aring = 556;
  18723. t.Ncommaaccent = 722;
  18724. t.lacute = 278;
  18725. t.agrave = 556;
  18726. t.Tcommaaccent = 611;
  18727. t.Cacute = 722;
  18728. t.atilde = 556;
  18729. t.Edotaccent = 667;
  18730. t.scaron = 556;
  18731. t.scedilla = 556;
  18732. t.iacute = 278;
  18733. t.lozenge = 494;
  18734. t.Rcaron = 722;
  18735. t.Gcommaaccent = 778;
  18736. t.ucircumflex = 611;
  18737. t.acircumflex = 556;
  18738. t.Amacron = 722;
  18739. t.rcaron = 389;
  18740. t.ccedilla = 556;
  18741. t.Zdotaccent = 611;
  18742. t.Thorn = 667;
  18743. t.Omacron = 778;
  18744. t.Racute = 722;
  18745. t.Sacute = 667;
  18746. t.dcaron = 743;
  18747. t.Umacron = 722;
  18748. t.uring = 611;
  18749. t.threesuperior = 333;
  18750. t.Ograve = 778;
  18751. t.Agrave = 722;
  18752. t.Abreve = 722;
  18753. t.multiply = 584;
  18754. t.uacute = 611;
  18755. t.Tcaron = 611;
  18756. t.partialdiff = 494;
  18757. t.ydieresis = 556;
  18758. t.Nacute = 722;
  18759. t.icircumflex = 278;
  18760. t.Ecircumflex = 667;
  18761. t.adieresis = 556;
  18762. t.edieresis = 556;
  18763. t.cacute = 556;
  18764. t.nacute = 611;
  18765. t.umacron = 611;
  18766. t.Ncaron = 722;
  18767. t.Iacute = 278;
  18768. t.plusminus = 584;
  18769. t.brokenbar = 280;
  18770. t.registered = 737;
  18771. t.Gbreve = 778;
  18772. t.Idotaccent = 278;
  18773. t.summation = 600;
  18774. t.Egrave = 667;
  18775. t.racute = 389;
  18776. t.omacron = 611;
  18777. t.Zacute = 611;
  18778. t.Zcaron = 611;
  18779. t.greaterequal = 549;
  18780. t.Eth = 722;
  18781. t.Ccedilla = 722;
  18782. t.lcommaaccent = 278;
  18783. t.tcaron = 389;
  18784. t.eogonek = 556;
  18785. t.Uogonek = 722;
  18786. t.Aacute = 722;
  18787. t.Adieresis = 722;
  18788. t.egrave = 556;
  18789. t.zacute = 500;
  18790. t.iogonek = 278;
  18791. t.Oacute = 778;
  18792. t.oacute = 611;
  18793. t.amacron = 556;
  18794. t.sacute = 556;
  18795. t.idieresis = 278;
  18796. t.Ocircumflex = 778;
  18797. t.Ugrave = 722;
  18798. t.Delta = 612;
  18799. t.thorn = 611;
  18800. t.twosuperior = 333;
  18801. t.Odieresis = 778;
  18802. t.mu = 611;
  18803. t.igrave = 278;
  18804. t.ohungarumlaut = 611;
  18805. t.Eogonek = 667;
  18806. t.dcroat = 611;
  18807. t.threequarters = 834;
  18808. t.Scedilla = 667;
  18809. t.lcaron = 400;
  18810. t.Kcommaaccent = 722;
  18811. t.Lacute = 611;
  18812. t.trademark = 1000;
  18813. t.edotaccent = 556;
  18814. t.Igrave = 278;
  18815. t.Imacron = 278;
  18816. t.Lcaron = 611;
  18817. t.onehalf = 834;
  18818. t.lessequal = 549;
  18819. t.ocircumflex = 611;
  18820. t.ntilde = 611;
  18821. t.Uhungarumlaut = 722;
  18822. t.Eacute = 667;
  18823. t.emacron = 556;
  18824. t.gbreve = 611;
  18825. t.onequarter = 834;
  18826. t.Scaron = 667;
  18827. t.Scommaaccent = 667;
  18828. t.Ohungarumlaut = 778;
  18829. t.degree = 400;
  18830. t.ograve = 611;
  18831. t.Ccaron = 722;
  18832. t.ugrave = 611;
  18833. t.radical = 549;
  18834. t.Dcaron = 722;
  18835. t.rcommaaccent = 389;
  18836. t.Ntilde = 722;
  18837. t.otilde = 611;
  18838. t.Rcommaaccent = 722;
  18839. t.Lcommaaccent = 611;
  18840. t.Atilde = 722;
  18841. t.Aogonek = 722;
  18842. t.Aring = 722;
  18843. t.Otilde = 778;
  18844. t.zdotaccent = 500;
  18845. t.Ecaron = 667;
  18846. t.Iogonek = 278;
  18847. t.kcommaaccent = 556;
  18848. t.minus = 584;
  18849. t.Icircumflex = 278;
  18850. t.ncaron = 611;
  18851. t.tcommaaccent = 333;
  18852. t.logicalnot = 584;
  18853. t.odieresis = 611;
  18854. t.udieresis = 611;
  18855. t.notequal = 549;
  18856. t.gcommaaccent = 611;
  18857. t.eth = 611;
  18858. t.zcaron = 500;
  18859. t.ncommaaccent = 611;
  18860. t.onesuperior = 333;
  18861. t.imacron = 278;
  18862. t.Euro = 556;
  18863. });
  18864. t["Helvetica-BoldOblique"] = getLookupTableFactory(function (t) {
  18865. t.space = 278;
  18866. t.exclam = 333;
  18867. t.quotedbl = 474;
  18868. t.numbersign = 556;
  18869. t.dollar = 556;
  18870. t.percent = 889;
  18871. t.ampersand = 722;
  18872. t.quoteright = 278;
  18873. t.parenleft = 333;
  18874. t.parenright = 333;
  18875. t.asterisk = 389;
  18876. t.plus = 584;
  18877. t.comma = 278;
  18878. t.hyphen = 333;
  18879. t.period = 278;
  18880. t.slash = 278;
  18881. t.zero = 556;
  18882. t.one = 556;
  18883. t.two = 556;
  18884. t.three = 556;
  18885. t.four = 556;
  18886. t.five = 556;
  18887. t.six = 556;
  18888. t.seven = 556;
  18889. t.eight = 556;
  18890. t.nine = 556;
  18891. t.colon = 333;
  18892. t.semicolon = 333;
  18893. t.less = 584;
  18894. t.equal = 584;
  18895. t.greater = 584;
  18896. t.question = 611;
  18897. t.at = 975;
  18898. t.A = 722;
  18899. t.B = 722;
  18900. t.C = 722;
  18901. t.D = 722;
  18902. t.E = 667;
  18903. t.F = 611;
  18904. t.G = 778;
  18905. t.H = 722;
  18906. t.I = 278;
  18907. t.J = 556;
  18908. t.K = 722;
  18909. t.L = 611;
  18910. t.M = 833;
  18911. t.N = 722;
  18912. t.O = 778;
  18913. t.P = 667;
  18914. t.Q = 778;
  18915. t.R = 722;
  18916. t.S = 667;
  18917. t.T = 611;
  18918. t.U = 722;
  18919. t.V = 667;
  18920. t.W = 944;
  18921. t.X = 667;
  18922. t.Y = 667;
  18923. t.Z = 611;
  18924. t.bracketleft = 333;
  18925. t.backslash = 278;
  18926. t.bracketright = 333;
  18927. t.asciicircum = 584;
  18928. t.underscore = 556;
  18929. t.quoteleft = 278;
  18930. t.a = 556;
  18931. t.b = 611;
  18932. t.c = 556;
  18933. t.d = 611;
  18934. t.e = 556;
  18935. t.f = 333;
  18936. t.g = 611;
  18937. t.h = 611;
  18938. t.i = 278;
  18939. t.j = 278;
  18940. t.k = 556;
  18941. t.l = 278;
  18942. t.m = 889;
  18943. t.n = 611;
  18944. t.o = 611;
  18945. t.p = 611;
  18946. t.q = 611;
  18947. t.r = 389;
  18948. t.s = 556;
  18949. t.t = 333;
  18950. t.u = 611;
  18951. t.v = 556;
  18952. t.w = 778;
  18953. t.x = 556;
  18954. t.y = 556;
  18955. t.z = 500;
  18956. t.braceleft = 389;
  18957. t.bar = 280;
  18958. t.braceright = 389;
  18959. t.asciitilde = 584;
  18960. t.exclamdown = 333;
  18961. t.cent = 556;
  18962. t.sterling = 556;
  18963. t.fraction = 167;
  18964. t.yen = 556;
  18965. t.florin = 556;
  18966. t.section = 556;
  18967. t.currency = 556;
  18968. t.quotesingle = 238;
  18969. t.quotedblleft = 500;
  18970. t.guillemotleft = 556;
  18971. t.guilsinglleft = 333;
  18972. t.guilsinglright = 333;
  18973. t.fi = 611;
  18974. t.fl = 611;
  18975. t.endash = 556;
  18976. t.dagger = 556;
  18977. t.daggerdbl = 556;
  18978. t.periodcentered = 278;
  18979. t.paragraph = 556;
  18980. t.bullet = 350;
  18981. t.quotesinglbase = 278;
  18982. t.quotedblbase = 500;
  18983. t.quotedblright = 500;
  18984. t.guillemotright = 556;
  18985. t.ellipsis = 1000;
  18986. t.perthousand = 1000;
  18987. t.questiondown = 611;
  18988. t.grave = 333;
  18989. t.acute = 333;
  18990. t.circumflex = 333;
  18991. t.tilde = 333;
  18992. t.macron = 333;
  18993. t.breve = 333;
  18994. t.dotaccent = 333;
  18995. t.dieresis = 333;
  18996. t.ring = 333;
  18997. t.cedilla = 333;
  18998. t.hungarumlaut = 333;
  18999. t.ogonek = 333;
  19000. t.caron = 333;
  19001. t.emdash = 1000;
  19002. t.AE = 1000;
  19003. t.ordfeminine = 370;
  19004. t.Lslash = 611;
  19005. t.Oslash = 778;
  19006. t.OE = 1000;
  19007. t.ordmasculine = 365;
  19008. t.ae = 889;
  19009. t.dotlessi = 278;
  19010. t.lslash = 278;
  19011. t.oslash = 611;
  19012. t.oe = 944;
  19013. t.germandbls = 611;
  19014. t.Idieresis = 278;
  19015. t.eacute = 556;
  19016. t.abreve = 556;
  19017. t.uhungarumlaut = 611;
  19018. t.ecaron = 556;
  19019. t.Ydieresis = 667;
  19020. t.divide = 584;
  19021. t.Yacute = 667;
  19022. t.Acircumflex = 722;
  19023. t.aacute = 556;
  19024. t.Ucircumflex = 722;
  19025. t.yacute = 556;
  19026. t.scommaaccent = 556;
  19027. t.ecircumflex = 556;
  19028. t.Uring = 722;
  19029. t.Udieresis = 722;
  19030. t.aogonek = 556;
  19031. t.Uacute = 722;
  19032. t.uogonek = 611;
  19033. t.Edieresis = 667;
  19034. t.Dcroat = 722;
  19035. t.commaaccent = 250;
  19036. t.copyright = 737;
  19037. t.Emacron = 667;
  19038. t.ccaron = 556;
  19039. t.aring = 556;
  19040. t.Ncommaaccent = 722;
  19041. t.lacute = 278;
  19042. t.agrave = 556;
  19043. t.Tcommaaccent = 611;
  19044. t.Cacute = 722;
  19045. t.atilde = 556;
  19046. t.Edotaccent = 667;
  19047. t.scaron = 556;
  19048. t.scedilla = 556;
  19049. t.iacute = 278;
  19050. t.lozenge = 494;
  19051. t.Rcaron = 722;
  19052. t.Gcommaaccent = 778;
  19053. t.ucircumflex = 611;
  19054. t.acircumflex = 556;
  19055. t.Amacron = 722;
  19056. t.rcaron = 389;
  19057. t.ccedilla = 556;
  19058. t.Zdotaccent = 611;
  19059. t.Thorn = 667;
  19060. t.Omacron = 778;
  19061. t.Racute = 722;
  19062. t.Sacute = 667;
  19063. t.dcaron = 743;
  19064. t.Umacron = 722;
  19065. t.uring = 611;
  19066. t.threesuperior = 333;
  19067. t.Ograve = 778;
  19068. t.Agrave = 722;
  19069. t.Abreve = 722;
  19070. t.multiply = 584;
  19071. t.uacute = 611;
  19072. t.Tcaron = 611;
  19073. t.partialdiff = 494;
  19074. t.ydieresis = 556;
  19075. t.Nacute = 722;
  19076. t.icircumflex = 278;
  19077. t.Ecircumflex = 667;
  19078. t.adieresis = 556;
  19079. t.edieresis = 556;
  19080. t.cacute = 556;
  19081. t.nacute = 611;
  19082. t.umacron = 611;
  19083. t.Ncaron = 722;
  19084. t.Iacute = 278;
  19085. t.plusminus = 584;
  19086. t.brokenbar = 280;
  19087. t.registered = 737;
  19088. t.Gbreve = 778;
  19089. t.Idotaccent = 278;
  19090. t.summation = 600;
  19091. t.Egrave = 667;
  19092. t.racute = 389;
  19093. t.omacron = 611;
  19094. t.Zacute = 611;
  19095. t.Zcaron = 611;
  19096. t.greaterequal = 549;
  19097. t.Eth = 722;
  19098. t.Ccedilla = 722;
  19099. t.lcommaaccent = 278;
  19100. t.tcaron = 389;
  19101. t.eogonek = 556;
  19102. t.Uogonek = 722;
  19103. t.Aacute = 722;
  19104. t.Adieresis = 722;
  19105. t.egrave = 556;
  19106. t.zacute = 500;
  19107. t.iogonek = 278;
  19108. t.Oacute = 778;
  19109. t.oacute = 611;
  19110. t.amacron = 556;
  19111. t.sacute = 556;
  19112. t.idieresis = 278;
  19113. t.Ocircumflex = 778;
  19114. t.Ugrave = 722;
  19115. t.Delta = 612;
  19116. t.thorn = 611;
  19117. t.twosuperior = 333;
  19118. t.Odieresis = 778;
  19119. t.mu = 611;
  19120. t.igrave = 278;
  19121. t.ohungarumlaut = 611;
  19122. t.Eogonek = 667;
  19123. t.dcroat = 611;
  19124. t.threequarters = 834;
  19125. t.Scedilla = 667;
  19126. t.lcaron = 400;
  19127. t.Kcommaaccent = 722;
  19128. t.Lacute = 611;
  19129. t.trademark = 1000;
  19130. t.edotaccent = 556;
  19131. t.Igrave = 278;
  19132. t.Imacron = 278;
  19133. t.Lcaron = 611;
  19134. t.onehalf = 834;
  19135. t.lessequal = 549;
  19136. t.ocircumflex = 611;
  19137. t.ntilde = 611;
  19138. t.Uhungarumlaut = 722;
  19139. t.Eacute = 667;
  19140. t.emacron = 556;
  19141. t.gbreve = 611;
  19142. t.onequarter = 834;
  19143. t.Scaron = 667;
  19144. t.Scommaaccent = 667;
  19145. t.Ohungarumlaut = 778;
  19146. t.degree = 400;
  19147. t.ograve = 611;
  19148. t.Ccaron = 722;
  19149. t.ugrave = 611;
  19150. t.radical = 549;
  19151. t.Dcaron = 722;
  19152. t.rcommaaccent = 389;
  19153. t.Ntilde = 722;
  19154. t.otilde = 611;
  19155. t.Rcommaaccent = 722;
  19156. t.Lcommaaccent = 611;
  19157. t.Atilde = 722;
  19158. t.Aogonek = 722;
  19159. t.Aring = 722;
  19160. t.Otilde = 778;
  19161. t.zdotaccent = 500;
  19162. t.Ecaron = 667;
  19163. t.Iogonek = 278;
  19164. t.kcommaaccent = 556;
  19165. t.minus = 584;
  19166. t.Icircumflex = 278;
  19167. t.ncaron = 611;
  19168. t.tcommaaccent = 333;
  19169. t.logicalnot = 584;
  19170. t.odieresis = 611;
  19171. t.udieresis = 611;
  19172. t.notequal = 549;
  19173. t.gcommaaccent = 611;
  19174. t.eth = 611;
  19175. t.zcaron = 500;
  19176. t.ncommaaccent = 611;
  19177. t.onesuperior = 333;
  19178. t.imacron = 278;
  19179. t.Euro = 556;
  19180. });
  19181. t["Helvetica-Oblique"] = getLookupTableFactory(function (t) {
  19182. t.space = 278;
  19183. t.exclam = 278;
  19184. t.quotedbl = 355;
  19185. t.numbersign = 556;
  19186. t.dollar = 556;
  19187. t.percent = 889;
  19188. t.ampersand = 667;
  19189. t.quoteright = 222;
  19190. t.parenleft = 333;
  19191. t.parenright = 333;
  19192. t.asterisk = 389;
  19193. t.plus = 584;
  19194. t.comma = 278;
  19195. t.hyphen = 333;
  19196. t.period = 278;
  19197. t.slash = 278;
  19198. t.zero = 556;
  19199. t.one = 556;
  19200. t.two = 556;
  19201. t.three = 556;
  19202. t.four = 556;
  19203. t.five = 556;
  19204. t.six = 556;
  19205. t.seven = 556;
  19206. t.eight = 556;
  19207. t.nine = 556;
  19208. t.colon = 278;
  19209. t.semicolon = 278;
  19210. t.less = 584;
  19211. t.equal = 584;
  19212. t.greater = 584;
  19213. t.question = 556;
  19214. t.at = 1015;
  19215. t.A = 667;
  19216. t.B = 667;
  19217. t.C = 722;
  19218. t.D = 722;
  19219. t.E = 667;
  19220. t.F = 611;
  19221. t.G = 778;
  19222. t.H = 722;
  19223. t.I = 278;
  19224. t.J = 500;
  19225. t.K = 667;
  19226. t.L = 556;
  19227. t.M = 833;
  19228. t.N = 722;
  19229. t.O = 778;
  19230. t.P = 667;
  19231. t.Q = 778;
  19232. t.R = 722;
  19233. t.S = 667;
  19234. t.T = 611;
  19235. t.U = 722;
  19236. t.V = 667;
  19237. t.W = 944;
  19238. t.X = 667;
  19239. t.Y = 667;
  19240. t.Z = 611;
  19241. t.bracketleft = 278;
  19242. t.backslash = 278;
  19243. t.bracketright = 278;
  19244. t.asciicircum = 469;
  19245. t.underscore = 556;
  19246. t.quoteleft = 222;
  19247. t.a = 556;
  19248. t.b = 556;
  19249. t.c = 500;
  19250. t.d = 556;
  19251. t.e = 556;
  19252. t.f = 278;
  19253. t.g = 556;
  19254. t.h = 556;
  19255. t.i = 222;
  19256. t.j = 222;
  19257. t.k = 500;
  19258. t.l = 222;
  19259. t.m = 833;
  19260. t.n = 556;
  19261. t.o = 556;
  19262. t.p = 556;
  19263. t.q = 556;
  19264. t.r = 333;
  19265. t.s = 500;
  19266. t.t = 278;
  19267. t.u = 556;
  19268. t.v = 500;
  19269. t.w = 722;
  19270. t.x = 500;
  19271. t.y = 500;
  19272. t.z = 500;
  19273. t.braceleft = 334;
  19274. t.bar = 260;
  19275. t.braceright = 334;
  19276. t.asciitilde = 584;
  19277. t.exclamdown = 333;
  19278. t.cent = 556;
  19279. t.sterling = 556;
  19280. t.fraction = 167;
  19281. t.yen = 556;
  19282. t.florin = 556;
  19283. t.section = 556;
  19284. t.currency = 556;
  19285. t.quotesingle = 191;
  19286. t.quotedblleft = 333;
  19287. t.guillemotleft = 556;
  19288. t.guilsinglleft = 333;
  19289. t.guilsinglright = 333;
  19290. t.fi = 500;
  19291. t.fl = 500;
  19292. t.endash = 556;
  19293. t.dagger = 556;
  19294. t.daggerdbl = 556;
  19295. t.periodcentered = 278;
  19296. t.paragraph = 537;
  19297. t.bullet = 350;
  19298. t.quotesinglbase = 222;
  19299. t.quotedblbase = 333;
  19300. t.quotedblright = 333;
  19301. t.guillemotright = 556;
  19302. t.ellipsis = 1000;
  19303. t.perthousand = 1000;
  19304. t.questiondown = 611;
  19305. t.grave = 333;
  19306. t.acute = 333;
  19307. t.circumflex = 333;
  19308. t.tilde = 333;
  19309. t.macron = 333;
  19310. t.breve = 333;
  19311. t.dotaccent = 333;
  19312. t.dieresis = 333;
  19313. t.ring = 333;
  19314. t.cedilla = 333;
  19315. t.hungarumlaut = 333;
  19316. t.ogonek = 333;
  19317. t.caron = 333;
  19318. t.emdash = 1000;
  19319. t.AE = 1000;
  19320. t.ordfeminine = 370;
  19321. t.Lslash = 556;
  19322. t.Oslash = 778;
  19323. t.OE = 1000;
  19324. t.ordmasculine = 365;
  19325. t.ae = 889;
  19326. t.dotlessi = 278;
  19327. t.lslash = 222;
  19328. t.oslash = 611;
  19329. t.oe = 944;
  19330. t.germandbls = 611;
  19331. t.Idieresis = 278;
  19332. t.eacute = 556;
  19333. t.abreve = 556;
  19334. t.uhungarumlaut = 556;
  19335. t.ecaron = 556;
  19336. t.Ydieresis = 667;
  19337. t.divide = 584;
  19338. t.Yacute = 667;
  19339. t.Acircumflex = 667;
  19340. t.aacute = 556;
  19341. t.Ucircumflex = 722;
  19342. t.yacute = 500;
  19343. t.scommaaccent = 500;
  19344. t.ecircumflex = 556;
  19345. t.Uring = 722;
  19346. t.Udieresis = 722;
  19347. t.aogonek = 556;
  19348. t.Uacute = 722;
  19349. t.uogonek = 556;
  19350. t.Edieresis = 667;
  19351. t.Dcroat = 722;
  19352. t.commaaccent = 250;
  19353. t.copyright = 737;
  19354. t.Emacron = 667;
  19355. t.ccaron = 500;
  19356. t.aring = 556;
  19357. t.Ncommaaccent = 722;
  19358. t.lacute = 222;
  19359. t.agrave = 556;
  19360. t.Tcommaaccent = 611;
  19361. t.Cacute = 722;
  19362. t.atilde = 556;
  19363. t.Edotaccent = 667;
  19364. t.scaron = 500;
  19365. t.scedilla = 500;
  19366. t.iacute = 278;
  19367. t.lozenge = 471;
  19368. t.Rcaron = 722;
  19369. t.Gcommaaccent = 778;
  19370. t.ucircumflex = 556;
  19371. t.acircumflex = 556;
  19372. t.Amacron = 667;
  19373. t.rcaron = 333;
  19374. t.ccedilla = 500;
  19375. t.Zdotaccent = 611;
  19376. t.Thorn = 667;
  19377. t.Omacron = 778;
  19378. t.Racute = 722;
  19379. t.Sacute = 667;
  19380. t.dcaron = 643;
  19381. t.Umacron = 722;
  19382. t.uring = 556;
  19383. t.threesuperior = 333;
  19384. t.Ograve = 778;
  19385. t.Agrave = 667;
  19386. t.Abreve = 667;
  19387. t.multiply = 584;
  19388. t.uacute = 556;
  19389. t.Tcaron = 611;
  19390. t.partialdiff = 476;
  19391. t.ydieresis = 500;
  19392. t.Nacute = 722;
  19393. t.icircumflex = 278;
  19394. t.Ecircumflex = 667;
  19395. t.adieresis = 556;
  19396. t.edieresis = 556;
  19397. t.cacute = 500;
  19398. t.nacute = 556;
  19399. t.umacron = 556;
  19400. t.Ncaron = 722;
  19401. t.Iacute = 278;
  19402. t.plusminus = 584;
  19403. t.brokenbar = 260;
  19404. t.registered = 737;
  19405. t.Gbreve = 778;
  19406. t.Idotaccent = 278;
  19407. t.summation = 600;
  19408. t.Egrave = 667;
  19409. t.racute = 333;
  19410. t.omacron = 556;
  19411. t.Zacute = 611;
  19412. t.Zcaron = 611;
  19413. t.greaterequal = 549;
  19414. t.Eth = 722;
  19415. t.Ccedilla = 722;
  19416. t.lcommaaccent = 222;
  19417. t.tcaron = 317;
  19418. t.eogonek = 556;
  19419. t.Uogonek = 722;
  19420. t.Aacute = 667;
  19421. t.Adieresis = 667;
  19422. t.egrave = 556;
  19423. t.zacute = 500;
  19424. t.iogonek = 222;
  19425. t.Oacute = 778;
  19426. t.oacute = 556;
  19427. t.amacron = 556;
  19428. t.sacute = 500;
  19429. t.idieresis = 278;
  19430. t.Ocircumflex = 778;
  19431. t.Ugrave = 722;
  19432. t.Delta = 612;
  19433. t.thorn = 556;
  19434. t.twosuperior = 333;
  19435. t.Odieresis = 778;
  19436. t.mu = 556;
  19437. t.igrave = 278;
  19438. t.ohungarumlaut = 556;
  19439. t.Eogonek = 667;
  19440. t.dcroat = 556;
  19441. t.threequarters = 834;
  19442. t.Scedilla = 667;
  19443. t.lcaron = 299;
  19444. t.Kcommaaccent = 667;
  19445. t.Lacute = 556;
  19446. t.trademark = 1000;
  19447. t.edotaccent = 556;
  19448. t.Igrave = 278;
  19449. t.Imacron = 278;
  19450. t.Lcaron = 556;
  19451. t.onehalf = 834;
  19452. t.lessequal = 549;
  19453. t.ocircumflex = 556;
  19454. t.ntilde = 556;
  19455. t.Uhungarumlaut = 722;
  19456. t.Eacute = 667;
  19457. t.emacron = 556;
  19458. t.gbreve = 556;
  19459. t.onequarter = 834;
  19460. t.Scaron = 667;
  19461. t.Scommaaccent = 667;
  19462. t.Ohungarumlaut = 778;
  19463. t.degree = 400;
  19464. t.ograve = 556;
  19465. t.Ccaron = 722;
  19466. t.ugrave = 556;
  19467. t.radical = 453;
  19468. t.Dcaron = 722;
  19469. t.rcommaaccent = 333;
  19470. t.Ntilde = 722;
  19471. t.otilde = 556;
  19472. t.Rcommaaccent = 722;
  19473. t.Lcommaaccent = 556;
  19474. t.Atilde = 667;
  19475. t.Aogonek = 667;
  19476. t.Aring = 667;
  19477. t.Otilde = 778;
  19478. t.zdotaccent = 500;
  19479. t.Ecaron = 667;
  19480. t.Iogonek = 278;
  19481. t.kcommaaccent = 500;
  19482. t.minus = 584;
  19483. t.Icircumflex = 278;
  19484. t.ncaron = 556;
  19485. t.tcommaaccent = 278;
  19486. t.logicalnot = 584;
  19487. t.odieresis = 556;
  19488. t.udieresis = 556;
  19489. t.notequal = 549;
  19490. t.gcommaaccent = 556;
  19491. t.eth = 556;
  19492. t.zcaron = 500;
  19493. t.ncommaaccent = 556;
  19494. t.onesuperior = 333;
  19495. t.imacron = 278;
  19496. t.Euro = 556;
  19497. });
  19498. t.Symbol = getLookupTableFactory(function (t) {
  19499. t.space = 250;
  19500. t.exclam = 333;
  19501. t.universal = 713;
  19502. t.numbersign = 500;
  19503. t.existential = 549;
  19504. t.percent = 833;
  19505. t.ampersand = 778;
  19506. t.suchthat = 439;
  19507. t.parenleft = 333;
  19508. t.parenright = 333;
  19509. t.asteriskmath = 500;
  19510. t.plus = 549;
  19511. t.comma = 250;
  19512. t.minus = 549;
  19513. t.period = 250;
  19514. t.slash = 278;
  19515. t.zero = 500;
  19516. t.one = 500;
  19517. t.two = 500;
  19518. t.three = 500;
  19519. t.four = 500;
  19520. t.five = 500;
  19521. t.six = 500;
  19522. t.seven = 500;
  19523. t.eight = 500;
  19524. t.nine = 500;
  19525. t.colon = 278;
  19526. t.semicolon = 278;
  19527. t.less = 549;
  19528. t.equal = 549;
  19529. t.greater = 549;
  19530. t.question = 444;
  19531. t.congruent = 549;
  19532. t.Alpha = 722;
  19533. t.Beta = 667;
  19534. t.Chi = 722;
  19535. t.Delta = 612;
  19536. t.Epsilon = 611;
  19537. t.Phi = 763;
  19538. t.Gamma = 603;
  19539. t.Eta = 722;
  19540. t.Iota = 333;
  19541. t.theta1 = 631;
  19542. t.Kappa = 722;
  19543. t.Lambda = 686;
  19544. t.Mu = 889;
  19545. t.Nu = 722;
  19546. t.Omicron = 722;
  19547. t.Pi = 768;
  19548. t.Theta = 741;
  19549. t.Rho = 556;
  19550. t.Sigma = 592;
  19551. t.Tau = 611;
  19552. t.Upsilon = 690;
  19553. t.sigma1 = 439;
  19554. t.Omega = 768;
  19555. t.Xi = 645;
  19556. t.Psi = 795;
  19557. t.Zeta = 611;
  19558. t.bracketleft = 333;
  19559. t.therefore = 863;
  19560. t.bracketright = 333;
  19561. t.perpendicular = 658;
  19562. t.underscore = 500;
  19563. t.radicalex = 500;
  19564. t.alpha = 631;
  19565. t.beta = 549;
  19566. t.chi = 549;
  19567. t.delta = 494;
  19568. t.epsilon = 439;
  19569. t.phi = 521;
  19570. t.gamma = 411;
  19571. t.eta = 603;
  19572. t.iota = 329;
  19573. t.phi1 = 603;
  19574. t.kappa = 549;
  19575. t.lambda = 549;
  19576. t.mu = 576;
  19577. t.nu = 521;
  19578. t.omicron = 549;
  19579. t.pi = 549;
  19580. t.theta = 521;
  19581. t.rho = 549;
  19582. t.sigma = 603;
  19583. t.tau = 439;
  19584. t.upsilon = 576;
  19585. t.omega1 = 713;
  19586. t.omega = 686;
  19587. t.xi = 493;
  19588. t.psi = 686;
  19589. t.zeta = 494;
  19590. t.braceleft = 480;
  19591. t.bar = 200;
  19592. t.braceright = 480;
  19593. t.similar = 549;
  19594. t.Euro = 750;
  19595. t.Upsilon1 = 620;
  19596. t.minute = 247;
  19597. t.lessequal = 549;
  19598. t.fraction = 167;
  19599. t.infinity = 713;
  19600. t.florin = 500;
  19601. t.club = 753;
  19602. t.diamond = 753;
  19603. t.heart = 753;
  19604. t.spade = 753;
  19605. t.arrowboth = 1042;
  19606. t.arrowleft = 987;
  19607. t.arrowup = 603;
  19608. t.arrowright = 987;
  19609. t.arrowdown = 603;
  19610. t.degree = 400;
  19611. t.plusminus = 549;
  19612. t.second = 411;
  19613. t.greaterequal = 549;
  19614. t.multiply = 549;
  19615. t.proportional = 713;
  19616. t.partialdiff = 494;
  19617. t.bullet = 460;
  19618. t.divide = 549;
  19619. t.notequal = 549;
  19620. t.equivalence = 549;
  19621. t.approxequal = 549;
  19622. t.ellipsis = 1000;
  19623. t.arrowvertex = 603;
  19624. t.arrowhorizex = 1000;
  19625. t.carriagereturn = 658;
  19626. t.aleph = 823;
  19627. t.Ifraktur = 686;
  19628. t.Rfraktur = 795;
  19629. t.weierstrass = 987;
  19630. t.circlemultiply = 768;
  19631. t.circleplus = 768;
  19632. t.emptyset = 823;
  19633. t.intersection = 768;
  19634. t.union = 768;
  19635. t.propersuperset = 713;
  19636. t.reflexsuperset = 713;
  19637. t.notsubset = 713;
  19638. t.propersubset = 713;
  19639. t.reflexsubset = 713;
  19640. t.element = 713;
  19641. t.notelement = 713;
  19642. t.angle = 768;
  19643. t.gradient = 713;
  19644. t.registerserif = 790;
  19645. t.copyrightserif = 790;
  19646. t.trademarkserif = 890;
  19647. t.product = 823;
  19648. t.radical = 549;
  19649. t.dotmath = 250;
  19650. t.logicalnot = 713;
  19651. t.logicaland = 603;
  19652. t.logicalor = 603;
  19653. t.arrowdblboth = 1042;
  19654. t.arrowdblleft = 987;
  19655. t.arrowdblup = 603;
  19656. t.arrowdblright = 987;
  19657. t.arrowdbldown = 603;
  19658. t.lozenge = 494;
  19659. t.angleleft = 329;
  19660. t.registersans = 790;
  19661. t.copyrightsans = 790;
  19662. t.trademarksans = 786;
  19663. t.summation = 713;
  19664. t.parenlefttp = 384;
  19665. t.parenleftex = 384;
  19666. t.parenleftbt = 384;
  19667. t.bracketlefttp = 384;
  19668. t.bracketleftex = 384;
  19669. t.bracketleftbt = 384;
  19670. t.bracelefttp = 494;
  19671. t.braceleftmid = 494;
  19672. t.braceleftbt = 494;
  19673. t.braceex = 494;
  19674. t.angleright = 329;
  19675. t.integral = 274;
  19676. t.integraltp = 686;
  19677. t.integralex = 686;
  19678. t.integralbt = 686;
  19679. t.parenrighttp = 384;
  19680. t.parenrightex = 384;
  19681. t.parenrightbt = 384;
  19682. t.bracketrighttp = 384;
  19683. t.bracketrightex = 384;
  19684. t.bracketrightbt = 384;
  19685. t.bracerighttp = 494;
  19686. t.bracerightmid = 494;
  19687. t.bracerightbt = 494;
  19688. t.apple = 790;
  19689. });
  19690. t["Times-Roman"] = getLookupTableFactory(function (t) {
  19691. t.space = 250;
  19692. t.exclam = 333;
  19693. t.quotedbl = 408;
  19694. t.numbersign = 500;
  19695. t.dollar = 500;
  19696. t.percent = 833;
  19697. t.ampersand = 778;
  19698. t.quoteright = 333;
  19699. t.parenleft = 333;
  19700. t.parenright = 333;
  19701. t.asterisk = 500;
  19702. t.plus = 564;
  19703. t.comma = 250;
  19704. t.hyphen = 333;
  19705. t.period = 250;
  19706. t.slash = 278;
  19707. t.zero = 500;
  19708. t.one = 500;
  19709. t.two = 500;
  19710. t.three = 500;
  19711. t.four = 500;
  19712. t.five = 500;
  19713. t.six = 500;
  19714. t.seven = 500;
  19715. t.eight = 500;
  19716. t.nine = 500;
  19717. t.colon = 278;
  19718. t.semicolon = 278;
  19719. t.less = 564;
  19720. t.equal = 564;
  19721. t.greater = 564;
  19722. t.question = 444;
  19723. t.at = 921;
  19724. t.A = 722;
  19725. t.B = 667;
  19726. t.C = 667;
  19727. t.D = 722;
  19728. t.E = 611;
  19729. t.F = 556;
  19730. t.G = 722;
  19731. t.H = 722;
  19732. t.I = 333;
  19733. t.J = 389;
  19734. t.K = 722;
  19735. t.L = 611;
  19736. t.M = 889;
  19737. t.N = 722;
  19738. t.O = 722;
  19739. t.P = 556;
  19740. t.Q = 722;
  19741. t.R = 667;
  19742. t.S = 556;
  19743. t.T = 611;
  19744. t.U = 722;
  19745. t.V = 722;
  19746. t.W = 944;
  19747. t.X = 722;
  19748. t.Y = 722;
  19749. t.Z = 611;
  19750. t.bracketleft = 333;
  19751. t.backslash = 278;
  19752. t.bracketright = 333;
  19753. t.asciicircum = 469;
  19754. t.underscore = 500;
  19755. t.quoteleft = 333;
  19756. t.a = 444;
  19757. t.b = 500;
  19758. t.c = 444;
  19759. t.d = 500;
  19760. t.e = 444;
  19761. t.f = 333;
  19762. t.g = 500;
  19763. t.h = 500;
  19764. t.i = 278;
  19765. t.j = 278;
  19766. t.k = 500;
  19767. t.l = 278;
  19768. t.m = 778;
  19769. t.n = 500;
  19770. t.o = 500;
  19771. t.p = 500;
  19772. t.q = 500;
  19773. t.r = 333;
  19774. t.s = 389;
  19775. t.t = 278;
  19776. t.u = 500;
  19777. t.v = 500;
  19778. t.w = 722;
  19779. t.x = 500;
  19780. t.y = 500;
  19781. t.z = 444;
  19782. t.braceleft = 480;
  19783. t.bar = 200;
  19784. t.braceright = 480;
  19785. t.asciitilde = 541;
  19786. t.exclamdown = 333;
  19787. t.cent = 500;
  19788. t.sterling = 500;
  19789. t.fraction = 167;
  19790. t.yen = 500;
  19791. t.florin = 500;
  19792. t.section = 500;
  19793. t.currency = 500;
  19794. t.quotesingle = 180;
  19795. t.quotedblleft = 444;
  19796. t.guillemotleft = 500;
  19797. t.guilsinglleft = 333;
  19798. t.guilsinglright = 333;
  19799. t.fi = 556;
  19800. t.fl = 556;
  19801. t.endash = 500;
  19802. t.dagger = 500;
  19803. t.daggerdbl = 500;
  19804. t.periodcentered = 250;
  19805. t.paragraph = 453;
  19806. t.bullet = 350;
  19807. t.quotesinglbase = 333;
  19808. t.quotedblbase = 444;
  19809. t.quotedblright = 444;
  19810. t.guillemotright = 500;
  19811. t.ellipsis = 1000;
  19812. t.perthousand = 1000;
  19813. t.questiondown = 444;
  19814. t.grave = 333;
  19815. t.acute = 333;
  19816. t.circumflex = 333;
  19817. t.tilde = 333;
  19818. t.macron = 333;
  19819. t.breve = 333;
  19820. t.dotaccent = 333;
  19821. t.dieresis = 333;
  19822. t.ring = 333;
  19823. t.cedilla = 333;
  19824. t.hungarumlaut = 333;
  19825. t.ogonek = 333;
  19826. t.caron = 333;
  19827. t.emdash = 1000;
  19828. t.AE = 889;
  19829. t.ordfeminine = 276;
  19830. t.Lslash = 611;
  19831. t.Oslash = 722;
  19832. t.OE = 889;
  19833. t.ordmasculine = 310;
  19834. t.ae = 667;
  19835. t.dotlessi = 278;
  19836. t.lslash = 278;
  19837. t.oslash = 500;
  19838. t.oe = 722;
  19839. t.germandbls = 500;
  19840. t.Idieresis = 333;
  19841. t.eacute = 444;
  19842. t.abreve = 444;
  19843. t.uhungarumlaut = 500;
  19844. t.ecaron = 444;
  19845. t.Ydieresis = 722;
  19846. t.divide = 564;
  19847. t.Yacute = 722;
  19848. t.Acircumflex = 722;
  19849. t.aacute = 444;
  19850. t.Ucircumflex = 722;
  19851. t.yacute = 500;
  19852. t.scommaaccent = 389;
  19853. t.ecircumflex = 444;
  19854. t.Uring = 722;
  19855. t.Udieresis = 722;
  19856. t.aogonek = 444;
  19857. t.Uacute = 722;
  19858. t.uogonek = 500;
  19859. t.Edieresis = 611;
  19860. t.Dcroat = 722;
  19861. t.commaaccent = 250;
  19862. t.copyright = 760;
  19863. t.Emacron = 611;
  19864. t.ccaron = 444;
  19865. t.aring = 444;
  19866. t.Ncommaaccent = 722;
  19867. t.lacute = 278;
  19868. t.agrave = 444;
  19869. t.Tcommaaccent = 611;
  19870. t.Cacute = 667;
  19871. t.atilde = 444;
  19872. t.Edotaccent = 611;
  19873. t.scaron = 389;
  19874. t.scedilla = 389;
  19875. t.iacute = 278;
  19876. t.lozenge = 471;
  19877. t.Rcaron = 667;
  19878. t.Gcommaaccent = 722;
  19879. t.ucircumflex = 500;
  19880. t.acircumflex = 444;
  19881. t.Amacron = 722;
  19882. t.rcaron = 333;
  19883. t.ccedilla = 444;
  19884. t.Zdotaccent = 611;
  19885. t.Thorn = 556;
  19886. t.Omacron = 722;
  19887. t.Racute = 667;
  19888. t.Sacute = 556;
  19889. t.dcaron = 588;
  19890. t.Umacron = 722;
  19891. t.uring = 500;
  19892. t.threesuperior = 300;
  19893. t.Ograve = 722;
  19894. t.Agrave = 722;
  19895. t.Abreve = 722;
  19896. t.multiply = 564;
  19897. t.uacute = 500;
  19898. t.Tcaron = 611;
  19899. t.partialdiff = 476;
  19900. t.ydieresis = 500;
  19901. t.Nacute = 722;
  19902. t.icircumflex = 278;
  19903. t.Ecircumflex = 611;
  19904. t.adieresis = 444;
  19905. t.edieresis = 444;
  19906. t.cacute = 444;
  19907. t.nacute = 500;
  19908. t.umacron = 500;
  19909. t.Ncaron = 722;
  19910. t.Iacute = 333;
  19911. t.plusminus = 564;
  19912. t.brokenbar = 200;
  19913. t.registered = 760;
  19914. t.Gbreve = 722;
  19915. t.Idotaccent = 333;
  19916. t.summation = 600;
  19917. t.Egrave = 611;
  19918. t.racute = 333;
  19919. t.omacron = 500;
  19920. t.Zacute = 611;
  19921. t.Zcaron = 611;
  19922. t.greaterequal = 549;
  19923. t.Eth = 722;
  19924. t.Ccedilla = 667;
  19925. t.lcommaaccent = 278;
  19926. t.tcaron = 326;
  19927. t.eogonek = 444;
  19928. t.Uogonek = 722;
  19929. t.Aacute = 722;
  19930. t.Adieresis = 722;
  19931. t.egrave = 444;
  19932. t.zacute = 444;
  19933. t.iogonek = 278;
  19934. t.Oacute = 722;
  19935. t.oacute = 500;
  19936. t.amacron = 444;
  19937. t.sacute = 389;
  19938. t.idieresis = 278;
  19939. t.Ocircumflex = 722;
  19940. t.Ugrave = 722;
  19941. t.Delta = 612;
  19942. t.thorn = 500;
  19943. t.twosuperior = 300;
  19944. t.Odieresis = 722;
  19945. t.mu = 500;
  19946. t.igrave = 278;
  19947. t.ohungarumlaut = 500;
  19948. t.Eogonek = 611;
  19949. t.dcroat = 500;
  19950. t.threequarters = 750;
  19951. t.Scedilla = 556;
  19952. t.lcaron = 344;
  19953. t.Kcommaaccent = 722;
  19954. t.Lacute = 611;
  19955. t.trademark = 980;
  19956. t.edotaccent = 444;
  19957. t.Igrave = 333;
  19958. t.Imacron = 333;
  19959. t.Lcaron = 611;
  19960. t.onehalf = 750;
  19961. t.lessequal = 549;
  19962. t.ocircumflex = 500;
  19963. t.ntilde = 500;
  19964. t.Uhungarumlaut = 722;
  19965. t.Eacute = 611;
  19966. t.emacron = 444;
  19967. t.gbreve = 500;
  19968. t.onequarter = 750;
  19969. t.Scaron = 556;
  19970. t.Scommaaccent = 556;
  19971. t.Ohungarumlaut = 722;
  19972. t.degree = 400;
  19973. t.ograve = 500;
  19974. t.Ccaron = 667;
  19975. t.ugrave = 500;
  19976. t.radical = 453;
  19977. t.Dcaron = 722;
  19978. t.rcommaaccent = 333;
  19979. t.Ntilde = 722;
  19980. t.otilde = 500;
  19981. t.Rcommaaccent = 667;
  19982. t.Lcommaaccent = 611;
  19983. t.Atilde = 722;
  19984. t.Aogonek = 722;
  19985. t.Aring = 722;
  19986. t.Otilde = 722;
  19987. t.zdotaccent = 444;
  19988. t.Ecaron = 611;
  19989. t.Iogonek = 333;
  19990. t.kcommaaccent = 500;
  19991. t.minus = 564;
  19992. t.Icircumflex = 333;
  19993. t.ncaron = 500;
  19994. t.tcommaaccent = 278;
  19995. t.logicalnot = 564;
  19996. t.odieresis = 500;
  19997. t.udieresis = 500;
  19998. t.notequal = 549;
  19999. t.gcommaaccent = 500;
  20000. t.eth = 500;
  20001. t.zcaron = 444;
  20002. t.ncommaaccent = 500;
  20003. t.onesuperior = 300;
  20004. t.imacron = 278;
  20005. t.Euro = 500;
  20006. });
  20007. t["Times-Bold"] = getLookupTableFactory(function (t) {
  20008. t.space = 250;
  20009. t.exclam = 333;
  20010. t.quotedbl = 555;
  20011. t.numbersign = 500;
  20012. t.dollar = 500;
  20013. t.percent = 1000;
  20014. t.ampersand = 833;
  20015. t.quoteright = 333;
  20016. t.parenleft = 333;
  20017. t.parenright = 333;
  20018. t.asterisk = 500;
  20019. t.plus = 570;
  20020. t.comma = 250;
  20021. t.hyphen = 333;
  20022. t.period = 250;
  20023. t.slash = 278;
  20024. t.zero = 500;
  20025. t.one = 500;
  20026. t.two = 500;
  20027. t.three = 500;
  20028. t.four = 500;
  20029. t.five = 500;
  20030. t.six = 500;
  20031. t.seven = 500;
  20032. t.eight = 500;
  20033. t.nine = 500;
  20034. t.colon = 333;
  20035. t.semicolon = 333;
  20036. t.less = 570;
  20037. t.equal = 570;
  20038. t.greater = 570;
  20039. t.question = 500;
  20040. t.at = 930;
  20041. t.A = 722;
  20042. t.B = 667;
  20043. t.C = 722;
  20044. t.D = 722;
  20045. t.E = 667;
  20046. t.F = 611;
  20047. t.G = 778;
  20048. t.H = 778;
  20049. t.I = 389;
  20050. t.J = 500;
  20051. t.K = 778;
  20052. t.L = 667;
  20053. t.M = 944;
  20054. t.N = 722;
  20055. t.O = 778;
  20056. t.P = 611;
  20057. t.Q = 778;
  20058. t.R = 722;
  20059. t.S = 556;
  20060. t.T = 667;
  20061. t.U = 722;
  20062. t.V = 722;
  20063. t.W = 1000;
  20064. t.X = 722;
  20065. t.Y = 722;
  20066. t.Z = 667;
  20067. t.bracketleft = 333;
  20068. t.backslash = 278;
  20069. t.bracketright = 333;
  20070. t.asciicircum = 581;
  20071. t.underscore = 500;
  20072. t.quoteleft = 333;
  20073. t.a = 500;
  20074. t.b = 556;
  20075. t.c = 444;
  20076. t.d = 556;
  20077. t.e = 444;
  20078. t.f = 333;
  20079. t.g = 500;
  20080. t.h = 556;
  20081. t.i = 278;
  20082. t.j = 333;
  20083. t.k = 556;
  20084. t.l = 278;
  20085. t.m = 833;
  20086. t.n = 556;
  20087. t.o = 500;
  20088. t.p = 556;
  20089. t.q = 556;
  20090. t.r = 444;
  20091. t.s = 389;
  20092. t.t = 333;
  20093. t.u = 556;
  20094. t.v = 500;
  20095. t.w = 722;
  20096. t.x = 500;
  20097. t.y = 500;
  20098. t.z = 444;
  20099. t.braceleft = 394;
  20100. t.bar = 220;
  20101. t.braceright = 394;
  20102. t.asciitilde = 520;
  20103. t.exclamdown = 333;
  20104. t.cent = 500;
  20105. t.sterling = 500;
  20106. t.fraction = 167;
  20107. t.yen = 500;
  20108. t.florin = 500;
  20109. t.section = 500;
  20110. t.currency = 500;
  20111. t.quotesingle = 278;
  20112. t.quotedblleft = 500;
  20113. t.guillemotleft = 500;
  20114. t.guilsinglleft = 333;
  20115. t.guilsinglright = 333;
  20116. t.fi = 556;
  20117. t.fl = 556;
  20118. t.endash = 500;
  20119. t.dagger = 500;
  20120. t.daggerdbl = 500;
  20121. t.periodcentered = 250;
  20122. t.paragraph = 540;
  20123. t.bullet = 350;
  20124. t.quotesinglbase = 333;
  20125. t.quotedblbase = 500;
  20126. t.quotedblright = 500;
  20127. t.guillemotright = 500;
  20128. t.ellipsis = 1000;
  20129. t.perthousand = 1000;
  20130. t.questiondown = 500;
  20131. t.grave = 333;
  20132. t.acute = 333;
  20133. t.circumflex = 333;
  20134. t.tilde = 333;
  20135. t.macron = 333;
  20136. t.breve = 333;
  20137. t.dotaccent = 333;
  20138. t.dieresis = 333;
  20139. t.ring = 333;
  20140. t.cedilla = 333;
  20141. t.hungarumlaut = 333;
  20142. t.ogonek = 333;
  20143. t.caron = 333;
  20144. t.emdash = 1000;
  20145. t.AE = 1000;
  20146. t.ordfeminine = 300;
  20147. t.Lslash = 667;
  20148. t.Oslash = 778;
  20149. t.OE = 1000;
  20150. t.ordmasculine = 330;
  20151. t.ae = 722;
  20152. t.dotlessi = 278;
  20153. t.lslash = 278;
  20154. t.oslash = 500;
  20155. t.oe = 722;
  20156. t.germandbls = 556;
  20157. t.Idieresis = 389;
  20158. t.eacute = 444;
  20159. t.abreve = 500;
  20160. t.uhungarumlaut = 556;
  20161. t.ecaron = 444;
  20162. t.Ydieresis = 722;
  20163. t.divide = 570;
  20164. t.Yacute = 722;
  20165. t.Acircumflex = 722;
  20166. t.aacute = 500;
  20167. t.Ucircumflex = 722;
  20168. t.yacute = 500;
  20169. t.scommaaccent = 389;
  20170. t.ecircumflex = 444;
  20171. t.Uring = 722;
  20172. t.Udieresis = 722;
  20173. t.aogonek = 500;
  20174. t.Uacute = 722;
  20175. t.uogonek = 556;
  20176. t.Edieresis = 667;
  20177. t.Dcroat = 722;
  20178. t.commaaccent = 250;
  20179. t.copyright = 747;
  20180. t.Emacron = 667;
  20181. t.ccaron = 444;
  20182. t.aring = 500;
  20183. t.Ncommaaccent = 722;
  20184. t.lacute = 278;
  20185. t.agrave = 500;
  20186. t.Tcommaaccent = 667;
  20187. t.Cacute = 722;
  20188. t.atilde = 500;
  20189. t.Edotaccent = 667;
  20190. t.scaron = 389;
  20191. t.scedilla = 389;
  20192. t.iacute = 278;
  20193. t.lozenge = 494;
  20194. t.Rcaron = 722;
  20195. t.Gcommaaccent = 778;
  20196. t.ucircumflex = 556;
  20197. t.acircumflex = 500;
  20198. t.Amacron = 722;
  20199. t.rcaron = 444;
  20200. t.ccedilla = 444;
  20201. t.Zdotaccent = 667;
  20202. t.Thorn = 611;
  20203. t.Omacron = 778;
  20204. t.Racute = 722;
  20205. t.Sacute = 556;
  20206. t.dcaron = 672;
  20207. t.Umacron = 722;
  20208. t.uring = 556;
  20209. t.threesuperior = 300;
  20210. t.Ograve = 778;
  20211. t.Agrave = 722;
  20212. t.Abreve = 722;
  20213. t.multiply = 570;
  20214. t.uacute = 556;
  20215. t.Tcaron = 667;
  20216. t.partialdiff = 494;
  20217. t.ydieresis = 500;
  20218. t.Nacute = 722;
  20219. t.icircumflex = 278;
  20220. t.Ecircumflex = 667;
  20221. t.adieresis = 500;
  20222. t.edieresis = 444;
  20223. t.cacute = 444;
  20224. t.nacute = 556;
  20225. t.umacron = 556;
  20226. t.Ncaron = 722;
  20227. t.Iacute = 389;
  20228. t.plusminus = 570;
  20229. t.brokenbar = 220;
  20230. t.registered = 747;
  20231. t.Gbreve = 778;
  20232. t.Idotaccent = 389;
  20233. t.summation = 600;
  20234. t.Egrave = 667;
  20235. t.racute = 444;
  20236. t.omacron = 500;
  20237. t.Zacute = 667;
  20238. t.Zcaron = 667;
  20239. t.greaterequal = 549;
  20240. t.Eth = 722;
  20241. t.Ccedilla = 722;
  20242. t.lcommaaccent = 278;
  20243. t.tcaron = 416;
  20244. t.eogonek = 444;
  20245. t.Uogonek = 722;
  20246. t.Aacute = 722;
  20247. t.Adieresis = 722;
  20248. t.egrave = 444;
  20249. t.zacute = 444;
  20250. t.iogonek = 278;
  20251. t.Oacute = 778;
  20252. t.oacute = 500;
  20253. t.amacron = 500;
  20254. t.sacute = 389;
  20255. t.idieresis = 278;
  20256. t.Ocircumflex = 778;
  20257. t.Ugrave = 722;
  20258. t.Delta = 612;
  20259. t.thorn = 556;
  20260. t.twosuperior = 300;
  20261. t.Odieresis = 778;
  20262. t.mu = 556;
  20263. t.igrave = 278;
  20264. t.ohungarumlaut = 500;
  20265. t.Eogonek = 667;
  20266. t.dcroat = 556;
  20267. t.threequarters = 750;
  20268. t.Scedilla = 556;
  20269. t.lcaron = 394;
  20270. t.Kcommaaccent = 778;
  20271. t.Lacute = 667;
  20272. t.trademark = 1000;
  20273. t.edotaccent = 444;
  20274. t.Igrave = 389;
  20275. t.Imacron = 389;
  20276. t.Lcaron = 667;
  20277. t.onehalf = 750;
  20278. t.lessequal = 549;
  20279. t.ocircumflex = 500;
  20280. t.ntilde = 556;
  20281. t.Uhungarumlaut = 722;
  20282. t.Eacute = 667;
  20283. t.emacron = 444;
  20284. t.gbreve = 500;
  20285. t.onequarter = 750;
  20286. t.Scaron = 556;
  20287. t.Scommaaccent = 556;
  20288. t.Ohungarumlaut = 778;
  20289. t.degree = 400;
  20290. t.ograve = 500;
  20291. t.Ccaron = 722;
  20292. t.ugrave = 556;
  20293. t.radical = 549;
  20294. t.Dcaron = 722;
  20295. t.rcommaaccent = 444;
  20296. t.Ntilde = 722;
  20297. t.otilde = 500;
  20298. t.Rcommaaccent = 722;
  20299. t.Lcommaaccent = 667;
  20300. t.Atilde = 722;
  20301. t.Aogonek = 722;
  20302. t.Aring = 722;
  20303. t.Otilde = 778;
  20304. t.zdotaccent = 444;
  20305. t.Ecaron = 667;
  20306. t.Iogonek = 389;
  20307. t.kcommaaccent = 556;
  20308. t.minus = 570;
  20309. t.Icircumflex = 389;
  20310. t.ncaron = 556;
  20311. t.tcommaaccent = 333;
  20312. t.logicalnot = 570;
  20313. t.odieresis = 500;
  20314. t.udieresis = 556;
  20315. t.notequal = 549;
  20316. t.gcommaaccent = 500;
  20317. t.eth = 500;
  20318. t.zcaron = 444;
  20319. t.ncommaaccent = 556;
  20320. t.onesuperior = 300;
  20321. t.imacron = 278;
  20322. t.Euro = 500;
  20323. });
  20324. t["Times-BoldItalic"] = getLookupTableFactory(function (t) {
  20325. t.space = 250;
  20326. t.exclam = 389;
  20327. t.quotedbl = 555;
  20328. t.numbersign = 500;
  20329. t.dollar = 500;
  20330. t.percent = 833;
  20331. t.ampersand = 778;
  20332. t.quoteright = 333;
  20333. t.parenleft = 333;
  20334. t.parenright = 333;
  20335. t.asterisk = 500;
  20336. t.plus = 570;
  20337. t.comma = 250;
  20338. t.hyphen = 333;
  20339. t.period = 250;
  20340. t.slash = 278;
  20341. t.zero = 500;
  20342. t.one = 500;
  20343. t.two = 500;
  20344. t.three = 500;
  20345. t.four = 500;
  20346. t.five = 500;
  20347. t.six = 500;
  20348. t.seven = 500;
  20349. t.eight = 500;
  20350. t.nine = 500;
  20351. t.colon = 333;
  20352. t.semicolon = 333;
  20353. t.less = 570;
  20354. t.equal = 570;
  20355. t.greater = 570;
  20356. t.question = 500;
  20357. t.at = 832;
  20358. t.A = 667;
  20359. t.B = 667;
  20360. t.C = 667;
  20361. t.D = 722;
  20362. t.E = 667;
  20363. t.F = 667;
  20364. t.G = 722;
  20365. t.H = 778;
  20366. t.I = 389;
  20367. t.J = 500;
  20368. t.K = 667;
  20369. t.L = 611;
  20370. t.M = 889;
  20371. t.N = 722;
  20372. t.O = 722;
  20373. t.P = 611;
  20374. t.Q = 722;
  20375. t.R = 667;
  20376. t.S = 556;
  20377. t.T = 611;
  20378. t.U = 722;
  20379. t.V = 667;
  20380. t.W = 889;
  20381. t.X = 667;
  20382. t.Y = 611;
  20383. t.Z = 611;
  20384. t.bracketleft = 333;
  20385. t.backslash = 278;
  20386. t.bracketright = 333;
  20387. t.asciicircum = 570;
  20388. t.underscore = 500;
  20389. t.quoteleft = 333;
  20390. t.a = 500;
  20391. t.b = 500;
  20392. t.c = 444;
  20393. t.d = 500;
  20394. t.e = 444;
  20395. t.f = 333;
  20396. t.g = 500;
  20397. t.h = 556;
  20398. t.i = 278;
  20399. t.j = 278;
  20400. t.k = 500;
  20401. t.l = 278;
  20402. t.m = 778;
  20403. t.n = 556;
  20404. t.o = 500;
  20405. t.p = 500;
  20406. t.q = 500;
  20407. t.r = 389;
  20408. t.s = 389;
  20409. t.t = 278;
  20410. t.u = 556;
  20411. t.v = 444;
  20412. t.w = 667;
  20413. t.x = 500;
  20414. t.y = 444;
  20415. t.z = 389;
  20416. t.braceleft = 348;
  20417. t.bar = 220;
  20418. t.braceright = 348;
  20419. t.asciitilde = 570;
  20420. t.exclamdown = 389;
  20421. t.cent = 500;
  20422. t.sterling = 500;
  20423. t.fraction = 167;
  20424. t.yen = 500;
  20425. t.florin = 500;
  20426. t.section = 500;
  20427. t.currency = 500;
  20428. t.quotesingle = 278;
  20429. t.quotedblleft = 500;
  20430. t.guillemotleft = 500;
  20431. t.guilsinglleft = 333;
  20432. t.guilsinglright = 333;
  20433. t.fi = 556;
  20434. t.fl = 556;
  20435. t.endash = 500;
  20436. t.dagger = 500;
  20437. t.daggerdbl = 500;
  20438. t.periodcentered = 250;
  20439. t.paragraph = 500;
  20440. t.bullet = 350;
  20441. t.quotesinglbase = 333;
  20442. t.quotedblbase = 500;
  20443. t.quotedblright = 500;
  20444. t.guillemotright = 500;
  20445. t.ellipsis = 1000;
  20446. t.perthousand = 1000;
  20447. t.questiondown = 500;
  20448. t.grave = 333;
  20449. t.acute = 333;
  20450. t.circumflex = 333;
  20451. t.tilde = 333;
  20452. t.macron = 333;
  20453. t.breve = 333;
  20454. t.dotaccent = 333;
  20455. t.dieresis = 333;
  20456. t.ring = 333;
  20457. t.cedilla = 333;
  20458. t.hungarumlaut = 333;
  20459. t.ogonek = 333;
  20460. t.caron = 333;
  20461. t.emdash = 1000;
  20462. t.AE = 944;
  20463. t.ordfeminine = 266;
  20464. t.Lslash = 611;
  20465. t.Oslash = 722;
  20466. t.OE = 944;
  20467. t.ordmasculine = 300;
  20468. t.ae = 722;
  20469. t.dotlessi = 278;
  20470. t.lslash = 278;
  20471. t.oslash = 500;
  20472. t.oe = 722;
  20473. t.germandbls = 500;
  20474. t.Idieresis = 389;
  20475. t.eacute = 444;
  20476. t.abreve = 500;
  20477. t.uhungarumlaut = 556;
  20478. t.ecaron = 444;
  20479. t.Ydieresis = 611;
  20480. t.divide = 570;
  20481. t.Yacute = 611;
  20482. t.Acircumflex = 667;
  20483. t.aacute = 500;
  20484. t.Ucircumflex = 722;
  20485. t.yacute = 444;
  20486. t.scommaaccent = 389;
  20487. t.ecircumflex = 444;
  20488. t.Uring = 722;
  20489. t.Udieresis = 722;
  20490. t.aogonek = 500;
  20491. t.Uacute = 722;
  20492. t.uogonek = 556;
  20493. t.Edieresis = 667;
  20494. t.Dcroat = 722;
  20495. t.commaaccent = 250;
  20496. t.copyright = 747;
  20497. t.Emacron = 667;
  20498. t.ccaron = 444;
  20499. t.aring = 500;
  20500. t.Ncommaaccent = 722;
  20501. t.lacute = 278;
  20502. t.agrave = 500;
  20503. t.Tcommaaccent = 611;
  20504. t.Cacute = 667;
  20505. t.atilde = 500;
  20506. t.Edotaccent = 667;
  20507. t.scaron = 389;
  20508. t.scedilla = 389;
  20509. t.iacute = 278;
  20510. t.lozenge = 494;
  20511. t.Rcaron = 667;
  20512. t.Gcommaaccent = 722;
  20513. t.ucircumflex = 556;
  20514. t.acircumflex = 500;
  20515. t.Amacron = 667;
  20516. t.rcaron = 389;
  20517. t.ccedilla = 444;
  20518. t.Zdotaccent = 611;
  20519. t.Thorn = 611;
  20520. t.Omacron = 722;
  20521. t.Racute = 667;
  20522. t.Sacute = 556;
  20523. t.dcaron = 608;
  20524. t.Umacron = 722;
  20525. t.uring = 556;
  20526. t.threesuperior = 300;
  20527. t.Ograve = 722;
  20528. t.Agrave = 667;
  20529. t.Abreve = 667;
  20530. t.multiply = 570;
  20531. t.uacute = 556;
  20532. t.Tcaron = 611;
  20533. t.partialdiff = 494;
  20534. t.ydieresis = 444;
  20535. t.Nacute = 722;
  20536. t.icircumflex = 278;
  20537. t.Ecircumflex = 667;
  20538. t.adieresis = 500;
  20539. t.edieresis = 444;
  20540. t.cacute = 444;
  20541. t.nacute = 556;
  20542. t.umacron = 556;
  20543. t.Ncaron = 722;
  20544. t.Iacute = 389;
  20545. t.plusminus = 570;
  20546. t.brokenbar = 220;
  20547. t.registered = 747;
  20548. t.Gbreve = 722;
  20549. t.Idotaccent = 389;
  20550. t.summation = 600;
  20551. t.Egrave = 667;
  20552. t.racute = 389;
  20553. t.omacron = 500;
  20554. t.Zacute = 611;
  20555. t.Zcaron = 611;
  20556. t.greaterequal = 549;
  20557. t.Eth = 722;
  20558. t.Ccedilla = 667;
  20559. t.lcommaaccent = 278;
  20560. t.tcaron = 366;
  20561. t.eogonek = 444;
  20562. t.Uogonek = 722;
  20563. t.Aacute = 667;
  20564. t.Adieresis = 667;
  20565. t.egrave = 444;
  20566. t.zacute = 389;
  20567. t.iogonek = 278;
  20568. t.Oacute = 722;
  20569. t.oacute = 500;
  20570. t.amacron = 500;
  20571. t.sacute = 389;
  20572. t.idieresis = 278;
  20573. t.Ocircumflex = 722;
  20574. t.Ugrave = 722;
  20575. t.Delta = 612;
  20576. t.thorn = 500;
  20577. t.twosuperior = 300;
  20578. t.Odieresis = 722;
  20579. t.mu = 576;
  20580. t.igrave = 278;
  20581. t.ohungarumlaut = 500;
  20582. t.Eogonek = 667;
  20583. t.dcroat = 500;
  20584. t.threequarters = 750;
  20585. t.Scedilla = 556;
  20586. t.lcaron = 382;
  20587. t.Kcommaaccent = 667;
  20588. t.Lacute = 611;
  20589. t.trademark = 1000;
  20590. t.edotaccent = 444;
  20591. t.Igrave = 389;
  20592. t.Imacron = 389;
  20593. t.Lcaron = 611;
  20594. t.onehalf = 750;
  20595. t.lessequal = 549;
  20596. t.ocircumflex = 500;
  20597. t.ntilde = 556;
  20598. t.Uhungarumlaut = 722;
  20599. t.Eacute = 667;
  20600. t.emacron = 444;
  20601. t.gbreve = 500;
  20602. t.onequarter = 750;
  20603. t.Scaron = 556;
  20604. t.Scommaaccent = 556;
  20605. t.Ohungarumlaut = 722;
  20606. t.degree = 400;
  20607. t.ograve = 500;
  20608. t.Ccaron = 667;
  20609. t.ugrave = 556;
  20610. t.radical = 549;
  20611. t.Dcaron = 722;
  20612. t.rcommaaccent = 389;
  20613. t.Ntilde = 722;
  20614. t.otilde = 500;
  20615. t.Rcommaaccent = 667;
  20616. t.Lcommaaccent = 611;
  20617. t.Atilde = 667;
  20618. t.Aogonek = 667;
  20619. t.Aring = 667;
  20620. t.Otilde = 722;
  20621. t.zdotaccent = 389;
  20622. t.Ecaron = 667;
  20623. t.Iogonek = 389;
  20624. t.kcommaaccent = 500;
  20625. t.minus = 606;
  20626. t.Icircumflex = 389;
  20627. t.ncaron = 556;
  20628. t.tcommaaccent = 278;
  20629. t.logicalnot = 606;
  20630. t.odieresis = 500;
  20631. t.udieresis = 556;
  20632. t.notequal = 549;
  20633. t.gcommaaccent = 500;
  20634. t.eth = 500;
  20635. t.zcaron = 389;
  20636. t.ncommaaccent = 556;
  20637. t.onesuperior = 300;
  20638. t.imacron = 278;
  20639. t.Euro = 500;
  20640. });
  20641. t["Times-Italic"] = getLookupTableFactory(function (t) {
  20642. t.space = 250;
  20643. t.exclam = 333;
  20644. t.quotedbl = 420;
  20645. t.numbersign = 500;
  20646. t.dollar = 500;
  20647. t.percent = 833;
  20648. t.ampersand = 778;
  20649. t.quoteright = 333;
  20650. t.parenleft = 333;
  20651. t.parenright = 333;
  20652. t.asterisk = 500;
  20653. t.plus = 675;
  20654. t.comma = 250;
  20655. t.hyphen = 333;
  20656. t.period = 250;
  20657. t.slash = 278;
  20658. t.zero = 500;
  20659. t.one = 500;
  20660. t.two = 500;
  20661. t.three = 500;
  20662. t.four = 500;
  20663. t.five = 500;
  20664. t.six = 500;
  20665. t.seven = 500;
  20666. t.eight = 500;
  20667. t.nine = 500;
  20668. t.colon = 333;
  20669. t.semicolon = 333;
  20670. t.less = 675;
  20671. t.equal = 675;
  20672. t.greater = 675;
  20673. t.question = 500;
  20674. t.at = 920;
  20675. t.A = 611;
  20676. t.B = 611;
  20677. t.C = 667;
  20678. t.D = 722;
  20679. t.E = 611;
  20680. t.F = 611;
  20681. t.G = 722;
  20682. t.H = 722;
  20683. t.I = 333;
  20684. t.J = 444;
  20685. t.K = 667;
  20686. t.L = 556;
  20687. t.M = 833;
  20688. t.N = 667;
  20689. t.O = 722;
  20690. t.P = 611;
  20691. t.Q = 722;
  20692. t.R = 611;
  20693. t.S = 500;
  20694. t.T = 556;
  20695. t.U = 722;
  20696. t.V = 611;
  20697. t.W = 833;
  20698. t.X = 611;
  20699. t.Y = 556;
  20700. t.Z = 556;
  20701. t.bracketleft = 389;
  20702. t.backslash = 278;
  20703. t.bracketright = 389;
  20704. t.asciicircum = 422;
  20705. t.underscore = 500;
  20706. t.quoteleft = 333;
  20707. t.a = 500;
  20708. t.b = 500;
  20709. t.c = 444;
  20710. t.d = 500;
  20711. t.e = 444;
  20712. t.f = 278;
  20713. t.g = 500;
  20714. t.h = 500;
  20715. t.i = 278;
  20716. t.j = 278;
  20717. t.k = 444;
  20718. t.l = 278;
  20719. t.m = 722;
  20720. t.n = 500;
  20721. t.o = 500;
  20722. t.p = 500;
  20723. t.q = 500;
  20724. t.r = 389;
  20725. t.s = 389;
  20726. t.t = 278;
  20727. t.u = 500;
  20728. t.v = 444;
  20729. t.w = 667;
  20730. t.x = 444;
  20731. t.y = 444;
  20732. t.z = 389;
  20733. t.braceleft = 400;
  20734. t.bar = 275;
  20735. t.braceright = 400;
  20736. t.asciitilde = 541;
  20737. t.exclamdown = 389;
  20738. t.cent = 500;
  20739. t.sterling = 500;
  20740. t.fraction = 167;
  20741. t.yen = 500;
  20742. t.florin = 500;
  20743. t.section = 500;
  20744. t.currency = 500;
  20745. t.quotesingle = 214;
  20746. t.quotedblleft = 556;
  20747. t.guillemotleft = 500;
  20748. t.guilsinglleft = 333;
  20749. t.guilsinglright = 333;
  20750. t.fi = 500;
  20751. t.fl = 500;
  20752. t.endash = 500;
  20753. t.dagger = 500;
  20754. t.daggerdbl = 500;
  20755. t.periodcentered = 250;
  20756. t.paragraph = 523;
  20757. t.bullet = 350;
  20758. t.quotesinglbase = 333;
  20759. t.quotedblbase = 556;
  20760. t.quotedblright = 556;
  20761. t.guillemotright = 500;
  20762. t.ellipsis = 889;
  20763. t.perthousand = 1000;
  20764. t.questiondown = 500;
  20765. t.grave = 333;
  20766. t.acute = 333;
  20767. t.circumflex = 333;
  20768. t.tilde = 333;
  20769. t.macron = 333;
  20770. t.breve = 333;
  20771. t.dotaccent = 333;
  20772. t.dieresis = 333;
  20773. t.ring = 333;
  20774. t.cedilla = 333;
  20775. t.hungarumlaut = 333;
  20776. t.ogonek = 333;
  20777. t.caron = 333;
  20778. t.emdash = 889;
  20779. t.AE = 889;
  20780. t.ordfeminine = 276;
  20781. t.Lslash = 556;
  20782. t.Oslash = 722;
  20783. t.OE = 944;
  20784. t.ordmasculine = 310;
  20785. t.ae = 667;
  20786. t.dotlessi = 278;
  20787. t.lslash = 278;
  20788. t.oslash = 500;
  20789. t.oe = 667;
  20790. t.germandbls = 500;
  20791. t.Idieresis = 333;
  20792. t.eacute = 444;
  20793. t.abreve = 500;
  20794. t.uhungarumlaut = 500;
  20795. t.ecaron = 444;
  20796. t.Ydieresis = 556;
  20797. t.divide = 675;
  20798. t.Yacute = 556;
  20799. t.Acircumflex = 611;
  20800. t.aacute = 500;
  20801. t.Ucircumflex = 722;
  20802. t.yacute = 444;
  20803. t.scommaaccent = 389;
  20804. t.ecircumflex = 444;
  20805. t.Uring = 722;
  20806. t.Udieresis = 722;
  20807. t.aogonek = 500;
  20808. t.Uacute = 722;
  20809. t.uogonek = 500;
  20810. t.Edieresis = 611;
  20811. t.Dcroat = 722;
  20812. t.commaaccent = 250;
  20813. t.copyright = 760;
  20814. t.Emacron = 611;
  20815. t.ccaron = 444;
  20816. t.aring = 500;
  20817. t.Ncommaaccent = 667;
  20818. t.lacute = 278;
  20819. t.agrave = 500;
  20820. t.Tcommaaccent = 556;
  20821. t.Cacute = 667;
  20822. t.atilde = 500;
  20823. t.Edotaccent = 611;
  20824. t.scaron = 389;
  20825. t.scedilla = 389;
  20826. t.iacute = 278;
  20827. t.lozenge = 471;
  20828. t.Rcaron = 611;
  20829. t.Gcommaaccent = 722;
  20830. t.ucircumflex = 500;
  20831. t.acircumflex = 500;
  20832. t.Amacron = 611;
  20833. t.rcaron = 389;
  20834. t.ccedilla = 444;
  20835. t.Zdotaccent = 556;
  20836. t.Thorn = 611;
  20837. t.Omacron = 722;
  20838. t.Racute = 611;
  20839. t.Sacute = 500;
  20840. t.dcaron = 544;
  20841. t.Umacron = 722;
  20842. t.uring = 500;
  20843. t.threesuperior = 300;
  20844. t.Ograve = 722;
  20845. t.Agrave = 611;
  20846. t.Abreve = 611;
  20847. t.multiply = 675;
  20848. t.uacute = 500;
  20849. t.Tcaron = 556;
  20850. t.partialdiff = 476;
  20851. t.ydieresis = 444;
  20852. t.Nacute = 667;
  20853. t.icircumflex = 278;
  20854. t.Ecircumflex = 611;
  20855. t.adieresis = 500;
  20856. t.edieresis = 444;
  20857. t.cacute = 444;
  20858. t.nacute = 500;
  20859. t.umacron = 500;
  20860. t.Ncaron = 667;
  20861. t.Iacute = 333;
  20862. t.plusminus = 675;
  20863. t.brokenbar = 275;
  20864. t.registered = 760;
  20865. t.Gbreve = 722;
  20866. t.Idotaccent = 333;
  20867. t.summation = 600;
  20868. t.Egrave = 611;
  20869. t.racute = 389;
  20870. t.omacron = 500;
  20871. t.Zacute = 556;
  20872. t.Zcaron = 556;
  20873. t.greaterequal = 549;
  20874. t.Eth = 722;
  20875. t.Ccedilla = 667;
  20876. t.lcommaaccent = 278;
  20877. t.tcaron = 300;
  20878. t.eogonek = 444;
  20879. t.Uogonek = 722;
  20880. t.Aacute = 611;
  20881. t.Adieresis = 611;
  20882. t.egrave = 444;
  20883. t.zacute = 389;
  20884. t.iogonek = 278;
  20885. t.Oacute = 722;
  20886. t.oacute = 500;
  20887. t.amacron = 500;
  20888. t.sacute = 389;
  20889. t.idieresis = 278;
  20890. t.Ocircumflex = 722;
  20891. t.Ugrave = 722;
  20892. t.Delta = 612;
  20893. t.thorn = 500;
  20894. t.twosuperior = 300;
  20895. t.Odieresis = 722;
  20896. t.mu = 500;
  20897. t.igrave = 278;
  20898. t.ohungarumlaut = 500;
  20899. t.Eogonek = 611;
  20900. t.dcroat = 500;
  20901. t.threequarters = 750;
  20902. t.Scedilla = 500;
  20903. t.lcaron = 300;
  20904. t.Kcommaaccent = 667;
  20905. t.Lacute = 556;
  20906. t.trademark = 980;
  20907. t.edotaccent = 444;
  20908. t.Igrave = 333;
  20909. t.Imacron = 333;
  20910. t.Lcaron = 611;
  20911. t.onehalf = 750;
  20912. t.lessequal = 549;
  20913. t.ocircumflex = 500;
  20914. t.ntilde = 500;
  20915. t.Uhungarumlaut = 722;
  20916. t.Eacute = 611;
  20917. t.emacron = 444;
  20918. t.gbreve = 500;
  20919. t.onequarter = 750;
  20920. t.Scaron = 500;
  20921. t.Scommaaccent = 500;
  20922. t.Ohungarumlaut = 722;
  20923. t.degree = 400;
  20924. t.ograve = 500;
  20925. t.Ccaron = 667;
  20926. t.ugrave = 500;
  20927. t.radical = 453;
  20928. t.Dcaron = 722;
  20929. t.rcommaaccent = 389;
  20930. t.Ntilde = 667;
  20931. t.otilde = 500;
  20932. t.Rcommaaccent = 611;
  20933. t.Lcommaaccent = 556;
  20934. t.Atilde = 611;
  20935. t.Aogonek = 611;
  20936. t.Aring = 611;
  20937. t.Otilde = 722;
  20938. t.zdotaccent = 389;
  20939. t.Ecaron = 611;
  20940. t.Iogonek = 333;
  20941. t.kcommaaccent = 444;
  20942. t.minus = 675;
  20943. t.Icircumflex = 333;
  20944. t.ncaron = 500;
  20945. t.tcommaaccent = 278;
  20946. t.logicalnot = 675;
  20947. t.odieresis = 500;
  20948. t.udieresis = 500;
  20949. t.notequal = 549;
  20950. t.gcommaaccent = 500;
  20951. t.eth = 500;
  20952. t.zcaron = 389;
  20953. t.ncommaaccent = 500;
  20954. t.onesuperior = 300;
  20955. t.imacron = 278;
  20956. t.Euro = 500;
  20957. });
  20958. t.ZapfDingbats = getLookupTableFactory(function (t) {
  20959. t.space = 278;
  20960. t.a1 = 974;
  20961. t.a2 = 961;
  20962. t.a202 = 974;
  20963. t.a3 = 980;
  20964. t.a4 = 719;
  20965. t.a5 = 789;
  20966. t.a119 = 790;
  20967. t.a118 = 791;
  20968. t.a117 = 690;
  20969. t.a11 = 960;
  20970. t.a12 = 939;
  20971. t.a13 = 549;
  20972. t.a14 = 855;
  20973. t.a15 = 911;
  20974. t.a16 = 933;
  20975. t.a105 = 911;
  20976. t.a17 = 945;
  20977. t.a18 = 974;
  20978. t.a19 = 755;
  20979. t.a20 = 846;
  20980. t.a21 = 762;
  20981. t.a22 = 761;
  20982. t.a23 = 571;
  20983. t.a24 = 677;
  20984. t.a25 = 763;
  20985. t.a26 = 760;
  20986. t.a27 = 759;
  20987. t.a28 = 754;
  20988. t.a6 = 494;
  20989. t.a7 = 552;
  20990. t.a8 = 537;
  20991. t.a9 = 577;
  20992. t.a10 = 692;
  20993. t.a29 = 786;
  20994. t.a30 = 788;
  20995. t.a31 = 788;
  20996. t.a32 = 790;
  20997. t.a33 = 793;
  20998. t.a34 = 794;
  20999. t.a35 = 816;
  21000. t.a36 = 823;
  21001. t.a37 = 789;
  21002. t.a38 = 841;
  21003. t.a39 = 823;
  21004. t.a40 = 833;
  21005. t.a41 = 816;
  21006. t.a42 = 831;
  21007. t.a43 = 923;
  21008. t.a44 = 744;
  21009. t.a45 = 723;
  21010. t.a46 = 749;
  21011. t.a47 = 790;
  21012. t.a48 = 792;
  21013. t.a49 = 695;
  21014. t.a50 = 776;
  21015. t.a51 = 768;
  21016. t.a52 = 792;
  21017. t.a53 = 759;
  21018. t.a54 = 707;
  21019. t.a55 = 708;
  21020. t.a56 = 682;
  21021. t.a57 = 701;
  21022. t.a58 = 826;
  21023. t.a59 = 815;
  21024. t.a60 = 789;
  21025. t.a61 = 789;
  21026. t.a62 = 707;
  21027. t.a63 = 687;
  21028. t.a64 = 696;
  21029. t.a65 = 689;
  21030. t.a66 = 786;
  21031. t.a67 = 787;
  21032. t.a68 = 713;
  21033. t.a69 = 791;
  21034. t.a70 = 785;
  21035. t.a71 = 791;
  21036. t.a72 = 873;
  21037. t.a73 = 761;
  21038. t.a74 = 762;
  21039. t.a203 = 762;
  21040. t.a75 = 759;
  21041. t.a204 = 759;
  21042. t.a76 = 892;
  21043. t.a77 = 892;
  21044. t.a78 = 788;
  21045. t.a79 = 784;
  21046. t.a81 = 438;
  21047. t.a82 = 138;
  21048. t.a83 = 277;
  21049. t.a84 = 415;
  21050. t.a97 = 392;
  21051. t.a98 = 392;
  21052. t.a99 = 668;
  21053. t.a100 = 668;
  21054. t.a89 = 390;
  21055. t.a90 = 390;
  21056. t.a93 = 317;
  21057. t.a94 = 317;
  21058. t.a91 = 276;
  21059. t.a92 = 276;
  21060. t.a205 = 509;
  21061. t.a85 = 509;
  21062. t.a206 = 410;
  21063. t.a86 = 410;
  21064. t.a87 = 234;
  21065. t.a88 = 234;
  21066. t.a95 = 334;
  21067. t.a96 = 334;
  21068. t.a101 = 732;
  21069. t.a102 = 544;
  21070. t.a103 = 544;
  21071. t.a104 = 910;
  21072. t.a106 = 667;
  21073. t.a107 = 760;
  21074. t.a108 = 760;
  21075. t.a112 = 776;
  21076. t.a111 = 595;
  21077. t.a110 = 694;
  21078. t.a109 = 626;
  21079. t.a120 = 788;
  21080. t.a121 = 788;
  21081. t.a122 = 788;
  21082. t.a123 = 788;
  21083. t.a124 = 788;
  21084. t.a125 = 788;
  21085. t.a126 = 788;
  21086. t.a127 = 788;
  21087. t.a128 = 788;
  21088. t.a129 = 788;
  21089. t.a130 = 788;
  21090. t.a131 = 788;
  21091. t.a132 = 788;
  21092. t.a133 = 788;
  21093. t.a134 = 788;
  21094. t.a135 = 788;
  21095. t.a136 = 788;
  21096. t.a137 = 788;
  21097. t.a138 = 788;
  21098. t.a139 = 788;
  21099. t.a140 = 788;
  21100. t.a141 = 788;
  21101. t.a142 = 788;
  21102. t.a143 = 788;
  21103. t.a144 = 788;
  21104. t.a145 = 788;
  21105. t.a146 = 788;
  21106. t.a147 = 788;
  21107. t.a148 = 788;
  21108. t.a149 = 788;
  21109. t.a150 = 788;
  21110. t.a151 = 788;
  21111. t.a152 = 788;
  21112. t.a153 = 788;
  21113. t.a154 = 788;
  21114. t.a155 = 788;
  21115. t.a156 = 788;
  21116. t.a157 = 788;
  21117. t.a158 = 788;
  21118. t.a159 = 788;
  21119. t.a160 = 894;
  21120. t.a161 = 838;
  21121. t.a163 = 1016;
  21122. t.a164 = 458;
  21123. t.a196 = 748;
  21124. t.a165 = 924;
  21125. t.a192 = 748;
  21126. t.a166 = 918;
  21127. t.a167 = 927;
  21128. t.a168 = 928;
  21129. t.a169 = 928;
  21130. t.a170 = 834;
  21131. t.a171 = 873;
  21132. t.a172 = 828;
  21133. t.a173 = 924;
  21134. t.a162 = 924;
  21135. t.a174 = 917;
  21136. t.a175 = 930;
  21137. t.a176 = 931;
  21138. t.a177 = 463;
  21139. t.a178 = 883;
  21140. t.a179 = 836;
  21141. t.a193 = 836;
  21142. t.a180 = 867;
  21143. t.a199 = 867;
  21144. t.a181 = 696;
  21145. t.a200 = 696;
  21146. t.a182 = 874;
  21147. t.a201 = 874;
  21148. t.a183 = 760;
  21149. t.a184 = 946;
  21150. t.a197 = 771;
  21151. t.a185 = 865;
  21152. t.a194 = 771;
  21153. t.a198 = 888;
  21154. t.a186 = 967;
  21155. t.a195 = 888;
  21156. t.a187 = 831;
  21157. t.a188 = 873;
  21158. t.a189 = 927;
  21159. t.a190 = 970;
  21160. t.a191 = 918;
  21161. });
  21162. });
  21163. const getFontBasicMetrics = getLookupTableFactory(function (t) {
  21164. t.Courier = {
  21165. ascent: 629,
  21166. descent: -157,
  21167. capHeight: 562,
  21168. xHeight: -426
  21169. };
  21170. t["Courier-Bold"] = {
  21171. ascent: 629,
  21172. descent: -157,
  21173. capHeight: 562,
  21174. xHeight: 439
  21175. };
  21176. t["Courier-Oblique"] = {
  21177. ascent: 629,
  21178. descent: -157,
  21179. capHeight: 562,
  21180. xHeight: 426
  21181. };
  21182. t["Courier-BoldOblique"] = {
  21183. ascent: 629,
  21184. descent: -157,
  21185. capHeight: 562,
  21186. xHeight: 426
  21187. };
  21188. t.Helvetica = {
  21189. ascent: 718,
  21190. descent: -207,
  21191. capHeight: 718,
  21192. xHeight: 523
  21193. };
  21194. t["Helvetica-Bold"] = {
  21195. ascent: 718,
  21196. descent: -207,
  21197. capHeight: 718,
  21198. xHeight: 532
  21199. };
  21200. t["Helvetica-Oblique"] = {
  21201. ascent: 718,
  21202. descent: -207,
  21203. capHeight: 718,
  21204. xHeight: 523
  21205. };
  21206. t["Helvetica-BoldOblique"] = {
  21207. ascent: 718,
  21208. descent: -207,
  21209. capHeight: 718,
  21210. xHeight: 532
  21211. };
  21212. t["Times-Roman"] = {
  21213. ascent: 683,
  21214. descent: -217,
  21215. capHeight: 662,
  21216. xHeight: 450
  21217. };
  21218. t["Times-Bold"] = {
  21219. ascent: 683,
  21220. descent: -217,
  21221. capHeight: 676,
  21222. xHeight: 461
  21223. };
  21224. t["Times-Italic"] = {
  21225. ascent: 683,
  21226. descent: -217,
  21227. capHeight: 653,
  21228. xHeight: 441
  21229. };
  21230. t["Times-BoldItalic"] = {
  21231. ascent: 683,
  21232. descent: -217,
  21233. capHeight: 669,
  21234. xHeight: 462
  21235. };
  21236. t.Symbol = {
  21237. ascent: Math.NaN,
  21238. descent: Math.NaN,
  21239. capHeight: Math.NaN,
  21240. xHeight: Math.NaN
  21241. };
  21242. t.ZapfDingbats = {
  21243. ascent: Math.NaN,
  21244. descent: Math.NaN,
  21245. capHeight: Math.NaN,
  21246. xHeight: Math.NaN
  21247. };
  21248. });
  21249. ;// ./src/core/glyf.js
  21250. const ON_CURVE_POINT = 1 << 0;
  21251. const X_SHORT_VECTOR = 1 << 1;
  21252. const Y_SHORT_VECTOR = 1 << 2;
  21253. const REPEAT_FLAG = 1 << 3;
  21254. const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4;
  21255. const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5;
  21256. const OVERLAP_SIMPLE = 1 << 6;
  21257. const ARG_1_AND_2_ARE_WORDS = 1 << 0;
  21258. const ARGS_ARE_XY_VALUES = 1 << 1;
  21259. const WE_HAVE_A_SCALE = 1 << 3;
  21260. const MORE_COMPONENTS = 1 << 5;
  21261. const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6;
  21262. const WE_HAVE_A_TWO_BY_TWO = 1 << 7;
  21263. const WE_HAVE_INSTRUCTIONS = 1 << 8;
  21264. class GlyfTable {
  21265. constructor({
  21266. glyfTable,
  21267. isGlyphLocationsLong,
  21268. locaTable,
  21269. numGlyphs
  21270. }) {
  21271. this.glyphs = [];
  21272. const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength);
  21273. const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength);
  21274. const offsetSize = isGlyphLocationsLong ? 4 : 2;
  21275. let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0);
  21276. let pos = 0;
  21277. for (let i = 0; i < numGlyphs; i++) {
  21278. pos += offsetSize;
  21279. const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos);
  21280. if (next === prev) {
  21281. this.glyphs.push(new Glyph({}));
  21282. continue;
  21283. }
  21284. const glyph = Glyph.parse(prev, glyf);
  21285. this.glyphs.push(glyph);
  21286. prev = next;
  21287. }
  21288. }
  21289. getSize() {
  21290. return this.glyphs.reduce((a, g) => {
  21291. const size = g.getSize();
  21292. return a + (size + 3 & ~3);
  21293. }, 0);
  21294. }
  21295. write() {
  21296. const totalSize = this.getSize();
  21297. const glyfTable = new DataView(new ArrayBuffer(totalSize));
  21298. const isLocationLong = totalSize > 0x1fffe;
  21299. const offsetSize = isLocationLong ? 4 : 2;
  21300. const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize));
  21301. if (isLocationLong) {
  21302. locaTable.setUint32(0, 0);
  21303. } else {
  21304. locaTable.setUint16(0, 0);
  21305. }
  21306. let pos = 0;
  21307. let locaIndex = 0;
  21308. for (const glyph of this.glyphs) {
  21309. pos += glyph.write(pos, glyfTable);
  21310. pos = pos + 3 & ~3;
  21311. locaIndex += offsetSize;
  21312. if (isLocationLong) {
  21313. locaTable.setUint32(locaIndex, pos);
  21314. } else {
  21315. locaTable.setUint16(locaIndex, pos >> 1);
  21316. }
  21317. }
  21318. return {
  21319. isLocationLong,
  21320. loca: new Uint8Array(locaTable.buffer),
  21321. glyf: new Uint8Array(glyfTable.buffer)
  21322. };
  21323. }
  21324. scale(factors) {
  21325. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  21326. this.glyphs[i].scale(factors[i]);
  21327. }
  21328. }
  21329. }
  21330. class Glyph {
  21331. constructor({
  21332. header = null,
  21333. simple = null,
  21334. composites = null
  21335. }) {
  21336. this.header = header;
  21337. this.simple = simple;
  21338. this.composites = composites;
  21339. }
  21340. static parse(pos, glyf) {
  21341. const [read, header] = GlyphHeader.parse(pos, glyf);
  21342. pos += read;
  21343. if (header.numberOfContours < 0) {
  21344. const composites = [];
  21345. while (true) {
  21346. const [n, composite] = CompositeGlyph.parse(pos, glyf);
  21347. pos += n;
  21348. composites.push(composite);
  21349. if (!(composite.flags & MORE_COMPONENTS)) {
  21350. break;
  21351. }
  21352. }
  21353. return new Glyph({
  21354. header,
  21355. composites
  21356. });
  21357. }
  21358. const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours);
  21359. return new Glyph({
  21360. header,
  21361. simple
  21362. });
  21363. }
  21364. getSize() {
  21365. if (!this.header) {
  21366. return 0;
  21367. }
  21368. const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0);
  21369. return this.header.getSize() + size;
  21370. }
  21371. write(pos, buf) {
  21372. if (!this.header) {
  21373. return 0;
  21374. }
  21375. const spos = pos;
  21376. pos += this.header.write(pos, buf);
  21377. if (this.simple) {
  21378. pos += this.simple.write(pos, buf);
  21379. } else {
  21380. for (const composite of this.composites) {
  21381. pos += composite.write(pos, buf);
  21382. }
  21383. }
  21384. return pos - spos;
  21385. }
  21386. scale(factor) {
  21387. if (!this.header) {
  21388. return;
  21389. }
  21390. const xMiddle = (this.header.xMin + this.header.xMax) / 2;
  21391. this.header.scale(xMiddle, factor);
  21392. if (this.simple) {
  21393. this.simple.scale(xMiddle, factor);
  21394. } else {
  21395. for (const composite of this.composites) {
  21396. composite.scale(xMiddle, factor);
  21397. }
  21398. }
  21399. }
  21400. }
  21401. class GlyphHeader {
  21402. constructor({
  21403. numberOfContours,
  21404. xMin,
  21405. yMin,
  21406. xMax,
  21407. yMax
  21408. }) {
  21409. this.numberOfContours = numberOfContours;
  21410. this.xMin = xMin;
  21411. this.yMin = yMin;
  21412. this.xMax = xMax;
  21413. this.yMax = yMax;
  21414. }
  21415. static parse(pos, glyf) {
  21416. return [10, new GlyphHeader({
  21417. numberOfContours: glyf.getInt16(pos),
  21418. xMin: glyf.getInt16(pos + 2),
  21419. yMin: glyf.getInt16(pos + 4),
  21420. xMax: glyf.getInt16(pos + 6),
  21421. yMax: glyf.getInt16(pos + 8)
  21422. })];
  21423. }
  21424. getSize() {
  21425. return 10;
  21426. }
  21427. write(pos, buf) {
  21428. buf.setInt16(pos, this.numberOfContours);
  21429. buf.setInt16(pos + 2, this.xMin);
  21430. buf.setInt16(pos + 4, this.yMin);
  21431. buf.setInt16(pos + 6, this.xMax);
  21432. buf.setInt16(pos + 8, this.yMax);
  21433. return 10;
  21434. }
  21435. scale(x, factor) {
  21436. this.xMin = Math.round(x + (this.xMin - x) * factor);
  21437. this.xMax = Math.round(x + (this.xMax - x) * factor);
  21438. }
  21439. }
  21440. class Contour {
  21441. constructor({
  21442. flags,
  21443. xCoordinates,
  21444. yCoordinates
  21445. }) {
  21446. this.xCoordinates = xCoordinates;
  21447. this.yCoordinates = yCoordinates;
  21448. this.flags = flags;
  21449. }
  21450. }
  21451. class SimpleGlyph {
  21452. constructor({
  21453. contours,
  21454. instructions
  21455. }) {
  21456. this.contours = contours;
  21457. this.instructions = instructions;
  21458. }
  21459. static parse(pos, glyf, numberOfContours) {
  21460. const endPtsOfContours = [];
  21461. for (let i = 0; i < numberOfContours; i++) {
  21462. const endPt = glyf.getUint16(pos);
  21463. pos += 2;
  21464. endPtsOfContours.push(endPt);
  21465. }
  21466. const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1;
  21467. const instructionLength = glyf.getUint16(pos);
  21468. pos += 2;
  21469. const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  21470. pos += instructionLength;
  21471. const flags = [];
  21472. for (let i = 0; i < numberOfPt; pos++, i++) {
  21473. let flag = glyf.getUint8(pos);
  21474. flags.push(flag);
  21475. if (flag & REPEAT_FLAG) {
  21476. const count = glyf.getUint8(++pos);
  21477. flag ^= REPEAT_FLAG;
  21478. for (let m = 0; m < count; m++) {
  21479. flags.push(flag);
  21480. }
  21481. i += count;
  21482. }
  21483. }
  21484. const allXCoordinates = [];
  21485. let xCoordinates = [];
  21486. let yCoordinates = [];
  21487. let pointFlags = [];
  21488. const contours = [];
  21489. let endPtsOfContoursIndex = 0;
  21490. let lastCoordinate = 0;
  21491. for (let i = 0; i < numberOfPt; i++) {
  21492. const flag = flags[i];
  21493. if (flag & X_SHORT_VECTOR) {
  21494. const x = glyf.getUint8(pos++);
  21495. lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x;
  21496. xCoordinates.push(lastCoordinate);
  21497. } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) {
  21498. xCoordinates.push(lastCoordinate);
  21499. } else {
  21500. lastCoordinate += glyf.getInt16(pos);
  21501. pos += 2;
  21502. xCoordinates.push(lastCoordinate);
  21503. }
  21504. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  21505. endPtsOfContoursIndex++;
  21506. allXCoordinates.push(xCoordinates);
  21507. xCoordinates = [];
  21508. }
  21509. }
  21510. lastCoordinate = 0;
  21511. endPtsOfContoursIndex = 0;
  21512. for (let i = 0; i < numberOfPt; i++) {
  21513. const flag = flags[i];
  21514. if (flag & Y_SHORT_VECTOR) {
  21515. const y = glyf.getUint8(pos++);
  21516. lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y;
  21517. yCoordinates.push(lastCoordinate);
  21518. } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) {
  21519. yCoordinates.push(lastCoordinate);
  21520. } else {
  21521. lastCoordinate += glyf.getInt16(pos);
  21522. pos += 2;
  21523. yCoordinates.push(lastCoordinate);
  21524. }
  21525. pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE);
  21526. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  21527. xCoordinates = allXCoordinates[endPtsOfContoursIndex];
  21528. endPtsOfContoursIndex++;
  21529. contours.push(new Contour({
  21530. flags: pointFlags,
  21531. xCoordinates,
  21532. yCoordinates
  21533. }));
  21534. yCoordinates = [];
  21535. pointFlags = [];
  21536. }
  21537. }
  21538. return new SimpleGlyph({
  21539. contours,
  21540. instructions
  21541. });
  21542. }
  21543. getSize() {
  21544. let size = this.contours.length * 2 + 2 + this.instructions.length;
  21545. let lastX = 0;
  21546. let lastY = 0;
  21547. for (const contour of this.contours) {
  21548. size += contour.flags.length;
  21549. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  21550. const x = contour.xCoordinates[i];
  21551. const y = contour.yCoordinates[i];
  21552. let abs = Math.abs(x - lastX);
  21553. if (abs > 255) {
  21554. size += 2;
  21555. } else if (abs > 0) {
  21556. size += 1;
  21557. }
  21558. lastX = x;
  21559. abs = Math.abs(y - lastY);
  21560. if (abs > 255) {
  21561. size += 2;
  21562. } else if (abs > 0) {
  21563. size += 1;
  21564. }
  21565. lastY = y;
  21566. }
  21567. }
  21568. return size;
  21569. }
  21570. write(pos, buf) {
  21571. const spos = pos;
  21572. const xCoordinates = [];
  21573. const yCoordinates = [];
  21574. const flags = [];
  21575. let lastX = 0;
  21576. let lastY = 0;
  21577. for (const contour of this.contours) {
  21578. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  21579. let flag = contour.flags[i];
  21580. const x = contour.xCoordinates[i];
  21581. let delta = x - lastX;
  21582. if (delta === 0) {
  21583. flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR;
  21584. xCoordinates.push(0);
  21585. } else {
  21586. const abs = Math.abs(delta);
  21587. if (abs <= 255) {
  21588. flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR;
  21589. xCoordinates.push(abs);
  21590. } else {
  21591. xCoordinates.push(delta);
  21592. }
  21593. }
  21594. lastX = x;
  21595. const y = contour.yCoordinates[i];
  21596. delta = y - lastY;
  21597. if (delta === 0) {
  21598. flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR;
  21599. yCoordinates.push(0);
  21600. } else {
  21601. const abs = Math.abs(delta);
  21602. if (abs <= 255) {
  21603. flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR;
  21604. yCoordinates.push(abs);
  21605. } else {
  21606. yCoordinates.push(delta);
  21607. }
  21608. }
  21609. lastY = y;
  21610. flags.push(flag);
  21611. }
  21612. buf.setUint16(pos, xCoordinates.length - 1);
  21613. pos += 2;
  21614. }
  21615. buf.setUint16(pos, this.instructions.length);
  21616. pos += 2;
  21617. if (this.instructions.length) {
  21618. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  21619. pos += this.instructions.length;
  21620. }
  21621. for (const flag of flags) {
  21622. buf.setUint8(pos++, flag);
  21623. }
  21624. for (let i = 0, ii = xCoordinates.length; i < ii; i++) {
  21625. const x = xCoordinates[i];
  21626. const flag = flags[i];
  21627. if (flag & X_SHORT_VECTOR) {
  21628. buf.setUint8(pos++, x);
  21629. } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) {
  21630. buf.setInt16(pos, x);
  21631. pos += 2;
  21632. }
  21633. }
  21634. for (let i = 0, ii = yCoordinates.length; i < ii; i++) {
  21635. const y = yCoordinates[i];
  21636. const flag = flags[i];
  21637. if (flag & Y_SHORT_VECTOR) {
  21638. buf.setUint8(pos++, y);
  21639. } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) {
  21640. buf.setInt16(pos, y);
  21641. pos += 2;
  21642. }
  21643. }
  21644. return pos - spos;
  21645. }
  21646. scale(x, factor) {
  21647. for (const contour of this.contours) {
  21648. if (contour.xCoordinates.length === 0) {
  21649. continue;
  21650. }
  21651. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  21652. contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor);
  21653. }
  21654. }
  21655. }
  21656. }
  21657. class CompositeGlyph {
  21658. constructor({
  21659. flags,
  21660. glyphIndex,
  21661. argument1,
  21662. argument2,
  21663. transf,
  21664. instructions
  21665. }) {
  21666. this.flags = flags;
  21667. this.glyphIndex = glyphIndex;
  21668. this.argument1 = argument1;
  21669. this.argument2 = argument2;
  21670. this.transf = transf;
  21671. this.instructions = instructions;
  21672. }
  21673. static parse(pos, glyf) {
  21674. const spos = pos;
  21675. const transf = [];
  21676. let flags = glyf.getUint16(pos);
  21677. const glyphIndex = glyf.getUint16(pos + 2);
  21678. pos += 4;
  21679. let argument1, argument2;
  21680. if (flags & ARG_1_AND_2_ARE_WORDS) {
  21681. if (flags & ARGS_ARE_XY_VALUES) {
  21682. argument1 = glyf.getInt16(pos);
  21683. argument2 = glyf.getInt16(pos + 2);
  21684. } else {
  21685. argument1 = glyf.getUint16(pos);
  21686. argument2 = glyf.getUint16(pos + 2);
  21687. }
  21688. pos += 4;
  21689. flags ^= ARG_1_AND_2_ARE_WORDS;
  21690. } else {
  21691. if (flags & ARGS_ARE_XY_VALUES) {
  21692. argument1 = glyf.getInt8(pos);
  21693. argument2 = glyf.getInt8(pos + 1);
  21694. } else {
  21695. argument1 = glyf.getUint8(pos);
  21696. argument2 = glyf.getUint8(pos + 1);
  21697. }
  21698. pos += 2;
  21699. }
  21700. if (flags & WE_HAVE_A_SCALE) {
  21701. transf.push(glyf.getUint16(pos));
  21702. pos += 2;
  21703. } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
  21704. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2));
  21705. pos += 4;
  21706. } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
  21707. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6));
  21708. pos += 8;
  21709. }
  21710. let instructions = null;
  21711. if (flags & WE_HAVE_INSTRUCTIONS) {
  21712. const instructionLength = glyf.getUint16(pos);
  21713. pos += 2;
  21714. instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  21715. pos += instructionLength;
  21716. }
  21717. return [pos - spos, new CompositeGlyph({
  21718. flags,
  21719. glyphIndex,
  21720. argument1,
  21721. argument2,
  21722. transf,
  21723. instructions
  21724. })];
  21725. }
  21726. getSize() {
  21727. let size = 2 + 2 + this.transf.length * 2;
  21728. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  21729. size += 2 + this.instructions.length;
  21730. }
  21731. size += 2;
  21732. if (this.flags & 2) {
  21733. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  21734. size += 2;
  21735. }
  21736. } else if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  21737. size += 2;
  21738. }
  21739. return size;
  21740. }
  21741. write(pos, buf) {
  21742. const spos = pos;
  21743. if (this.flags & ARGS_ARE_XY_VALUES) {
  21744. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  21745. this.flags |= ARG_1_AND_2_ARE_WORDS;
  21746. }
  21747. } else if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  21748. this.flags |= ARG_1_AND_2_ARE_WORDS;
  21749. }
  21750. buf.setUint16(pos, this.flags);
  21751. buf.setUint16(pos + 2, this.glyphIndex);
  21752. pos += 4;
  21753. if (this.flags & ARG_1_AND_2_ARE_WORDS) {
  21754. if (this.flags & ARGS_ARE_XY_VALUES) {
  21755. buf.setInt16(pos, this.argument1);
  21756. buf.setInt16(pos + 2, this.argument2);
  21757. } else {
  21758. buf.setUint16(pos, this.argument1);
  21759. buf.setUint16(pos + 2, this.argument2);
  21760. }
  21761. pos += 4;
  21762. } else {
  21763. buf.setUint8(pos, this.argument1);
  21764. buf.setUint8(pos + 1, this.argument2);
  21765. pos += 2;
  21766. }
  21767. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  21768. buf.setUint16(pos, this.instructions.length);
  21769. pos += 2;
  21770. if (this.instructions.length) {
  21771. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  21772. pos += this.instructions.length;
  21773. }
  21774. }
  21775. return pos - spos;
  21776. }
  21777. scale(x, factor) {}
  21778. }
  21779. ;// ./src/core/opentype_file_builder.js
  21780. function writeInt16(dest, offset, num) {
  21781. dest[offset] = num >> 8 & 0xff;
  21782. dest[offset + 1] = num & 0xff;
  21783. }
  21784. function writeInt32(dest, offset, num) {
  21785. dest[offset] = num >> 24 & 0xff;
  21786. dest[offset + 1] = num >> 16 & 0xff;
  21787. dest[offset + 2] = num >> 8 & 0xff;
  21788. dest[offset + 3] = num & 0xff;
  21789. }
  21790. function writeData(dest, offset, data) {
  21791. if (data instanceof Uint8Array) {
  21792. dest.set(data, offset);
  21793. } else if (typeof data === "string") {
  21794. for (let i = 0, ii = data.length; i < ii; i++) {
  21795. dest[offset++] = data.charCodeAt(i) & 0xff;
  21796. }
  21797. } else {
  21798. for (const num of data) {
  21799. dest[offset++] = num & 0xff;
  21800. }
  21801. }
  21802. }
  21803. const OTF_HEADER_SIZE = 12;
  21804. const OTF_TABLE_ENTRY_SIZE = 16;
  21805. class OpenTypeFileBuilder {
  21806. constructor(sfnt) {
  21807. this.sfnt = sfnt;
  21808. this.tables = Object.create(null);
  21809. }
  21810. static getSearchParams(entriesCount, entrySize) {
  21811. let maxPower2 = 1,
  21812. log2 = 0;
  21813. while ((maxPower2 ^ entriesCount) > maxPower2) {
  21814. maxPower2 <<= 1;
  21815. log2++;
  21816. }
  21817. const searchRange = maxPower2 * entrySize;
  21818. return {
  21819. range: searchRange,
  21820. entry: log2,
  21821. rangeShift: entrySize * entriesCount - searchRange
  21822. };
  21823. }
  21824. toArray() {
  21825. let sfnt = this.sfnt;
  21826. const tables = this.tables;
  21827. const tablesNames = Object.keys(tables);
  21828. tablesNames.sort();
  21829. const numTables = tablesNames.length;
  21830. let i, j, jj, table, tableName;
  21831. let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  21832. const tableOffsets = [offset];
  21833. for (i = 0; i < numTables; i++) {
  21834. table = tables[tablesNames[i]];
  21835. const paddedLength = (table.length + 3 & ~3) >>> 0;
  21836. offset += paddedLength;
  21837. tableOffsets.push(offset);
  21838. }
  21839. const file = new Uint8Array(offset);
  21840. for (i = 0; i < numTables; i++) {
  21841. table = tables[tablesNames[i]];
  21842. writeData(file, tableOffsets[i], table);
  21843. }
  21844. if (sfnt === "true") {
  21845. sfnt = string32(0x00010000);
  21846. }
  21847. file[0] = sfnt.charCodeAt(0) & 0xff;
  21848. file[1] = sfnt.charCodeAt(1) & 0xff;
  21849. file[2] = sfnt.charCodeAt(2) & 0xff;
  21850. file[3] = sfnt.charCodeAt(3) & 0xff;
  21851. writeInt16(file, 4, numTables);
  21852. const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  21853. writeInt16(file, 6, searchParams.range);
  21854. writeInt16(file, 8, searchParams.entry);
  21855. writeInt16(file, 10, searchParams.rangeShift);
  21856. offset = OTF_HEADER_SIZE;
  21857. for (i = 0; i < numTables; i++) {
  21858. tableName = tablesNames[i];
  21859. file[offset] = tableName.charCodeAt(0) & 0xff;
  21860. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  21861. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  21862. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  21863. let checksum = 0;
  21864. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  21865. const quad = readUint32(file, j);
  21866. checksum = checksum + quad >>> 0;
  21867. }
  21868. writeInt32(file, offset + 4, checksum);
  21869. writeInt32(file, offset + 8, tableOffsets[i]);
  21870. writeInt32(file, offset + 12, tables[tableName].length);
  21871. offset += OTF_TABLE_ENTRY_SIZE;
  21872. }
  21873. return file;
  21874. }
  21875. addTable(tag, data) {
  21876. if (tag in this.tables) {
  21877. throw new Error("Table " + tag + " already exists");
  21878. }
  21879. this.tables[tag] = data;
  21880. }
  21881. }
  21882. ;// ./src/core/type1_parser.js
  21883. const HINTING_ENABLED = false;
  21884. const COMMAND_MAP = {
  21885. hstem: [1],
  21886. vstem: [3],
  21887. vmoveto: [4],
  21888. rlineto: [5],
  21889. hlineto: [6],
  21890. vlineto: [7],
  21891. rrcurveto: [8],
  21892. callsubr: [10],
  21893. flex: [12, 35],
  21894. drop: [12, 18],
  21895. endchar: [14],
  21896. rmoveto: [21],
  21897. hmoveto: [22],
  21898. vhcurveto: [30],
  21899. hvcurveto: [31]
  21900. };
  21901. class Type1CharString {
  21902. constructor() {
  21903. this.width = 0;
  21904. this.lsb = 0;
  21905. this.flexing = false;
  21906. this.output = [];
  21907. this.stack = [];
  21908. }
  21909. convert(encoded, subrs, seacAnalysisEnabled) {
  21910. const count = encoded.length;
  21911. let error = false;
  21912. let wx, sbx, subrNumber;
  21913. for (let i = 0; i < count; i++) {
  21914. let value = encoded[i];
  21915. if (value < 32) {
  21916. if (value === 12) {
  21917. value = (value << 8) + encoded[++i];
  21918. }
  21919. switch (value) {
  21920. case 1:
  21921. if (!HINTING_ENABLED) {
  21922. this.stack = [];
  21923. break;
  21924. }
  21925. error = this.executeCommand(2, COMMAND_MAP.hstem);
  21926. break;
  21927. case 3:
  21928. if (!HINTING_ENABLED) {
  21929. this.stack = [];
  21930. break;
  21931. }
  21932. error = this.executeCommand(2, COMMAND_MAP.vstem);
  21933. break;
  21934. case 4:
  21935. if (this.flexing) {
  21936. if (this.stack.length < 1) {
  21937. error = true;
  21938. break;
  21939. }
  21940. const dy = this.stack.pop();
  21941. this.stack.push(0, dy);
  21942. break;
  21943. }
  21944. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  21945. break;
  21946. case 5:
  21947. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  21948. break;
  21949. case 6:
  21950. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  21951. break;
  21952. case 7:
  21953. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  21954. break;
  21955. case 8:
  21956. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  21957. break;
  21958. case 9:
  21959. this.stack = [];
  21960. break;
  21961. case 10:
  21962. if (this.stack.length < 1) {
  21963. error = true;
  21964. break;
  21965. }
  21966. subrNumber = this.stack.pop();
  21967. if (!subrs[subrNumber]) {
  21968. error = true;
  21969. break;
  21970. }
  21971. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  21972. break;
  21973. case 11:
  21974. return error;
  21975. case 13:
  21976. if (this.stack.length < 2) {
  21977. error = true;
  21978. break;
  21979. }
  21980. wx = this.stack.pop();
  21981. sbx = this.stack.pop();
  21982. this.lsb = sbx;
  21983. this.width = wx;
  21984. this.stack.push(wx, sbx);
  21985. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  21986. break;
  21987. case 14:
  21988. this.output.push(COMMAND_MAP.endchar[0]);
  21989. break;
  21990. case 21:
  21991. if (this.flexing) {
  21992. break;
  21993. }
  21994. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  21995. break;
  21996. case 22:
  21997. if (this.flexing) {
  21998. this.stack.push(0);
  21999. break;
  22000. }
  22001. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  22002. break;
  22003. case 30:
  22004. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  22005. break;
  22006. case 31:
  22007. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  22008. break;
  22009. case (12 << 8) + 0:
  22010. this.stack = [];
  22011. break;
  22012. case (12 << 8) + 1:
  22013. if (!HINTING_ENABLED) {
  22014. this.stack = [];
  22015. break;
  22016. }
  22017. error = this.executeCommand(2, COMMAND_MAP.vstem);
  22018. break;
  22019. case (12 << 8) + 2:
  22020. if (!HINTING_ENABLED) {
  22021. this.stack = [];
  22022. break;
  22023. }
  22024. error = this.executeCommand(2, COMMAND_MAP.hstem);
  22025. break;
  22026. case (12 << 8) + 6:
  22027. if (seacAnalysisEnabled) {
  22028. const asb = this.stack.at(-5);
  22029. this.seac = this.stack.splice(-4, 4);
  22030. this.seac[0] += this.lsb - asb;
  22031. error = this.executeCommand(0, COMMAND_MAP.endchar);
  22032. } else {
  22033. error = this.executeCommand(4, COMMAND_MAP.endchar);
  22034. }
  22035. break;
  22036. case (12 << 8) + 7:
  22037. if (this.stack.length < 4) {
  22038. error = true;
  22039. break;
  22040. }
  22041. this.stack.pop();
  22042. wx = this.stack.pop();
  22043. const sby = this.stack.pop();
  22044. sbx = this.stack.pop();
  22045. this.lsb = sbx;
  22046. this.width = wx;
  22047. this.stack.push(wx, sbx, sby);
  22048. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  22049. break;
  22050. case (12 << 8) + 12:
  22051. if (this.stack.length < 2) {
  22052. error = true;
  22053. break;
  22054. }
  22055. const num2 = this.stack.pop();
  22056. const num1 = this.stack.pop();
  22057. this.stack.push(num1 / num2);
  22058. break;
  22059. case (12 << 8) + 16:
  22060. if (this.stack.length < 2) {
  22061. error = true;
  22062. break;
  22063. }
  22064. subrNumber = this.stack.pop();
  22065. const numArgs = this.stack.pop();
  22066. if (subrNumber === 0 && numArgs === 3) {
  22067. const flexArgs = this.stack.splice(-17, 17);
  22068. this.stack.push(flexArgs[2] + flexArgs[0], flexArgs[3] + flexArgs[1], flexArgs[4], flexArgs[5], flexArgs[6], flexArgs[7], flexArgs[8], flexArgs[9], flexArgs[10], flexArgs[11], flexArgs[12], flexArgs[13], flexArgs[14]);
  22069. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  22070. this.flexing = false;
  22071. this.stack.push(flexArgs[15], flexArgs[16]);
  22072. } else if (subrNumber === 1 && numArgs === 0) {
  22073. this.flexing = true;
  22074. }
  22075. break;
  22076. case (12 << 8) + 17:
  22077. break;
  22078. case (12 << 8) + 33:
  22079. this.stack = [];
  22080. break;
  22081. default:
  22082. warn('Unknown type 1 charstring command of "' + value + '"');
  22083. break;
  22084. }
  22085. if (error) {
  22086. break;
  22087. }
  22088. continue;
  22089. } else if (value <= 246) {
  22090. value -= 139;
  22091. } else if (value <= 250) {
  22092. value = (value - 247) * 256 + encoded[++i] + 108;
  22093. } else if (value <= 254) {
  22094. value = -((value - 251) * 256) - encoded[++i] - 108;
  22095. } else {
  22096. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  22097. }
  22098. this.stack.push(value);
  22099. }
  22100. return error;
  22101. }
  22102. executeCommand(howManyArgs, command, keepStack) {
  22103. const stackLength = this.stack.length;
  22104. if (howManyArgs > stackLength) {
  22105. return true;
  22106. }
  22107. const start = stackLength - howManyArgs;
  22108. for (let i = start; i < stackLength; i++) {
  22109. let value = this.stack[i];
  22110. if (Number.isInteger(value)) {
  22111. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  22112. } else {
  22113. value = 65536 * value | 0;
  22114. this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  22115. }
  22116. }
  22117. this.output.push(...command);
  22118. if (keepStack) {
  22119. this.stack.splice(start, howManyArgs);
  22120. } else {
  22121. this.stack.length = 0;
  22122. }
  22123. return false;
  22124. }
  22125. }
  22126. const EEXEC_ENCRYPT_KEY = 55665;
  22127. const CHAR_STRS_ENCRYPT_KEY = 4330;
  22128. function isHexDigit(code) {
  22129. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  22130. }
  22131. function decrypt(data, key, discardNumber) {
  22132. if (discardNumber >= data.length) {
  22133. return new Uint8Array(0);
  22134. }
  22135. const c1 = 52845,
  22136. c2 = 22719;
  22137. let r = key | 0,
  22138. i,
  22139. j;
  22140. for (i = 0; i < discardNumber; i++) {
  22141. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  22142. }
  22143. const count = data.length - discardNumber;
  22144. const decrypted = new Uint8Array(count);
  22145. for (i = discardNumber, j = 0; j < count; i++, j++) {
  22146. const value = data[i];
  22147. decrypted[j] = value ^ r >> 8;
  22148. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  22149. }
  22150. return decrypted;
  22151. }
  22152. function decryptAscii(data, key, discardNumber) {
  22153. const c1 = 52845,
  22154. c2 = 22719;
  22155. let r = key | 0;
  22156. const count = data.length,
  22157. maybeLength = count >>> 1;
  22158. const decrypted = new Uint8Array(maybeLength);
  22159. let i, j;
  22160. for (i = 0, j = 0; i < count; i++) {
  22161. const digit1 = data[i];
  22162. if (!isHexDigit(digit1)) {
  22163. continue;
  22164. }
  22165. i++;
  22166. let digit2;
  22167. while (i < count && !isHexDigit(digit2 = data[i])) {
  22168. i++;
  22169. }
  22170. if (i < count) {
  22171. const value = parseInt(String.fromCharCode(digit1, digit2), 16);
  22172. decrypted[j++] = value ^ r >> 8;
  22173. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  22174. }
  22175. }
  22176. return decrypted.slice(discardNumber, j);
  22177. }
  22178. function isSpecial(c) {
  22179. return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
  22180. }
  22181. class Type1Parser {
  22182. constructor(stream, encrypted, seacAnalysisEnabled) {
  22183. if (encrypted) {
  22184. const data = stream.getBytes();
  22185. const isBinary = !((isHexDigit(data[0]) || isWhiteSpace(data[0])) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]) && isHexDigit(data[4]) && isHexDigit(data[5]) && isHexDigit(data[6]) && isHexDigit(data[7]));
  22186. stream = new Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  22187. }
  22188. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  22189. this.stream = stream;
  22190. this.nextChar();
  22191. }
  22192. readNumberArray() {
  22193. this.getToken();
  22194. const array = [];
  22195. while (true) {
  22196. const token = this.getToken();
  22197. if (token === null || token === "]" || token === "}") {
  22198. break;
  22199. }
  22200. array.push(parseFloat(token || 0));
  22201. }
  22202. return array;
  22203. }
  22204. readNumber() {
  22205. const token = this.getToken();
  22206. return parseFloat(token || 0);
  22207. }
  22208. readInt() {
  22209. const token = this.getToken();
  22210. return parseInt(token || 0, 10) | 0;
  22211. }
  22212. readBoolean() {
  22213. const token = this.getToken();
  22214. return token === "true" ? 1 : 0;
  22215. }
  22216. nextChar() {
  22217. return this.currentChar = this.stream.getByte();
  22218. }
  22219. prevChar() {
  22220. this.stream.skip(-2);
  22221. return this.currentChar = this.stream.getByte();
  22222. }
  22223. getToken() {
  22224. let comment = false;
  22225. let ch = this.currentChar;
  22226. while (true) {
  22227. if (ch === -1) {
  22228. return null;
  22229. }
  22230. if (comment) {
  22231. if (ch === 0x0a || ch === 0x0d) {
  22232. comment = false;
  22233. }
  22234. } else if (ch === 0x25) {
  22235. comment = true;
  22236. } else if (!isWhiteSpace(ch)) {
  22237. break;
  22238. }
  22239. ch = this.nextChar();
  22240. }
  22241. if (isSpecial(ch)) {
  22242. this.nextChar();
  22243. return String.fromCharCode(ch);
  22244. }
  22245. let token = "";
  22246. do {
  22247. token += String.fromCharCode(ch);
  22248. ch = this.nextChar();
  22249. } while (ch >= 0 && !isWhiteSpace(ch) && !isSpecial(ch));
  22250. return token;
  22251. }
  22252. readCharStrings(bytes, lenIV) {
  22253. if (lenIV === -1) {
  22254. return bytes;
  22255. }
  22256. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  22257. }
  22258. extractFontProgram(properties) {
  22259. const stream = this.stream;
  22260. const subrs = [],
  22261. charstrings = [];
  22262. const privateData = Object.create(null);
  22263. privateData.lenIV = 4;
  22264. const program = {
  22265. subrs: [],
  22266. charstrings: [],
  22267. properties: {
  22268. privateData
  22269. }
  22270. };
  22271. let token, length, data, lenIV;
  22272. while ((token = this.getToken()) !== null) {
  22273. if (token !== "/") {
  22274. continue;
  22275. }
  22276. token = this.getToken();
  22277. switch (token) {
  22278. case "CharStrings":
  22279. this.getToken();
  22280. this.getToken();
  22281. this.getToken();
  22282. this.getToken();
  22283. while (true) {
  22284. token = this.getToken();
  22285. if (token === null || token === "end") {
  22286. break;
  22287. }
  22288. if (token !== "/") {
  22289. continue;
  22290. }
  22291. const glyph = this.getToken();
  22292. length = this.readInt();
  22293. this.getToken();
  22294. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  22295. lenIV = program.properties.privateData.lenIV;
  22296. const encoded = this.readCharStrings(data, lenIV);
  22297. this.nextChar();
  22298. token = this.getToken();
  22299. if (token === "noaccess") {
  22300. this.getToken();
  22301. } else if (token === "/") {
  22302. this.prevChar();
  22303. }
  22304. charstrings.push({
  22305. glyph,
  22306. encoded
  22307. });
  22308. }
  22309. break;
  22310. case "Subrs":
  22311. this.readInt();
  22312. this.getToken();
  22313. while (this.getToken() === "dup") {
  22314. const index = this.readInt();
  22315. length = this.readInt();
  22316. this.getToken();
  22317. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  22318. lenIV = program.properties.privateData.lenIV;
  22319. const encoded = this.readCharStrings(data, lenIV);
  22320. this.nextChar();
  22321. token = this.getToken();
  22322. if (token === "noaccess") {
  22323. this.getToken();
  22324. }
  22325. subrs[index] = encoded;
  22326. }
  22327. break;
  22328. case "BlueValues":
  22329. case "OtherBlues":
  22330. case "FamilyBlues":
  22331. case "FamilyOtherBlues":
  22332. const blueArray = this.readNumberArray();
  22333. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  22334. program.properties.privateData[token] = blueArray;
  22335. }
  22336. break;
  22337. case "StemSnapH":
  22338. case "StemSnapV":
  22339. program.properties.privateData[token] = this.readNumberArray();
  22340. break;
  22341. case "StdHW":
  22342. case "StdVW":
  22343. program.properties.privateData[token] = this.readNumberArray()[0];
  22344. break;
  22345. case "BlueShift":
  22346. case "lenIV":
  22347. case "BlueFuzz":
  22348. case "BlueScale":
  22349. case "LanguageGroup":
  22350. program.properties.privateData[token] = this.readNumber();
  22351. break;
  22352. case "ExpansionFactor":
  22353. program.properties.privateData[token] = this.readNumber() || 0.06;
  22354. break;
  22355. case "ForceBold":
  22356. program.properties.privateData[token] = this.readBoolean();
  22357. break;
  22358. }
  22359. }
  22360. for (const {
  22361. encoded,
  22362. glyph
  22363. } of charstrings) {
  22364. const charString = new Type1CharString();
  22365. const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  22366. let output = charString.output;
  22367. if (error) {
  22368. output = [14];
  22369. }
  22370. const charStringObject = {
  22371. glyphName: glyph,
  22372. charstring: output,
  22373. width: charString.width,
  22374. lsb: charString.lsb,
  22375. seac: charString.seac
  22376. };
  22377. if (glyph === ".notdef") {
  22378. program.charstrings.unshift(charStringObject);
  22379. } else {
  22380. program.charstrings.push(charStringObject);
  22381. }
  22382. if (properties.builtInEncoding) {
  22383. const index = properties.builtInEncoding.indexOf(glyph);
  22384. if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
  22385. properties.widths[index] = charString.width;
  22386. }
  22387. }
  22388. }
  22389. return program;
  22390. }
  22391. extractFontHeader(properties) {
  22392. let token;
  22393. while ((token = this.getToken()) !== null) {
  22394. if (token !== "/") {
  22395. continue;
  22396. }
  22397. token = this.getToken();
  22398. switch (token) {
  22399. case "FontMatrix":
  22400. const matrix = this.readNumberArray();
  22401. properties.fontMatrix = matrix;
  22402. break;
  22403. case "Encoding":
  22404. const encodingArg = this.getToken();
  22405. let encoding;
  22406. if (!/^\d+$/.test(encodingArg)) {
  22407. encoding = getEncoding(encodingArg);
  22408. } else {
  22409. encoding = [];
  22410. const size = parseInt(encodingArg, 10) | 0;
  22411. this.getToken();
  22412. for (let j = 0; j < size; j++) {
  22413. token = this.getToken();
  22414. while (token !== "dup" && token !== "def") {
  22415. token = this.getToken();
  22416. if (token === null) {
  22417. return;
  22418. }
  22419. }
  22420. if (token === "def") {
  22421. break;
  22422. }
  22423. const index = this.readInt();
  22424. this.getToken();
  22425. const glyph = this.getToken();
  22426. encoding[index] = glyph;
  22427. this.getToken();
  22428. }
  22429. }
  22430. properties.builtInEncoding = encoding;
  22431. break;
  22432. case "FontBBox":
  22433. const fontBBox = this.readNumberArray();
  22434. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  22435. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  22436. properties.ascentScaled = true;
  22437. break;
  22438. }
  22439. }
  22440. }
  22441. }
  22442. ;// ./src/core/type1_font.js
  22443. function findBlock(streamBytes, signature, startIndex) {
  22444. const streamBytesLength = streamBytes.length;
  22445. const signatureLength = signature.length;
  22446. const scanLength = streamBytesLength - signatureLength;
  22447. let i = startIndex,
  22448. found = false;
  22449. while (i < scanLength) {
  22450. let j = 0;
  22451. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  22452. j++;
  22453. }
  22454. if (j >= signatureLength) {
  22455. i += j;
  22456. while (i < streamBytesLength && isWhiteSpace(streamBytes[i])) {
  22457. i++;
  22458. }
  22459. found = true;
  22460. break;
  22461. }
  22462. i++;
  22463. }
  22464. return {
  22465. found,
  22466. length: i
  22467. };
  22468. }
  22469. function getHeaderBlock(stream, suggestedLength) {
  22470. const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  22471. const streamStartPos = stream.pos;
  22472. let headerBytes, headerBytesLength, block;
  22473. try {
  22474. headerBytes = stream.getBytes(suggestedLength);
  22475. headerBytesLength = headerBytes.length;
  22476. } catch {}
  22477. if (headerBytesLength === suggestedLength) {
  22478. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  22479. if (block.found && block.length === suggestedLength) {
  22480. return {
  22481. stream: new Stream(headerBytes),
  22482. length: suggestedLength
  22483. };
  22484. }
  22485. }
  22486. warn('Invalid "Length1" property in Type1 font -- trying to recover.');
  22487. stream.pos = streamStartPos;
  22488. const SCAN_BLOCK_LENGTH = 2048;
  22489. let actualLength;
  22490. while (true) {
  22491. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  22492. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  22493. if (block.length === 0) {
  22494. break;
  22495. }
  22496. stream.pos += block.length;
  22497. if (block.found) {
  22498. actualLength = stream.pos - streamStartPos;
  22499. break;
  22500. }
  22501. }
  22502. stream.pos = streamStartPos;
  22503. if (actualLength) {
  22504. return {
  22505. stream: new Stream(stream.getBytes(actualLength)),
  22506. length: actualLength
  22507. };
  22508. }
  22509. warn('Unable to recover "Length1" property in Type1 font -- using as is.');
  22510. return {
  22511. stream: new Stream(stream.getBytes(suggestedLength)),
  22512. length: suggestedLength
  22513. };
  22514. }
  22515. function getEexecBlock(stream, suggestedLength) {
  22516. const eexecBytes = stream.getBytes();
  22517. if (eexecBytes.length === 0) {
  22518. throw new FormatError("getEexecBlock - no font program found.");
  22519. }
  22520. return {
  22521. stream: new Stream(eexecBytes),
  22522. length: eexecBytes.length
  22523. };
  22524. }
  22525. class Type1Font {
  22526. constructor(name, file, properties) {
  22527. const PFB_HEADER_SIZE = 6;
  22528. let headerBlockLength = properties.length1;
  22529. let eexecBlockLength = properties.length2;
  22530. let pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  22531. const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  22532. if (pfbHeaderPresent) {
  22533. file.skip(PFB_HEADER_SIZE);
  22534. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  22535. }
  22536. const headerBlock = getHeaderBlock(file, headerBlockLength);
  22537. const headerBlockParser = new Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED);
  22538. headerBlockParser.extractFontHeader(properties);
  22539. if (pfbHeaderPresent) {
  22540. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  22541. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  22542. }
  22543. const eexecBlock = getEexecBlock(file, eexecBlockLength);
  22544. const eexecBlockParser = new Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED);
  22545. const data = eexecBlockParser.extractFontProgram(properties);
  22546. for (const key in data.properties) {
  22547. properties[key] = data.properties[key];
  22548. }
  22549. const charstrings = data.charstrings;
  22550. const type2Charstrings = this.getType2Charstrings(charstrings);
  22551. const subrs = this.getType2Subrs(data.subrs);
  22552. this.charstrings = charstrings;
  22553. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  22554. this.seacs = this.getSeacs(data.charstrings);
  22555. }
  22556. get numGlyphs() {
  22557. return this.charstrings.length + 1;
  22558. }
  22559. getCharset() {
  22560. const charset = [".notdef"];
  22561. for (const {
  22562. glyphName
  22563. } of this.charstrings) {
  22564. charset.push(glyphName);
  22565. }
  22566. return charset;
  22567. }
  22568. getGlyphMapping(properties) {
  22569. const charstrings = this.charstrings;
  22570. if (properties.composite) {
  22571. const charCodeToGlyphId = Object.create(null);
  22572. for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
  22573. const charCode = properties.cMap.charCodeOf(glyphId);
  22574. charCodeToGlyphId[charCode] = glyphId + 1;
  22575. }
  22576. return charCodeToGlyphId;
  22577. }
  22578. const glyphNames = [".notdef"];
  22579. let builtInEncoding, glyphId;
  22580. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  22581. glyphNames.push(charstrings[glyphId].glyphName);
  22582. }
  22583. const encoding = properties.builtInEncoding;
  22584. if (encoding) {
  22585. builtInEncoding = Object.create(null);
  22586. for (const charCode in encoding) {
  22587. glyphId = glyphNames.indexOf(encoding[charCode]);
  22588. if (glyphId >= 0) {
  22589. builtInEncoding[charCode] = glyphId;
  22590. }
  22591. }
  22592. }
  22593. return type1FontGlyphMapping(properties, builtInEncoding, glyphNames);
  22594. }
  22595. hasGlyphId(id) {
  22596. if (id < 0 || id >= this.numGlyphs) {
  22597. return false;
  22598. }
  22599. if (id === 0) {
  22600. return true;
  22601. }
  22602. const glyph = this.charstrings[id - 1];
  22603. return glyph.charstring.length > 0;
  22604. }
  22605. getSeacs(charstrings) {
  22606. const seacMap = [];
  22607. for (let i = 0, ii = charstrings.length; i < ii; i++) {
  22608. const charstring = charstrings[i];
  22609. if (charstring.seac) {
  22610. seacMap[i + 1] = charstring.seac;
  22611. }
  22612. }
  22613. return seacMap;
  22614. }
  22615. getType2Charstrings(type1Charstrings) {
  22616. const type2Charstrings = [];
  22617. for (const type1Charstring of type1Charstrings) {
  22618. type2Charstrings.push(type1Charstring.charstring);
  22619. }
  22620. return type2Charstrings;
  22621. }
  22622. getType2Subrs(type1Subrs) {
  22623. let bias = 0;
  22624. const count = type1Subrs.length;
  22625. if (count < 1133) {
  22626. bias = 107;
  22627. } else if (count < 33769) {
  22628. bias = 1131;
  22629. } else {
  22630. bias = 32768;
  22631. }
  22632. const type2Subrs = [];
  22633. let i;
  22634. for (i = 0; i < bias; i++) {
  22635. type2Subrs.push([0x0b]);
  22636. }
  22637. for (i = 0; i < count; i++) {
  22638. type2Subrs.push(type1Subrs[i]);
  22639. }
  22640. return type2Subrs;
  22641. }
  22642. wrap(name, glyphs, charstrings, subrs, properties) {
  22643. const cff = new CFF();
  22644. cff.header = new CFFHeader(1, 0, 4, 4);
  22645. cff.names = [name];
  22646. const topDict = new CFFTopDict();
  22647. topDict.setByName("version", 391);
  22648. topDict.setByName("Notice", 392);
  22649. topDict.setByName("FullName", 393);
  22650. topDict.setByName("FamilyName", 394);
  22651. topDict.setByName("Weight", 395);
  22652. topDict.setByName("Encoding", null);
  22653. topDict.setByName("FontMatrix", properties.fontMatrix);
  22654. topDict.setByName("FontBBox", properties.bbox);
  22655. topDict.setByName("charset", null);
  22656. topDict.setByName("CharStrings", null);
  22657. topDict.setByName("Private", null);
  22658. cff.topDict = topDict;
  22659. const strings = new CFFStrings();
  22660. strings.add("Version 0.11");
  22661. strings.add("See original notice");
  22662. strings.add(name);
  22663. strings.add(name);
  22664. strings.add("Medium");
  22665. cff.strings = strings;
  22666. cff.globalSubrIndex = new CFFIndex();
  22667. const count = glyphs.length;
  22668. const charsetArray = [".notdef"];
  22669. let i, ii;
  22670. for (i = 0; i < count; i++) {
  22671. const glyphName = charstrings[i].glyphName;
  22672. const index = CFFStandardStrings.indexOf(glyphName);
  22673. if (index === -1) {
  22674. strings.add(glyphName);
  22675. }
  22676. charsetArray.push(glyphName);
  22677. }
  22678. cff.charset = new CFFCharset(false, 0, charsetArray);
  22679. const charStringsIndex = new CFFIndex();
  22680. charStringsIndex.add([0x8b, 0x0e]);
  22681. for (i = 0; i < count; i++) {
  22682. charStringsIndex.add(glyphs[i]);
  22683. }
  22684. cff.charStrings = charStringsIndex;
  22685. const privateDict = new CFFPrivateDict();
  22686. privateDict.setByName("Subrs", null);
  22687. const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
  22688. for (i = 0, ii = fields.length; i < ii; i++) {
  22689. const field = fields[i];
  22690. if (!(field in properties.privateData)) {
  22691. continue;
  22692. }
  22693. const value = properties.privateData[field];
  22694. if (Array.isArray(value)) {
  22695. for (let j = value.length - 1; j > 0; j--) {
  22696. value[j] -= value[j - 1];
  22697. }
  22698. }
  22699. privateDict.setByName(field, value);
  22700. }
  22701. cff.topDict.privateDict = privateDict;
  22702. const subrIndex = new CFFIndex();
  22703. for (i = 0, ii = subrs.length; i < ii; i++) {
  22704. subrIndex.add(subrs[i]);
  22705. }
  22706. privateDict.subrsIndex = subrIndex;
  22707. const compiler = new CFFCompiler(cff);
  22708. return compiler.compile();
  22709. }
  22710. }
  22711. ;// ./src/core/fonts.js
  22712. const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
  22713. const PDF_GLYPH_SPACE_UNITS = 1000;
  22714. const EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "charProcOperatorList", "composite", "cssFontInfo", "data", "defaultVMetrics", "defaultWidth", "descent", "fallbackName", "fontMatrix", "isInvalidPDFjsFont", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "subtype", "systemFontInfo", "type", "vertical"];
  22715. const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
  22716. function adjustWidths(properties) {
  22717. if (!properties.fontMatrix) {
  22718. return;
  22719. }
  22720. if (properties.fontMatrix[0] === FONT_IDENTITY_MATRIX[0]) {
  22721. return;
  22722. }
  22723. const scale = 0.001 / properties.fontMatrix[0];
  22724. const glyphsWidths = properties.widths;
  22725. for (const glyph in glyphsWidths) {
  22726. glyphsWidths[glyph] *= scale;
  22727. }
  22728. properties.defaultWidth *= scale;
  22729. }
  22730. function adjustTrueTypeToUnicode(properties, isSymbolicFont, nameRecords) {
  22731. if (properties.isInternalFont) {
  22732. return;
  22733. }
  22734. if (properties.hasIncludedToUnicodeMap) {
  22735. return;
  22736. }
  22737. if (properties.hasEncoding) {
  22738. return;
  22739. }
  22740. if (properties.toUnicode instanceof IdentityToUnicodeMap) {
  22741. return;
  22742. }
  22743. if (!isSymbolicFont) {
  22744. return;
  22745. }
  22746. if (nameRecords.length === 0) {
  22747. return;
  22748. }
  22749. if (properties.defaultEncoding === WinAnsiEncoding) {
  22750. return;
  22751. }
  22752. for (const r of nameRecords) {
  22753. if (!isWinNameRecord(r)) {
  22754. return;
  22755. }
  22756. }
  22757. const encoding = WinAnsiEncoding;
  22758. const toUnicode = [],
  22759. glyphsUnicodeMap = getGlyphsUnicode();
  22760. for (const charCode in encoding) {
  22761. const glyphName = encoding[charCode];
  22762. if (glyphName === "") {
  22763. continue;
  22764. }
  22765. const unicode = glyphsUnicodeMap[glyphName];
  22766. if (unicode === undefined) {
  22767. continue;
  22768. }
  22769. toUnicode[charCode] = String.fromCharCode(unicode);
  22770. }
  22771. if (toUnicode.length > 0) {
  22772. properties.toUnicode.amend(toUnicode);
  22773. }
  22774. }
  22775. function adjustType1ToUnicode(properties, builtInEncoding) {
  22776. if (properties.isInternalFont) {
  22777. return;
  22778. }
  22779. if (properties.hasIncludedToUnicodeMap) {
  22780. return;
  22781. }
  22782. if (builtInEncoding === properties.defaultEncoding) {
  22783. return;
  22784. }
  22785. if (properties.toUnicode instanceof IdentityToUnicodeMap) {
  22786. return;
  22787. }
  22788. const toUnicode = [],
  22789. glyphsUnicodeMap = getGlyphsUnicode();
  22790. for (const charCode in builtInEncoding) {
  22791. if (properties.hasEncoding) {
  22792. if (properties.baseEncodingName || properties.differences[charCode] !== undefined) {
  22793. continue;
  22794. }
  22795. }
  22796. const glyphName = builtInEncoding[charCode];
  22797. const unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  22798. if (unicode !== -1) {
  22799. toUnicode[charCode] = String.fromCharCode(unicode);
  22800. }
  22801. }
  22802. if (toUnicode.length > 0) {
  22803. properties.toUnicode.amend(toUnicode);
  22804. }
  22805. }
  22806. function amendFallbackToUnicode(properties) {
  22807. if (!properties.fallbackToUnicode) {
  22808. return;
  22809. }
  22810. if (properties.toUnicode instanceof IdentityToUnicodeMap) {
  22811. return;
  22812. }
  22813. const toUnicode = [];
  22814. for (const charCode in properties.fallbackToUnicode) {
  22815. if (properties.toUnicode.has(charCode)) {
  22816. continue;
  22817. }
  22818. toUnicode[charCode] = properties.fallbackToUnicode[charCode];
  22819. }
  22820. if (toUnicode.length > 0) {
  22821. properties.toUnicode.amend(toUnicode);
  22822. }
  22823. }
  22824. class fonts_Glyph {
  22825. constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  22826. this.originalCharCode = originalCharCode;
  22827. this.fontChar = fontChar;
  22828. this.unicode = unicode;
  22829. this.accent = accent;
  22830. this.width = width;
  22831. this.vmetric = vmetric;
  22832. this.operatorListId = operatorListId;
  22833. this.isSpace = isSpace;
  22834. this.isInFont = isInFont;
  22835. }
  22836. get category() {
  22837. return shadow(this, "category", getCharUnicodeCategory(this.unicode), true);
  22838. }
  22839. }
  22840. function int16(b0, b1) {
  22841. return (b0 << 8) + b1;
  22842. }
  22843. function writeSignedInt16(bytes, index, value) {
  22844. bytes[index + 1] = value;
  22845. bytes[index] = value >>> 8;
  22846. }
  22847. function signedInt16(b0, b1) {
  22848. const value = (b0 << 8) + b1;
  22849. return value & 1 << 15 ? value - 0x10000 : value;
  22850. }
  22851. function writeUint32(bytes, index, value) {
  22852. bytes[index + 3] = value & 0xff;
  22853. bytes[index + 2] = value >>> 8;
  22854. bytes[index + 1] = value >>> 16;
  22855. bytes[index] = value >>> 24;
  22856. }
  22857. function int32(b0, b1, b2, b3) {
  22858. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  22859. }
  22860. function string16(value) {
  22861. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  22862. }
  22863. function safeString16(value) {
  22864. if (value > 0x7fff) {
  22865. value = 0x7fff;
  22866. } else if (value < -0x8000) {
  22867. value = -0x8000;
  22868. }
  22869. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  22870. }
  22871. function isTrueTypeFile(file) {
  22872. const header = file.peekBytes(4);
  22873. return readUint32(header, 0) === 0x00010000 || bytesToString(header) === "true";
  22874. }
  22875. function isTrueTypeCollectionFile(file) {
  22876. const header = file.peekBytes(4);
  22877. return bytesToString(header) === "ttcf";
  22878. }
  22879. function isOpenTypeFile(file) {
  22880. const header = file.peekBytes(4);
  22881. return bytesToString(header) === "OTTO";
  22882. }
  22883. function isType1File(file) {
  22884. const header = file.peekBytes(2);
  22885. if (header[0] === 0x25 && header[1] === 0x21) {
  22886. return true;
  22887. }
  22888. if (header[0] === 0x80 && header[1] === 0x01) {
  22889. return true;
  22890. }
  22891. return false;
  22892. }
  22893. function isCFFFile(file) {
  22894. const header = file.peekBytes(4);
  22895. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  22896. return true;
  22897. }
  22898. return false;
  22899. }
  22900. function getFontFileType(file, {
  22901. type,
  22902. subtype,
  22903. composite
  22904. }) {
  22905. let fileType, fileSubtype;
  22906. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  22907. fileType = composite ? "CIDFontType2" : "TrueType";
  22908. } else if (isOpenTypeFile(file)) {
  22909. fileType = composite ? "CIDFontType2" : "OpenType";
  22910. } else if (isType1File(file)) {
  22911. if (composite) {
  22912. fileType = "CIDFontType0";
  22913. } else {
  22914. fileType = type === "MMType1" ? "MMType1" : "Type1";
  22915. }
  22916. } else if (isCFFFile(file)) {
  22917. if (composite) {
  22918. fileType = "CIDFontType0";
  22919. fileSubtype = "CIDFontType0C";
  22920. } else {
  22921. fileType = type === "MMType1" ? "MMType1" : "Type1";
  22922. fileSubtype = "Type1C";
  22923. }
  22924. } else {
  22925. warn("getFontFileType: Unable to detect correct font file Type/Subtype.");
  22926. fileType = type;
  22927. fileSubtype = subtype;
  22928. }
  22929. return [fileType, fileSubtype];
  22930. }
  22931. function applyStandardFontGlyphMap(map, glyphMap) {
  22932. for (const charCode in glyphMap) {
  22933. map[+charCode] = glyphMap[charCode];
  22934. }
  22935. }
  22936. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  22937. const toFontChar = [];
  22938. let unicode;
  22939. for (let i = 0, ii = encoding.length; i < ii; i++) {
  22940. unicode = getUnicodeForGlyph(encoding[i], glyphsUnicodeMap);
  22941. if (unicode !== -1) {
  22942. toFontChar[i] = unicode;
  22943. }
  22944. }
  22945. for (const charCode in differences) {
  22946. unicode = getUnicodeForGlyph(differences[charCode], glyphsUnicodeMap);
  22947. if (unicode !== -1) {
  22948. toFontChar[+charCode] = unicode;
  22949. }
  22950. }
  22951. return toFontChar;
  22952. }
  22953. function isMacNameRecord(r) {
  22954. return r.platform === 1 && r.encoding === 0 && r.language === 0;
  22955. }
  22956. function isWinNameRecord(r) {
  22957. return r.platform === 3 && r.encoding === 1 && r.language === 0x409;
  22958. }
  22959. function convertCidString(charCode, cid, shouldThrow = false) {
  22960. switch (cid.length) {
  22961. case 1:
  22962. return cid.charCodeAt(0);
  22963. case 2:
  22964. return cid.charCodeAt(0) << 8 | cid.charCodeAt(1);
  22965. }
  22966. const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`;
  22967. if (shouldThrow) {
  22968. throw new FormatError(msg);
  22969. }
  22970. warn(msg);
  22971. return cid;
  22972. }
  22973. function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId, toUnicode) {
  22974. const newMap = Object.create(null);
  22975. const toUnicodeExtraMap = new Map();
  22976. const toFontChar = [];
  22977. const usedGlyphIds = new Set();
  22978. let privateUseAreaIndex = 0;
  22979. const privateUseOffetStart = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  22980. let nextAvailableFontCharCode = privateUseOffetStart;
  22981. let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  22982. const isInPrivateArea = code => PRIVATE_USE_AREAS[0][0] <= code && code <= PRIVATE_USE_AREAS[0][1] || PRIVATE_USE_AREAS[1][0] <= code && code <= PRIVATE_USE_AREAS[1][1];
  22983. for (const originalCharCode in charCodeToGlyphId) {
  22984. let glyphId = charCodeToGlyphId[originalCharCode];
  22985. if (!hasGlyph(glyphId)) {
  22986. continue;
  22987. }
  22988. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  22989. privateUseAreaIndex++;
  22990. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  22991. warn("Ran out of space in font private use area.");
  22992. break;
  22993. }
  22994. nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  22995. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  22996. }
  22997. const fontCharCode = nextAvailableFontCharCode++;
  22998. if (glyphId === 0) {
  22999. glyphId = newGlyphZeroId;
  23000. }
  23001. let unicode = toUnicode.get(originalCharCode);
  23002. if (typeof unicode === "string") {
  23003. unicode = unicode.codePointAt(0);
  23004. }
  23005. if (unicode && !isInPrivateArea(unicode) && !usedGlyphIds.has(glyphId)) {
  23006. toUnicodeExtraMap.set(unicode, glyphId);
  23007. usedGlyphIds.add(glyphId);
  23008. }
  23009. newMap[fontCharCode] = glyphId;
  23010. toFontChar[originalCharCode] = fontCharCode;
  23011. }
  23012. return {
  23013. toFontChar,
  23014. charCodeToGlyphId: newMap,
  23015. toUnicodeExtraMap,
  23016. nextAvailableFontCharCode
  23017. };
  23018. }
  23019. function getRanges(glyphs, toUnicodeExtraMap, numGlyphs) {
  23020. const codes = [];
  23021. for (const charCode in glyphs) {
  23022. if (glyphs[charCode] >= numGlyphs) {
  23023. continue;
  23024. }
  23025. codes.push({
  23026. fontCharCode: charCode | 0,
  23027. glyphId: glyphs[charCode]
  23028. });
  23029. }
  23030. if (toUnicodeExtraMap) {
  23031. for (const [unicode, glyphId] of toUnicodeExtraMap) {
  23032. if (glyphId >= numGlyphs) {
  23033. continue;
  23034. }
  23035. codes.push({
  23036. fontCharCode: unicode,
  23037. glyphId
  23038. });
  23039. }
  23040. }
  23041. if (codes.length === 0) {
  23042. codes.push({
  23043. fontCharCode: 0,
  23044. glyphId: 0
  23045. });
  23046. }
  23047. codes.sort(function fontGetRangesSort(a, b) {
  23048. return a.fontCharCode - b.fontCharCode;
  23049. });
  23050. const ranges = [];
  23051. const length = codes.length;
  23052. for (let n = 0; n < length;) {
  23053. const start = codes[n].fontCharCode;
  23054. const codeIndices = [codes[n].glyphId];
  23055. ++n;
  23056. let end = start;
  23057. while (n < length && end + 1 === codes[n].fontCharCode) {
  23058. codeIndices.push(codes[n].glyphId);
  23059. ++end;
  23060. ++n;
  23061. if (end === 0xffff) {
  23062. break;
  23063. }
  23064. }
  23065. ranges.push([start, end, codeIndices]);
  23066. }
  23067. return ranges;
  23068. }
  23069. function createCmapTable(glyphs, toUnicodeExtraMap, numGlyphs) {
  23070. const ranges = getRanges(glyphs, toUnicodeExtraMap, numGlyphs);
  23071. const numTables = ranges.at(-1)[1] > 0xffff ? 2 : 1;
  23072. let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + string32(4 + numTables * 8);
  23073. let i, ii, j, jj;
  23074. for (i = ranges.length - 1; i >= 0; --i) {
  23075. if (ranges[i][0] <= 0xffff) {
  23076. break;
  23077. }
  23078. }
  23079. const bmpLength = i + 1;
  23080. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  23081. ranges[i][1] = 0xfffe;
  23082. }
  23083. const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  23084. const segCount = bmpLength + trailingRangesCount;
  23085. const searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2);
  23086. let startCount = "";
  23087. let endCount = "";
  23088. let idDeltas = "";
  23089. let idRangeOffsets = "";
  23090. let glyphsIds = "";
  23091. let bias = 0;
  23092. let range, start, end, codes;
  23093. for (i = 0, ii = bmpLength; i < ii; i++) {
  23094. range = ranges[i];
  23095. start = range[0];
  23096. end = range[1];
  23097. startCount += string16(start);
  23098. endCount += string16(end);
  23099. codes = range[2];
  23100. let contiguous = true;
  23101. for (j = 1, jj = codes.length; j < jj; ++j) {
  23102. if (codes[j] !== codes[j - 1] + 1) {
  23103. contiguous = false;
  23104. break;
  23105. }
  23106. }
  23107. if (!contiguous) {
  23108. const offset = (segCount - i) * 2 + bias * 2;
  23109. bias += end - start + 1;
  23110. idDeltas += string16(0);
  23111. idRangeOffsets += string16(offset);
  23112. for (j = 0, jj = codes.length; j < jj; ++j) {
  23113. glyphsIds += string16(codes[j]);
  23114. }
  23115. } else {
  23116. const startCode = codes[0];
  23117. idDeltas += string16(startCode - start & 0xffff);
  23118. idRangeOffsets += string16(0);
  23119. }
  23120. }
  23121. if (trailingRangesCount > 0) {
  23122. endCount += "\xFF\xFF";
  23123. startCount += "\xFF\xFF";
  23124. idDeltas += "\x00\x01";
  23125. idRangeOffsets += "\x00\x00";
  23126. }
  23127. const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
  23128. let format31012 = "";
  23129. let header31012 = "";
  23130. if (numTables > 1) {
  23131. cmap += "\x00\x03" + "\x00\x0A" + string32(4 + numTables * 8 + 4 + format314.length);
  23132. format31012 = "";
  23133. for (i = 0, ii = ranges.length; i < ii; i++) {
  23134. range = ranges[i];
  23135. start = range[0];
  23136. codes = range[2];
  23137. let code = codes[0];
  23138. for (j = 1, jj = codes.length; j < jj; ++j) {
  23139. if (codes[j] !== codes[j - 1] + 1) {
  23140. end = range[0] + j - 1;
  23141. format31012 += string32(start) + string32(end) + string32(code);
  23142. start = end + 1;
  23143. code = codes[j];
  23144. }
  23145. }
  23146. format31012 += string32(start) + string32(range[1]) + string32(code);
  23147. }
  23148. header31012 = "\x00\x0C" + "\x00\x00" + string32(format31012.length + 16) + "\x00\x00\x00\x00" + string32(format31012.length / 12);
  23149. }
  23150. return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
  23151. }
  23152. function validateOS2Table(os2, file) {
  23153. file.pos = (file.start || 0) + os2.offset;
  23154. const version = file.getUint16();
  23155. file.skip(60);
  23156. const selection = file.getUint16();
  23157. if (version < 4 && selection & 0x0300) {
  23158. return false;
  23159. }
  23160. const firstChar = file.getUint16();
  23161. const lastChar = file.getUint16();
  23162. if (firstChar > lastChar) {
  23163. return false;
  23164. }
  23165. file.skip(6);
  23166. const usWinAscent = file.getUint16();
  23167. if (usWinAscent === 0) {
  23168. return false;
  23169. }
  23170. os2.data[8] = os2.data[9] = 0;
  23171. return true;
  23172. }
  23173. function createOS2Table(properties, charstrings, override) {
  23174. override ||= {
  23175. unitsPerEm: 0,
  23176. yMax: 0,
  23177. yMin: 0,
  23178. ascent: 0,
  23179. descent: 0
  23180. };
  23181. let ulUnicodeRange1 = 0;
  23182. let ulUnicodeRange2 = 0;
  23183. let ulUnicodeRange3 = 0;
  23184. let ulUnicodeRange4 = 0;
  23185. let firstCharIndex = null;
  23186. let lastCharIndex = 0;
  23187. let position = -1;
  23188. if (charstrings) {
  23189. for (let code in charstrings) {
  23190. code |= 0;
  23191. if (firstCharIndex > code || !firstCharIndex) {
  23192. firstCharIndex = code;
  23193. }
  23194. if (lastCharIndex < code) {
  23195. lastCharIndex = code;
  23196. }
  23197. position = getUnicodeRangeFor(code, position);
  23198. if (position < 32) {
  23199. ulUnicodeRange1 |= 1 << position;
  23200. } else if (position < 64) {
  23201. ulUnicodeRange2 |= 1 << position - 32;
  23202. } else if (position < 96) {
  23203. ulUnicodeRange3 |= 1 << position - 64;
  23204. } else if (position < 123) {
  23205. ulUnicodeRange4 |= 1 << position - 96;
  23206. } else {
  23207. throw new FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
  23208. }
  23209. }
  23210. if (lastCharIndex > 0xffff) {
  23211. lastCharIndex = 0xffff;
  23212. }
  23213. } else {
  23214. firstCharIndex = 0;
  23215. lastCharIndex = 255;
  23216. }
  23217. const bbox = properties.bbox || [0, 0, 0, 0];
  23218. const unitsPerEm = override.unitsPerEm || (properties.fontMatrix ? 1 / Math.max(...properties.fontMatrix.slice(0, 4).map(Math.abs)) : 1000);
  23219. const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  23220. const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  23221. let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  23222. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  23223. typoDescent = -typoDescent;
  23224. }
  23225. const winAscent = override.yMax || typoAscent;
  23226. const winDescent = -override.yMin || -typoDescent;
  23227. return "\x00\x03" + "\x02\x24" + "\x01\xF4" + "\x00\x05" + "\x00\x00" + "\x02\x8A" + "\x02\xBB" + "\x00\x00" + "\x00\x8C" + "\x02\x8A" + "\x02\xBB" + "\x00\x00" + "\x01\xDF" + "\x00\x31" + "\x01\x02" + "\x00\x00" + "\x00\x00\x06" + String.fromCharCode(properties.fixedPitch ? 0x09 : 0x00) + "\x00\x00\x00\x00\x00\x00" + string32(ulUnicodeRange1) + string32(ulUnicodeRange2) + string32(ulUnicodeRange3) + string32(ulUnicodeRange4) + "\x2A\x32\x31\x2A" + string16(properties.italicAngle ? 1 : 0) + string16(firstCharIndex || properties.firstChar) + string16(lastCharIndex || properties.lastChar) + string16(typoAscent) + string16(typoDescent) + "\x00\x64" + string16(winAscent) + string16(winDescent) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + string16(properties.xHeight) + string16(properties.capHeight) + string16(0) + string16(firstCharIndex || properties.firstChar) + "\x00\x03";
  23228. }
  23229. function createPostTable(properties) {
  23230. const angle = Math.floor(properties.italicAngle * 2 ** 16);
  23231. return "\x00\x03\x00\x00" + string32(angle) + "\x00\x00" + "\x00\x00" + string32(properties.fixedPitch ? 1 : 0) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00";
  23232. }
  23233. function createPostscriptName(name) {
  23234. return name.replaceAll(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63);
  23235. }
  23236. function createNameTable(name, proto) {
  23237. if (!proto) {
  23238. proto = [[], []];
  23239. }
  23240. const strings = [proto[0][0] || "Original licence", proto[0][1] || name, proto[0][2] || "Unknown", proto[0][3] || "uniqueID", proto[0][4] || name, proto[0][5] || "Version 0.11", proto[0][6] || createPostscriptName(name), proto[0][7] || "Unknown", proto[0][8] || "Unknown", proto[0][9] || "Unknown"];
  23241. const stringsUnicode = [];
  23242. let i, ii, j, jj, str;
  23243. for (i = 0, ii = strings.length; i < ii; i++) {
  23244. str = proto[1][i] || strings[i];
  23245. const strBufUnicode = [];
  23246. for (j = 0, jj = str.length; j < jj; j++) {
  23247. strBufUnicode.push(string16(str.charCodeAt(j)));
  23248. }
  23249. stringsUnicode.push(strBufUnicode.join(""));
  23250. }
  23251. const names = [strings, stringsUnicode];
  23252. const platforms = ["\x00\x01", "\x00\x03"];
  23253. const encodings = ["\x00\x00", "\x00\x01"];
  23254. const languages = ["\x00\x00", "\x04\x09"];
  23255. const namesRecordCount = strings.length * platforms.length;
  23256. let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  23257. let strOffset = 0;
  23258. for (i = 0, ii = platforms.length; i < ii; i++) {
  23259. const strs = names[i];
  23260. for (j = 0, jj = strs.length; j < jj; j++) {
  23261. str = strs[j];
  23262. const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  23263. nameTable += nameRecord;
  23264. strOffset += str.length;
  23265. }
  23266. }
  23267. nameTable += strings.join("") + stringsUnicode.join("");
  23268. return nameTable;
  23269. }
  23270. class Font {
  23271. constructor(name, file, properties) {
  23272. this.name = name;
  23273. this.psName = null;
  23274. this.mimetype = null;
  23275. this.disableFontFace = false;
  23276. this.loadedName = properties.loadedName;
  23277. this.isType3Font = properties.isType3Font;
  23278. this.missingFile = false;
  23279. this.cssFontInfo = properties.cssFontInfo;
  23280. this._charsCache = Object.create(null);
  23281. this._glyphCache = Object.create(null);
  23282. let isSerifFont = !!(properties.flags & FontFlags.Serif);
  23283. if (!isSerifFont && !properties.isSimulatedFlags) {
  23284. const baseName = name.replaceAll(/[,_]/g, "-").split("-", 1)[0],
  23285. serifFonts = getSerifFonts();
  23286. for (const namePart of baseName.split("+")) {
  23287. if (serifFonts[namePart]) {
  23288. isSerifFont = true;
  23289. break;
  23290. }
  23291. }
  23292. }
  23293. this.isSerifFont = isSerifFont;
  23294. this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  23295. this.isMonospace = !!(properties.flags & FontFlags.FixedPitch);
  23296. let {
  23297. type,
  23298. subtype
  23299. } = properties;
  23300. this.type = type;
  23301. this.subtype = subtype;
  23302. this.systemFontInfo = properties.systemFontInfo;
  23303. const matches = name.match(/^InvalidPDFjsFont_(.*)_\d+$/);
  23304. this.isInvalidPDFjsFont = !!matches;
  23305. if (this.isInvalidPDFjsFont) {
  23306. this.fallbackName = matches[1];
  23307. } else if (this.isMonospace) {
  23308. this.fallbackName = "monospace";
  23309. } else if (this.isSerifFont) {
  23310. this.fallbackName = "serif";
  23311. } else {
  23312. this.fallbackName = "sans-serif";
  23313. }
  23314. if (this.systemFontInfo?.guessFallback) {
  23315. this.systemFontInfo.guessFallback = false;
  23316. this.systemFontInfo.css += `,${this.fallbackName}`;
  23317. }
  23318. this.differences = properties.differences;
  23319. this.widths = properties.widths;
  23320. this.defaultWidth = properties.defaultWidth;
  23321. this.composite = properties.composite;
  23322. this.cMap = properties.cMap;
  23323. this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
  23324. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  23325. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  23326. this.lineHeight = this.ascent - this.descent;
  23327. this.fontMatrix = properties.fontMatrix;
  23328. this.bbox = properties.bbox;
  23329. this.defaultEncoding = properties.defaultEncoding;
  23330. this.toUnicode = properties.toUnicode;
  23331. this.toFontChar = [];
  23332. if (properties.type === "Type3") {
  23333. for (let charCode = 0; charCode < 256; charCode++) {
  23334. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  23335. }
  23336. return;
  23337. }
  23338. this.cidEncoding = properties.cidEncoding || "";
  23339. this.vertical = !!properties.vertical;
  23340. if (this.vertical) {
  23341. this.vmetrics = properties.vmetrics;
  23342. this.defaultVMetrics = properties.defaultVMetrics;
  23343. }
  23344. if (!file || file.isEmpty) {
  23345. if (file) {
  23346. warn('Font file is empty in "' + name + '" (' + this.loadedName + ")");
  23347. }
  23348. this.fallbackToSystemFont(properties);
  23349. return;
  23350. }
  23351. [type, subtype] = getFontFileType(file, properties);
  23352. if (type !== this.type || subtype !== this.subtype) {
  23353. info("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
  23354. }
  23355. let data;
  23356. try {
  23357. switch (type) {
  23358. case "MMType1":
  23359. info("MMType1 font (" + name + "), falling back to Type1.");
  23360. case "Type1":
  23361. case "CIDFontType0":
  23362. this.mimetype = "font/opentype";
  23363. const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new CFFFont(file, properties) : new Type1Font(name, file, properties);
  23364. adjustWidths(properties);
  23365. data = this.convert(name, cff, properties);
  23366. break;
  23367. case "OpenType":
  23368. case "TrueType":
  23369. case "CIDFontType2":
  23370. this.mimetype = "font/opentype";
  23371. data = this.checkAndRepair(name, file, properties);
  23372. if (this.isOpenType) {
  23373. adjustWidths(properties);
  23374. type = "OpenType";
  23375. }
  23376. break;
  23377. default:
  23378. throw new FormatError(`Font ${type} is not supported`);
  23379. }
  23380. } catch (e) {
  23381. warn(e);
  23382. this.fallbackToSystemFont(properties);
  23383. return;
  23384. }
  23385. amendFallbackToUnicode(properties);
  23386. this.data = data;
  23387. this.type = type;
  23388. this.subtype = subtype;
  23389. this.fontMatrix = properties.fontMatrix;
  23390. this.widths = properties.widths;
  23391. this.defaultWidth = properties.defaultWidth;
  23392. this.toUnicode = properties.toUnicode;
  23393. this.seacMap = properties.seacMap;
  23394. }
  23395. get renderer() {
  23396. const renderer = FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED);
  23397. return shadow(this, "renderer", renderer);
  23398. }
  23399. exportData(extraProperties = false) {
  23400. const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
  23401. const data = Object.create(null);
  23402. let property, value;
  23403. for (property of exportDataProperties) {
  23404. value = this[property];
  23405. if (value !== undefined) {
  23406. data[property] = value;
  23407. }
  23408. }
  23409. return data;
  23410. }
  23411. fallbackToSystemFont(properties) {
  23412. this.missingFile = true;
  23413. const {
  23414. name,
  23415. type
  23416. } = this;
  23417. let fontName = normalizeFontName(name);
  23418. const stdFontMap = getStdFontMap(),
  23419. nonStdFontMap = getNonStdFontMap();
  23420. const isStandardFont = !!stdFontMap[fontName];
  23421. const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  23422. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  23423. const fontBasicMetricsMap = getFontBasicMetrics();
  23424. const metrics = fontBasicMetricsMap[fontName];
  23425. if (metrics) {
  23426. if (isNaN(this.ascent)) {
  23427. this.ascent = metrics.ascent / PDF_GLYPH_SPACE_UNITS;
  23428. }
  23429. if (isNaN(this.descent)) {
  23430. this.descent = metrics.descent / PDF_GLYPH_SPACE_UNITS;
  23431. }
  23432. if (isNaN(this.capHeight)) {
  23433. this.capHeight = metrics.capHeight / PDF_GLYPH_SPACE_UNITS;
  23434. }
  23435. }
  23436. this.bold = /bold/gi.test(fontName);
  23437. this.italic = /oblique|italic/gi.test(fontName);
  23438. this.black = /Black/g.test(name);
  23439. const isNarrow = /Narrow/g.test(name);
  23440. this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
  23441. if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
  23442. const cidToGidMap = properties.cidToGidMap;
  23443. const map = [];
  23444. applyStandardFontGlyphMap(map, getGlyphMapForStandardFonts());
  23445. if (/Arial-?Black/i.test(name)) {
  23446. applyStandardFontGlyphMap(map, getSupplementalGlyphMapForArialBlack());
  23447. } else if (/Calibri/i.test(name)) {
  23448. applyStandardFontGlyphMap(map, getSupplementalGlyphMapForCalibri());
  23449. }
  23450. if (cidToGidMap) {
  23451. for (const charCode in map) {
  23452. const cid = map[charCode];
  23453. if (cidToGidMap[cid] !== undefined) {
  23454. map[+charCode] = cidToGidMap[cid];
  23455. }
  23456. }
  23457. if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof IdentityToUnicodeMap) {
  23458. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  23459. const cid = map[charCode];
  23460. if (cidToGidMap[cid] === undefined) {
  23461. map[+charCode] = unicodeCharCode;
  23462. }
  23463. });
  23464. }
  23465. }
  23466. if (!(this.toUnicode instanceof IdentityToUnicodeMap)) {
  23467. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  23468. map[+charCode] = unicodeCharCode;
  23469. });
  23470. }
  23471. this.toFontChar = map;
  23472. this.toUnicode = new ToUnicodeMap(map);
  23473. } else if (/Symbol/i.test(fontName)) {
  23474. this.toFontChar = buildToFontChar(SymbolSetEncoding, getGlyphsUnicode(), this.differences);
  23475. } else if (/Dingbats/i.test(fontName)) {
  23476. this.toFontChar = buildToFontChar(ZapfDingbatsEncoding, getDingbatsGlyphsUnicode(), this.differences);
  23477. } else if (isStandardFont || isMappedToStandardFont) {
  23478. const map = buildToFontChar(this.defaultEncoding, getGlyphsUnicode(), this.differences);
  23479. if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof IdentityToUnicodeMap)) {
  23480. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  23481. map[+charCode] = unicodeCharCode;
  23482. });
  23483. }
  23484. this.toFontChar = map;
  23485. } else {
  23486. const glyphsUnicodeMap = getGlyphsUnicode();
  23487. const map = [];
  23488. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  23489. if (!this.composite) {
  23490. const glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
  23491. const unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  23492. if (unicode !== -1) {
  23493. unicodeCharCode = unicode;
  23494. }
  23495. }
  23496. map[+charCode] = unicodeCharCode;
  23497. });
  23498. if (this.composite && this.toUnicode instanceof IdentityToUnicodeMap) {
  23499. if (/Tahoma|Verdana/i.test(name)) {
  23500. applyStandardFontGlyphMap(map, getGlyphMapForStandardFonts());
  23501. }
  23502. }
  23503. this.toFontChar = map;
  23504. }
  23505. amendFallbackToUnicode(properties);
  23506. this.loadedName = fontName.split("-", 1)[0];
  23507. }
  23508. checkAndRepair(name, font, properties) {
  23509. const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
  23510. function readTables(file, numTables) {
  23511. const tables = Object.create(null);
  23512. tables["OS/2"] = null;
  23513. tables.cmap = null;
  23514. tables.head = null;
  23515. tables.hhea = null;
  23516. tables.hmtx = null;
  23517. tables.maxp = null;
  23518. tables.name = null;
  23519. tables.post = null;
  23520. for (let i = 0; i < numTables; i++) {
  23521. const table = readTableEntry(file);
  23522. if (!VALID_TABLES.includes(table.tag)) {
  23523. continue;
  23524. }
  23525. if (table.length === 0) {
  23526. continue;
  23527. }
  23528. tables[table.tag] = table;
  23529. }
  23530. return tables;
  23531. }
  23532. function readTableEntry(file) {
  23533. const tag = file.getString(4);
  23534. const checksum = file.getInt32() >>> 0;
  23535. const offset = file.getInt32() >>> 0;
  23536. const length = file.getInt32() >>> 0;
  23537. const previousPosition = file.pos;
  23538. file.pos = file.start || 0;
  23539. file.skip(offset);
  23540. const data = file.getBytes(length);
  23541. file.pos = previousPosition;
  23542. if (tag === "head") {
  23543. data[8] = data[9] = data[10] = data[11] = 0;
  23544. data[17] |= 0x20;
  23545. }
  23546. return {
  23547. tag,
  23548. checksum,
  23549. length,
  23550. offset,
  23551. data
  23552. };
  23553. }
  23554. function readOpenTypeHeader(ttf) {
  23555. return {
  23556. version: ttf.getString(4),
  23557. numTables: ttf.getUint16(),
  23558. searchRange: ttf.getUint16(),
  23559. entrySelector: ttf.getUint16(),
  23560. rangeShift: ttf.getUint16()
  23561. };
  23562. }
  23563. function readTrueTypeCollectionHeader(ttc) {
  23564. const ttcTag = ttc.getString(4);
  23565. assert(ttcTag === "ttcf", "Must be a TrueType Collection font.");
  23566. const majorVersion = ttc.getUint16();
  23567. const minorVersion = ttc.getUint16();
  23568. const numFonts = ttc.getInt32() >>> 0;
  23569. const offsetTable = [];
  23570. for (let i = 0; i < numFonts; i++) {
  23571. offsetTable.push(ttc.getInt32() >>> 0);
  23572. }
  23573. const header = {
  23574. ttcTag,
  23575. majorVersion,
  23576. minorVersion,
  23577. numFonts,
  23578. offsetTable
  23579. };
  23580. switch (majorVersion) {
  23581. case 1:
  23582. return header;
  23583. case 2:
  23584. header.dsigTag = ttc.getInt32() >>> 0;
  23585. header.dsigLength = ttc.getInt32() >>> 0;
  23586. header.dsigOffset = ttc.getInt32() >>> 0;
  23587. return header;
  23588. }
  23589. throw new FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
  23590. }
  23591. function readTrueTypeCollectionData(ttc, fontName) {
  23592. const {
  23593. numFonts,
  23594. offsetTable
  23595. } = readTrueTypeCollectionHeader(ttc);
  23596. const fontNameParts = fontName.split("+");
  23597. let fallbackData;
  23598. for (let i = 0; i < numFonts; i++) {
  23599. ttc.pos = (ttc.start || 0) + offsetTable[i];
  23600. const potentialHeader = readOpenTypeHeader(ttc);
  23601. const potentialTables = readTables(ttc, potentialHeader.numTables);
  23602. if (!potentialTables.name) {
  23603. throw new FormatError('TrueType Collection font must contain a "name" table.');
  23604. }
  23605. const [nameTable] = readNameTable(potentialTables.name);
  23606. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  23607. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  23608. const nameEntry = nameTable[j][k]?.replaceAll(/\s/g, "");
  23609. if (!nameEntry) {
  23610. continue;
  23611. }
  23612. if (nameEntry === fontName) {
  23613. return {
  23614. header: potentialHeader,
  23615. tables: potentialTables
  23616. };
  23617. }
  23618. if (fontNameParts.length < 2) {
  23619. continue;
  23620. }
  23621. for (const part of fontNameParts) {
  23622. if (nameEntry === part) {
  23623. fallbackData = {
  23624. name: part,
  23625. header: potentialHeader,
  23626. tables: potentialTables
  23627. };
  23628. }
  23629. }
  23630. }
  23631. }
  23632. }
  23633. if (fallbackData) {
  23634. warn(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`);
  23635. return {
  23636. header: fallbackData.header,
  23637. tables: fallbackData.tables
  23638. };
  23639. }
  23640. throw new FormatError(`TrueType Collection does not contain "${fontName}" font.`);
  23641. }
  23642. function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
  23643. if (!cmap) {
  23644. warn("No cmap table available.");
  23645. return {
  23646. platformId: -1,
  23647. encodingId: -1,
  23648. mappings: [],
  23649. hasShortCmap: false
  23650. };
  23651. }
  23652. let segment;
  23653. let start = (file.start || 0) + cmap.offset;
  23654. file.pos = start;
  23655. file.skip(2);
  23656. const numTables = file.getUint16();
  23657. let potentialTable;
  23658. let canBreak = false;
  23659. for (let i = 0; i < numTables; i++) {
  23660. const platformId = file.getUint16();
  23661. const encodingId = file.getUint16();
  23662. const offset = file.getInt32() >>> 0;
  23663. let useTable = false;
  23664. if (potentialTable?.platformId === platformId && potentialTable?.encodingId === encodingId) {
  23665. continue;
  23666. }
  23667. if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
  23668. useTable = true;
  23669. } else if (platformId === 1 && encodingId === 0) {
  23670. useTable = true;
  23671. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  23672. useTable = true;
  23673. if (!isSymbolicFont) {
  23674. canBreak = true;
  23675. }
  23676. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  23677. useTable = true;
  23678. let correctlySorted = true;
  23679. if (i < numTables - 1) {
  23680. const nextBytes = file.peekBytes(2),
  23681. nextPlatformId = int16(nextBytes[0], nextBytes[1]);
  23682. if (nextPlatformId < platformId) {
  23683. correctlySorted = false;
  23684. }
  23685. }
  23686. if (correctlySorted) {
  23687. canBreak = true;
  23688. }
  23689. }
  23690. if (useTable) {
  23691. potentialTable = {
  23692. platformId,
  23693. encodingId,
  23694. offset
  23695. };
  23696. }
  23697. if (canBreak) {
  23698. break;
  23699. }
  23700. }
  23701. if (potentialTable) {
  23702. file.pos = start + potentialTable.offset;
  23703. }
  23704. if (!potentialTable || file.peekByte() === -1) {
  23705. warn("Could not find a preferred cmap table.");
  23706. return {
  23707. platformId: -1,
  23708. encodingId: -1,
  23709. mappings: [],
  23710. hasShortCmap: false
  23711. };
  23712. }
  23713. const format = file.getUint16();
  23714. let hasShortCmap = false;
  23715. const mappings = [];
  23716. let j, glyphId;
  23717. if (format === 0) {
  23718. file.skip(2 + 2);
  23719. for (j = 0; j < 256; j++) {
  23720. const index = file.getByte();
  23721. if (!index) {
  23722. continue;
  23723. }
  23724. mappings.push({
  23725. charCode: j,
  23726. glyphId: index
  23727. });
  23728. }
  23729. hasShortCmap = true;
  23730. } else if (format === 2) {
  23731. file.skip(2 + 2);
  23732. const subHeaderKeys = [];
  23733. let maxSubHeaderKey = 0;
  23734. for (let i = 0; i < 256; i++) {
  23735. const subHeaderKey = file.getUint16() >> 3;
  23736. subHeaderKeys.push(subHeaderKey);
  23737. maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey);
  23738. }
  23739. const subHeaders = [];
  23740. for (let i = 0; i <= maxSubHeaderKey; i++) {
  23741. subHeaders.push({
  23742. firstCode: file.getUint16(),
  23743. entryCount: file.getUint16(),
  23744. idDelta: signedInt16(file.getByte(), file.getByte()),
  23745. idRangePos: file.pos + file.getUint16()
  23746. });
  23747. }
  23748. for (let i = 0; i < 256; i++) {
  23749. if (subHeaderKeys[i] === 0) {
  23750. file.pos = subHeaders[0].idRangePos + 2 * i;
  23751. glyphId = file.getUint16();
  23752. mappings.push({
  23753. charCode: i,
  23754. glyphId
  23755. });
  23756. } else {
  23757. const s = subHeaders[subHeaderKeys[i]];
  23758. for (j = 0; j < s.entryCount; j++) {
  23759. const charCode = (i << 8) + j + s.firstCode;
  23760. file.pos = s.idRangePos + 2 * j;
  23761. glyphId = file.getUint16();
  23762. if (glyphId !== 0) {
  23763. glyphId = (glyphId + s.idDelta) % 65536;
  23764. }
  23765. mappings.push({
  23766. charCode,
  23767. glyphId
  23768. });
  23769. }
  23770. }
  23771. }
  23772. } else if (format === 4) {
  23773. file.skip(2 + 2);
  23774. const segCount = file.getUint16() >> 1;
  23775. file.skip(6);
  23776. const segments = [];
  23777. let segIndex;
  23778. for (segIndex = 0; segIndex < segCount; segIndex++) {
  23779. segments.push({
  23780. end: file.getUint16()
  23781. });
  23782. }
  23783. file.skip(2);
  23784. for (segIndex = 0; segIndex < segCount; segIndex++) {
  23785. segments[segIndex].start = file.getUint16();
  23786. }
  23787. for (segIndex = 0; segIndex < segCount; segIndex++) {
  23788. segments[segIndex].delta = file.getUint16();
  23789. }
  23790. let offsetsCount = 0,
  23791. offsetIndex;
  23792. for (segIndex = 0; segIndex < segCount; segIndex++) {
  23793. segment = segments[segIndex];
  23794. const rangeOffset = file.getUint16();
  23795. if (!rangeOffset) {
  23796. segment.offsetIndex = -1;
  23797. continue;
  23798. }
  23799. offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  23800. segment.offsetIndex = offsetIndex;
  23801. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  23802. }
  23803. const offsets = [];
  23804. for (j = 0; j < offsetsCount; j++) {
  23805. offsets.push(file.getUint16());
  23806. }
  23807. for (segIndex = 0; segIndex < segCount; segIndex++) {
  23808. segment = segments[segIndex];
  23809. start = segment.start;
  23810. const end = segment.end;
  23811. const delta = segment.delta;
  23812. offsetIndex = segment.offsetIndex;
  23813. for (j = start; j <= end; j++) {
  23814. if (j === 0xffff) {
  23815. continue;
  23816. }
  23817. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  23818. glyphId = glyphId + delta & 0xffff;
  23819. mappings.push({
  23820. charCode: j,
  23821. glyphId
  23822. });
  23823. }
  23824. }
  23825. } else if (format === 6) {
  23826. file.skip(2 + 2);
  23827. const firstCode = file.getUint16();
  23828. const entryCount = file.getUint16();
  23829. for (j = 0; j < entryCount; j++) {
  23830. glyphId = file.getUint16();
  23831. const charCode = firstCode + j;
  23832. mappings.push({
  23833. charCode,
  23834. glyphId
  23835. });
  23836. }
  23837. } else if (format === 12) {
  23838. file.skip(2 + 4 + 4);
  23839. const nGroups = file.getInt32() >>> 0;
  23840. for (j = 0; j < nGroups; j++) {
  23841. const startCharCode = file.getInt32() >>> 0;
  23842. const endCharCode = file.getInt32() >>> 0;
  23843. let glyphCode = file.getInt32() >>> 0;
  23844. for (let charCode = startCharCode; charCode <= endCharCode; charCode++) {
  23845. mappings.push({
  23846. charCode,
  23847. glyphId: glyphCode++
  23848. });
  23849. }
  23850. }
  23851. } else {
  23852. warn("cmap table has unsupported format: " + format);
  23853. return {
  23854. platformId: -1,
  23855. encodingId: -1,
  23856. mappings: [],
  23857. hasShortCmap: false
  23858. };
  23859. }
  23860. mappings.sort(function (a, b) {
  23861. return a.charCode - b.charCode;
  23862. });
  23863. for (let i = 1; i < mappings.length; i++) {
  23864. if (mappings[i - 1].charCode === mappings[i].charCode) {
  23865. mappings.splice(i, 1);
  23866. i--;
  23867. }
  23868. }
  23869. return {
  23870. platformId: potentialTable.platformId,
  23871. encodingId: potentialTable.encodingId,
  23872. mappings,
  23873. hasShortCmap
  23874. };
  23875. }
  23876. function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) {
  23877. if (!header) {
  23878. if (metrics) {
  23879. metrics.data = null;
  23880. }
  23881. return;
  23882. }
  23883. file.pos = (file.start || 0) + header.offset;
  23884. file.pos += 4;
  23885. file.pos += 2;
  23886. file.pos += 2;
  23887. file.pos += 2;
  23888. file.pos += 2;
  23889. file.pos += 2;
  23890. file.pos += 2;
  23891. file.pos += 2;
  23892. file.pos += 2;
  23893. file.pos += 2;
  23894. const caretOffset = file.getUint16();
  23895. file.pos += 8;
  23896. file.pos += 2;
  23897. let numOfMetrics = file.getUint16();
  23898. if (caretOffset !== 0) {
  23899. const macStyle = int16(headTable.data[44], headTable.data[45]);
  23900. if (!(macStyle & 2)) {
  23901. header.data[22] = 0;
  23902. header.data[23] = 0;
  23903. }
  23904. }
  23905. if (numOfMetrics > numGlyphs) {
  23906. info(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`);
  23907. numOfMetrics = numGlyphs;
  23908. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  23909. header.data[35] = numOfMetrics & 0x00ff;
  23910. }
  23911. const numOfSidebearings = numGlyphs - numOfMetrics;
  23912. const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  23913. if (numMissing > 0) {
  23914. const entries = new Uint8Array(metrics.length + numMissing * 2);
  23915. entries.set(metrics.data);
  23916. if (dupFirstEntry) {
  23917. entries[metrics.length] = metrics.data[2];
  23918. entries[metrics.length + 1] = metrics.data[3];
  23919. }
  23920. metrics.data = entries;
  23921. }
  23922. }
  23923. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  23924. const glyphProfile = {
  23925. length: 0,
  23926. sizeOfInstructions: 0
  23927. };
  23928. if (sourceStart < 0 || sourceStart >= source.length || sourceEnd > source.length || sourceEnd - sourceStart <= 12) {
  23929. return glyphProfile;
  23930. }
  23931. const glyf = source.subarray(sourceStart, sourceEnd);
  23932. const xMin = signedInt16(glyf[2], glyf[3]);
  23933. const yMin = signedInt16(glyf[4], glyf[5]);
  23934. const xMax = signedInt16(glyf[6], glyf[7]);
  23935. const yMax = signedInt16(glyf[8], glyf[9]);
  23936. if (xMin > xMax) {
  23937. writeSignedInt16(glyf, 2, xMax);
  23938. writeSignedInt16(glyf, 6, xMin);
  23939. }
  23940. if (yMin > yMax) {
  23941. writeSignedInt16(glyf, 4, yMax);
  23942. writeSignedInt16(glyf, 8, yMin);
  23943. }
  23944. const contoursCount = signedInt16(glyf[0], glyf[1]);
  23945. if (contoursCount < 0) {
  23946. if (contoursCount < -1) {
  23947. return glyphProfile;
  23948. }
  23949. dest.set(glyf, destStart);
  23950. glyphProfile.length = glyf.length;
  23951. return glyphProfile;
  23952. }
  23953. let i,
  23954. j = 10,
  23955. flagsCount = 0;
  23956. for (i = 0; i < contoursCount; i++) {
  23957. const endPoint = glyf[j] << 8 | glyf[j + 1];
  23958. flagsCount = endPoint + 1;
  23959. j += 2;
  23960. }
  23961. const instructionsStart = j;
  23962. const instructionsLength = glyf[j] << 8 | glyf[j + 1];
  23963. glyphProfile.sizeOfInstructions = instructionsLength;
  23964. j += 2 + instructionsLength;
  23965. const instructionsEnd = j;
  23966. let coordinatesLength = 0;
  23967. for (i = 0; i < flagsCount; i++) {
  23968. const flag = glyf[j++];
  23969. if (flag & 0xc0) {
  23970. glyf[j - 1] = flag & 0x3f;
  23971. }
  23972. let xLength = 2;
  23973. if (flag & 2) {
  23974. xLength = 1;
  23975. } else if (flag & 16) {
  23976. xLength = 0;
  23977. }
  23978. let yLength = 2;
  23979. if (flag & 4) {
  23980. yLength = 1;
  23981. } else if (flag & 32) {
  23982. yLength = 0;
  23983. }
  23984. const xyLength = xLength + yLength;
  23985. coordinatesLength += xyLength;
  23986. if (flag & 8) {
  23987. const repeat = glyf[j++];
  23988. if (repeat === 0) {
  23989. glyf[j - 1] ^= 8;
  23990. }
  23991. i += repeat;
  23992. coordinatesLength += repeat * xyLength;
  23993. }
  23994. }
  23995. if (coordinatesLength === 0) {
  23996. return glyphProfile;
  23997. }
  23998. let glyphDataLength = j + coordinatesLength;
  23999. if (glyphDataLength > glyf.length) {
  24000. return glyphProfile;
  24001. }
  24002. if (!hintsValid && instructionsLength > 0) {
  24003. dest.set(glyf.subarray(0, instructionsStart), destStart);
  24004. dest.set([0, 0], destStart + instructionsStart);
  24005. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  24006. glyphDataLength -= instructionsLength;
  24007. if (glyf.length - glyphDataLength > 3) {
  24008. glyphDataLength = glyphDataLength + 3 & ~3;
  24009. }
  24010. glyphProfile.length = glyphDataLength;
  24011. return glyphProfile;
  24012. }
  24013. if (glyf.length - glyphDataLength > 3) {
  24014. glyphDataLength = glyphDataLength + 3 & ~3;
  24015. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  24016. glyphProfile.length = glyphDataLength;
  24017. return glyphProfile;
  24018. }
  24019. dest.set(glyf, destStart);
  24020. glyphProfile.length = glyf.length;
  24021. return glyphProfile;
  24022. }
  24023. function sanitizeHead(head, numGlyphs, locaLength) {
  24024. const data = head.data;
  24025. const version = int32(data[0], data[1], data[2], data[3]);
  24026. if (version >> 16 !== 1) {
  24027. info("Attempting to fix invalid version in head table: " + version);
  24028. data[0] = 0;
  24029. data[1] = 1;
  24030. data[2] = 0;
  24031. data[3] = 0;
  24032. }
  24033. const indexToLocFormat = int16(data[50], data[51]);
  24034. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  24035. info("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
  24036. const numGlyphsPlusOne = numGlyphs + 1;
  24037. if (locaLength === numGlyphsPlusOne << 1) {
  24038. data[50] = 0;
  24039. data[51] = 0;
  24040. } else if (locaLength === numGlyphsPlusOne << 2) {
  24041. data[50] = 0;
  24042. data[51] = 1;
  24043. } else {
  24044. throw new FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
  24045. }
  24046. }
  24047. }
  24048. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
  24049. let itemSize, itemDecode, itemEncode;
  24050. if (isGlyphLocationsLong) {
  24051. itemSize = 4;
  24052. itemDecode = function fontItemDecodeLong(data, offset) {
  24053. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  24054. };
  24055. itemEncode = function fontItemEncodeLong(data, offset, value) {
  24056. data[offset] = value >>> 24 & 0xff;
  24057. data[offset + 1] = value >> 16 & 0xff;
  24058. data[offset + 2] = value >> 8 & 0xff;
  24059. data[offset + 3] = value & 0xff;
  24060. };
  24061. } else {
  24062. itemSize = 2;
  24063. itemDecode = function fontItemDecode(data, offset) {
  24064. return data[offset] << 9 | data[offset + 1] << 1;
  24065. };
  24066. itemEncode = function fontItemEncode(data, offset, value) {
  24067. data[offset] = value >> 9 & 0xff;
  24068. data[offset + 1] = value >> 1 & 0xff;
  24069. };
  24070. }
  24071. const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  24072. const locaDataSize = itemSize * (1 + numGlyphsOut);
  24073. const locaData = new Uint8Array(locaDataSize);
  24074. locaData.set(loca.data.subarray(0, locaDataSize));
  24075. loca.data = locaData;
  24076. const oldGlyfData = glyf.data;
  24077. const oldGlyfDataLength = oldGlyfData.length;
  24078. const newGlyfData = new Uint8Array(oldGlyfDataLength);
  24079. let i, j;
  24080. const locaEntries = [];
  24081. for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
  24082. let offset = itemDecode(locaData, j);
  24083. if (offset > oldGlyfDataLength) {
  24084. offset = oldGlyfDataLength;
  24085. }
  24086. locaEntries.push({
  24087. index: i,
  24088. offset,
  24089. endOffset: 0
  24090. });
  24091. }
  24092. locaEntries.sort((a, b) => a.offset - b.offset);
  24093. for (i = 0; i < numGlyphs; i++) {
  24094. locaEntries[i].endOffset = locaEntries[i + 1].offset;
  24095. }
  24096. locaEntries.sort((a, b) => a.index - b.index);
  24097. for (i = 0; i < numGlyphs; i++) {
  24098. const {
  24099. offset,
  24100. endOffset
  24101. } = locaEntries[i];
  24102. if (offset !== 0 || endOffset !== 0) {
  24103. break;
  24104. }
  24105. const nextOffset = locaEntries[i + 1].offset;
  24106. if (nextOffset === 0) {
  24107. continue;
  24108. }
  24109. locaEntries[i].endOffset = nextOffset;
  24110. break;
  24111. }
  24112. const last = locaEntries.at(-2);
  24113. if (last.offset !== 0 && last.endOffset === 0) {
  24114. last.endOffset = oldGlyfDataLength;
  24115. }
  24116. const missingGlyphs = Object.create(null);
  24117. let writeOffset = 0;
  24118. itemEncode(locaData, 0, writeOffset);
  24119. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  24120. const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
  24121. const newLength = glyphProfile.length;
  24122. if (newLength === 0) {
  24123. missingGlyphs[i] = true;
  24124. }
  24125. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  24126. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  24127. }
  24128. writeOffset += newLength;
  24129. itemEncode(locaData, j, writeOffset);
  24130. }
  24131. if (writeOffset === 0) {
  24132. const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  24133. for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
  24134. itemEncode(locaData, j, simpleGlyph.length);
  24135. }
  24136. glyf.data = simpleGlyph;
  24137. } else if (dupFirstEntry) {
  24138. const firstEntryLength = itemDecode(locaData, itemSize);
  24139. if (newGlyfData.length > firstEntryLength + writeOffset) {
  24140. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  24141. } else {
  24142. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  24143. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  24144. }
  24145. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  24146. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  24147. } else {
  24148. glyf.data = newGlyfData.subarray(0, writeOffset);
  24149. }
  24150. return {
  24151. missingGlyphs,
  24152. maxSizeOfInstructions
  24153. };
  24154. }
  24155. function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
  24156. const start = (font.start || 0) + post.offset;
  24157. font.pos = start;
  24158. const length = post.length,
  24159. end = start + length;
  24160. const version = font.getInt32();
  24161. font.skip(28);
  24162. let glyphNames;
  24163. let valid = true;
  24164. let i;
  24165. switch (version) {
  24166. case 0x00010000:
  24167. glyphNames = MacStandardGlyphOrdering;
  24168. break;
  24169. case 0x00020000:
  24170. const numGlyphs = font.getUint16();
  24171. if (numGlyphs !== maxpNumGlyphs) {
  24172. valid = false;
  24173. break;
  24174. }
  24175. const glyphNameIndexes = [];
  24176. for (i = 0; i < numGlyphs; ++i) {
  24177. const index = font.getUint16();
  24178. if (index >= 32768) {
  24179. valid = false;
  24180. break;
  24181. }
  24182. glyphNameIndexes.push(index);
  24183. }
  24184. if (!valid) {
  24185. break;
  24186. }
  24187. const customNames = [],
  24188. strBuf = [];
  24189. while (font.pos < end) {
  24190. const stringLength = font.getByte();
  24191. strBuf.length = stringLength;
  24192. for (i = 0; i < stringLength; ++i) {
  24193. strBuf[i] = String.fromCharCode(font.getByte());
  24194. }
  24195. customNames.push(strBuf.join(""));
  24196. }
  24197. glyphNames = [];
  24198. for (i = 0; i < numGlyphs; ++i) {
  24199. const j = glyphNameIndexes[i];
  24200. if (j < 258) {
  24201. glyphNames.push(MacStandardGlyphOrdering[j]);
  24202. continue;
  24203. }
  24204. glyphNames.push(customNames[j - 258]);
  24205. }
  24206. break;
  24207. case 0x00030000:
  24208. break;
  24209. default:
  24210. warn("Unknown/unsupported post table version " + version);
  24211. valid = false;
  24212. if (propertiesObj.defaultEncoding) {
  24213. glyphNames = propertiesObj.defaultEncoding;
  24214. }
  24215. break;
  24216. }
  24217. propertiesObj.glyphNames = glyphNames;
  24218. return valid;
  24219. }
  24220. function readNameTable(nameTable) {
  24221. const start = (font.start || 0) + nameTable.offset;
  24222. font.pos = start;
  24223. const names = [[], []],
  24224. records = [];
  24225. const length = nameTable.length,
  24226. end = start + length;
  24227. const format = font.getUint16();
  24228. const FORMAT_0_HEADER_LENGTH = 6;
  24229. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  24230. return [names, records];
  24231. }
  24232. const numRecords = font.getUint16();
  24233. const stringsStart = font.getUint16();
  24234. const NAME_RECORD_LENGTH = 12;
  24235. let i, ii;
  24236. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  24237. const r = {
  24238. platform: font.getUint16(),
  24239. encoding: font.getUint16(),
  24240. language: font.getUint16(),
  24241. name: font.getUint16(),
  24242. length: font.getUint16(),
  24243. offset: font.getUint16()
  24244. };
  24245. if (isMacNameRecord(r) || isWinNameRecord(r)) {
  24246. records.push(r);
  24247. }
  24248. }
  24249. for (i = 0, ii = records.length; i < ii; i++) {
  24250. const record = records[i];
  24251. if (record.length <= 0) {
  24252. continue;
  24253. }
  24254. const pos = start + stringsStart + record.offset;
  24255. if (pos + record.length > end) {
  24256. continue;
  24257. }
  24258. font.pos = pos;
  24259. const nameIndex = record.name;
  24260. if (record.encoding) {
  24261. let str = "";
  24262. for (let j = 0, jj = record.length; j < jj; j += 2) {
  24263. str += String.fromCharCode(font.getUint16());
  24264. }
  24265. names[1][nameIndex] = str;
  24266. } else {
  24267. names[0][nameIndex] = font.getString(record.length);
  24268. }
  24269. }
  24270. return [names, records];
  24271. }
  24272. const TTOpsStackDeltas = [0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, 0, 0, -2, -5, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -1, -1, 1, -1, -999, 0, 1, 0, -1, -2, 0, -1, -2, -1, -1, 0, -1, -1, 0, 0, -999, -999, -1, -1, -1, -1, -2, -999, -2, -2, -999, 0, -2, -2, 0, 0, -2, 0, -2, 0, 0, 0, -2, -1, -1, 1, 1, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, 0, -999, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -999, -999, -999, -999, -999, -1, -1, -2, -2, 0, 0, 0, 0, -1, -1, -999, -2, -2, 0, 0, -1, -2, -2, 0, 0, 0, -1, -1, -1, -2];
  24273. function sanitizeTTProgram(table, ttContext) {
  24274. let data = table.data;
  24275. let i = 0,
  24276. j,
  24277. n,
  24278. b,
  24279. funcId,
  24280. pc,
  24281. lastEndf = 0,
  24282. lastDeff = 0;
  24283. const stack = [];
  24284. const callstack = [];
  24285. const functionsCalled = [];
  24286. let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  24287. let inFDEF = false,
  24288. ifLevel = 0,
  24289. inELSE = 0;
  24290. for (let ii = data.length; i < ii;) {
  24291. const op = data[i++];
  24292. if (op === 0x40) {
  24293. n = data[i++];
  24294. if (inFDEF || inELSE) {
  24295. i += n;
  24296. } else {
  24297. for (j = 0; j < n; j++) {
  24298. stack.push(data[i++]);
  24299. }
  24300. }
  24301. } else if (op === 0x41) {
  24302. n = data[i++];
  24303. if (inFDEF || inELSE) {
  24304. i += n * 2;
  24305. } else {
  24306. for (j = 0; j < n; j++) {
  24307. b = data[i++];
  24308. stack.push(b << 8 | data[i++]);
  24309. }
  24310. }
  24311. } else if ((op & 0xf8) === 0xb0) {
  24312. n = op - 0xb0 + 1;
  24313. if (inFDEF || inELSE) {
  24314. i += n;
  24315. } else {
  24316. for (j = 0; j < n; j++) {
  24317. stack.push(data[i++]);
  24318. }
  24319. }
  24320. } else if ((op & 0xf8) === 0xb8) {
  24321. n = op - 0xb8 + 1;
  24322. if (inFDEF || inELSE) {
  24323. i += n * 2;
  24324. } else {
  24325. for (j = 0; j < n; j++) {
  24326. b = data[i++];
  24327. stack.push(signedInt16(b, data[i++]));
  24328. }
  24329. }
  24330. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  24331. if (!inFDEF && !inELSE) {
  24332. funcId = stack.at(-1);
  24333. if (isNaN(funcId)) {
  24334. info("TT: CALL empty stack (or invalid entry).");
  24335. } else {
  24336. ttContext.functionsUsed[funcId] = true;
  24337. if (funcId in ttContext.functionsStackDeltas) {
  24338. const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
  24339. if (newStackLength < 0) {
  24340. warn("TT: CALL invalid functions stack delta.");
  24341. ttContext.hintsValid = false;
  24342. return;
  24343. }
  24344. stack.length = newStackLength;
  24345. } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
  24346. callstack.push({
  24347. data,
  24348. i,
  24349. stackTop: stack.length - 1
  24350. });
  24351. functionsCalled.push(funcId);
  24352. pc = ttContext.functionsDefined[funcId];
  24353. if (!pc) {
  24354. warn("TT: CALL non-existent function");
  24355. ttContext.hintsValid = false;
  24356. return;
  24357. }
  24358. data = pc.data;
  24359. i = pc.i;
  24360. }
  24361. }
  24362. }
  24363. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  24364. if (inFDEF || inELSE) {
  24365. warn("TT: nested FDEFs not allowed");
  24366. tooComplexToFollowFunctions = true;
  24367. }
  24368. inFDEF = true;
  24369. lastDeff = i;
  24370. funcId = stack.pop();
  24371. ttContext.functionsDefined[funcId] = {
  24372. data,
  24373. i
  24374. };
  24375. } else if (op === 0x2d) {
  24376. if (inFDEF) {
  24377. inFDEF = false;
  24378. lastEndf = i;
  24379. } else {
  24380. pc = callstack.pop();
  24381. if (!pc) {
  24382. warn("TT: ENDF bad stack");
  24383. ttContext.hintsValid = false;
  24384. return;
  24385. }
  24386. funcId = functionsCalled.pop();
  24387. data = pc.data;
  24388. i = pc.i;
  24389. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  24390. }
  24391. } else if (op === 0x89) {
  24392. if (inFDEF || inELSE) {
  24393. warn("TT: nested IDEFs not allowed");
  24394. tooComplexToFollowFunctions = true;
  24395. }
  24396. inFDEF = true;
  24397. lastDeff = i;
  24398. } else if (op === 0x58) {
  24399. ++ifLevel;
  24400. } else if (op === 0x1b) {
  24401. inELSE = ifLevel;
  24402. } else if (op === 0x59) {
  24403. if (inELSE === ifLevel) {
  24404. inELSE = 0;
  24405. }
  24406. --ifLevel;
  24407. } else if (op === 0x1c) {
  24408. if (!inFDEF && !inELSE) {
  24409. const offset = stack.at(-1);
  24410. if (offset > 0) {
  24411. i += offset - 1;
  24412. }
  24413. }
  24414. }
  24415. if (!inFDEF && !inELSE) {
  24416. let stackDelta = 0;
  24417. if (op <= 0x8e) {
  24418. stackDelta = TTOpsStackDeltas[op];
  24419. } else if (op >= 0xc0 && op <= 0xdf) {
  24420. stackDelta = -1;
  24421. } else if (op >= 0xe0) {
  24422. stackDelta = -2;
  24423. }
  24424. if (op >= 0x71 && op <= 0x75) {
  24425. n = stack.pop();
  24426. if (!isNaN(n)) {
  24427. stackDelta = -n * 2;
  24428. }
  24429. }
  24430. while (stackDelta < 0 && stack.length > 0) {
  24431. stack.pop();
  24432. stackDelta++;
  24433. }
  24434. while (stackDelta > 0) {
  24435. stack.push(NaN);
  24436. stackDelta--;
  24437. }
  24438. }
  24439. }
  24440. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  24441. const content = [data];
  24442. if (i > data.length) {
  24443. content.push(new Uint8Array(i - data.length));
  24444. }
  24445. if (lastDeff > lastEndf) {
  24446. warn("TT: complementing a missing function tail");
  24447. content.push(new Uint8Array([0x22, 0x2d]));
  24448. }
  24449. foldTTTable(table, content);
  24450. }
  24451. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  24452. if (ttContext.tooComplexToFollowFunctions) {
  24453. return;
  24454. }
  24455. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  24456. warn("TT: more functions defined than expected");
  24457. ttContext.hintsValid = false;
  24458. return;
  24459. }
  24460. for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  24461. if (j > maxFunctionDefs) {
  24462. warn("TT: invalid function id: " + j);
  24463. ttContext.hintsValid = false;
  24464. return;
  24465. }
  24466. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  24467. warn("TT: undefined function: " + j);
  24468. ttContext.hintsValid = false;
  24469. return;
  24470. }
  24471. }
  24472. }
  24473. function foldTTTable(table, content) {
  24474. if (content.length > 1) {
  24475. let newLength = 0;
  24476. let j, jj;
  24477. for (j = 0, jj = content.length; j < jj; j++) {
  24478. newLength += content[j].length;
  24479. }
  24480. newLength = newLength + 3 & ~3;
  24481. const result = new Uint8Array(newLength);
  24482. let pos = 0;
  24483. for (j = 0, jj = content.length; j < jj; j++) {
  24484. result.set(content[j], pos);
  24485. pos += content[j].length;
  24486. }
  24487. table.data = result;
  24488. table.length = newLength;
  24489. }
  24490. }
  24491. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  24492. const ttContext = {
  24493. functionsDefined: [],
  24494. functionsUsed: [],
  24495. functionsStackDeltas: [],
  24496. tooComplexToFollowFunctions: false,
  24497. hintsValid: true
  24498. };
  24499. if (fpgm) {
  24500. sanitizeTTProgram(fpgm, ttContext);
  24501. }
  24502. if (prep) {
  24503. sanitizeTTProgram(prep, ttContext);
  24504. }
  24505. if (fpgm) {
  24506. checkInvalidFunctions(ttContext, maxFunctionDefs);
  24507. }
  24508. if (cvt && cvt.length & 1) {
  24509. const cvtData = new Uint8Array(cvt.length + 1);
  24510. cvtData.set(cvt.data);
  24511. cvt.data = cvtData;
  24512. }
  24513. return ttContext.hintsValid;
  24514. }
  24515. font = new Stream(new Uint8Array(font.getBytes()));
  24516. let header, tables;
  24517. if (isTrueTypeCollectionFile(font)) {
  24518. const ttcData = readTrueTypeCollectionData(font, this.name);
  24519. header = ttcData.header;
  24520. tables = ttcData.tables;
  24521. } else {
  24522. header = readOpenTypeHeader(font);
  24523. tables = readTables(font, header.numTables);
  24524. }
  24525. let cff, cffFile;
  24526. const isTrueType = !tables["CFF "];
  24527. if (!isTrueType) {
  24528. const isComposite = properties.composite && (properties.cidToGidMap?.length > 0 || !(properties.cMap instanceof IdentityCMap));
  24529. if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
  24530. cffFile = new Stream(tables["CFF "].data);
  24531. cff = new CFFFont(cffFile, properties);
  24532. adjustWidths(properties);
  24533. return this.convert(name, cff, properties);
  24534. }
  24535. delete tables.glyf;
  24536. delete tables.loca;
  24537. delete tables.fpgm;
  24538. delete tables.prep;
  24539. delete tables["cvt "];
  24540. this.isOpenType = true;
  24541. } else {
  24542. if (!tables.loca) {
  24543. throw new FormatError('Required "loca" table is not found');
  24544. }
  24545. if (!tables.glyf) {
  24546. warn('Required "glyf" table is not found -- trying to recover.');
  24547. tables.glyf = {
  24548. tag: "glyf",
  24549. data: new Uint8Array(0)
  24550. };
  24551. }
  24552. this.isOpenType = false;
  24553. }
  24554. if (!tables.maxp) {
  24555. throw new FormatError('Required "maxp" table is not found');
  24556. }
  24557. font.pos = (font.start || 0) + tables.maxp.offset;
  24558. let version = font.getInt32();
  24559. const numGlyphs = font.getUint16();
  24560. if (version !== 0x00010000 && version !== 0x00005000) {
  24561. if (tables.maxp.length === 6) {
  24562. version = 0x0005000;
  24563. } else if (tables.maxp.length >= 32) {
  24564. version = 0x00010000;
  24565. } else {
  24566. throw new FormatError(`"maxp" table has a wrong version number`);
  24567. }
  24568. writeUint32(tables.maxp.data, 0, version);
  24569. }
  24570. if (properties.scaleFactors?.length === numGlyphs && isTrueType) {
  24571. const {
  24572. scaleFactors
  24573. } = properties;
  24574. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  24575. const glyphs = new GlyfTable({
  24576. glyfTable: tables.glyf.data,
  24577. isGlyphLocationsLong,
  24578. locaTable: tables.loca.data,
  24579. numGlyphs
  24580. });
  24581. glyphs.scale(scaleFactors);
  24582. const {
  24583. glyf,
  24584. loca,
  24585. isLocationLong
  24586. } = glyphs.write();
  24587. tables.glyf.data = glyf;
  24588. tables.loca.data = loca;
  24589. if (isLocationLong !== !!isGlyphLocationsLong) {
  24590. tables.head.data[50] = 0;
  24591. tables.head.data[51] = isLocationLong ? 1 : 0;
  24592. }
  24593. const metrics = tables.hmtx.data;
  24594. for (let i = 0; i < numGlyphs; i++) {
  24595. const j = 4 * i;
  24596. const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1]));
  24597. metrics[j] = advanceWidth >> 8 & 0xff;
  24598. metrics[j + 1] = advanceWidth & 0xff;
  24599. const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3]));
  24600. writeSignedInt16(metrics, j + 2, lsb);
  24601. }
  24602. }
  24603. let numGlyphsOut = numGlyphs + 1;
  24604. let dupFirstEntry = true;
  24605. if (numGlyphsOut > 0xffff) {
  24606. dupFirstEntry = false;
  24607. numGlyphsOut = numGlyphs;
  24608. warn("Not enough space in glyfs to duplicate first glyph.");
  24609. }
  24610. let maxFunctionDefs = 0;
  24611. let maxSizeOfInstructions = 0;
  24612. if (version >= 0x00010000 && tables.maxp.length >= 32) {
  24613. font.pos += 8;
  24614. const maxZones = font.getUint16();
  24615. if (maxZones > 2) {
  24616. tables.maxp.data[14] = 0;
  24617. tables.maxp.data[15] = 2;
  24618. }
  24619. font.pos += 4;
  24620. maxFunctionDefs = font.getUint16();
  24621. font.pos += 4;
  24622. maxSizeOfInstructions = font.getUint16();
  24623. }
  24624. tables.maxp.data[4] = numGlyphsOut >> 8;
  24625. tables.maxp.data[5] = numGlyphsOut & 255;
  24626. const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
  24627. if (!hintsValid) {
  24628. delete tables.fpgm;
  24629. delete tables.prep;
  24630. delete tables["cvt "];
  24631. }
  24632. sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry);
  24633. if (!tables.head) {
  24634. throw new FormatError('Required "head" table is not found');
  24635. }
  24636. sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
  24637. let missingGlyphs = Object.create(null);
  24638. if (isTrueType) {
  24639. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  24640. const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
  24641. missingGlyphs = glyphsInfo.missingGlyphs;
  24642. if (version >= 0x00010000 && tables.maxp.length >= 32) {
  24643. tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  24644. tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  24645. }
  24646. }
  24647. if (!tables.hhea) {
  24648. throw new FormatError('Required "hhea" table is not found');
  24649. }
  24650. if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
  24651. tables.hhea.data[10] = 0xff;
  24652. tables.hhea.data[11] = 0xff;
  24653. }
  24654. const metricsOverride = {
  24655. unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
  24656. yMax: signedInt16(tables.head.data[42], tables.head.data[43]),
  24657. yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
  24658. ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]),
  24659. descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]),
  24660. lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9])
  24661. };
  24662. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  24663. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  24664. this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm;
  24665. if (this.cssFontInfo?.lineHeight) {
  24666. this.lineHeight = this.cssFontInfo.metrics.lineHeight;
  24667. this.lineGap = this.cssFontInfo.metrics.lineGap;
  24668. } else {
  24669. this.lineHeight = this.ascent - this.descent + this.lineGap;
  24670. }
  24671. if (tables.post) {
  24672. readPostScriptTable(tables.post, properties, numGlyphs);
  24673. }
  24674. tables.post = {
  24675. tag: "post",
  24676. data: createPostTable(properties)
  24677. };
  24678. const charCodeToGlyphId = Object.create(null);
  24679. function hasGlyph(glyphId) {
  24680. return !missingGlyphs[glyphId];
  24681. }
  24682. if (properties.composite) {
  24683. const cidToGidMap = properties.cidToGidMap || [];
  24684. const isCidToGidMapEmpty = cidToGidMap.length === 0;
  24685. properties.cMap.forEach(function (charCode, cid) {
  24686. if (typeof cid === "string") {
  24687. cid = convertCidString(charCode, cid, true);
  24688. }
  24689. if (cid > 0xffff) {
  24690. throw new FormatError("Max size of CID is 65,535");
  24691. }
  24692. let glyphId = -1;
  24693. if (isCidToGidMapEmpty) {
  24694. glyphId = cid;
  24695. } else if (cidToGidMap[cid] !== undefined) {
  24696. glyphId = cidToGidMap[cid];
  24697. }
  24698. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  24699. charCodeToGlyphId[charCode] = glyphId;
  24700. }
  24701. });
  24702. } else {
  24703. const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
  24704. const cmapPlatformId = cmapTable.platformId;
  24705. const cmapEncodingId = cmapTable.encodingId;
  24706. const cmapMappings = cmapTable.mappings;
  24707. let baseEncoding = [],
  24708. forcePostTable = false;
  24709. if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) {
  24710. baseEncoding = getEncoding(properties.baseEncodingName);
  24711. }
  24712. if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) {
  24713. const glyphsUnicodeMap = getGlyphsUnicode();
  24714. for (let charCode = 0; charCode < 256; charCode++) {
  24715. let glyphName;
  24716. if (this.differences[charCode] !== undefined) {
  24717. glyphName = this.differences[charCode];
  24718. } else if (baseEncoding.length && baseEncoding[charCode] !== "") {
  24719. glyphName = baseEncoding[charCode];
  24720. } else {
  24721. glyphName = StandardEncoding[charCode];
  24722. }
  24723. if (!glyphName) {
  24724. continue;
  24725. }
  24726. const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  24727. let unicodeOrCharCode;
  24728. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  24729. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  24730. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  24731. unicodeOrCharCode = MacRomanEncoding.indexOf(standardGlyphName);
  24732. }
  24733. if (unicodeOrCharCode === undefined) {
  24734. if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof IdentityToUnicodeMap)) {
  24735. const unicode = this.toUnicode.get(charCode);
  24736. if (unicode) {
  24737. unicodeOrCharCode = unicode.codePointAt(0);
  24738. }
  24739. }
  24740. if (unicodeOrCharCode === undefined) {
  24741. continue;
  24742. }
  24743. }
  24744. for (const mapping of cmapMappings) {
  24745. if (mapping.charCode !== unicodeOrCharCode) {
  24746. continue;
  24747. }
  24748. charCodeToGlyphId[charCode] = mapping.glyphId;
  24749. break;
  24750. }
  24751. }
  24752. } else if (cmapPlatformId === 0) {
  24753. for (const mapping of cmapMappings) {
  24754. charCodeToGlyphId[mapping.charCode] = mapping.glyphId;
  24755. }
  24756. forcePostTable = true;
  24757. } else if (cmapPlatformId === 3 && cmapEncodingId === 0) {
  24758. for (const mapping of cmapMappings) {
  24759. let charCode = mapping.charCode;
  24760. if (charCode >= 0xf000 && charCode <= 0xf0ff) {
  24761. charCode &= 0xff;
  24762. }
  24763. charCodeToGlyphId[charCode] = mapping.glyphId;
  24764. }
  24765. } else {
  24766. for (const mapping of cmapMappings) {
  24767. charCodeToGlyphId[mapping.charCode] = mapping.glyphId;
  24768. }
  24769. }
  24770. if (properties.glyphNames && (baseEncoding.length || this.differences.length)) {
  24771. for (let i = 0; i < 256; ++i) {
  24772. if (!forcePostTable && charCodeToGlyphId[i] !== undefined) {
  24773. continue;
  24774. }
  24775. const glyphName = this.differences[i] || baseEncoding[i];
  24776. if (!glyphName) {
  24777. continue;
  24778. }
  24779. const glyphId = properties.glyphNames.indexOf(glyphName);
  24780. if (glyphId > 0 && hasGlyph(glyphId)) {
  24781. charCodeToGlyphId[i] = glyphId;
  24782. }
  24783. }
  24784. }
  24785. }
  24786. if (charCodeToGlyphId.length === 0) {
  24787. charCodeToGlyphId[0] = 0;
  24788. }
  24789. let glyphZeroId = numGlyphsOut - 1;
  24790. if (!dupFirstEntry) {
  24791. glyphZeroId = 0;
  24792. }
  24793. if (!properties.cssFontInfo) {
  24794. const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId, this.toUnicode);
  24795. this.toFontChar = newMapping.toFontChar;
  24796. tables.cmap = {
  24797. tag: "cmap",
  24798. data: createCmapTable(newMapping.charCodeToGlyphId, newMapping.toUnicodeExtraMap, numGlyphsOut)
  24799. };
  24800. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
  24801. tables["OS/2"] = {
  24802. tag: "OS/2",
  24803. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  24804. };
  24805. }
  24806. }
  24807. if (!isTrueType) {
  24808. try {
  24809. cffFile = new Stream(tables["CFF "].data);
  24810. const parser = new CFFParser(cffFile, properties, SEAC_ANALYSIS_ENABLED);
  24811. cff = parser.parse();
  24812. cff.duplicateFirstGlyph();
  24813. const compiler = new CFFCompiler(cff);
  24814. tables["CFF "].data = compiler.compile();
  24815. } catch {
  24816. warn("Failed to compile font " + properties.loadedName);
  24817. }
  24818. }
  24819. if (!tables.name) {
  24820. tables.name = {
  24821. tag: "name",
  24822. data: createNameTable(this.name)
  24823. };
  24824. } else {
  24825. const [namePrototype, nameRecords] = readNameTable(tables.name);
  24826. tables.name.data = createNameTable(name, namePrototype);
  24827. this.psName = namePrototype[0][6] || null;
  24828. if (!properties.composite) {
  24829. adjustTrueTypeToUnicode(properties, this.isSymbolicFont, nameRecords);
  24830. }
  24831. }
  24832. const builder = new OpenTypeFileBuilder(header.version);
  24833. for (const tableTag in tables) {
  24834. builder.addTable(tableTag, tables[tableTag].data);
  24835. }
  24836. return builder.toArray();
  24837. }
  24838. convert(fontName, font, properties) {
  24839. properties.fixedPitch = false;
  24840. if (properties.builtInEncoding) {
  24841. adjustType1ToUnicode(properties, properties.builtInEncoding);
  24842. }
  24843. let glyphZeroId = 1;
  24844. if (font instanceof CFFFont) {
  24845. glyphZeroId = font.numGlyphs - 1;
  24846. }
  24847. const mapping = font.getGlyphMapping(properties);
  24848. let newMapping = null;
  24849. let newCharCodeToGlyphId = mapping;
  24850. let toUnicodeExtraMap = null;
  24851. if (!properties.cssFontInfo) {
  24852. newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId, this.toUnicode);
  24853. this.toFontChar = newMapping.toFontChar;
  24854. newCharCodeToGlyphId = newMapping.charCodeToGlyphId;
  24855. toUnicodeExtraMap = newMapping.toUnicodeExtraMap;
  24856. }
  24857. const numGlyphs = font.numGlyphs;
  24858. function getCharCodes(charCodeToGlyphId, glyphId) {
  24859. let charCodes = null;
  24860. for (const charCode in charCodeToGlyphId) {
  24861. if (glyphId === charCodeToGlyphId[charCode]) {
  24862. (charCodes ||= []).push(charCode | 0);
  24863. }
  24864. }
  24865. return charCodes;
  24866. }
  24867. function createCharCode(charCodeToGlyphId, glyphId) {
  24868. for (const charCode in charCodeToGlyphId) {
  24869. if (glyphId === charCodeToGlyphId[charCode]) {
  24870. return charCode | 0;
  24871. }
  24872. }
  24873. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  24874. return newMapping.nextAvailableFontCharCode++;
  24875. }
  24876. const seacs = font.seacs;
  24877. if (newMapping && SEAC_ANALYSIS_ENABLED && seacs?.length) {
  24878. const matrix = properties.fontMatrix || FONT_IDENTITY_MATRIX;
  24879. const charset = font.getCharset();
  24880. const seacMap = Object.create(null);
  24881. for (let glyphId in seacs) {
  24882. glyphId |= 0;
  24883. const seac = seacs[glyphId];
  24884. const baseGlyphName = StandardEncoding[seac[2]];
  24885. const accentGlyphName = StandardEncoding[seac[3]];
  24886. const baseGlyphId = charset.indexOf(baseGlyphName);
  24887. const accentGlyphId = charset.indexOf(accentGlyphName);
  24888. if (baseGlyphId < 0 || accentGlyphId < 0) {
  24889. continue;
  24890. }
  24891. const accentOffset = {
  24892. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  24893. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  24894. };
  24895. const charCodes = getCharCodes(mapping, glyphId);
  24896. if (!charCodes) {
  24897. continue;
  24898. }
  24899. for (const charCode of charCodes) {
  24900. const charCodeToGlyphId = newMapping.charCodeToGlyphId;
  24901. const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  24902. const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  24903. seacMap[charCode] = {
  24904. baseFontCharCode,
  24905. accentFontCharCode,
  24906. accentOffset
  24907. };
  24908. }
  24909. }
  24910. properties.seacMap = seacMap;
  24911. }
  24912. const unitsPerEm = properties.fontMatrix ? 1 / Math.max(...properties.fontMatrix.slice(0, 4).map(Math.abs)) : 1000;
  24913. const builder = new OpenTypeFileBuilder("\x4F\x54\x54\x4F");
  24914. builder.addTable("CFF ", font.data);
  24915. builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId));
  24916. builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, toUnicodeExtraMap, numGlyphs));
  24917. builder.addTable("head", "\x00\x01\x00\x00" + "\x00\x00\x10\x00" + "\x00\x00\x00\x00" + "\x5F\x0F\x3C\xF5" + "\x00\x00" + safeString16(unitsPerEm) + "\x00\x00\x00\x00\x9e\x0b\x7e\x27" + "\x00\x00\x00\x00\x9e\x0b\x7e\x27" + "\x00\x00" + safeString16(properties.descent) + "\x0F\xFF" + safeString16(properties.ascent) + string16(properties.italicAngle ? 2 : 0) + "\x00\x11" + "\x00\x00" + "\x00\x00" + "\x00\x00");
  24918. builder.addTable("hhea", "\x00\x01\x00\x00" + safeString16(properties.ascent) + safeString16(properties.descent) + "\x00\x00" + "\xFF\xFF" + "\x00\x00" + "\x00\x00" + "\x00\x00" + safeString16(properties.capHeight) + safeString16(Math.tan(properties.italicAngle) * properties.xHeight) + "\x00\x00" + "\x00\x00" + "\x00\x00" + "\x00\x00" + "\x00\x00" + "\x00\x00" + string16(numGlyphs));
  24919. builder.addTable("hmtx", function fontFieldsHmtx() {
  24920. const charstrings = font.charstrings;
  24921. const cffWidths = font.cff ? font.cff.widths : null;
  24922. let hmtx = "\x00\x00\x00\x00";
  24923. for (let i = 1, ii = numGlyphs; i < ii; i++) {
  24924. let width = 0;
  24925. if (charstrings) {
  24926. const charstring = charstrings[i - 1];
  24927. width = "width" in charstring ? charstring.width : 0;
  24928. } else if (cffWidths) {
  24929. width = Math.ceil(cffWidths[i] || 0);
  24930. }
  24931. hmtx += string16(width) + string16(0);
  24932. }
  24933. return hmtx;
  24934. }());
  24935. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  24936. builder.addTable("name", createNameTable(fontName));
  24937. builder.addTable("post", createPostTable(properties));
  24938. return builder.toArray();
  24939. }
  24940. get _spaceWidth() {
  24941. const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
  24942. let width;
  24943. for (const glyphName of possibleSpaceReplacements) {
  24944. if (glyphName in this.widths) {
  24945. width = this.widths[glyphName];
  24946. break;
  24947. }
  24948. const glyphsUnicodeMap = getGlyphsUnicode();
  24949. const glyphUnicode = glyphsUnicodeMap[glyphName];
  24950. let charcode = 0;
  24951. if (this.composite && this.cMap.contains(glyphUnicode)) {
  24952. charcode = this.cMap.lookup(glyphUnicode);
  24953. if (typeof charcode === "string") {
  24954. charcode = convertCidString(glyphUnicode, charcode);
  24955. }
  24956. }
  24957. if (!charcode && this.toUnicode) {
  24958. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  24959. }
  24960. if (charcode <= 0) {
  24961. charcode = glyphUnicode;
  24962. }
  24963. width = this.widths[charcode];
  24964. if (width) {
  24965. break;
  24966. }
  24967. }
  24968. return shadow(this, "_spaceWidth", width || this.defaultWidth);
  24969. }
  24970. _charToGlyph(charcode, isSpace = false) {
  24971. let glyph = this._glyphCache[charcode];
  24972. if (glyph?.isSpace === isSpace) {
  24973. return glyph;
  24974. }
  24975. let fontCharCode, width, operatorListId;
  24976. let widthCode = charcode;
  24977. if (this.cMap?.contains(charcode)) {
  24978. widthCode = this.cMap.lookup(charcode);
  24979. if (typeof widthCode === "string") {
  24980. widthCode = convertCidString(charcode, widthCode);
  24981. }
  24982. }
  24983. width = this.widths[widthCode];
  24984. if (typeof width !== "number") {
  24985. width = this.defaultWidth;
  24986. }
  24987. const vmetric = this.vmetrics?.[widthCode];
  24988. let unicode = this.toUnicode.get(charcode) || charcode;
  24989. if (typeof unicode === "number") {
  24990. unicode = String.fromCharCode(unicode);
  24991. }
  24992. let isInFont = this.toFontChar[charcode] !== undefined;
  24993. fontCharCode = this.toFontChar[charcode] || charcode;
  24994. if (this.missingFile) {
  24995. const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
  24996. if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
  24997. fontCharCode = 0x20;
  24998. if (glyphName === "") {
  24999. width ||= this._spaceWidth;
  25000. unicode = String.fromCharCode(fontCharCode);
  25001. }
  25002. }
  25003. fontCharCode = mapSpecialUnicodeValues(fontCharCode);
  25004. }
  25005. if (this.isType3Font) {
  25006. operatorListId = fontCharCode;
  25007. }
  25008. let accent = null;
  25009. if (this.seacMap?.[charcode]) {
  25010. isInFont = true;
  25011. const seac = this.seacMap[charcode];
  25012. fontCharCode = seac.baseFontCharCode;
  25013. accent = {
  25014. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  25015. offset: seac.accentOffset
  25016. };
  25017. }
  25018. let fontChar = "";
  25019. if (typeof fontCharCode === "number") {
  25020. if (fontCharCode <= 0x10ffff) {
  25021. fontChar = String.fromCodePoint(fontCharCode);
  25022. } else {
  25023. warn(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
  25024. }
  25025. }
  25026. if (this.missingFile && this.vertical && fontChar.length === 1) {
  25027. const vertical = getVerticalPresentationForm()[fontChar.charCodeAt(0)];
  25028. if (vertical) {
  25029. fontChar = unicode = String.fromCharCode(vertical);
  25030. }
  25031. }
  25032. glyph = new fonts_Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  25033. return this._glyphCache[charcode] = glyph;
  25034. }
  25035. charsToGlyphs(chars) {
  25036. let glyphs = this._charsCache[chars];
  25037. if (glyphs) {
  25038. return glyphs;
  25039. }
  25040. glyphs = [];
  25041. if (this.cMap) {
  25042. const c = Object.create(null),
  25043. ii = chars.length;
  25044. let i = 0;
  25045. while (i < ii) {
  25046. this.cMap.readCharCode(chars, i, c);
  25047. const {
  25048. charcode,
  25049. length
  25050. } = c;
  25051. i += length;
  25052. const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20);
  25053. glyphs.push(glyph);
  25054. }
  25055. } else {
  25056. for (let i = 0, ii = chars.length; i < ii; ++i) {
  25057. const charcode = chars.charCodeAt(i);
  25058. const glyph = this._charToGlyph(charcode, charcode === 0x20);
  25059. glyphs.push(glyph);
  25060. }
  25061. }
  25062. return this._charsCache[chars] = glyphs;
  25063. }
  25064. getCharPositions(chars) {
  25065. const positions = [];
  25066. if (this.cMap) {
  25067. const c = Object.create(null);
  25068. let i = 0;
  25069. while (i < chars.length) {
  25070. this.cMap.readCharCode(chars, i, c);
  25071. const length = c.length;
  25072. positions.push([i, i + length]);
  25073. i += length;
  25074. }
  25075. } else {
  25076. for (let i = 0, ii = chars.length; i < ii; ++i) {
  25077. positions.push([i, i + 1]);
  25078. }
  25079. }
  25080. return positions;
  25081. }
  25082. get glyphCacheValues() {
  25083. return Object.values(this._glyphCache);
  25084. }
  25085. encodeString(str) {
  25086. const buffers = [];
  25087. const currentBuf = [];
  25088. const hasCurrentBufErrors = () => buffers.length % 2 === 1;
  25089. const getCharCode = this.toUnicode instanceof IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode));
  25090. for (let i = 0, ii = str.length; i < ii; i++) {
  25091. const unicode = str.codePointAt(i);
  25092. if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
  25093. i++;
  25094. }
  25095. if (this.toUnicode) {
  25096. const charCode = getCharCode(unicode);
  25097. if (charCode !== -1) {
  25098. if (hasCurrentBufErrors()) {
  25099. buffers.push(currentBuf.join(""));
  25100. currentBuf.length = 0;
  25101. }
  25102. const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
  25103. for (let j = charCodeLength - 1; j >= 0; j--) {
  25104. currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
  25105. }
  25106. continue;
  25107. }
  25108. }
  25109. if (!hasCurrentBufErrors()) {
  25110. buffers.push(currentBuf.join(""));
  25111. currentBuf.length = 0;
  25112. }
  25113. currentBuf.push(String.fromCodePoint(unicode));
  25114. }
  25115. buffers.push(currentBuf.join(""));
  25116. return buffers;
  25117. }
  25118. }
  25119. class ErrorFont {
  25120. constructor(error) {
  25121. this.error = error;
  25122. this.loadedName = "g_font_error";
  25123. this.missingFile = true;
  25124. }
  25125. charsToGlyphs() {
  25126. return [];
  25127. }
  25128. encodeString(chars) {
  25129. return [chars];
  25130. }
  25131. exportData(extraProperties = false) {
  25132. return {
  25133. error: this.error
  25134. };
  25135. }
  25136. }
  25137. ;// ./src/core/pattern.js
  25138. const ShadingType = {
  25139. FUNCTION_BASED: 1,
  25140. AXIAL: 2,
  25141. RADIAL: 3,
  25142. FREE_FORM_MESH: 4,
  25143. LATTICE_FORM_MESH: 5,
  25144. COONS_PATCH_MESH: 6,
  25145. TENSOR_PATCH_MESH: 7
  25146. };
  25147. class Pattern {
  25148. constructor() {
  25149. unreachable("Cannot initialize Pattern.");
  25150. }
  25151. static parseShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache) {
  25152. const dict = shading instanceof BaseStream ? shading.dict : shading;
  25153. const type = dict.get("ShadingType");
  25154. try {
  25155. switch (type) {
  25156. case ShadingType.AXIAL:
  25157. case ShadingType.RADIAL:
  25158. return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, localColorSpaceCache);
  25159. case ShadingType.FREE_FORM_MESH:
  25160. case ShadingType.LATTICE_FORM_MESH:
  25161. case ShadingType.COONS_PATCH_MESH:
  25162. case ShadingType.TENSOR_PATCH_MESH:
  25163. return new MeshShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache);
  25164. default:
  25165. throw new FormatError("Unsupported ShadingType: " + type);
  25166. }
  25167. } catch (ex) {
  25168. if (ex instanceof MissingDataException) {
  25169. throw ex;
  25170. }
  25171. warn(ex);
  25172. return new DummyShading();
  25173. }
  25174. }
  25175. }
  25176. class BaseShading {
  25177. static SMALL_NUMBER = 1e-6;
  25178. getIR() {
  25179. unreachable("Abstract method `getIR` called.");
  25180. }
  25181. }
  25182. class RadialAxialShading extends BaseShading {
  25183. constructor(dict, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  25184. super();
  25185. this.shadingType = dict.get("ShadingType");
  25186. let coordsLen = 0;
  25187. if (this.shadingType === ShadingType.AXIAL) {
  25188. coordsLen = 4;
  25189. } else if (this.shadingType === ShadingType.RADIAL) {
  25190. coordsLen = 6;
  25191. }
  25192. this.coordsArr = dict.getArray("Coords");
  25193. if (!isNumberArray(this.coordsArr, coordsLen)) {
  25194. throw new FormatError("RadialAxialShading: Invalid /Coords array.");
  25195. }
  25196. const cs = ColorSpace.parse({
  25197. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  25198. xref,
  25199. resources,
  25200. pdfFunctionFactory,
  25201. localColorSpaceCache
  25202. });
  25203. this.bbox = lookupNormalRect(dict.getArray("BBox"), null);
  25204. let t0 = 0.0,
  25205. t1 = 1.0;
  25206. const domainArr = dict.getArray("Domain");
  25207. if (isNumberArray(domainArr, 2)) {
  25208. [t0, t1] = domainArr;
  25209. }
  25210. let extendStart = false,
  25211. extendEnd = false;
  25212. const extendArr = dict.getArray("Extend");
  25213. if (isBooleanArray(extendArr, 2)) {
  25214. [extendStart, extendEnd] = extendArr;
  25215. }
  25216. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  25217. const [x1, y1, r1, x2, y2, r2] = this.coordsArr;
  25218. const distance = Math.hypot(x1 - x2, y1 - y2);
  25219. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  25220. warn("Unsupported radial gradient.");
  25221. }
  25222. }
  25223. this.extendStart = extendStart;
  25224. this.extendEnd = extendEnd;
  25225. const fnObj = dict.getRaw("Function");
  25226. const fn = pdfFunctionFactory.createFromArray(fnObj);
  25227. const NUMBER_OF_SAMPLES = 840;
  25228. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  25229. const colorStops = this.colorStops = [];
  25230. if (t0 >= t1 || step <= 0) {
  25231. info("Bad shading domain.");
  25232. return;
  25233. }
  25234. const color = new Float32Array(cs.numComps),
  25235. ratio = new Float32Array(1);
  25236. let rgbColor;
  25237. let iBase = 0;
  25238. ratio[0] = t0;
  25239. fn(ratio, 0, color, 0);
  25240. let rgbBase = cs.getRgb(color, 0);
  25241. const cssColorBase = Util.makeHexColor(rgbBase[0], rgbBase[1], rgbBase[2]);
  25242. colorStops.push([0, cssColorBase]);
  25243. let iPrev = 1;
  25244. ratio[0] = t0 + step;
  25245. fn(ratio, 0, color, 0);
  25246. let rgbPrev = cs.getRgb(color, 0);
  25247. let maxSlopeR = rgbPrev[0] - rgbBase[0] + 1;
  25248. let maxSlopeG = rgbPrev[1] - rgbBase[1] + 1;
  25249. let maxSlopeB = rgbPrev[2] - rgbBase[2] + 1;
  25250. let minSlopeR = rgbPrev[0] - rgbBase[0] - 1;
  25251. let minSlopeG = rgbPrev[1] - rgbBase[1] - 1;
  25252. let minSlopeB = rgbPrev[2] - rgbBase[2] - 1;
  25253. for (let i = 2; i < NUMBER_OF_SAMPLES; i++) {
  25254. ratio[0] = t0 + i * step;
  25255. fn(ratio, 0, color, 0);
  25256. rgbColor = cs.getRgb(color, 0);
  25257. const run = i - iBase;
  25258. maxSlopeR = Math.min(maxSlopeR, (rgbColor[0] - rgbBase[0] + 1) / run);
  25259. maxSlopeG = Math.min(maxSlopeG, (rgbColor[1] - rgbBase[1] + 1) / run);
  25260. maxSlopeB = Math.min(maxSlopeB, (rgbColor[2] - rgbBase[2] + 1) / run);
  25261. minSlopeR = Math.max(minSlopeR, (rgbColor[0] - rgbBase[0] - 1) / run);
  25262. minSlopeG = Math.max(minSlopeG, (rgbColor[1] - rgbBase[1] - 1) / run);
  25263. minSlopeB = Math.max(minSlopeB, (rgbColor[2] - rgbBase[2] - 1) / run);
  25264. const slopesExist = minSlopeR <= maxSlopeR && minSlopeG <= maxSlopeG && minSlopeB <= maxSlopeB;
  25265. if (!slopesExist) {
  25266. const cssColor = Util.makeHexColor(rgbPrev[0], rgbPrev[1], rgbPrev[2]);
  25267. colorStops.push([iPrev / NUMBER_OF_SAMPLES, cssColor]);
  25268. maxSlopeR = rgbColor[0] - rgbPrev[0] + 1;
  25269. maxSlopeG = rgbColor[1] - rgbPrev[1] + 1;
  25270. maxSlopeB = rgbColor[2] - rgbPrev[2] + 1;
  25271. minSlopeR = rgbColor[0] - rgbPrev[0] - 1;
  25272. minSlopeG = rgbColor[1] - rgbPrev[1] - 1;
  25273. minSlopeB = rgbColor[2] - rgbPrev[2] - 1;
  25274. iBase = iPrev;
  25275. rgbBase = rgbPrev;
  25276. }
  25277. iPrev = i;
  25278. rgbPrev = rgbColor;
  25279. }
  25280. const cssColor = Util.makeHexColor(rgbPrev[0], rgbPrev[1], rgbPrev[2]);
  25281. colorStops.push([1, cssColor]);
  25282. let background = "transparent";
  25283. if (dict.has("Background")) {
  25284. rgbColor = cs.getRgb(dict.get("Background"), 0);
  25285. background = Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  25286. }
  25287. if (!extendStart) {
  25288. colorStops.unshift([0, background]);
  25289. colorStops[1][0] += BaseShading.SMALL_NUMBER;
  25290. }
  25291. if (!extendEnd) {
  25292. colorStops.at(-1)[0] -= BaseShading.SMALL_NUMBER;
  25293. colorStops.push([1, background]);
  25294. }
  25295. this.colorStops = colorStops;
  25296. }
  25297. getIR() {
  25298. const {
  25299. coordsArr,
  25300. shadingType
  25301. } = this;
  25302. let type, p0, p1, r0, r1;
  25303. if (shadingType === ShadingType.AXIAL) {
  25304. p0 = [coordsArr[0], coordsArr[1]];
  25305. p1 = [coordsArr[2], coordsArr[3]];
  25306. r0 = null;
  25307. r1 = null;
  25308. type = "axial";
  25309. } else if (shadingType === ShadingType.RADIAL) {
  25310. p0 = [coordsArr[0], coordsArr[1]];
  25311. p1 = [coordsArr[3], coordsArr[4]];
  25312. r0 = coordsArr[2];
  25313. r1 = coordsArr[5];
  25314. type = "radial";
  25315. } else {
  25316. unreachable(`getPattern type unknown: ${shadingType}`);
  25317. }
  25318. return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
  25319. }
  25320. }
  25321. class MeshStreamReader {
  25322. constructor(stream, context) {
  25323. this.stream = stream;
  25324. this.context = context;
  25325. this.buffer = 0;
  25326. this.bufferLength = 0;
  25327. const numComps = context.numComps;
  25328. this.tmpCompsBuf = new Float32Array(numComps);
  25329. const csNumComps = context.colorSpace.numComps;
  25330. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  25331. }
  25332. get hasData() {
  25333. if (this.stream.end) {
  25334. return this.stream.pos < this.stream.end;
  25335. }
  25336. if (this.bufferLength > 0) {
  25337. return true;
  25338. }
  25339. const nextByte = this.stream.getByte();
  25340. if (nextByte < 0) {
  25341. return false;
  25342. }
  25343. this.buffer = nextByte;
  25344. this.bufferLength = 8;
  25345. return true;
  25346. }
  25347. readBits(n) {
  25348. let buffer = this.buffer;
  25349. let bufferLength = this.bufferLength;
  25350. if (n === 32) {
  25351. if (bufferLength === 0) {
  25352. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  25353. }
  25354. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  25355. const nextByte = this.stream.getByte();
  25356. this.buffer = nextByte & (1 << bufferLength) - 1;
  25357. return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
  25358. }
  25359. if (n === 8 && bufferLength === 0) {
  25360. return this.stream.getByte();
  25361. }
  25362. while (bufferLength < n) {
  25363. buffer = buffer << 8 | this.stream.getByte();
  25364. bufferLength += 8;
  25365. }
  25366. bufferLength -= n;
  25367. this.bufferLength = bufferLength;
  25368. this.buffer = buffer & (1 << bufferLength) - 1;
  25369. return buffer >> bufferLength;
  25370. }
  25371. align() {
  25372. this.buffer = 0;
  25373. this.bufferLength = 0;
  25374. }
  25375. readFlag() {
  25376. return this.readBits(this.context.bitsPerFlag);
  25377. }
  25378. readCoordinate() {
  25379. const bitsPerCoordinate = this.context.bitsPerCoordinate;
  25380. const xi = this.readBits(bitsPerCoordinate);
  25381. const yi = this.readBits(bitsPerCoordinate);
  25382. const decode = this.context.decode;
  25383. const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  25384. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  25385. }
  25386. readComponents() {
  25387. const numComps = this.context.numComps;
  25388. const bitsPerComponent = this.context.bitsPerComponent;
  25389. const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  25390. const decode = this.context.decode;
  25391. const components = this.tmpCompsBuf;
  25392. for (let i = 0, j = 4; i < numComps; i++, j += 2) {
  25393. const ci = this.readBits(bitsPerComponent);
  25394. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  25395. }
  25396. const color = this.tmpCsCompsBuf;
  25397. if (this.context.colorFn) {
  25398. this.context.colorFn(components, 0, color, 0);
  25399. }
  25400. return this.context.colorSpace.getRgb(color, 0);
  25401. }
  25402. }
  25403. let bCache = Object.create(null);
  25404. function buildB(count) {
  25405. const lut = [];
  25406. for (let i = 0; i <= count; i++) {
  25407. const t = i / count,
  25408. t_ = 1 - t;
  25409. lut.push(new Float32Array([t_ ** 3, 3 * t * t_ ** 2, 3 * t ** 2 * t_, t ** 3]));
  25410. }
  25411. return lut;
  25412. }
  25413. function getB(count) {
  25414. return bCache[count] ||= buildB(count);
  25415. }
  25416. function clearPatternCaches() {
  25417. bCache = Object.create(null);
  25418. }
  25419. class MeshShading extends BaseShading {
  25420. static MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3;
  25421. static MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20;
  25422. static TRIANGLE_DENSITY = 20;
  25423. constructor(stream, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  25424. super();
  25425. if (!(stream instanceof BaseStream)) {
  25426. throw new FormatError("Mesh data is not a stream");
  25427. }
  25428. const dict = stream.dict;
  25429. this.shadingType = dict.get("ShadingType");
  25430. this.bbox = lookupNormalRect(dict.getArray("BBox"), null);
  25431. const cs = ColorSpace.parse({
  25432. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  25433. xref,
  25434. resources,
  25435. pdfFunctionFactory,
  25436. localColorSpaceCache
  25437. });
  25438. this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
  25439. const fnObj = dict.getRaw("Function");
  25440. const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  25441. this.coords = [];
  25442. this.colors = [];
  25443. this.figures = [];
  25444. const decodeContext = {
  25445. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  25446. bitsPerComponent: dict.get("BitsPerComponent"),
  25447. bitsPerFlag: dict.get("BitsPerFlag"),
  25448. decode: dict.getArray("Decode"),
  25449. colorFn: fn,
  25450. colorSpace: cs,
  25451. numComps: fn ? 1 : cs.numComps
  25452. };
  25453. const reader = new MeshStreamReader(stream, decodeContext);
  25454. let patchMesh = false;
  25455. switch (this.shadingType) {
  25456. case ShadingType.FREE_FORM_MESH:
  25457. this._decodeType4Shading(reader);
  25458. break;
  25459. case ShadingType.LATTICE_FORM_MESH:
  25460. const verticesPerRow = dict.get("VerticesPerRow") | 0;
  25461. if (verticesPerRow < 2) {
  25462. throw new FormatError("Invalid VerticesPerRow");
  25463. }
  25464. this._decodeType5Shading(reader, verticesPerRow);
  25465. break;
  25466. case ShadingType.COONS_PATCH_MESH:
  25467. this._decodeType6Shading(reader);
  25468. patchMesh = true;
  25469. break;
  25470. case ShadingType.TENSOR_PATCH_MESH:
  25471. this._decodeType7Shading(reader);
  25472. patchMesh = true;
  25473. break;
  25474. default:
  25475. unreachable("Unsupported mesh type.");
  25476. break;
  25477. }
  25478. if (patchMesh) {
  25479. this._updateBounds();
  25480. for (let i = 0, ii = this.figures.length; i < ii; i++) {
  25481. this._buildFigureFromPatch(i);
  25482. }
  25483. }
  25484. this._updateBounds();
  25485. this._packData();
  25486. }
  25487. _decodeType4Shading(reader) {
  25488. const coords = this.coords;
  25489. const colors = this.colors;
  25490. const operators = [];
  25491. const ps = [];
  25492. let verticesLeft = 0;
  25493. while (reader.hasData) {
  25494. const f = reader.readFlag();
  25495. const coord = reader.readCoordinate();
  25496. const color = reader.readComponents();
  25497. if (verticesLeft === 0) {
  25498. if (!(0 <= f && f <= 2)) {
  25499. throw new FormatError("Unknown type4 flag");
  25500. }
  25501. switch (f) {
  25502. case 0:
  25503. verticesLeft = 3;
  25504. break;
  25505. case 1:
  25506. ps.push(ps.at(-2), ps.at(-1));
  25507. verticesLeft = 1;
  25508. break;
  25509. case 2:
  25510. ps.push(ps.at(-3), ps.at(-1));
  25511. verticesLeft = 1;
  25512. break;
  25513. }
  25514. operators.push(f);
  25515. }
  25516. ps.push(coords.length);
  25517. coords.push(coord);
  25518. colors.push(color);
  25519. verticesLeft--;
  25520. reader.align();
  25521. }
  25522. this.figures.push({
  25523. type: "triangles",
  25524. coords: new Int32Array(ps),
  25525. colors: new Int32Array(ps)
  25526. });
  25527. }
  25528. _decodeType5Shading(reader, verticesPerRow) {
  25529. const coords = this.coords;
  25530. const colors = this.colors;
  25531. const ps = [];
  25532. while (reader.hasData) {
  25533. const coord = reader.readCoordinate();
  25534. const color = reader.readComponents();
  25535. ps.push(coords.length);
  25536. coords.push(coord);
  25537. colors.push(color);
  25538. }
  25539. this.figures.push({
  25540. type: "lattice",
  25541. coords: new Int32Array(ps),
  25542. colors: new Int32Array(ps),
  25543. verticesPerRow
  25544. });
  25545. }
  25546. _decodeType6Shading(reader) {
  25547. const coords = this.coords;
  25548. const colors = this.colors;
  25549. const ps = new Int32Array(16);
  25550. const cs = new Int32Array(4);
  25551. while (reader.hasData) {
  25552. const f = reader.readFlag();
  25553. if (!(0 <= f && f <= 3)) {
  25554. throw new FormatError("Unknown type6 flag");
  25555. }
  25556. const pi = coords.length;
  25557. for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  25558. coords.push(reader.readCoordinate());
  25559. }
  25560. const ci = colors.length;
  25561. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  25562. colors.push(reader.readComponents());
  25563. }
  25564. let tmp1, tmp2, tmp3, tmp4;
  25565. switch (f) {
  25566. case 0:
  25567. ps[12] = pi + 3;
  25568. ps[13] = pi + 4;
  25569. ps[14] = pi + 5;
  25570. ps[15] = pi + 6;
  25571. ps[8] = pi + 2;
  25572. ps[11] = pi + 7;
  25573. ps[4] = pi + 1;
  25574. ps[7] = pi + 8;
  25575. ps[0] = pi;
  25576. ps[1] = pi + 11;
  25577. ps[2] = pi + 10;
  25578. ps[3] = pi + 9;
  25579. cs[2] = ci + 1;
  25580. cs[3] = ci + 2;
  25581. cs[0] = ci;
  25582. cs[1] = ci + 3;
  25583. break;
  25584. case 1:
  25585. tmp1 = ps[12];
  25586. tmp2 = ps[13];
  25587. tmp3 = ps[14];
  25588. tmp4 = ps[15];
  25589. ps[12] = tmp4;
  25590. ps[13] = pi + 0;
  25591. ps[14] = pi + 1;
  25592. ps[15] = pi + 2;
  25593. ps[8] = tmp3;
  25594. ps[11] = pi + 3;
  25595. ps[4] = tmp2;
  25596. ps[7] = pi + 4;
  25597. ps[0] = tmp1;
  25598. ps[1] = pi + 7;
  25599. ps[2] = pi + 6;
  25600. ps[3] = pi + 5;
  25601. tmp1 = cs[2];
  25602. tmp2 = cs[3];
  25603. cs[2] = tmp2;
  25604. cs[3] = ci;
  25605. cs[0] = tmp1;
  25606. cs[1] = ci + 1;
  25607. break;
  25608. case 2:
  25609. tmp1 = ps[15];
  25610. tmp2 = ps[11];
  25611. ps[12] = ps[3];
  25612. ps[13] = pi + 0;
  25613. ps[14] = pi + 1;
  25614. ps[15] = pi + 2;
  25615. ps[8] = ps[7];
  25616. ps[11] = pi + 3;
  25617. ps[4] = tmp2;
  25618. ps[7] = pi + 4;
  25619. ps[0] = tmp1;
  25620. ps[1] = pi + 7;
  25621. ps[2] = pi + 6;
  25622. ps[3] = pi + 5;
  25623. tmp1 = cs[3];
  25624. cs[2] = cs[1];
  25625. cs[3] = ci;
  25626. cs[0] = tmp1;
  25627. cs[1] = ci + 1;
  25628. break;
  25629. case 3:
  25630. ps[12] = ps[0];
  25631. ps[13] = pi + 0;
  25632. ps[14] = pi + 1;
  25633. ps[15] = pi + 2;
  25634. ps[8] = ps[1];
  25635. ps[11] = pi + 3;
  25636. ps[4] = ps[2];
  25637. ps[7] = pi + 4;
  25638. ps[0] = ps[3];
  25639. ps[1] = pi + 7;
  25640. ps[2] = pi + 6;
  25641. ps[3] = pi + 5;
  25642. cs[2] = cs[0];
  25643. cs[3] = ci;
  25644. cs[0] = cs[1];
  25645. cs[1] = ci + 1;
  25646. break;
  25647. }
  25648. ps[5] = coords.length;
  25649. coords.push([(-4 * coords[ps[0]][0] - coords[ps[15]][0] + 6 * (coords[ps[4]][0] + coords[ps[1]][0]) - 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + 3 * (coords[ps[13]][0] + coords[ps[7]][0])) / 9, (-4 * coords[ps[0]][1] - coords[ps[15]][1] + 6 * (coords[ps[4]][1] + coords[ps[1]][1]) - 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + 3 * (coords[ps[13]][1] + coords[ps[7]][1])) / 9]);
  25650. ps[6] = coords.length;
  25651. coords.push([(-4 * coords[ps[3]][0] - coords[ps[12]][0] + 6 * (coords[ps[2]][0] + coords[ps[7]][0]) - 2 * (coords[ps[0]][0] + coords[ps[15]][0]) + 3 * (coords[ps[4]][0] + coords[ps[14]][0])) / 9, (-4 * coords[ps[3]][1] - coords[ps[12]][1] + 6 * (coords[ps[2]][1] + coords[ps[7]][1]) - 2 * (coords[ps[0]][1] + coords[ps[15]][1]) + 3 * (coords[ps[4]][1] + coords[ps[14]][1])) / 9]);
  25652. ps[9] = coords.length;
  25653. coords.push([(-4 * coords[ps[12]][0] - coords[ps[3]][0] + 6 * (coords[ps[8]][0] + coords[ps[13]][0]) - 2 * (coords[ps[0]][0] + coords[ps[15]][0]) + 3 * (coords[ps[11]][0] + coords[ps[1]][0])) / 9, (-4 * coords[ps[12]][1] - coords[ps[3]][1] + 6 * (coords[ps[8]][1] + coords[ps[13]][1]) - 2 * (coords[ps[0]][1] + coords[ps[15]][1]) + 3 * (coords[ps[11]][1] + coords[ps[1]][1])) / 9]);
  25654. ps[10] = coords.length;
  25655. coords.push([(-4 * coords[ps[15]][0] - coords[ps[0]][0] + 6 * (coords[ps[11]][0] + coords[ps[14]][0]) - 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + 3 * (coords[ps[2]][0] + coords[ps[8]][0])) / 9, (-4 * coords[ps[15]][1] - coords[ps[0]][1] + 6 * (coords[ps[11]][1] + coords[ps[14]][1]) - 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + 3 * (coords[ps[2]][1] + coords[ps[8]][1])) / 9]);
  25656. this.figures.push({
  25657. type: "patch",
  25658. coords: new Int32Array(ps),
  25659. colors: new Int32Array(cs)
  25660. });
  25661. }
  25662. }
  25663. _decodeType7Shading(reader) {
  25664. const coords = this.coords;
  25665. const colors = this.colors;
  25666. const ps = new Int32Array(16);
  25667. const cs = new Int32Array(4);
  25668. while (reader.hasData) {
  25669. const f = reader.readFlag();
  25670. if (!(0 <= f && f <= 3)) {
  25671. throw new FormatError("Unknown type7 flag");
  25672. }
  25673. const pi = coords.length;
  25674. for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  25675. coords.push(reader.readCoordinate());
  25676. }
  25677. const ci = colors.length;
  25678. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  25679. colors.push(reader.readComponents());
  25680. }
  25681. let tmp1, tmp2, tmp3, tmp4;
  25682. switch (f) {
  25683. case 0:
  25684. ps[12] = pi + 3;
  25685. ps[13] = pi + 4;
  25686. ps[14] = pi + 5;
  25687. ps[15] = pi + 6;
  25688. ps[8] = pi + 2;
  25689. ps[9] = pi + 13;
  25690. ps[10] = pi + 14;
  25691. ps[11] = pi + 7;
  25692. ps[4] = pi + 1;
  25693. ps[5] = pi + 12;
  25694. ps[6] = pi + 15;
  25695. ps[7] = pi + 8;
  25696. ps[0] = pi;
  25697. ps[1] = pi + 11;
  25698. ps[2] = pi + 10;
  25699. ps[3] = pi + 9;
  25700. cs[2] = ci + 1;
  25701. cs[3] = ci + 2;
  25702. cs[0] = ci;
  25703. cs[1] = ci + 3;
  25704. break;
  25705. case 1:
  25706. tmp1 = ps[12];
  25707. tmp2 = ps[13];
  25708. tmp3 = ps[14];
  25709. tmp4 = ps[15];
  25710. ps[12] = tmp4;
  25711. ps[13] = pi + 0;
  25712. ps[14] = pi + 1;
  25713. ps[15] = pi + 2;
  25714. ps[8] = tmp3;
  25715. ps[9] = pi + 9;
  25716. ps[10] = pi + 10;
  25717. ps[11] = pi + 3;
  25718. ps[4] = tmp2;
  25719. ps[5] = pi + 8;
  25720. ps[6] = pi + 11;
  25721. ps[7] = pi + 4;
  25722. ps[0] = tmp1;
  25723. ps[1] = pi + 7;
  25724. ps[2] = pi + 6;
  25725. ps[3] = pi + 5;
  25726. tmp1 = cs[2];
  25727. tmp2 = cs[3];
  25728. cs[2] = tmp2;
  25729. cs[3] = ci;
  25730. cs[0] = tmp1;
  25731. cs[1] = ci + 1;
  25732. break;
  25733. case 2:
  25734. tmp1 = ps[15];
  25735. tmp2 = ps[11];
  25736. ps[12] = ps[3];
  25737. ps[13] = pi + 0;
  25738. ps[14] = pi + 1;
  25739. ps[15] = pi + 2;
  25740. ps[8] = ps[7];
  25741. ps[9] = pi + 9;
  25742. ps[10] = pi + 10;
  25743. ps[11] = pi + 3;
  25744. ps[4] = tmp2;
  25745. ps[5] = pi + 8;
  25746. ps[6] = pi + 11;
  25747. ps[7] = pi + 4;
  25748. ps[0] = tmp1;
  25749. ps[1] = pi + 7;
  25750. ps[2] = pi + 6;
  25751. ps[3] = pi + 5;
  25752. tmp1 = cs[3];
  25753. cs[2] = cs[1];
  25754. cs[3] = ci;
  25755. cs[0] = tmp1;
  25756. cs[1] = ci + 1;
  25757. break;
  25758. case 3:
  25759. ps[12] = ps[0];
  25760. ps[13] = pi + 0;
  25761. ps[14] = pi + 1;
  25762. ps[15] = pi + 2;
  25763. ps[8] = ps[1];
  25764. ps[9] = pi + 9;
  25765. ps[10] = pi + 10;
  25766. ps[11] = pi + 3;
  25767. ps[4] = ps[2];
  25768. ps[5] = pi + 8;
  25769. ps[6] = pi + 11;
  25770. ps[7] = pi + 4;
  25771. ps[0] = ps[3];
  25772. ps[1] = pi + 7;
  25773. ps[2] = pi + 6;
  25774. ps[3] = pi + 5;
  25775. cs[2] = cs[0];
  25776. cs[3] = ci;
  25777. cs[0] = cs[1];
  25778. cs[1] = ci + 1;
  25779. break;
  25780. }
  25781. this.figures.push({
  25782. type: "patch",
  25783. coords: new Int32Array(ps),
  25784. colors: new Int32Array(cs)
  25785. });
  25786. }
  25787. }
  25788. _buildFigureFromPatch(index) {
  25789. const figure = this.figures[index];
  25790. assert(figure.type === "patch", "Unexpected patch mesh figure");
  25791. const coords = this.coords,
  25792. colors = this.colors;
  25793. const pi = figure.coords;
  25794. const ci = figure.colors;
  25795. const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  25796. const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  25797. const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  25798. const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  25799. let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0]));
  25800. splitXBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  25801. let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1]));
  25802. splitYBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  25803. const verticesPerRow = splitXBy + 1;
  25804. const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  25805. const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  25806. let k = 0;
  25807. const cl = new Uint8Array(3),
  25808. cr = new Uint8Array(3);
  25809. const c0 = colors[ci[0]],
  25810. c1 = colors[ci[1]],
  25811. c2 = colors[ci[2]],
  25812. c3 = colors[ci[3]];
  25813. const bRow = getB(splitYBy),
  25814. bCol = getB(splitXBy);
  25815. for (let row = 0; row <= splitYBy; row++) {
  25816. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  25817. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  25818. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  25819. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  25820. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  25821. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  25822. for (let col = 0; col <= splitXBy; col++, k++) {
  25823. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  25824. continue;
  25825. }
  25826. let x = 0,
  25827. y = 0;
  25828. let q = 0;
  25829. for (let i = 0; i <= 3; i++) {
  25830. for (let j = 0; j <= 3; j++, q++) {
  25831. const m = bRow[row][i] * bCol[col][j];
  25832. x += coords[pi[q]][0] * m;
  25833. y += coords[pi[q]][1] * m;
  25834. }
  25835. }
  25836. figureCoords[k] = coords.length;
  25837. coords.push([x, y]);
  25838. figureColors[k] = colors.length;
  25839. const newColor = new Uint8Array(3);
  25840. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  25841. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  25842. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  25843. colors.push(newColor);
  25844. }
  25845. }
  25846. figureCoords[0] = pi[0];
  25847. figureColors[0] = ci[0];
  25848. figureCoords[splitXBy] = pi[3];
  25849. figureColors[splitXBy] = ci[1];
  25850. figureCoords[verticesPerRow * splitYBy] = pi[12];
  25851. figureColors[verticesPerRow * splitYBy] = ci[2];
  25852. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  25853. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  25854. this.figures[index] = {
  25855. type: "lattice",
  25856. coords: figureCoords,
  25857. colors: figureColors,
  25858. verticesPerRow
  25859. };
  25860. }
  25861. _updateBounds() {
  25862. let minX = this.coords[0][0],
  25863. minY = this.coords[0][1],
  25864. maxX = minX,
  25865. maxY = minY;
  25866. for (let i = 1, ii = this.coords.length; i < ii; i++) {
  25867. const x = this.coords[i][0],
  25868. y = this.coords[i][1];
  25869. minX = minX > x ? x : minX;
  25870. minY = minY > y ? y : minY;
  25871. maxX = maxX < x ? x : maxX;
  25872. maxY = maxY < y ? y : maxY;
  25873. }
  25874. this.bounds = [minX, minY, maxX, maxY];
  25875. }
  25876. _packData() {
  25877. let i, ii, j, jj;
  25878. const coords = this.coords;
  25879. const coordsPacked = new Float32Array(coords.length * 2);
  25880. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  25881. const xy = coords[i];
  25882. coordsPacked[j++] = xy[0];
  25883. coordsPacked[j++] = xy[1];
  25884. }
  25885. this.coords = coordsPacked;
  25886. const colors = this.colors;
  25887. const colorsPacked = new Uint8Array(colors.length * 3);
  25888. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  25889. const c = colors[i];
  25890. colorsPacked[j++] = c[0];
  25891. colorsPacked[j++] = c[1];
  25892. colorsPacked[j++] = c[2];
  25893. }
  25894. this.colors = colorsPacked;
  25895. const figures = this.figures;
  25896. for (i = 0, ii = figures.length; i < ii; i++) {
  25897. const figure = figures[i],
  25898. ps = figure.coords,
  25899. cs = figure.colors;
  25900. for (j = 0, jj = ps.length; j < jj; j++) {
  25901. ps[j] *= 2;
  25902. cs[j] *= 3;
  25903. }
  25904. }
  25905. }
  25906. getIR() {
  25907. const {
  25908. bounds
  25909. } = this;
  25910. if (bounds[2] - bounds[0] === 0 || bounds[3] - bounds[1] === 0) {
  25911. throw new FormatError(`Invalid MeshShading bounds: [${bounds}].`);
  25912. }
  25913. return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, bounds, this.bbox, this.background];
  25914. }
  25915. }
  25916. class DummyShading extends BaseShading {
  25917. getIR() {
  25918. return ["Dummy"];
  25919. }
  25920. }
  25921. function getTilingPatternIR(operatorList, dict, color) {
  25922. const matrix = lookupMatrix(dict.getArray("Matrix"), IDENTITY_MATRIX);
  25923. const bbox = lookupNormalRect(dict.getArray("BBox"), null);
  25924. if (!bbox || bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  25925. throw new FormatError(`Invalid getTilingPatternIR /BBox array.`);
  25926. }
  25927. const xstep = dict.get("XStep");
  25928. if (typeof xstep !== "number") {
  25929. throw new FormatError(`Invalid getTilingPatternIR /XStep value.`);
  25930. }
  25931. const ystep = dict.get("YStep");
  25932. if (typeof ystep !== "number") {
  25933. throw new FormatError(`Invalid getTilingPatternIR /YStep value.`);
  25934. }
  25935. const paintType = dict.get("PaintType");
  25936. if (!Number.isInteger(paintType)) {
  25937. throw new FormatError(`Invalid getTilingPatternIR /PaintType value.`);
  25938. }
  25939. const tilingType = dict.get("TilingType");
  25940. if (!Number.isInteger(tilingType)) {
  25941. throw new FormatError(`Invalid getTilingPatternIR /TilingType value.`);
  25942. }
  25943. return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  25944. }
  25945. ;// ./src/core/calibri_factors.js
  25946. const CalibriBoldFactors = [1.3877, 1, 1, 1, 0.97801, 0.92482, 0.89552, 0.91133, 0.81988, 0.97566, 0.98152, 0.93548, 0.93548, 1.2798, 0.85284, 0.92794, 1, 0.96134, 1.54657, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.82845, 0.82845, 0.85284, 0.85284, 0.85284, 0.75859, 0.92138, 0.83908, 0.7762, 0.73293, 0.87289, 0.73133, 0.7514, 0.81921, 0.87356, 0.95958, 0.59526, 0.75727, 0.69225, 1.04924, 0.9121, 0.86943, 0.79795, 0.88198, 0.77958, 0.70864, 0.81055, 0.90399, 0.88653, 0.96017, 0.82577, 0.77892, 0.78257, 0.97507, 1.54657, 0.97507, 0.85284, 0.89552, 0.90176, 0.88762, 0.8785, 0.75241, 0.8785, 0.90518, 0.95015, 0.77618, 0.8785, 0.88401, 0.91916, 0.86304, 0.88401, 0.91488, 0.8785, 0.8801, 0.8785, 0.8785, 0.91343, 0.7173, 1.04106, 0.8785, 0.85075, 0.95794, 0.82616, 0.85162, 0.79492, 0.88331, 1.69808, 0.88331, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.7801, 0.89552, 1.24487, 1.13254, 1.12401, 0.96839, 0.85284, 0.68787, 0.70645, 0.85592, 0.90747, 1.01466, 1.0088, 0.90323, 1, 1.07463, 1, 0.91056, 0.75806, 1.19118, 0.96839, 0.78864, 0.82845, 0.84133, 0.75859, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.77539, 0.73293, 0.73133, 0.73133, 0.73133, 0.73133, 0.95958, 0.95958, 0.95958, 0.95958, 0.88506, 0.9121, 0.86943, 0.86943, 0.86943, 0.86943, 0.86943, 0.85284, 0.87508, 0.90399, 0.90399, 0.90399, 0.90399, 0.77892, 0.79795, 0.90807, 0.88762, 0.88762, 0.88762, 0.88762, 0.88762, 0.88762, 0.8715, 0.75241, 0.90518, 0.90518, 0.90518, 0.90518, 0.88401, 0.88401, 0.88401, 0.88401, 0.8785, 0.8785, 0.8801, 0.8801, 0.8801, 0.8801, 0.8801, 0.90747, 0.89049, 0.8785, 0.8785, 0.8785, 0.8785, 0.85162, 0.8785, 0.85162, 0.83908, 0.88762, 0.83908, 0.88762, 0.83908, 0.88762, 0.73293, 0.75241, 0.73293, 0.75241, 0.73293, 0.75241, 0.73293, 0.75241, 0.87289, 0.83016, 0.88506, 0.93125, 0.73133, 0.90518, 0.73133, 0.90518, 0.73133, 0.90518, 0.73133, 0.90518, 0.73133, 0.90518, 0.81921, 0.77618, 0.81921, 0.77618, 0.81921, 0.77618, 1, 1, 0.87356, 0.8785, 0.91075, 0.89608, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.76229, 0.90167, 0.59526, 0.91916, 1, 1, 0.86304, 0.69225, 0.88401, 1, 1, 0.70424, 0.79468, 0.91926, 0.88175, 0.70823, 0.94903, 0.9121, 0.8785, 1, 1, 0.9121, 0.8785, 0.87802, 0.88656, 0.8785, 0.86943, 0.8801, 0.86943, 0.8801, 0.86943, 0.8801, 0.87402, 0.89291, 0.77958, 0.91343, 1, 1, 0.77958, 0.91343, 0.70864, 0.7173, 0.70864, 0.7173, 0.70864, 0.7173, 0.70864, 0.7173, 1, 1, 0.81055, 0.75841, 0.81055, 1.06452, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.96017, 0.95794, 0.77892, 0.85162, 0.77892, 0.78257, 0.79492, 0.78257, 0.79492, 0.78257, 0.79492, 0.9297, 0.56892, 0.83908, 0.88762, 0.77539, 0.8715, 0.87508, 0.89049, 1, 1, 0.81055, 1.04106, 1.20528, 1.20528, 1, 1.15543, 0.70674, 0.98387, 0.94721, 1.33431, 1.45894, 0.95161, 1.06303, 0.83908, 0.80352, 0.57184, 0.6965, 0.56289, 0.82001, 0.56029, 0.81235, 1.02988, 0.83908, 0.7762, 0.68156, 0.80367, 0.73133, 0.78257, 0.87356, 0.86943, 0.95958, 0.75727, 0.89019, 1.04924, 0.9121, 0.7648, 0.86943, 0.87356, 0.79795, 0.78275, 0.81055, 0.77892, 0.9762, 0.82577, 0.99819, 0.84896, 0.95958, 0.77892, 0.96108, 1.01407, 0.89049, 1.02988, 0.94211, 0.96108, 0.8936, 0.84021, 0.87842, 0.96399, 0.79109, 0.89049, 1.00813, 1.02988, 0.86077, 0.87445, 0.92099, 0.84723, 0.86513, 0.8801, 0.75638, 0.85714, 0.78216, 0.79586, 0.87965, 0.94211, 0.97747, 0.78287, 0.97926, 0.84971, 1.02988, 0.94211, 0.8801, 0.94211, 0.84971, 0.73133, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90264, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90518, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90548, 1, 1, 1, 1, 1, 1, 0.96017, 0.95794, 0.96017, 0.95794, 0.96017, 0.95794, 0.77892, 0.85162, 1, 1, 0.89552, 0.90527, 1, 0.90363, 0.92794, 0.92794, 0.92794, 0.92794, 0.87012, 0.87012, 0.87012, 0.89552, 0.89552, 1.42259, 0.71143, 1.06152, 1, 1, 1.03372, 1.03372, 0.97171, 1.4956, 2.2807, 0.93835, 0.83406, 0.91133, 0.84107, 0.91133, 1, 1, 1, 0.72021, 1, 1.23108, 0.83489, 0.88525, 0.88525, 0.81499, 0.90527, 1.81055, 0.90527, 1.81055, 1.31006, 1.53711, 0.94434, 1.08696, 1, 0.95018, 0.77192, 0.85284, 0.90747, 1.17534, 0.69825, 0.9716, 1.37077, 0.90747, 0.90747, 0.85356, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.08004, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90727, 0.90727, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  25947. const CalibriBoldMetrics = {
  25948. lineHeight: 1.2207,
  25949. lineGap: 0.2207
  25950. };
  25951. const CalibriBoldItalicFactors = [1.3877, 1, 1, 1, 0.97801, 0.92482, 0.89552, 0.91133, 0.81988, 0.97566, 0.98152, 0.93548, 0.93548, 1.2798, 0.85284, 0.92794, 1, 0.96134, 1.56239, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.82845, 0.82845, 0.85284, 0.85284, 0.85284, 0.75859, 0.92138, 0.83908, 0.7762, 0.71805, 0.87289, 0.73133, 0.7514, 0.81921, 0.87356, 0.95958, 0.59526, 0.75727, 0.69225, 1.04924, 0.90872, 0.85938, 0.79795, 0.87068, 0.77958, 0.69766, 0.81055, 0.90399, 0.88653, 0.96068, 0.82577, 0.77892, 0.78257, 0.97507, 1.529, 0.97507, 0.85284, 0.89552, 0.90176, 0.94908, 0.86411, 0.74012, 0.86411, 0.88323, 0.95015, 0.86411, 0.86331, 0.88401, 0.91916, 0.86304, 0.88401, 0.9039, 0.86331, 0.86331, 0.86411, 0.86411, 0.90464, 0.70852, 1.04106, 0.86331, 0.84372, 0.95794, 0.82616, 0.84548, 0.79492, 0.88331, 1.69808, 0.88331, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.7801, 0.89552, 1.24487, 1.13254, 1.19129, 0.96839, 0.85284, 0.68787, 0.70645, 0.85592, 0.90747, 1.01466, 1.0088, 0.90323, 1, 1.07463, 1, 0.91056, 0.75806, 1.19118, 0.96839, 0.78864, 0.82845, 0.84133, 0.75859, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.77539, 0.71805, 0.73133, 0.73133, 0.73133, 0.73133, 0.95958, 0.95958, 0.95958, 0.95958, 0.88506, 0.90872, 0.85938, 0.85938, 0.85938, 0.85938, 0.85938, 0.85284, 0.87068, 0.90399, 0.90399, 0.90399, 0.90399, 0.77892, 0.79795, 0.90807, 0.94908, 0.94908, 0.94908, 0.94908, 0.94908, 0.94908, 0.85887, 0.74012, 0.88323, 0.88323, 0.88323, 0.88323, 0.88401, 0.88401, 0.88401, 0.88401, 0.8785, 0.86331, 0.86331, 0.86331, 0.86331, 0.86331, 0.86331, 0.90747, 0.89049, 0.86331, 0.86331, 0.86331, 0.86331, 0.84548, 0.86411, 0.84548, 0.83908, 0.94908, 0.83908, 0.94908, 0.83908, 0.94908, 0.71805, 0.74012, 0.71805, 0.74012, 0.71805, 0.74012, 0.71805, 0.74012, 0.87289, 0.79538, 0.88506, 0.92726, 0.73133, 0.88323, 0.73133, 0.88323, 0.73133, 0.88323, 0.73133, 0.88323, 0.73133, 0.88323, 0.81921, 0.86411, 0.81921, 0.86411, 0.81921, 0.86411, 1, 1, 0.87356, 0.86331, 0.91075, 0.8777, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.76467, 0.90167, 0.59526, 0.91916, 1, 1, 0.86304, 0.69225, 0.88401, 1, 1, 0.70424, 0.77312, 0.91926, 0.88175, 0.70823, 0.94903, 0.90872, 0.86331, 1, 1, 0.90872, 0.86331, 0.86906, 0.88116, 0.86331, 0.85938, 0.86331, 0.85938, 0.86331, 0.85938, 0.86331, 0.87402, 0.86549, 0.77958, 0.90464, 1, 1, 0.77958, 0.90464, 0.69766, 0.70852, 0.69766, 0.70852, 0.69766, 0.70852, 0.69766, 0.70852, 1, 1, 0.81055, 0.75841, 0.81055, 1.06452, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.96068, 0.95794, 0.77892, 0.84548, 0.77892, 0.78257, 0.79492, 0.78257, 0.79492, 0.78257, 0.79492, 0.9297, 0.56892, 0.83908, 0.94908, 0.77539, 0.85887, 0.87068, 0.89049, 1, 1, 0.81055, 1.04106, 1.20528, 1.20528, 1, 1.15543, 0.70088, 0.98387, 0.94721, 1.33431, 1.45894, 0.95161, 1.48387, 0.83908, 0.80352, 0.57118, 0.6965, 0.56347, 0.79179, 0.55853, 0.80346, 1.02988, 0.83908, 0.7762, 0.67174, 0.86036, 0.73133, 0.78257, 0.87356, 0.86441, 0.95958, 0.75727, 0.89019, 1.04924, 0.90872, 0.74889, 0.85938, 0.87891, 0.79795, 0.7957, 0.81055, 0.77892, 0.97447, 0.82577, 0.97466, 0.87179, 0.95958, 0.77892, 0.94252, 0.95612, 0.8753, 1.02988, 0.92733, 0.94252, 0.87411, 0.84021, 0.8728, 0.95612, 0.74081, 0.8753, 1.02189, 1.02988, 0.84814, 0.87445, 0.91822, 0.84723, 0.85668, 0.86331, 0.81344, 0.87581, 0.76422, 0.82046, 0.96057, 0.92733, 0.99375, 0.78022, 0.95452, 0.86015, 1.02988, 0.92733, 0.86331, 0.92733, 0.86015, 0.73133, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90631, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.88323, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.85174, 1, 1, 1, 1, 1, 1, 0.96068, 0.95794, 0.96068, 0.95794, 0.96068, 0.95794, 0.77892, 0.84548, 1, 1, 0.89552, 0.90527, 1, 0.90363, 0.92794, 0.92794, 0.92794, 0.89807, 0.87012, 0.87012, 0.87012, 0.89552, 0.89552, 1.42259, 0.71094, 1.06152, 1, 1, 1.03372, 1.03372, 0.97171, 1.4956, 2.2807, 0.92972, 0.83406, 0.91133, 0.83326, 0.91133, 1, 1, 1, 0.72021, 1, 1.23108, 0.83489, 0.88525, 0.88525, 0.81499, 0.90616, 1.81055, 0.90527, 1.81055, 1.3107, 1.53711, 0.94434, 1.08696, 1, 0.95018, 0.77192, 0.85284, 0.90747, 1.17534, 0.69825, 0.9716, 1.37077, 0.90747, 0.90747, 0.85356, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.08004, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90727, 0.90727, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  25952. const CalibriBoldItalicMetrics = {
  25953. lineHeight: 1.2207,
  25954. lineGap: 0.2207
  25955. };
  25956. const CalibriItalicFactors = [1.3877, 1, 1, 1, 1.17223, 1.1293, 0.89552, 0.91133, 0.80395, 1.02269, 1.15601, 0.91056, 0.91056, 1.2798, 0.85284, 0.89807, 1, 0.90861, 1.39543, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.96309, 0.96309, 0.85284, 0.85284, 0.85284, 0.83319, 0.88071, 0.8675, 0.81552, 0.72346, 0.85193, 0.73206, 0.7522, 0.81105, 0.86275, 0.90685, 0.6377, 0.77892, 0.75593, 1.02638, 0.89249, 0.84118, 0.77452, 0.85374, 0.75186, 0.67789, 0.79776, 0.88844, 0.85066, 0.94309, 0.77818, 0.7306, 0.76659, 1.10369, 1.38313, 1.10369, 1.06139, 0.89552, 0.8739, 0.9245, 0.9245, 0.83203, 0.9245, 0.85865, 1.09842, 0.9245, 0.9245, 1.03297, 1.07692, 0.90918, 1.03297, 0.94959, 0.9245, 0.92274, 0.9245, 0.9245, 1.02933, 0.77832, 1.20562, 0.9245, 0.8916, 0.98986, 0.86621, 0.89453, 0.79004, 0.94152, 1.77256, 0.94152, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.91729, 0.89552, 1.17889, 1.13254, 1.16359, 0.92098, 0.85284, 0.68787, 0.71353, 0.84737, 0.90747, 1.0088, 1.0044, 0.87683, 1, 1.09091, 1, 0.92229, 0.739, 1.15642, 0.92098, 0.76288, 0.80504, 0.80972, 0.75859, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.76318, 0.72346, 0.73206, 0.73206, 0.73206, 0.73206, 0.90685, 0.90685, 0.90685, 0.90685, 0.86477, 0.89249, 0.84118, 0.84118, 0.84118, 0.84118, 0.84118, 0.85284, 0.84557, 0.88844, 0.88844, 0.88844, 0.88844, 0.7306, 0.77452, 0.86331, 0.9245, 0.9245, 0.9245, 0.9245, 0.9245, 0.9245, 0.84843, 0.83203, 0.85865, 0.85865, 0.85865, 0.85865, 0.82601, 0.82601, 0.82601, 0.82601, 0.94469, 0.9245, 0.92274, 0.92274, 0.92274, 0.92274, 0.92274, 0.90747, 0.86651, 0.9245, 0.9245, 0.9245, 0.9245, 0.89453, 0.9245, 0.89453, 0.8675, 0.9245, 0.8675, 0.9245, 0.8675, 0.9245, 0.72346, 0.83203, 0.72346, 0.83203, 0.72346, 0.83203, 0.72346, 0.83203, 0.85193, 0.8875, 0.86477, 0.99034, 0.73206, 0.85865, 0.73206, 0.85865, 0.73206, 0.85865, 0.73206, 0.85865, 0.73206, 0.85865, 0.81105, 0.9245, 0.81105, 0.9245, 0.81105, 0.9245, 1, 1, 0.86275, 0.9245, 0.90872, 0.93591, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 1.03297, 0.90685, 0.82601, 0.77896, 1.05611, 0.6377, 1.07692, 1, 1, 0.90918, 0.75593, 1.03297, 1, 1, 0.76032, 0.9375, 0.98156, 0.93407, 0.77261, 1.11429, 0.89249, 0.9245, 1, 1, 0.89249, 0.9245, 0.92534, 0.86698, 0.9245, 0.84118, 0.92274, 0.84118, 0.92274, 0.84118, 0.92274, 0.8667, 0.86291, 0.75186, 1.02933, 1, 1, 0.75186, 1.02933, 0.67789, 0.77832, 0.67789, 0.77832, 0.67789, 0.77832, 0.67789, 0.77832, 1, 1, 0.79776, 0.97655, 0.79776, 1.23023, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.94309, 0.98986, 0.7306, 0.89453, 0.7306, 0.76659, 0.79004, 0.76659, 0.79004, 0.76659, 0.79004, 1.09231, 0.54873, 0.8675, 0.9245, 0.76318, 0.84843, 0.84557, 0.86651, 1, 1, 0.79776, 1.20562, 1.18622, 1.18622, 1, 1.1437, 0.67009, 0.96334, 0.93695, 1.35191, 1.40909, 0.95161, 1.48387, 0.8675, 0.90861, 0.6192, 0.7363, 0.64824, 0.82411, 0.56321, 0.85696, 1.23516, 0.8675, 0.81552, 0.7286, 0.84134, 0.73206, 0.76659, 0.86275, 0.84369, 0.90685, 0.77892, 0.85871, 1.02638, 0.89249, 0.75828, 0.84118, 0.85984, 0.77452, 0.76466, 0.79776, 0.7306, 0.90782, 0.77818, 0.903, 0.87291, 0.90685, 0.7306, 0.99058, 1.03667, 0.94635, 1.23516, 0.9849, 0.99058, 0.92393, 0.8916, 0.942, 1.03667, 0.75026, 0.94635, 1.0297, 1.23516, 0.90918, 0.94048, 0.98217, 0.89746, 0.84153, 0.92274, 0.82507, 0.88832, 0.84438, 0.88178, 1.03525, 0.9849, 1.00225, 0.78086, 0.97248, 0.89404, 1.23516, 0.9849, 0.92274, 0.9849, 0.89404, 0.73206, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.89693, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.85865, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90933, 1, 1, 1, 1, 1, 1, 0.94309, 0.98986, 0.94309, 0.98986, 0.94309, 0.98986, 0.7306, 0.89453, 1, 1, 0.89552, 0.90527, 1, 0.90186, 1.12308, 1.12308, 1.12308, 1.12308, 1.2566, 1.2566, 1.2566, 0.89552, 0.89552, 1.42259, 0.68994, 1.03809, 1, 1, 1.0176, 1.0176, 1.11523, 1.4956, 2.01462, 0.97858, 0.82616, 0.91133, 0.83437, 0.91133, 1, 1, 1, 0.70508, 1, 1.23108, 0.79801, 0.84426, 0.84426, 0.774, 0.90572, 1.81055, 0.90749, 1.81055, 1.28809, 1.55469, 0.94434, 1.07806, 1, 0.97094, 0.7589, 0.85284, 0.90747, 1.19658, 0.69825, 0.97622, 1.33512, 0.90747, 0.90747, 0.85284, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.0336, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05859, 1.05859, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  25957. const CalibriItalicMetrics = {
  25958. lineHeight: 1.2207,
  25959. lineGap: 0.2207
  25960. };
  25961. const CalibriRegularFactors = [1.3877, 1, 1, 1, 1.17223, 1.1293, 0.89552, 0.91133, 0.80395, 1.02269, 1.15601, 0.91056, 0.91056, 1.2798, 0.85284, 0.89807, 1, 0.90861, 1.39016, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.96309, 0.96309, 0.85284, 0.85284, 0.85284, 0.83319, 0.88071, 0.8675, 0.81552, 0.73834, 0.85193, 0.73206, 0.7522, 0.81105, 0.86275, 0.90685, 0.6377, 0.77892, 0.75593, 1.02638, 0.89385, 0.85122, 0.77452, 0.86503, 0.75186, 0.68887, 0.79776, 0.88844, 0.85066, 0.94258, 0.77818, 0.7306, 0.76659, 1.10369, 1.39016, 1.10369, 1.06139, 0.89552, 0.8739, 0.86128, 0.94469, 0.8457, 0.94469, 0.89464, 1.09842, 0.84636, 0.94469, 1.03297, 1.07692, 0.90918, 1.03297, 0.95897, 0.94469, 0.9482, 0.94469, 0.94469, 1.04692, 0.78223, 1.20562, 0.94469, 0.90332, 0.98986, 0.86621, 0.90527, 0.79004, 0.94152, 1.77256, 0.94152, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.91729, 0.89552, 1.17889, 1.13254, 1.08707, 0.92098, 0.85284, 0.68787, 0.71353, 0.84737, 0.90747, 1.0088, 1.0044, 0.87683, 1, 1.09091, 1, 0.92229, 0.739, 1.15642, 0.92098, 0.76288, 0.80504, 0.80972, 0.75859, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.76318, 0.73834, 0.73206, 0.73206, 0.73206, 0.73206, 0.90685, 0.90685, 0.90685, 0.90685, 0.86477, 0.89385, 0.85122, 0.85122, 0.85122, 0.85122, 0.85122, 0.85284, 0.85311, 0.88844, 0.88844, 0.88844, 0.88844, 0.7306, 0.77452, 0.86331, 0.86128, 0.86128, 0.86128, 0.86128, 0.86128, 0.86128, 0.8693, 0.8457, 0.89464, 0.89464, 0.89464, 0.89464, 0.82601, 0.82601, 0.82601, 0.82601, 0.94469, 0.94469, 0.9482, 0.9482, 0.9482, 0.9482, 0.9482, 0.90747, 0.86651, 0.94469, 0.94469, 0.94469, 0.94469, 0.90527, 0.94469, 0.90527, 0.8675, 0.86128, 0.8675, 0.86128, 0.8675, 0.86128, 0.73834, 0.8457, 0.73834, 0.8457, 0.73834, 0.8457, 0.73834, 0.8457, 0.85193, 0.92454, 0.86477, 0.9921, 0.73206, 0.89464, 0.73206, 0.89464, 0.73206, 0.89464, 0.73206, 0.89464, 0.73206, 0.89464, 0.81105, 0.84636, 0.81105, 0.84636, 0.81105, 0.84636, 1, 1, 0.86275, 0.94469, 0.90872, 0.95786, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 1.03297, 0.90685, 0.82601, 0.77741, 1.05611, 0.6377, 1.07692, 1, 1, 0.90918, 0.75593, 1.03297, 1, 1, 0.76032, 0.90452, 0.98156, 1.11842, 0.77261, 1.11429, 0.89385, 0.94469, 1, 1, 0.89385, 0.94469, 0.95877, 0.86901, 0.94469, 0.85122, 0.9482, 0.85122, 0.9482, 0.85122, 0.9482, 0.8667, 0.90016, 0.75186, 1.04692, 1, 1, 0.75186, 1.04692, 0.68887, 0.78223, 0.68887, 0.78223, 0.68887, 0.78223, 0.68887, 0.78223, 1, 1, 0.79776, 0.92188, 0.79776, 1.23023, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.94258, 0.98986, 0.7306, 0.90527, 0.7306, 0.76659, 0.79004, 0.76659, 0.79004, 0.76659, 0.79004, 1.09231, 0.54873, 0.8675, 0.86128, 0.76318, 0.8693, 0.85311, 0.86651, 1, 1, 0.79776, 1.20562, 1.18622, 1.18622, 1, 1.1437, 0.67742, 0.96334, 0.93695, 1.35191, 1.40909, 0.95161, 1.48387, 0.86686, 0.90861, 0.62267, 0.74359, 0.65649, 0.85498, 0.56963, 0.88254, 1.23516, 0.8675, 0.81552, 0.75443, 0.84503, 0.73206, 0.76659, 0.86275, 0.85122, 0.90685, 0.77892, 0.85746, 1.02638, 0.89385, 0.75657, 0.85122, 0.86275, 0.77452, 0.74171, 0.79776, 0.7306, 0.95165, 0.77818, 0.89772, 0.88831, 0.90685, 0.7306, 0.98142, 1.02191, 0.96576, 1.23516, 0.99018, 0.98142, 0.9236, 0.89258, 0.94035, 1.02191, 0.78848, 0.96576, 0.9561, 1.23516, 0.90918, 0.92578, 0.95424, 0.89746, 0.83969, 0.9482, 0.80113, 0.89442, 0.85208, 0.86155, 0.98022, 0.99018, 1.00452, 0.81209, 0.99247, 0.89181, 1.23516, 0.99018, 0.9482, 0.99018, 0.89181, 0.73206, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.88844, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.89464, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.96766, 1, 1, 1, 1, 1, 1, 0.94258, 0.98986, 0.94258, 0.98986, 0.94258, 0.98986, 0.7306, 0.90527, 1, 1, 0.89552, 0.90527, 1, 0.90186, 1.12308, 1.12308, 1.12308, 1.12308, 1.2566, 1.2566, 1.2566, 0.89552, 0.89552, 1.42259, 0.69043, 1.03809, 1, 1, 1.0176, 1.0176, 1.11523, 1.4956, 2.01462, 0.99331, 0.82616, 0.91133, 0.84286, 0.91133, 1, 1, 1, 0.70508, 1, 1.23108, 0.79801, 0.84426, 0.84426, 0.774, 0.90527, 1.81055, 0.90527, 1.81055, 1.28809, 1.55469, 0.94434, 1.07806, 1, 0.97094, 0.7589, 0.85284, 0.90747, 1.19658, 0.69825, 0.97622, 1.33512, 0.90747, 0.90747, 0.85356, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.0336, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05859, 1.05859, 1, 1, 1, 1.07185, 0.99413, 0.96334, 1.08065, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  25962. const CalibriRegularMetrics = {
  25963. lineHeight: 1.2207,
  25964. lineGap: 0.2207
  25965. };
  25966. ;// ./src/core/helvetica_factors.js
  25967. const HelveticaBoldFactors = [0.76116, 1, 1, 1.0006, 0.99998, 0.99974, 0.99973, 0.99973, 0.99982, 0.99977, 1.00087, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.00003, 1.00003, 1.00003, 1.00026, 0.9999, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 0.99973, 0.99977, 1.00026, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 0.99998, 1.0006, 0.99998, 1.00003, 0.99973, 0.99998, 0.99973, 1.00026, 0.99973, 1.00026, 0.99973, 0.99998, 1.00026, 1.00026, 1.0006, 1.0006, 0.99973, 1.0006, 0.99982, 1.00026, 1.00026, 1.00026, 1.00026, 0.99959, 0.99973, 0.99998, 1.00026, 0.99973, 1.00022, 0.99973, 0.99973, 1, 0.99959, 1.00077, 0.99959, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.00077, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.99973, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.06409, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 1.00026, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 1.03374, 0.99977, 1.00026, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.00042, 0.99973, 0.99973, 1.0006, 0.99977, 0.99973, 0.99973, 1.00026, 1.0006, 1.00026, 1.0006, 1.00026, 1.03828, 1.00026, 0.99999, 1.00026, 1.0006, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.9993, 0.9998, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1, 1.00016, 0.99977, 0.99959, 0.99977, 0.99959, 0.99977, 0.99959, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00026, 0.99998, 1.00026, 0.8121, 1.00026, 0.99998, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.00016, 1.00022, 1.00001, 0.99973, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 1.0006, 0.99973, 0.99977, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 0.99973, 1.00026, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 1.00034, 0.99977, 1, 0.99997, 1.00026, 1.00078, 1.00036, 0.99973, 1.00013, 1.0006, 0.99977, 0.99977, 0.99988, 0.85148, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 0.99977, 1.00001, 0.99999, 0.99977, 1.00069, 1.00022, 0.99977, 1.00001, 0.99984, 1.00026, 1.00001, 1.00024, 1.00001, 0.9999, 1, 1.0006, 1.00001, 1.00041, 0.99962, 1.00026, 1.0006, 0.99995, 1.00041, 0.99942, 0.99973, 0.99927, 1.00082, 0.99902, 1.00026, 1.00087, 1.0006, 1.00069, 0.99973, 0.99867, 0.99973, 0.9993, 1.00026, 1.00049, 1.00056, 1, 0.99988, 0.99935, 0.99995, 0.99954, 1.00055, 0.99945, 1.00032, 1.0006, 0.99995, 1.00026, 0.99995, 1.00032, 1.00001, 1.00008, 0.99971, 1.00019, 0.9994, 1.00001, 1.0006, 1.00044, 0.99973, 1.00023, 1.00047, 1, 0.99942, 0.99561, 0.99989, 1.00035, 0.99977, 1.00035, 0.99977, 1.00019, 0.99944, 1.00001, 1.00021, 0.99926, 1.00035, 1.00035, 0.99942, 1.00048, 0.99999, 0.99977, 1.00022, 1.00035, 1.00001, 0.99977, 1.00026, 0.99989, 1.00057, 1.00001, 0.99936, 1.00052, 1.00012, 0.99996, 1.00043, 1, 1.00035, 0.9994, 0.99976, 1.00035, 0.99973, 1.00052, 1.00041, 1.00119, 1.00037, 0.99973, 1.00002, 0.99986, 1.00041, 1.00041, 0.99902, 0.9996, 1.00034, 0.99999, 1.00026, 0.99999, 1.00026, 0.99973, 1.00052, 0.99973, 1, 0.99973, 1.00041, 1.00075, 0.9994, 1.0003, 0.99999, 1, 1.00041, 0.99955, 1, 0.99915, 0.99973, 0.99973, 1.00026, 1.00119, 0.99955, 0.99973, 1.0006, 0.99911, 1.0006, 1.00026, 0.99972, 1.00026, 0.99902, 1.00041, 0.99973, 0.99999, 1, 1, 1.00038, 1.0005, 1.00016, 1.00022, 1.00016, 1.00022, 1.00016, 1.00022, 1.00001, 0.99973, 1, 1, 0.99973, 1, 1, 0.99955, 1.0006, 1.0006, 1.0006, 1.0006, 1, 1, 1, 0.99973, 0.99973, 0.99972, 1, 1, 1.00106, 0.99999, 0.99998, 0.99998, 0.99999, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1.00023, 0.99973, 0.99971, 1.00047, 1.00023, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1, 1, 1, 1, 1, 1, 1, 0.99972, 1, 1.20985, 1.39713, 1.00003, 1.00031, 1.00015, 1, 0.99561, 1.00027, 1.00031, 1.00031, 0.99915, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99972, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 0.99998, 0.99998, 0.99998, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  25968. const HelveticaBoldMetrics = {
  25969. lineHeight: 1.2,
  25970. lineGap: 0.2
  25971. };
  25972. const HelveticaBoldItalicFactors = [0.76116, 1, 1, 1.0006, 0.99998, 0.99974, 0.99973, 0.99973, 0.99982, 0.99977, 1.00087, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.00003, 1.00003, 1.00003, 1.00026, 0.9999, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 0.99973, 0.99977, 1.00026, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 0.99998, 1.0006, 0.99998, 1.00003, 0.99973, 0.99998, 0.99973, 1.00026, 0.99973, 1.00026, 0.99973, 0.99998, 1.00026, 1.00026, 1.0006, 1.0006, 0.99973, 1.0006, 0.99982, 1.00026, 1.00026, 1.00026, 1.00026, 0.99959, 0.99973, 0.99998, 1.00026, 0.99973, 1.00022, 0.99973, 0.99973, 1, 0.99959, 1.00077, 0.99959, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.00077, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.99973, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.06409, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 1.00026, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 1.0044, 0.99977, 1.00026, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99971, 0.99973, 0.99973, 1.0006, 0.99977, 0.99973, 0.99973, 1.00026, 1.0006, 1.00026, 1.0006, 1.00026, 1.01011, 1.00026, 0.99999, 1.00026, 1.0006, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.9993, 0.9998, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1, 1.00016, 0.99977, 0.99959, 0.99977, 0.99959, 0.99977, 0.99959, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00026, 0.99998, 1.00026, 0.8121, 1.00026, 0.99998, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.00016, 1.00022, 1.00001, 0.99973, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 1.0006, 0.99973, 0.99977, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 0.99973, 1.00026, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99977, 1, 1, 1.00026, 0.99969, 0.99972, 0.99981, 0.9998, 1.0006, 0.99977, 0.99977, 1.00022, 0.91155, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 0.99977, 1.00001, 0.99999, 0.99977, 0.99966, 1.00022, 1.00032, 1.00001, 0.99944, 1.00026, 1.00001, 0.99968, 1.00001, 1.00047, 1, 1.0006, 1.00001, 0.99981, 1.00101, 1.00026, 1.0006, 0.99948, 0.99981, 1.00064, 0.99973, 0.99942, 1.00101, 1.00061, 1.00026, 1.00069, 1.0006, 1.00014, 0.99973, 1.01322, 0.99973, 1.00065, 1.00026, 1.00012, 0.99923, 1, 1.00064, 1.00076, 0.99948, 1.00055, 1.00063, 1.00007, 0.99943, 1.0006, 0.99948, 1.00026, 0.99948, 0.99943, 1.00001, 1.00001, 1.00029, 1.00038, 1.00035, 1.00001, 1.0006, 1.0006, 0.99973, 0.99978, 1.00001, 1.00057, 0.99989, 0.99967, 0.99964, 0.99967, 0.99977, 0.99999, 0.99977, 1.00038, 0.99977, 1.00001, 0.99973, 1.00066, 0.99967, 0.99967, 1.00041, 0.99998, 0.99999, 0.99977, 1.00022, 0.99967, 1.00001, 0.99977, 1.00026, 0.99964, 1.00031, 1.00001, 0.99999, 0.99999, 1, 1.00023, 1, 1, 0.99999, 1.00035, 1.00001, 0.99999, 0.99973, 0.99977, 0.99999, 1.00058, 0.99973, 0.99973, 0.99955, 0.9995, 1.00026, 1.00026, 1.00032, 0.99989, 1.00034, 0.99999, 1.00026, 1.00026, 1.00026, 0.99973, 0.45998, 0.99973, 1.00026, 0.99973, 1.00001, 0.99999, 0.99982, 0.99994, 0.99996, 1, 1.00042, 1.00044, 1.00029, 1.00023, 0.99973, 0.99973, 1.00026, 0.99949, 1.00002, 0.99973, 1.0006, 1.0006, 1.0006, 0.99975, 1.00026, 1.00026, 1.00032, 0.98685, 0.99973, 1.00026, 1, 1, 0.99966, 1.00044, 1.00016, 1.00022, 1.00016, 1.00022, 1.00016, 1.00022, 1.00001, 0.99973, 1, 1, 0.99973, 1, 1, 0.99955, 1.0006, 1.0006, 1.0006, 1.0006, 1, 1, 1, 0.99973, 0.99973, 0.99972, 1, 1, 1.00106, 0.99999, 0.99998, 0.99998, 0.99999, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1, 0.99973, 0.99971, 0.99978, 1, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1.00098, 1, 1, 1, 1.00049, 1, 1, 0.99972, 1, 1.20985, 1.39713, 1.00003, 1.00031, 1.00015, 1, 0.99561, 1.00027, 1.00031, 1.00031, 0.99915, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99972, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 0.99998, 0.99998, 0.99998, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  25973. const HelveticaBoldItalicMetrics = {
  25974. lineHeight: 1.35,
  25975. lineGap: 0.2
  25976. };
  25977. const HelveticaItalicFactors = [0.76116, 1, 1, 1.0006, 1.0006, 1.00006, 0.99973, 0.99973, 0.99982, 1.00001, 1.00043, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1, 1.00003, 1.00003, 1.00003, 0.99973, 0.99987, 1.00001, 1.00001, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 1, 1.00001, 0.99973, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 1.0006, 1.0006, 1.0006, 0.99949, 0.99973, 0.99998, 0.99973, 0.99973, 1, 0.99973, 0.99973, 1.0006, 0.99973, 0.99973, 0.99924, 0.99924, 1, 0.99924, 0.99999, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.0006, 0.99973, 1, 0.99977, 1, 1, 1, 1.00005, 1.0009, 1.00005, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.0009, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.9998, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 1, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.06409, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 1, 0.99973, 1, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1.0288, 0.99977, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99924, 1.0006, 1.0006, 0.99946, 1.00034, 1, 0.99924, 1.00001, 1, 1, 0.99973, 0.99924, 0.99973, 0.99924, 0.99973, 1.06311, 0.99973, 1.00024, 0.99973, 0.99924, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.00041, 0.9998, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1, 1.00016, 0.99977, 0.99998, 0.99977, 0.99998, 0.99977, 0.99998, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00026, 1.0006, 1.00026, 0.89547, 1.00026, 1.0006, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.00016, 0.99977, 1.00001, 1, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 0.99924, 0.99973, 1.00001, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 1, 1.00026, 1.0006, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 1.00001, 1, 1.00054, 0.99977, 1.00084, 1.00007, 0.99973, 1.00013, 0.99924, 1.00001, 1.00001, 0.99945, 0.91221, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 1.00001, 1.00001, 0.99999, 0.99977, 0.99933, 1.00022, 1.00054, 1.00001, 1.00065, 1.00026, 1.00001, 1.0001, 1.00001, 1.00052, 1, 1.0006, 1.00001, 0.99945, 0.99897, 0.99968, 0.99924, 1.00036, 0.99945, 0.99949, 1, 1.0006, 0.99897, 0.99918, 0.99968, 0.99911, 0.99924, 1, 0.99962, 1.01487, 1, 1.0005, 0.99973, 1.00012, 1.00043, 1, 0.99995, 0.99994, 1.00036, 0.99947, 1.00019, 1.00063, 1.00025, 0.99924, 1.00036, 0.99973, 1.00036, 1.00025, 1.00001, 1.00001, 1.00027, 1.0001, 1.00068, 1.00001, 1.0006, 1.0006, 1, 1.00008, 0.99957, 0.99972, 0.9994, 0.99954, 0.99975, 1.00051, 1.00001, 1.00019, 1.00001, 1.0001, 0.99986, 1.00001, 1.00001, 1.00038, 0.99954, 0.99954, 0.9994, 1.00066, 0.99999, 0.99977, 1.00022, 1.00054, 1.00001, 0.99977, 1.00026, 0.99975, 1.0001, 1.00001, 0.99993, 0.9995, 0.99955, 1.00016, 0.99978, 0.99974, 1.00019, 1.00022, 0.99955, 1.00053, 0.99973, 1.00089, 1.00005, 0.99967, 1.00048, 0.99973, 1.00002, 1.00034, 0.99973, 0.99973, 0.99964, 1.00006, 1.00066, 0.99947, 0.99973, 0.98894, 0.99973, 1, 0.44898, 1, 0.99946, 1, 1.00039, 1.00082, 0.99991, 0.99991, 0.99985, 1.00022, 1.00023, 1.00061, 1.00006, 0.99966, 0.99973, 0.99973, 0.99973, 1.00019, 1.0008, 1, 0.99924, 0.99924, 0.99924, 0.99983, 1.00044, 0.99973, 0.99964, 0.98332, 1, 0.99973, 1, 1, 0.99962, 0.99895, 1.00016, 0.99977, 1.00016, 0.99977, 1.00016, 0.99977, 1.00001, 1, 1, 1, 0.99973, 1, 1, 0.99955, 0.99924, 0.99924, 0.99924, 0.99924, 0.99998, 0.99998, 0.99998, 0.99973, 0.99973, 0.99972, 1, 1, 1.00267, 0.99999, 0.99998, 0.99998, 1, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1.00023, 0.99973, 1.00423, 0.99925, 0.99999, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1.00049, 1, 1.00245, 1, 1, 1, 1, 0.96329, 1, 1.20985, 1.39713, 1.00003, 0.8254, 1.00015, 1, 1.00035, 1.00027, 1.00031, 1.00031, 1.00003, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.95317, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 0.99998, 0.99998, 0.99998, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  25978. const HelveticaItalicMetrics = {
  25979. lineHeight: 1.35,
  25980. lineGap: 0.2
  25981. };
  25982. const HelveticaRegularFactors = [0.76116, 1, 1, 1.0006, 1.0006, 1.00006, 0.99973, 0.99973, 0.99982, 1.00001, 1.00043, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1, 1.00003, 1.00003, 1.00003, 0.99973, 0.99987, 1.00001, 1.00001, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 1, 1.00001, 0.99973, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 1.0006, 1.0006, 1.0006, 0.99949, 0.99973, 0.99998, 0.99973, 0.99973, 1, 0.99973, 0.99973, 1.0006, 0.99973, 0.99973, 0.99924, 0.99924, 1, 0.99924, 0.99999, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.0006, 0.99973, 1, 0.99977, 1, 1, 1, 1.00005, 1.0009, 1.00005, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.0009, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.9998, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 1, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.06409, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 1, 0.99973, 1, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1.04596, 0.99977, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99924, 1.0006, 1.0006, 1.00019, 1.00034, 1, 0.99924, 1.00001, 1, 1, 0.99973, 0.99924, 0.99973, 0.99924, 0.99973, 1.02572, 0.99973, 1.00005, 0.99973, 0.99924, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99999, 0.9998, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1, 1.00016, 0.99977, 0.99998, 0.99977, 0.99998, 0.99977, 0.99998, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00026, 1.0006, 1.00026, 0.84533, 1.00026, 1.0006, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.00016, 0.99977, 1.00001, 1, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 0.99924, 0.99973, 1.00001, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 1, 1.00026, 1.0006, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99928, 1, 0.99977, 1.00013, 1.00055, 0.99947, 0.99945, 0.99941, 0.99924, 1.00001, 1.00001, 1.0004, 0.91621, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 1.00001, 1.00005, 0.99999, 0.99977, 1.00015, 1.00022, 0.99977, 1.00001, 0.99973, 1.00026, 1.00001, 1.00019, 1.00001, 0.99946, 1, 1.0006, 1.00001, 0.99978, 1.00045, 0.99973, 0.99924, 1.00023, 0.99978, 0.99966, 1, 1.00065, 1.00045, 1.00019, 0.99973, 0.99973, 0.99924, 1, 1, 0.96499, 1, 1.00055, 0.99973, 1.00008, 1.00027, 1, 0.9997, 0.99995, 1.00023, 0.99933, 1.00019, 1.00015, 1.00031, 0.99924, 1.00023, 0.99973, 1.00023, 1.00031, 1.00001, 0.99928, 1.00029, 1.00092, 1.00035, 1.00001, 1.0006, 1.0006, 1, 0.99988, 0.99975, 1, 1.00082, 0.99561, 0.9996, 1.00035, 1.00001, 0.99962, 1.00001, 1.00092, 0.99964, 1.00001, 0.99963, 0.99999, 1.00035, 1.00035, 1.00082, 0.99962, 0.99999, 0.99977, 1.00022, 1.00035, 1.00001, 0.99977, 1.00026, 0.9996, 0.99967, 1.00001, 1.00034, 1.00074, 1.00054, 1.00053, 1.00063, 0.99971, 0.99962, 1.00035, 0.99975, 0.99977, 0.99973, 1.00043, 0.99953, 1.0007, 0.99915, 0.99973, 1.00008, 0.99892, 1.00073, 1.00073, 1.00114, 0.99915, 1.00073, 0.99955, 0.99973, 1.00092, 0.99973, 1, 0.99998, 1, 1.0003, 1, 1.00043, 1.00001, 0.99969, 1.0003, 1, 1.00035, 1.00001, 0.9995, 1, 1.00092, 0.99973, 0.99973, 0.99973, 1.0007, 0.9995, 1, 0.99924, 1.0006, 0.99924, 0.99972, 1.00062, 0.99973, 1.00114, 1.00073, 1, 0.99955, 1, 1, 1.00047, 0.99968, 1.00016, 0.99977, 1.00016, 0.99977, 1.00016, 0.99977, 1.00001, 1, 1, 1, 0.99973, 1, 1, 0.99955, 0.99924, 0.99924, 0.99924, 0.99924, 0.99998, 0.99998, 0.99998, 0.99973, 0.99973, 0.99972, 1, 1, 1.00267, 0.99999, 0.99998, 0.99998, 1, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1.00023, 0.99973, 0.99971, 0.99925, 1.00023, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1, 1, 1, 1, 1, 1, 1, 0.96329, 1, 1.20985, 1.39713, 1.00003, 0.8254, 1.00015, 1, 1.00035, 1.00027, 1.00031, 1.00031, 0.99915, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.95317, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  25983. const HelveticaRegularMetrics = {
  25984. lineHeight: 1.2,
  25985. lineGap: 0.2
  25986. };
  25987. ;// ./src/core/liberationsans_widths.js
  25988. const LiberationSansBoldWidths = [365, 0, 333, 278, 333, 474, 556, 556, 889, 722, 238, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 333, 584, 584, 584, 611, 975, 722, 722, 722, 722, 667, 611, 778, 722, 278, 556, 722, 611, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 333, 278, 333, 584, 556, 333, 556, 611, 556, 611, 556, 333, 611, 611, 278, 278, 556, 278, 889, 611, 611, 611, 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389, 584, 333, 556, 556, 556, 556, 280, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 556, 278, 333, 333, 365, 556, 834, 834, 834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 556, 556, 556, 556, 556, 278, 278, 278, 278, 611, 611, 611, 611, 611, 611, 611, 549, 611, 611, 611, 611, 611, 556, 611, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 719, 722, 611, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 611, 778, 611, 778, 611, 778, 611, 722, 611, 722, 611, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 785, 556, 556, 278, 722, 556, 556, 611, 278, 611, 278, 611, 385, 611, 479, 611, 278, 722, 611, 722, 611, 722, 611, 708, 723, 611, 778, 611, 778, 611, 778, 611, 1000, 944, 722, 389, 722, 389, 722, 389, 667, 556, 667, 556, 667, 556, 667, 556, 611, 333, 611, 479, 611, 333, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 944, 778, 667, 556, 667, 611, 500, 611, 500, 611, 500, 278, 556, 722, 556, 1000, 889, 778, 611, 667, 556, 611, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 465, 722, 333, 853, 906, 474, 825, 927, 838, 278, 722, 722, 601, 719, 667, 611, 722, 778, 278, 722, 667, 833, 722, 644, 778, 722, 667, 600, 611, 667, 821, 667, 809, 802, 278, 667, 615, 451, 611, 278, 582, 615, 610, 556, 606, 475, 460, 611, 541, 278, 558, 556, 612, 556, 445, 611, 766, 619, 520, 684, 446, 582, 715, 576, 753, 845, 278, 582, 611, 582, 845, 667, 669, 885, 567, 711, 667, 278, 276, 556, 1094, 1062, 875, 610, 722, 622, 719, 722, 719, 722, 567, 712, 667, 904, 626, 719, 719, 610, 702, 833, 722, 778, 719, 667, 722, 611, 622, 854, 667, 730, 703, 1005, 1019, 870, 979, 719, 711, 1031, 719, 556, 618, 615, 417, 635, 556, 709, 497, 615, 615, 500, 635, 740, 604, 611, 604, 611, 556, 490, 556, 875, 556, 615, 581, 833, 844, 729, 854, 615, 552, 854, 583, 556, 556, 611, 417, 552, 556, 278, 281, 278, 969, 906, 611, 500, 615, 556, 604, 778, 611, 487, 447, 944, 778, 944, 778, 944, 778, 667, 556, 333, 333, 556, 1000, 1000, 552, 278, 278, 278, 278, 500, 500, 500, 556, 556, 350, 1000, 1000, 240, 479, 333, 333, 604, 333, 167, 396, 556, 556, 1094, 556, 885, 489, 1115, 1000, 768, 600, 834, 834, 834, 834, 1000, 500, 1000, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 722, 274, 549, 549, 583, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 611, 611, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 333, 333, 333, 333, 333, 333, 333, 333];
  25989. const LiberationSansBoldMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
  25990. const LiberationSansBoldItalicWidths = [365, 0, 333, 278, 333, 474, 556, 556, 889, 722, 238, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 333, 584, 584, 584, 611, 975, 722, 722, 722, 722, 667, 611, 778, 722, 278, 556, 722, 611, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 333, 278, 333, 584, 556, 333, 556, 611, 556, 611, 556, 333, 611, 611, 278, 278, 556, 278, 889, 611, 611, 611, 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389, 584, 333, 556, 556, 556, 556, 280, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 556, 278, 333, 333, 365, 556, 834, 834, 834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 556, 556, 556, 556, 556, 278, 278, 278, 278, 611, 611, 611, 611, 611, 611, 611, 549, 611, 611, 611, 611, 611, 556, 611, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 740, 722, 611, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 611, 778, 611, 778, 611, 778, 611, 722, 611, 722, 611, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 782, 556, 556, 278, 722, 556, 556, 611, 278, 611, 278, 611, 396, 611, 479, 611, 278, 722, 611, 722, 611, 722, 611, 708, 723, 611, 778, 611, 778, 611, 778, 611, 1000, 944, 722, 389, 722, 389, 722, 389, 667, 556, 667, 556, 667, 556, 667, 556, 611, 333, 611, 479, 611, 333, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 944, 778, 667, 556, 667, 611, 500, 611, 500, 611, 500, 278, 556, 722, 556, 1000, 889, 778, 611, 667, 556, 611, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 722, 333, 854, 906, 473, 844, 930, 847, 278, 722, 722, 610, 671, 667, 611, 722, 778, 278, 722, 667, 833, 722, 657, 778, 718, 667, 590, 611, 667, 822, 667, 829, 781, 278, 667, 620, 479, 611, 278, 591, 620, 621, 556, 610, 479, 492, 611, 558, 278, 566, 556, 603, 556, 450, 611, 712, 605, 532, 664, 409, 591, 704, 578, 773, 834, 278, 591, 611, 591, 834, 667, 667, 886, 614, 719, 667, 278, 278, 556, 1094, 1042, 854, 622, 719, 677, 719, 722, 708, 722, 614, 722, 667, 927, 643, 719, 719, 615, 687, 833, 722, 778, 719, 667, 722, 611, 677, 781, 667, 729, 708, 979, 989, 854, 1000, 708, 719, 1042, 729, 556, 619, 604, 534, 618, 556, 736, 510, 611, 611, 507, 622, 740, 604, 611, 611, 611, 556, 889, 556, 885, 556, 646, 583, 889, 935, 707, 854, 594, 552, 865, 589, 556, 556, 611, 469, 563, 556, 278, 278, 278, 969, 906, 611, 507, 619, 556, 611, 778, 611, 575, 467, 944, 778, 944, 778, 944, 778, 667, 556, 333, 333, 556, 1000, 1000, 552, 278, 278, 278, 278, 500, 500, 500, 556, 556, 350, 1000, 1000, 240, 479, 333, 333, 604, 333, 167, 396, 556, 556, 1104, 556, 885, 516, 1146, 1000, 768, 600, 834, 834, 834, 834, 999, 500, 1000, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 722, 274, 549, 549, 583, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 611, 611, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 333, 333, 333, 333, 333, 333, 333, 333];
  25991. const LiberationSansBoldItalicMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
  25992. const LiberationSansItalicWidths = [365, 0, 333, 278, 278, 355, 556, 556, 889, 667, 191, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 278, 278, 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, 611, 778, 722, 278, 500, 667, 556, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, 333, 556, 556, 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, 556, 556, 556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334, 584, 333, 556, 556, 556, 556, 260, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 537, 278, 333, 333, 365, 556, 834, 834, 834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 500, 556, 556, 556, 556, 278, 278, 278, 278, 556, 556, 556, 556, 556, 556, 556, 549, 611, 556, 556, 556, 556, 500, 556, 500, 667, 556, 667, 556, 667, 556, 722, 500, 722, 500, 722, 500, 722, 500, 722, 625, 722, 556, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 556, 778, 556, 778, 556, 778, 556, 722, 556, 722, 556, 278, 278, 278, 278, 278, 278, 278, 222, 278, 278, 733, 444, 500, 222, 667, 500, 500, 556, 222, 556, 222, 556, 281, 556, 400, 556, 222, 722, 556, 722, 556, 722, 556, 615, 723, 556, 778, 556, 778, 556, 778, 556, 1000, 944, 722, 333, 722, 333, 722, 333, 667, 500, 667, 500, 667, 500, 667, 500, 611, 278, 611, 354, 611, 278, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 944, 722, 667, 500, 667, 611, 500, 611, 500, 611, 500, 222, 556, 667, 556, 1000, 889, 778, 611, 667, 500, 611, 278, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 667, 278, 789, 846, 389, 794, 865, 775, 222, 667, 667, 570, 671, 667, 611, 722, 778, 278, 667, 667, 833, 722, 648, 778, 725, 667, 600, 611, 667, 837, 667, 831, 761, 278, 667, 570, 439, 555, 222, 550, 570, 571, 500, 556, 439, 463, 555, 542, 222, 500, 492, 548, 500, 447, 556, 670, 573, 486, 603, 374, 550, 652, 546, 728, 779, 222, 550, 556, 550, 779, 667, 667, 843, 544, 708, 667, 278, 278, 500, 1066, 982, 844, 589, 715, 639, 724, 667, 651, 667, 544, 704, 667, 917, 614, 715, 715, 589, 686, 833, 722, 778, 725, 667, 722, 611, 639, 795, 667, 727, 673, 920, 923, 805, 886, 651, 694, 1022, 682, 556, 562, 522, 493, 553, 556, 688, 465, 556, 556, 472, 564, 686, 550, 556, 556, 556, 500, 833, 500, 835, 500, 572, 518, 830, 851, 621, 736, 526, 492, 752, 534, 556, 556, 556, 378, 496, 500, 222, 222, 222, 910, 828, 556, 472, 565, 500, 556, 778, 556, 492, 339, 944, 722, 944, 722, 944, 722, 667, 500, 333, 333, 556, 1000, 1000, 552, 222, 222, 222, 222, 333, 333, 333, 556, 556, 350, 1000, 1000, 188, 354, 333, 333, 500, 333, 167, 365, 556, 556, 1094, 556, 885, 323, 1083, 1000, 768, 600, 834, 834, 834, 834, 1000, 500, 998, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 719, 274, 549, 549, 584, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 500, 500, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 294, 294, 324, 324, 316, 328, 398, 285];
  25993. const LiberationSansItalicMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
  25994. const LiberationSansRegularWidths = [365, 0, 333, 278, 278, 355, 556, 556, 889, 667, 191, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 278, 278, 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, 611, 778, 722, 278, 500, 667, 556, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, 333, 556, 556, 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, 556, 556, 556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334, 584, 333, 556, 556, 556, 556, 260, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 537, 278, 333, 333, 365, 556, 834, 834, 834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 500, 556, 556, 556, 556, 278, 278, 278, 278, 556, 556, 556, 556, 556, 556, 556, 549, 611, 556, 556, 556, 556, 500, 556, 500, 667, 556, 667, 556, 667, 556, 722, 500, 722, 500, 722, 500, 722, 500, 722, 615, 722, 556, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 556, 778, 556, 778, 556, 778, 556, 722, 556, 722, 556, 278, 278, 278, 278, 278, 278, 278, 222, 278, 278, 735, 444, 500, 222, 667, 500, 500, 556, 222, 556, 222, 556, 292, 556, 334, 556, 222, 722, 556, 722, 556, 722, 556, 604, 723, 556, 778, 556, 778, 556, 778, 556, 1000, 944, 722, 333, 722, 333, 722, 333, 667, 500, 667, 500, 667, 500, 667, 500, 611, 278, 611, 375, 611, 278, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 944, 722, 667, 500, 667, 611, 500, 611, 500, 611, 500, 222, 556, 667, 556, 1000, 889, 778, 611, 667, 500, 611, 278, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 667, 278, 784, 838, 384, 774, 855, 752, 222, 667, 667, 551, 668, 667, 611, 722, 778, 278, 667, 668, 833, 722, 650, 778, 722, 667, 618, 611, 667, 798, 667, 835, 748, 278, 667, 578, 446, 556, 222, 547, 578, 575, 500, 557, 446, 441, 556, 556, 222, 500, 500, 576, 500, 448, 556, 690, 569, 482, 617, 395, 547, 648, 525, 713, 781, 222, 547, 556, 547, 781, 667, 667, 865, 542, 719, 667, 278, 278, 500, 1057, 1010, 854, 583, 722, 635, 719, 667, 656, 667, 542, 677, 667, 923, 604, 719, 719, 583, 656, 833, 722, 778, 719, 667, 722, 611, 635, 760, 667, 740, 667, 917, 938, 792, 885, 656, 719, 1010, 722, 556, 573, 531, 365, 583, 556, 669, 458, 559, 559, 438, 583, 688, 552, 556, 542, 556, 500, 458, 500, 823, 500, 573, 521, 802, 823, 625, 719, 521, 510, 750, 542, 556, 556, 556, 365, 510, 500, 222, 278, 222, 906, 812, 556, 438, 559, 500, 552, 778, 556, 489, 411, 944, 722, 944, 722, 944, 722, 667, 500, 333, 333, 556, 1000, 1000, 552, 222, 222, 222, 222, 333, 333, 333, 556, 556, 350, 1000, 1000, 188, 354, 333, 333, 500, 333, 167, 365, 556, 556, 1094, 556, 885, 323, 1073, 1000, 768, 600, 834, 834, 834, 834, 1000, 500, 1000, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 719, 274, 549, 549, 583, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 500, 500, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 294, 294, 324, 324, 316, 328, 398, 285];
  25995. const LiberationSansRegularMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
  25996. ;// ./src/core/myriadpro_factors.js
  25997. const MyriadProBoldFactors = [1.36898, 1, 1, 0.72706, 0.80479, 0.83734, 0.98894, 0.99793, 0.9897, 0.93884, 0.86209, 0.94292, 0.94292, 1.16661, 1.02058, 0.93582, 0.96694, 0.93582, 1.19137, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.78076, 0.78076, 1.02058, 1.02058, 1.02058, 0.72851, 0.78966, 0.90838, 0.83637, 0.82391, 0.96376, 0.80061, 0.86275, 0.8768, 0.95407, 1.0258, 0.73901, 0.85022, 0.83655, 1.0156, 0.95546, 0.92179, 0.87107, 0.92179, 0.82114, 0.8096, 0.89713, 0.94438, 0.95353, 0.94083, 0.91905, 0.90406, 0.9446, 0.94292, 1.18777, 0.94292, 1.02058, 0.89903, 0.90088, 0.94938, 0.97898, 0.81093, 0.97571, 0.94938, 1.024, 0.9577, 0.95933, 0.98621, 1.0474, 0.97455, 0.98981, 0.9672, 0.95933, 0.9446, 0.97898, 0.97407, 0.97646, 0.78036, 1.10208, 0.95442, 0.95298, 0.97579, 0.9332, 0.94039, 0.938, 0.80687, 1.01149, 0.80687, 1.02058, 0.80479, 0.99793, 0.99793, 0.99793, 0.99793, 1.01149, 1.00872, 0.90088, 0.91882, 1.0213, 0.8361, 1.02058, 0.62295, 0.54324, 0.89022, 1.08595, 1, 1, 0.90088, 1, 0.97455, 0.93582, 0.90088, 1, 1.05686, 0.8361, 0.99642, 0.99642, 0.99642, 0.72851, 0.90838, 0.90838, 0.90838, 0.90838, 0.90838, 0.90838, 0.868, 0.82391, 0.80061, 0.80061, 0.80061, 0.80061, 1.0258, 1.0258, 1.0258, 1.0258, 0.97484, 0.95546, 0.92179, 0.92179, 0.92179, 0.92179, 0.92179, 1.02058, 0.92179, 0.94438, 0.94438, 0.94438, 0.94438, 0.90406, 0.86958, 0.98225, 0.94938, 0.94938, 0.94938, 0.94938, 0.94938, 0.94938, 0.9031, 0.81093, 0.94938, 0.94938, 0.94938, 0.94938, 0.98621, 0.98621, 0.98621, 0.98621, 0.93969, 0.95933, 0.9446, 0.9446, 0.9446, 0.9446, 0.9446, 1.08595, 0.9446, 0.95442, 0.95442, 0.95442, 0.95442, 0.94039, 0.97898, 0.94039, 0.90838, 0.94938, 0.90838, 0.94938, 0.90838, 0.94938, 0.82391, 0.81093, 0.82391, 0.81093, 0.82391, 0.81093, 0.82391, 0.81093, 0.96376, 0.84313, 0.97484, 0.97571, 0.80061, 0.94938, 0.80061, 0.94938, 0.80061, 0.94938, 0.80061, 0.94938, 0.80061, 0.94938, 0.8768, 0.9577, 0.8768, 0.9577, 0.8768, 0.9577, 1, 1, 0.95407, 0.95933, 0.97069, 0.95933, 1.0258, 0.98621, 1.0258, 0.98621, 1.0258, 0.98621, 1.0258, 0.98621, 1.0258, 0.98621, 0.887, 1.01591, 0.73901, 1.0474, 1, 1, 0.97455, 0.83655, 0.98981, 1, 1, 0.83655, 0.73977, 0.83655, 0.73903, 0.84638, 1.033, 0.95546, 0.95933, 1, 1, 0.95546, 0.95933, 0.8271, 0.95417, 0.95933, 0.92179, 0.9446, 0.92179, 0.9446, 0.92179, 0.9446, 0.936, 0.91964, 0.82114, 0.97646, 1, 1, 0.82114, 0.97646, 0.8096, 0.78036, 0.8096, 0.78036, 1, 1, 0.8096, 0.78036, 1, 1, 0.89713, 0.77452, 0.89713, 1.10208, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94083, 0.97579, 0.90406, 0.94039, 0.90406, 0.9446, 0.938, 0.9446, 0.938, 0.9446, 0.938, 1, 0.99793, 0.90838, 0.94938, 0.868, 0.9031, 0.92179, 0.9446, 1, 1, 0.89713, 1.10208, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90989, 0.9358, 0.91945, 0.83181, 0.75261, 0.87992, 0.82976, 0.96034, 0.83689, 0.97268, 1.0078, 0.90838, 0.83637, 0.8019, 0.90157, 0.80061, 0.9446, 0.95407, 0.92436, 1.0258, 0.85022, 0.97153, 1.0156, 0.95546, 0.89192, 0.92179, 0.92361, 0.87107, 0.96318, 0.89713, 0.93704, 0.95638, 0.91905, 0.91709, 0.92796, 1.0258, 0.93704, 0.94836, 1.0373, 0.95933, 1.0078, 0.95871, 0.94836, 0.96174, 0.92601, 0.9498, 0.98607, 0.95776, 0.95933, 1.05453, 1.0078, 0.98275, 0.9314, 0.95617, 0.91701, 1.05993, 0.9446, 0.78367, 0.9553, 1, 0.86832, 1.0128, 0.95871, 0.99394, 0.87548, 0.96361, 0.86774, 1.0078, 0.95871, 0.9446, 0.95871, 0.86774, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.94083, 0.97579, 0.94083, 0.97579, 0.94083, 0.97579, 0.90406, 0.94039, 0.96694, 1, 0.89903, 1, 1, 1, 0.93582, 0.93582, 0.93582, 1, 0.908, 0.908, 0.918, 0.94219, 0.94219, 0.96544, 1, 1.285, 1, 1, 0.81079, 0.81079, 1, 1, 0.74854, 1, 1, 1, 1, 0.99793, 1, 1, 1, 0.65, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.17173, 1, 0.80535, 0.76169, 1.02058, 1.0732, 1.05486, 1, 1, 1.30692, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.16161, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  25998. const MyriadProBoldMetrics = {
  25999. lineHeight: 1.2,
  26000. lineGap: 0.2
  26001. };
  26002. const MyriadProBoldItalicFactors = [1.36898, 1, 1, 0.66227, 0.80779, 0.81625, 0.97276, 0.97276, 0.97733, 0.92222, 0.83266, 0.94292, 0.94292, 1.16148, 1.02058, 0.93582, 0.96694, 0.93582, 1.17337, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.78076, 0.78076, 1.02058, 1.02058, 1.02058, 0.71541, 0.76813, 0.85576, 0.80591, 0.80729, 0.94299, 0.77512, 0.83655, 0.86523, 0.92222, 0.98621, 0.71743, 0.81698, 0.79726, 0.98558, 0.92222, 0.90637, 0.83809, 0.90637, 0.80729, 0.76463, 0.86275, 0.90699, 0.91605, 0.9154, 0.85308, 0.85458, 0.90531, 0.94292, 1.21296, 0.94292, 1.02058, 0.89903, 1.18616, 0.99613, 0.91677, 0.78216, 0.91677, 0.90083, 0.98796, 0.9135, 0.92168, 0.95381, 0.98981, 0.95298, 0.95381, 0.93459, 0.92168, 0.91513, 0.92004, 0.91677, 0.95077, 0.748, 1.04502, 0.91677, 0.92061, 0.94236, 0.89544, 0.89364, 0.9, 0.80687, 0.8578, 0.80687, 1.02058, 0.80779, 0.97276, 0.97276, 0.97276, 0.97276, 0.8578, 0.99973, 1.18616, 0.91339, 1.08074, 0.82891, 1.02058, 0.55509, 0.71526, 0.89022, 1.08595, 1, 1, 1.18616, 1, 0.96736, 0.93582, 1.18616, 1, 1.04864, 0.82711, 0.99043, 0.99043, 0.99043, 0.71541, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.845, 0.80729, 0.77512, 0.77512, 0.77512, 0.77512, 0.98621, 0.98621, 0.98621, 0.98621, 0.95961, 0.92222, 0.90637, 0.90637, 0.90637, 0.90637, 0.90637, 1.02058, 0.90251, 0.90699, 0.90699, 0.90699, 0.90699, 0.85458, 0.83659, 0.94951, 0.99613, 0.99613, 0.99613, 0.99613, 0.99613, 0.99613, 0.85811, 0.78216, 0.90083, 0.90083, 0.90083, 0.90083, 0.95381, 0.95381, 0.95381, 0.95381, 0.9135, 0.92168, 0.91513, 0.91513, 0.91513, 0.91513, 0.91513, 1.08595, 0.91677, 0.91677, 0.91677, 0.91677, 0.91677, 0.89364, 0.92332, 0.89364, 0.85576, 0.99613, 0.85576, 0.99613, 0.85576, 0.99613, 0.80729, 0.78216, 0.80729, 0.78216, 0.80729, 0.78216, 0.80729, 0.78216, 0.94299, 0.76783, 0.95961, 0.91677, 0.77512, 0.90083, 0.77512, 0.90083, 0.77512, 0.90083, 0.77512, 0.90083, 0.77512, 0.90083, 0.86523, 0.9135, 0.86523, 0.9135, 0.86523, 0.9135, 1, 1, 0.92222, 0.92168, 0.92222, 0.92168, 0.98621, 0.95381, 0.98621, 0.95381, 0.98621, 0.95381, 0.98621, 0.95381, 0.98621, 0.95381, 0.86036, 0.97096, 0.71743, 0.98981, 1, 1, 0.95298, 0.79726, 0.95381, 1, 1, 0.79726, 0.6894, 0.79726, 0.74321, 0.81691, 1.0006, 0.92222, 0.92168, 1, 1, 0.92222, 0.92168, 0.79464, 0.92098, 0.92168, 0.90637, 0.91513, 0.90637, 0.91513, 0.90637, 0.91513, 0.909, 0.87514, 0.80729, 0.95077, 1, 1, 0.80729, 0.95077, 0.76463, 0.748, 0.76463, 0.748, 1, 1, 0.76463, 0.748, 1, 1, 0.86275, 0.72651, 0.86275, 1.04502, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.9154, 0.94236, 0.85458, 0.89364, 0.85458, 0.90531, 0.9, 0.90531, 0.9, 0.90531, 0.9, 1, 0.97276, 0.85576, 0.99613, 0.845, 0.85811, 0.90251, 0.91677, 1, 1, 0.86275, 1.04502, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.00899, 1.30628, 0.85576, 0.80178, 0.66862, 0.7927, 0.69323, 0.88127, 0.72459, 0.89711, 0.95381, 0.85576, 0.80591, 0.7805, 0.94729, 0.77512, 0.90531, 0.92222, 0.90637, 0.98621, 0.81698, 0.92655, 0.98558, 0.92222, 0.85359, 0.90637, 0.90976, 0.83809, 0.94523, 0.86275, 0.83509, 0.93157, 0.85308, 0.83392, 0.92346, 0.98621, 0.83509, 0.92886, 0.91324, 0.92168, 0.95381, 0.90646, 0.92886, 0.90557, 0.86847, 0.90276, 0.91324, 0.86842, 0.92168, 0.99531, 0.95381, 0.9224, 0.85408, 0.92699, 0.86847, 1.0051, 0.91513, 0.80487, 0.93481, 1, 0.88159, 1.05214, 0.90646, 0.97355, 0.81539, 0.89398, 0.85923, 0.95381, 0.90646, 0.91513, 0.90646, 0.85923, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9154, 0.94236, 0.9154, 0.94236, 0.9154, 0.94236, 0.85458, 0.89364, 0.96694, 1, 0.89903, 1, 1, 1, 0.91782, 0.91782, 0.91782, 1, 0.896, 0.896, 0.896, 0.9332, 0.9332, 0.95973, 1, 1.26, 1, 1, 0.80479, 0.80178, 1, 1, 0.85633, 1, 1, 1, 1, 0.97276, 1, 1, 1, 0.698, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.14542, 1, 0.79199, 0.78694, 1.02058, 1.03493, 1.05486, 1, 1, 1.23026, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.20006, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  26003. const MyriadProBoldItalicMetrics = {
  26004. lineHeight: 1.2,
  26005. lineGap: 0.2
  26006. };
  26007. const MyriadProItalicFactors = [1.36898, 1, 1, 0.65507, 0.84943, 0.85639, 0.88465, 0.88465, 0.86936, 0.88307, 0.86948, 0.85283, 0.85283, 1.06383, 1.02058, 0.75945, 0.9219, 0.75945, 1.17337, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.75945, 0.75945, 1.02058, 1.02058, 1.02058, 0.69046, 0.70926, 0.85158, 0.77812, 0.76852, 0.89591, 0.70466, 0.76125, 0.80094, 0.86822, 0.83864, 0.728, 0.77212, 0.79475, 0.93637, 0.87514, 0.8588, 0.76013, 0.8588, 0.72421, 0.69866, 0.77598, 0.85991, 0.80811, 0.87832, 0.78112, 0.77512, 0.8562, 1.0222, 1.18417, 1.0222, 1.27014, 0.89903, 1.15012, 0.93859, 0.94399, 0.846, 0.94399, 0.81453, 1.0186, 0.94219, 0.96017, 1.03075, 1.02175, 0.912, 1.03075, 0.96998, 0.96017, 0.93859, 0.94399, 0.94399, 0.95493, 0.746, 1.12658, 0.94578, 0.91, 0.979, 0.882, 0.882, 0.83, 0.85034, 0.83537, 0.85034, 1.02058, 0.70869, 0.88465, 0.88465, 0.88465, 0.88465, 0.83537, 0.90083, 1.15012, 0.9161, 0.94565, 0.73541, 1.02058, 0.53609, 0.69353, 0.79519, 1.08595, 1, 1, 1.15012, 1, 0.91974, 0.75945, 1.15012, 1, 0.9446, 0.73361, 0.9005, 0.9005, 0.9005, 0.62864, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.773, 0.76852, 0.70466, 0.70466, 0.70466, 0.70466, 0.83864, 0.83864, 0.83864, 0.83864, 0.90561, 0.87514, 0.8588, 0.8588, 0.8588, 0.8588, 0.8588, 1.02058, 0.85751, 0.85991, 0.85991, 0.85991, 0.85991, 0.77512, 0.76013, 0.88075, 0.93859, 0.93859, 0.93859, 0.93859, 0.93859, 0.93859, 0.8075, 0.846, 0.81453, 0.81453, 0.81453, 0.81453, 0.82424, 0.82424, 0.82424, 0.82424, 0.9278, 0.96017, 0.93859, 0.93859, 0.93859, 0.93859, 0.93859, 1.08595, 0.8562, 0.94578, 0.94578, 0.94578, 0.94578, 0.882, 0.94578, 0.882, 0.85158, 0.93859, 0.85158, 0.93859, 0.85158, 0.93859, 0.76852, 0.846, 0.76852, 0.846, 0.76852, 0.846, 0.76852, 0.846, 0.89591, 0.8544, 0.90561, 0.94399, 0.70466, 0.81453, 0.70466, 0.81453, 0.70466, 0.81453, 0.70466, 0.81453, 0.70466, 0.81453, 0.80094, 0.94219, 0.80094, 0.94219, 0.80094, 0.94219, 1, 1, 0.86822, 0.96017, 0.86822, 0.96017, 0.83864, 0.82424, 0.83864, 0.82424, 0.83864, 0.82424, 0.83864, 1.03075, 0.83864, 0.82424, 0.81402, 1.02738, 0.728, 1.02175, 1, 1, 0.912, 0.79475, 1.03075, 1, 1, 0.79475, 0.83911, 0.79475, 0.66266, 0.80553, 1.06676, 0.87514, 0.96017, 1, 1, 0.87514, 0.96017, 0.86865, 0.87396, 0.96017, 0.8588, 0.93859, 0.8588, 0.93859, 0.8588, 0.93859, 0.867, 0.84759, 0.72421, 0.95493, 1, 1, 0.72421, 0.95493, 0.69866, 0.746, 0.69866, 0.746, 1, 1, 0.69866, 0.746, 1, 1, 0.77598, 0.88417, 0.77598, 1.12658, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.87832, 0.979, 0.77512, 0.882, 0.77512, 0.8562, 0.83, 0.8562, 0.83, 0.8562, 0.83, 1, 0.88465, 0.85158, 0.93859, 0.773, 0.8075, 0.85751, 0.8562, 1, 1, 0.77598, 1.12658, 1.15012, 1.15012, 1.15012, 1.15012, 1.15012, 1.15313, 1.15012, 1.15012, 1.15012, 1.08106, 1.03901, 0.85158, 0.77025, 0.62264, 0.7646, 0.65351, 0.86026, 0.69461, 0.89947, 1.03075, 0.85158, 0.77812, 0.76449, 0.88836, 0.70466, 0.8562, 0.86822, 0.8588, 0.83864, 0.77212, 0.85308, 0.93637, 0.87514, 0.82352, 0.8588, 0.85701, 0.76013, 0.89058, 0.77598, 0.8156, 0.82565, 0.78112, 0.77899, 0.89386, 0.83864, 0.8156, 0.9486, 0.92388, 0.96186, 1.03075, 0.91123, 0.9486, 0.93298, 0.878, 0.93942, 0.92388, 0.84596, 0.96186, 0.95119, 1.03075, 0.922, 0.88787, 0.95829, 0.88, 0.93559, 0.93859, 0.78815, 0.93758, 1, 0.89217, 1.03737, 0.91123, 0.93969, 0.77487, 0.85769, 0.86799, 1.03075, 0.91123, 0.93859, 0.91123, 0.86799, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.87832, 0.979, 0.87832, 0.979, 0.87832, 0.979, 0.77512, 0.882, 0.9219, 1, 0.89903, 1, 1, 1, 0.87321, 0.87321, 0.87321, 1, 1.027, 1.027, 1.027, 0.86847, 0.86847, 0.79121, 1, 1.124, 1, 1, 0.73572, 0.73572, 1, 1, 0.85034, 1, 1, 1, 1, 0.88465, 1, 1, 1, 0.669, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.04828, 1, 0.74948, 0.75187, 1.02058, 0.98391, 1.02119, 1, 1, 1.06233, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05233, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  26008. const MyriadProItalicMetrics = {
  26009. lineHeight: 1.2,
  26010. lineGap: 0.2
  26011. };
  26012. const MyriadProRegularFactors = [1.36898, 1, 1, 0.76305, 0.82784, 0.94935, 0.89364, 0.92241, 0.89073, 0.90706, 0.98472, 0.85283, 0.85283, 1.0664, 1.02058, 0.74505, 0.9219, 0.74505, 1.23456, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.74505, 0.74505, 1.02058, 1.02058, 1.02058, 0.73002, 0.72601, 0.91755, 0.8126, 0.80314, 0.92222, 0.73764, 0.79726, 0.83051, 0.90284, 0.86023, 0.74, 0.8126, 0.84869, 0.96518, 0.91115, 0.8858, 0.79761, 0.8858, 0.74498, 0.73914, 0.81363, 0.89591, 0.83659, 0.89633, 0.85608, 0.8111, 0.90531, 1.0222, 1.22736, 1.0222, 1.27014, 0.89903, 0.90088, 0.86667, 1.0231, 0.896, 1.01411, 0.90083, 1.05099, 1.00512, 0.99793, 1.05326, 1.09377, 0.938, 1.06226, 1.00119, 0.99793, 0.98714, 1.0231, 1.01231, 0.98196, 0.792, 1.19137, 0.99074, 0.962, 1.01915, 0.926, 0.942, 0.856, 0.85034, 0.92006, 0.85034, 1.02058, 0.69067, 0.92241, 0.92241, 0.92241, 0.92241, 0.92006, 0.9332, 0.90088, 0.91882, 0.93484, 0.75339, 1.02058, 0.56866, 0.54324, 0.79519, 1.08595, 1, 1, 0.90088, 1, 0.95325, 0.74505, 0.90088, 1, 0.97198, 0.75339, 0.91009, 0.91009, 0.91009, 0.66466, 0.91755, 0.91755, 0.91755, 0.91755, 0.91755, 0.91755, 0.788, 0.80314, 0.73764, 0.73764, 0.73764, 0.73764, 0.86023, 0.86023, 0.86023, 0.86023, 0.92915, 0.91115, 0.8858, 0.8858, 0.8858, 0.8858, 0.8858, 1.02058, 0.8858, 0.89591, 0.89591, 0.89591, 0.89591, 0.8111, 0.79611, 0.89713, 0.86667, 0.86667, 0.86667, 0.86667, 0.86667, 0.86667, 0.86936, 0.896, 0.90083, 0.90083, 0.90083, 0.90083, 0.84224, 0.84224, 0.84224, 0.84224, 0.97276, 0.99793, 0.98714, 0.98714, 0.98714, 0.98714, 0.98714, 1.08595, 0.89876, 0.99074, 0.99074, 0.99074, 0.99074, 0.942, 1.0231, 0.942, 0.91755, 0.86667, 0.91755, 0.86667, 0.91755, 0.86667, 0.80314, 0.896, 0.80314, 0.896, 0.80314, 0.896, 0.80314, 0.896, 0.92222, 0.93372, 0.92915, 1.01411, 0.73764, 0.90083, 0.73764, 0.90083, 0.73764, 0.90083, 0.73764, 0.90083, 0.73764, 0.90083, 0.83051, 1.00512, 0.83051, 1.00512, 0.83051, 1.00512, 1, 1, 0.90284, 0.99793, 0.90976, 0.99793, 0.86023, 0.84224, 0.86023, 0.84224, 0.86023, 0.84224, 0.86023, 1.05326, 0.86023, 0.84224, 0.82873, 1.07469, 0.74, 1.09377, 1, 1, 0.938, 0.84869, 1.06226, 1, 1, 0.84869, 0.83704, 0.84869, 0.81441, 0.85588, 1.08927, 0.91115, 0.99793, 1, 1, 0.91115, 0.99793, 0.91887, 0.90991, 0.99793, 0.8858, 0.98714, 0.8858, 0.98714, 0.8858, 0.98714, 0.894, 0.91434, 0.74498, 0.98196, 1, 1, 0.74498, 0.98196, 0.73914, 0.792, 0.73914, 0.792, 1, 1, 0.73914, 0.792, 1, 1, 0.81363, 0.904, 0.81363, 1.19137, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89633, 1.01915, 0.8111, 0.942, 0.8111, 0.90531, 0.856, 0.90531, 0.856, 0.90531, 0.856, 1, 0.92241, 0.91755, 0.86667, 0.788, 0.86936, 0.8858, 0.89876, 1, 1, 0.81363, 1.19137, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90388, 1.03901, 0.92138, 0.78105, 0.7154, 0.86169, 0.80513, 0.94007, 0.82528, 0.98612, 1.06226, 0.91755, 0.8126, 0.81884, 0.92819, 0.73764, 0.90531, 0.90284, 0.8858, 0.86023, 0.8126, 0.91172, 0.96518, 0.91115, 0.83089, 0.8858, 0.87791, 0.79761, 0.89297, 0.81363, 0.88157, 0.89992, 0.85608, 0.81992, 0.94307, 0.86023, 0.88157, 0.95308, 0.98699, 0.99793, 1.06226, 0.95817, 0.95308, 0.97358, 0.928, 0.98088, 0.98699, 0.92761, 0.99793, 0.96017, 1.06226, 0.986, 0.944, 0.95978, 0.938, 0.96705, 0.98714, 0.80442, 0.98972, 1, 0.89762, 1.04552, 0.95817, 0.99007, 0.87064, 0.91879, 0.88888, 1.06226, 0.95817, 0.98714, 0.95817, 0.88888, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.89633, 1.01915, 0.89633, 1.01915, 0.89633, 1.01915, 0.8111, 0.942, 0.9219, 1, 0.89903, 1, 1, 1, 0.93173, 0.93173, 0.93173, 1, 1.06304, 1.06304, 1.06904, 0.89903, 0.89903, 0.80549, 1, 1.156, 1, 1, 0.76575, 0.76575, 1, 1, 0.72458, 1, 1, 1, 1, 0.92241, 1, 1, 1, 0.619, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.07257, 1, 0.74705, 0.71119, 1.02058, 1.024, 1.02119, 1, 1, 1.1536, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05638, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  26013. const MyriadProRegularMetrics = {
  26014. lineHeight: 1.2,
  26015. lineGap: 0.2
  26016. };
  26017. ;// ./src/core/segoeui_factors.js
  26018. const SegoeuiBoldFactors = [1.76738, 1, 1, 0.99297, 0.9824, 1.04016, 1.06497, 1.03424, 0.97529, 1.17647, 1.23203, 1.1085, 1.1085, 1.16939, 1.2107, 0.9754, 1.21408, 0.9754, 1.59578, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 0.81378, 0.81378, 1.2107, 1.2107, 1.2107, 0.71703, 0.97847, 0.97363, 0.88776, 0.8641, 1.02096, 0.79795, 0.85132, 0.914, 1.06085, 1.1406, 0.8007, 0.89858, 0.83693, 1.14889, 1.09398, 0.97489, 0.92094, 0.97489, 0.90399, 0.84041, 0.95923, 1.00135, 1, 1.06467, 0.98243, 0.90996, 0.99361, 1.1085, 1.56942, 1.1085, 1.2107, 0.74627, 0.94282, 0.96752, 1.01519, 0.86304, 1.01359, 0.97278, 1.15103, 1.01359, 0.98561, 1.02285, 1.02285, 1.00527, 1.02285, 1.0302, 0.99041, 1.0008, 1.01519, 1.01359, 1.02258, 0.79104, 1.16862, 0.99041, 0.97454, 1.02511, 0.99298, 0.96752, 0.95801, 0.94856, 1.16579, 0.94856, 1.2107, 0.9824, 1.03424, 1.03424, 1, 1.03424, 1.16579, 0.8727, 1.3871, 1.18622, 1.10818, 1.04478, 1.2107, 1.18622, 0.75155, 0.94994, 1.28826, 1.21408, 1.21408, 0.91056, 1, 0.91572, 0.9754, 0.64663, 1.18328, 1.24866, 1.04478, 1.14169, 1.15749, 1.17389, 0.71703, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.93506, 0.8641, 0.79795, 0.79795, 0.79795, 0.79795, 1.1406, 1.1406, 1.1406, 1.1406, 1.02096, 1.09398, 0.97426, 0.97426, 0.97426, 0.97426, 0.97426, 1.2107, 0.97489, 1.00135, 1.00135, 1.00135, 1.00135, 0.90996, 0.92094, 1.02798, 0.96752, 0.96752, 0.96752, 0.96752, 0.96752, 0.96752, 0.93136, 0.86304, 0.97278, 0.97278, 0.97278, 0.97278, 1.02285, 1.02285, 1.02285, 1.02285, 0.97122, 0.99041, 1, 1, 1, 1, 1, 1.28826, 1.0008, 0.99041, 0.99041, 0.99041, 0.99041, 0.96752, 1.01519, 0.96752, 0.97363, 0.96752, 0.97363, 0.96752, 0.97363, 0.96752, 0.8641, 0.86304, 0.8641, 0.86304, 0.8641, 0.86304, 0.8641, 0.86304, 1.02096, 1.03057, 1.02096, 1.03517, 0.79795, 0.97278, 0.79795, 0.97278, 0.79795, 0.97278, 0.79795, 0.97278, 0.79795, 0.97278, 0.914, 1.01359, 0.914, 1.01359, 0.914, 1.01359, 1, 1, 1.06085, 0.98561, 1.06085, 1.00879, 1.1406, 1.02285, 1.1406, 1.02285, 1.1406, 1.02285, 1.1406, 1.02285, 1.1406, 1.02285, 0.97138, 1.08692, 0.8007, 1.02285, 1, 1, 1.00527, 0.83693, 1.02285, 1, 1, 0.83693, 0.9455, 0.83693, 0.90418, 0.83693, 1.13005, 1.09398, 0.99041, 1, 1, 1.09398, 0.99041, 0.96692, 1.09251, 0.99041, 0.97489, 1.0008, 0.97489, 1.0008, 0.97489, 1.0008, 0.93994, 0.97931, 0.90399, 1.02258, 1, 1, 0.90399, 1.02258, 0.84041, 0.79104, 0.84041, 0.79104, 0.84041, 0.79104, 0.84041, 0.79104, 1, 1, 0.95923, 1.07034, 0.95923, 1.16862, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.06467, 1.02511, 0.90996, 0.96752, 0.90996, 0.99361, 0.95801, 0.99361, 0.95801, 0.99361, 0.95801, 1.07733, 1.03424, 0.97363, 0.96752, 0.93506, 0.93136, 0.97489, 1.0008, 1, 1, 0.95923, 1.16862, 1.15103, 1.15103, 1.01173, 1.03959, 0.75953, 0.81378, 0.79912, 1.15103, 1.21994, 0.95161, 0.87815, 1.01149, 0.81525, 0.7676, 0.98167, 1.01134, 1.02546, 0.84097, 1.03089, 1.18102, 0.97363, 0.88776, 0.85134, 0.97826, 0.79795, 0.99361, 1.06085, 0.97489, 1.1406, 0.89858, 1.0388, 1.14889, 1.09398, 0.86039, 0.97489, 1.0595, 0.92094, 0.94793, 0.95923, 0.90996, 0.99346, 0.98243, 1.02112, 0.95493, 1.1406, 0.90996, 1.03574, 1.02597, 1.0008, 1.18102, 1.06628, 1.03574, 1.0192, 1.01932, 1.00886, 0.97531, 1.0106, 1.0008, 1.13189, 1.18102, 1.02277, 0.98683, 1.0016, 0.99561, 1.07237, 1.0008, 0.90434, 0.99921, 0.93803, 0.8965, 1.23085, 1.06628, 1.04983, 0.96268, 1.0499, 0.98439, 1.18102, 1.06628, 1.0008, 1.06628, 0.98439, 0.79795, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.09466, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.97278, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.02065, 1, 1, 1, 1, 1, 1, 1.06467, 1.02511, 1.06467, 1.02511, 1.06467, 1.02511, 0.90996, 0.96752, 1, 1.21408, 0.89903, 1, 1, 0.75155, 1.04394, 1.04394, 1.04394, 1.04394, 0.98633, 0.98633, 0.98633, 0.73047, 0.73047, 1.20642, 0.91211, 1.25635, 1.222, 1.02956, 1.03372, 1.03372, 0.96039, 1.24633, 1, 1.12454, 0.93503, 1.03424, 1.19687, 1.03424, 1, 1, 1, 0.771, 1, 1, 1.15749, 1.15749, 1.15749, 1.10948, 0.86279, 0.94434, 0.86279, 0.94434, 0.86182, 1, 1, 1.16897, 1, 0.96085, 0.90137, 1.2107, 1.18416, 1.13973, 0.69825, 0.9716, 2.10339, 1.29004, 1.29004, 1.21172, 1.29004, 1.29004, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.18874, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.09193, 1.09193, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  26019. const SegoeuiBoldMetrics = {
  26020. lineHeight: 1.33008,
  26021. lineGap: 0
  26022. };
  26023. const SegoeuiBoldItalicFactors = [1.76738, 1, 1, 0.98946, 1.03959, 1.04016, 1.02809, 1.036, 0.97639, 1.10953, 1.23203, 1.11144, 1.11144, 1.16939, 1.21237, 0.9754, 1.21261, 0.9754, 1.59754, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 0.81378, 0.81378, 1.21237, 1.21237, 1.21237, 0.73541, 0.97847, 0.97363, 0.89723, 0.87897, 1.0426, 0.79429, 0.85292, 0.91149, 1.05815, 1.1406, 0.79631, 0.90128, 0.83853, 1.04396, 1.10615, 0.97552, 0.94436, 0.97552, 0.88641, 0.80527, 0.96083, 1.00135, 1, 1.06777, 0.9817, 0.91142, 0.99361, 1.11144, 1.57293, 1.11144, 1.21237, 0.74627, 1.31818, 1.06585, 0.97042, 0.83055, 0.97042, 0.93503, 1.1261, 0.97042, 0.97922, 1.14236, 0.94552, 1.01054, 1.14236, 1.02471, 0.97922, 0.94165, 0.97042, 0.97042, 1.0276, 0.78929, 1.1261, 0.97922, 0.95874, 1.02197, 0.98507, 0.96752, 0.97168, 0.95107, 1.16579, 0.95107, 1.21237, 1.03959, 1.036, 1.036, 1, 1.036, 1.16579, 0.87357, 1.31818, 1.18754, 1.26781, 1.05356, 1.21237, 1.18622, 0.79487, 0.94994, 1.29004, 1.24047, 1.24047, 1.31818, 1, 0.91484, 0.9754, 1.31818, 1.1349, 1.24866, 1.05356, 1.13934, 1.15574, 1.17389, 0.73541, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.94385, 0.87897, 0.79429, 0.79429, 0.79429, 0.79429, 1.1406, 1.1406, 1.1406, 1.1406, 1.0426, 1.10615, 0.97552, 0.97552, 0.97552, 0.97552, 0.97552, 1.21237, 0.97552, 1.00135, 1.00135, 1.00135, 1.00135, 0.91142, 0.94436, 0.98721, 1.06585, 1.06585, 1.06585, 1.06585, 1.06585, 1.06585, 0.96705, 0.83055, 0.93503, 0.93503, 0.93503, 0.93503, 1.14236, 1.14236, 1.14236, 1.14236, 0.93125, 0.97922, 0.94165, 0.94165, 0.94165, 0.94165, 0.94165, 1.29004, 0.94165, 0.97922, 0.97922, 0.97922, 0.97922, 0.96752, 0.97042, 0.96752, 0.97363, 1.06585, 0.97363, 1.06585, 0.97363, 1.06585, 0.87897, 0.83055, 0.87897, 0.83055, 0.87897, 0.83055, 0.87897, 0.83055, 1.0426, 1.0033, 1.0426, 0.97042, 0.79429, 0.93503, 0.79429, 0.93503, 0.79429, 0.93503, 0.79429, 0.93503, 0.79429, 0.93503, 0.91149, 0.97042, 0.91149, 0.97042, 0.91149, 0.97042, 1, 1, 1.05815, 0.97922, 1.05815, 0.97922, 1.1406, 1.14236, 1.1406, 1.14236, 1.1406, 1.14236, 1.1406, 1.14236, 1.1406, 1.14236, 0.97441, 1.04302, 0.79631, 1.01582, 1, 1, 1.01054, 0.83853, 1.14236, 1, 1, 0.83853, 1.09125, 0.83853, 0.90418, 0.83853, 1.19508, 1.10615, 0.97922, 1, 1, 1.10615, 0.97922, 1.01034, 1.10466, 0.97922, 0.97552, 0.94165, 0.97552, 0.94165, 0.97552, 0.94165, 0.91602, 0.91981, 0.88641, 1.0276, 1, 1, 0.88641, 1.0276, 0.80527, 0.78929, 0.80527, 0.78929, 0.80527, 0.78929, 0.80527, 0.78929, 1, 1, 0.96083, 1.05403, 0.95923, 1.16862, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.06777, 1.02197, 0.91142, 0.96752, 0.91142, 0.99361, 0.97168, 0.99361, 0.97168, 0.99361, 0.97168, 1.23199, 1.036, 0.97363, 1.06585, 0.94385, 0.96705, 0.97552, 0.94165, 1, 1, 0.96083, 1.1261, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 0.95161, 1.27126, 1.00811, 0.83284, 0.77702, 0.99137, 0.95253, 1.0347, 0.86142, 1.07205, 1.14236, 0.97363, 0.89723, 0.86869, 1.09818, 0.79429, 0.99361, 1.05815, 0.97552, 1.1406, 0.90128, 1.06662, 1.04396, 1.10615, 0.84918, 0.97552, 1.04694, 0.94436, 0.98015, 0.96083, 0.91142, 1.00356, 0.9817, 1.01945, 0.98999, 1.1406, 0.91142, 1.04961, 0.9898, 1.00639, 1.14236, 1.07514, 1.04961, 0.99607, 1.02897, 1.008, 0.9898, 0.95134, 1.00639, 1.11121, 1.14236, 1.00518, 0.97981, 1.02186, 1, 1.08578, 0.94165, 0.99314, 0.98387, 0.93028, 0.93377, 1.35125, 1.07514, 1.10687, 0.93491, 1.04232, 1.00351, 1.14236, 1.07514, 0.94165, 1.07514, 1.00351, 0.79429, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.09097, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.93503, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.96609, 1, 1, 1, 1, 1, 1, 1.06777, 1.02197, 1.06777, 1.02197, 1.06777, 1.02197, 0.91142, 0.96752, 1, 1.21261, 0.89903, 1, 1, 0.75155, 1.04745, 1.04745, 1.04745, 1.04394, 0.98633, 0.98633, 0.98633, 0.72959, 0.72959, 1.20502, 0.91406, 1.26514, 1.222, 1.02956, 1.03372, 1.03372, 0.96039, 1.24633, 1, 1.09125, 0.93327, 1.03336, 1.16541, 1.036, 1, 1, 1, 0.771, 1, 1, 1.15574, 1.15574, 1.15574, 1.15574, 0.86364, 0.94434, 0.86279, 0.94434, 0.86224, 1, 1, 1.16798, 1, 0.96085, 0.90068, 1.21237, 1.18416, 1.13904, 0.69825, 0.9716, 2.10339, 1.29004, 1.29004, 1.21339, 1.29004, 1.29004, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.18775, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.13269, 1.13269, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  26024. const SegoeuiBoldItalicMetrics = {
  26025. lineHeight: 1.33008,
  26026. lineGap: 0
  26027. };
  26028. const SegoeuiItalicFactors = [1.76738, 1, 1, 0.98946, 1.14763, 1.05365, 1.06234, 0.96927, 0.92586, 1.15373, 1.18414, 0.91349, 0.91349, 1.07403, 1.17308, 0.78383, 1.20088, 0.78383, 1.42531, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.78383, 0.78383, 1.17308, 1.17308, 1.17308, 0.77349, 0.94565, 0.94729, 0.85944, 0.88506, 0.9858, 0.74817, 0.80016, 0.88449, 0.98039, 0.95782, 0.69238, 0.89898, 0.83231, 0.98183, 1.03989, 0.96924, 0.86237, 0.96924, 0.80595, 0.74524, 0.86091, 0.95402, 0.94143, 0.98448, 0.8858, 0.83089, 0.93285, 1.0949, 1.39016, 1.0949, 1.45994, 0.74627, 1.04839, 0.97454, 0.97454, 0.87207, 0.97454, 0.87533, 1.06151, 0.97454, 1.00176, 1.16484, 1.08132, 0.98047, 1.16484, 1.02989, 1.01054, 0.96225, 0.97454, 0.97454, 1.06598, 0.79004, 1.16344, 1.00351, 0.94629, 0.9973, 0.91016, 0.96777, 0.9043, 0.91082, 0.92481, 0.91082, 1.17308, 0.95748, 0.96927, 0.96927, 1, 0.96927, 0.92481, 0.80597, 1.04839, 1.23393, 1.1781, 0.9245, 1.17308, 1.20808, 0.63218, 0.94261, 1.24822, 1.09971, 1.09971, 1.04839, 1, 0.85273, 0.78032, 1.04839, 1.09971, 1.22326, 0.9245, 1.09836, 1.13525, 1.15222, 0.70424, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.85498, 0.88506, 0.74817, 0.74817, 0.74817, 0.74817, 0.95782, 0.95782, 0.95782, 0.95782, 0.9858, 1.03989, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 1.17308, 0.96924, 0.95402, 0.95402, 0.95402, 0.95402, 0.83089, 0.86237, 0.88409, 0.97454, 0.97454, 0.97454, 0.97454, 0.97454, 0.97454, 0.92916, 0.87207, 0.87533, 0.87533, 0.87533, 0.87533, 0.93146, 0.93146, 0.93146, 0.93146, 0.93854, 1.01054, 0.96225, 0.96225, 0.96225, 0.96225, 0.96225, 1.24822, 0.8761, 1.00351, 1.00351, 1.00351, 1.00351, 0.96777, 0.97454, 0.96777, 0.94729, 0.97454, 0.94729, 0.97454, 0.94729, 0.97454, 0.88506, 0.87207, 0.88506, 0.87207, 0.88506, 0.87207, 0.88506, 0.87207, 0.9858, 0.95391, 0.9858, 0.97454, 0.74817, 0.87533, 0.74817, 0.87533, 0.74817, 0.87533, 0.74817, 0.87533, 0.74817, 0.87533, 0.88449, 0.97454, 0.88449, 0.97454, 0.88449, 0.97454, 1, 1, 0.98039, 1.00176, 0.98039, 1.00176, 0.95782, 0.93146, 0.95782, 0.93146, 0.95782, 0.93146, 0.95782, 1.16484, 0.95782, 0.93146, 0.84421, 1.12761, 0.69238, 1.08132, 1, 1, 0.98047, 0.83231, 1.16484, 1, 1, 0.84723, 1.04861, 0.84723, 0.78755, 0.83231, 1.23736, 1.03989, 1.01054, 1, 1, 1.03989, 1.01054, 0.9857, 1.03849, 1.01054, 0.96924, 0.96225, 0.96924, 0.96225, 0.96924, 0.96225, 0.92383, 0.90171, 0.80595, 1.06598, 1, 1, 0.80595, 1.06598, 0.74524, 0.79004, 0.74524, 0.79004, 0.74524, 0.79004, 0.74524, 0.79004, 1, 1, 0.86091, 1.02759, 0.85771, 1.16344, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.98448, 0.9973, 0.83089, 0.96777, 0.83089, 0.93285, 0.9043, 0.93285, 0.9043, 0.93285, 0.9043, 1.31868, 0.96927, 0.94729, 0.97454, 0.85498, 0.92916, 0.96924, 0.8761, 1, 1, 0.86091, 1.16344, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 0.81965, 0.81965, 0.94729, 0.78032, 0.71022, 0.90883, 0.84171, 0.99877, 0.77596, 1.05734, 1.2, 0.94729, 0.85944, 0.82791, 0.9607, 0.74817, 0.93285, 0.98039, 0.96924, 0.95782, 0.89898, 0.98316, 0.98183, 1.03989, 0.78614, 0.96924, 0.97642, 0.86237, 0.86075, 0.86091, 0.83089, 0.90082, 0.8858, 0.97296, 1.01284, 0.95782, 0.83089, 1.0976, 1.04, 1.03342, 1.2, 1.0675, 1.0976, 0.98205, 1.03809, 1.05097, 1.04, 0.95364, 1.03342, 1.05401, 1.2, 1.02148, 1.0119, 1.04724, 1.0127, 1.02732, 0.96225, 0.8965, 0.97783, 0.93574, 0.94818, 1.30679, 1.0675, 1.11826, 0.99821, 1.0557, 1.0326, 1.2, 1.0675, 0.96225, 1.0675, 1.0326, 0.74817, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.03754, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.87533, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.98705, 1, 1, 1, 1, 1, 1, 0.98448, 0.9973, 0.98448, 0.9973, 0.98448, 0.9973, 0.83089, 0.96777, 1, 1.20088, 0.89903, 1, 1, 0.75155, 0.94945, 0.94945, 0.94945, 0.94945, 1.12317, 1.12317, 1.12317, 0.67603, 0.67603, 1.15621, 0.73584, 1.21191, 1.22135, 1.06483, 0.94868, 0.94868, 0.95996, 1.24633, 1, 1.07497, 0.87709, 0.96927, 1.01473, 0.96927, 1, 1, 1, 0.77295, 1, 1, 1.09836, 1.09836, 1.09836, 1.01522, 0.86321, 0.94434, 0.8649, 0.94434, 0.86182, 1, 1, 1.083, 1, 0.91578, 0.86438, 1.17308, 1.18416, 1.14589, 0.69825, 0.97622, 1.96791, 1.24822, 1.24822, 1.17308, 1.24822, 1.24822, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.17984, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.10742, 1.10742, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  26029. const SegoeuiItalicMetrics = {
  26030. lineHeight: 1.33008,
  26031. lineGap: 0
  26032. };
  26033. const SegoeuiRegularFactors = [1.76738, 1, 1, 0.98594, 1.02285, 1.10454, 1.06234, 0.96927, 0.92037, 1.19985, 1.2046, 0.90616, 0.90616, 1.07152, 1.1714, 0.78032, 1.20088, 0.78032, 1.40246, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.78032, 0.78032, 1.1714, 1.1714, 1.1714, 0.80597, 0.94084, 0.96706, 0.85944, 0.85734, 0.97093, 0.75842, 0.79936, 0.88198, 0.9831, 0.95782, 0.71387, 0.86969, 0.84636, 1.07796, 1.03584, 0.96924, 0.83968, 0.96924, 0.82826, 0.79649, 0.85771, 0.95132, 0.93119, 0.98965, 0.88433, 0.8287, 0.93365, 1.08612, 1.3638, 1.08612, 1.45786, 0.74627, 0.80499, 0.91484, 1.05707, 0.92383, 1.05882, 0.9403, 1.12654, 1.05882, 1.01756, 1.09011, 1.09011, 0.99414, 1.09011, 1.034, 1.01756, 1.05356, 1.05707, 1.05882, 1.04399, 0.84863, 1.21968, 1.01756, 0.95801, 1.00068, 0.91797, 0.96777, 0.9043, 0.90351, 0.92105, 0.90351, 1.1714, 0.85337, 0.96927, 0.96927, 0.99912, 0.96927, 0.92105, 0.80597, 1.2434, 1.20808, 1.05937, 0.90957, 1.1714, 1.20808, 0.75155, 0.94261, 1.24644, 1.09971, 1.09971, 0.84751, 1, 0.85273, 0.78032, 0.61584, 1.05425, 1.17914, 0.90957, 1.08665, 1.11593, 1.14169, 0.73381, 0.96706, 0.96706, 0.96706, 0.96706, 0.96706, 0.96706, 0.86035, 0.85734, 0.75842, 0.75842, 0.75842, 0.75842, 0.95782, 0.95782, 0.95782, 0.95782, 0.97093, 1.03584, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 1.1714, 0.96924, 0.95132, 0.95132, 0.95132, 0.95132, 0.8287, 0.83968, 0.89049, 0.91484, 0.91484, 0.91484, 0.91484, 0.91484, 0.91484, 0.93575, 0.92383, 0.9403, 0.9403, 0.9403, 0.9403, 0.8717, 0.8717, 0.8717, 0.8717, 1.00527, 1.01756, 1.05356, 1.05356, 1.05356, 1.05356, 1.05356, 1.24644, 0.95923, 1.01756, 1.01756, 1.01756, 1.01756, 0.96777, 1.05707, 0.96777, 0.96706, 0.91484, 0.96706, 0.91484, 0.96706, 0.91484, 0.85734, 0.92383, 0.85734, 0.92383, 0.85734, 0.92383, 0.85734, 0.92383, 0.97093, 1.0969, 0.97093, 1.05882, 0.75842, 0.9403, 0.75842, 0.9403, 0.75842, 0.9403, 0.75842, 0.9403, 0.75842, 0.9403, 0.88198, 1.05882, 0.88198, 1.05882, 0.88198, 1.05882, 1, 1, 0.9831, 1.01756, 0.9831, 1.01756, 0.95782, 0.8717, 0.95782, 0.8717, 0.95782, 0.8717, 0.95782, 1.09011, 0.95782, 0.8717, 0.84784, 1.11551, 0.71387, 1.09011, 1, 1, 0.99414, 0.84636, 1.09011, 1, 1, 0.84636, 1.0536, 0.84636, 0.94298, 0.84636, 1.23297, 1.03584, 1.01756, 1, 1, 1.03584, 1.01756, 1.00323, 1.03444, 1.01756, 0.96924, 1.05356, 0.96924, 1.05356, 0.96924, 1.05356, 0.93066, 0.98293, 0.82826, 1.04399, 1, 1, 0.82826, 1.04399, 0.79649, 0.84863, 0.79649, 0.84863, 0.79649, 0.84863, 0.79649, 0.84863, 1, 1, 0.85771, 1.17318, 0.85771, 1.21968, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.98965, 1.00068, 0.8287, 0.96777, 0.8287, 0.93365, 0.9043, 0.93365, 0.9043, 0.93365, 0.9043, 1.08571, 0.96927, 0.96706, 0.91484, 0.86035, 0.93575, 0.96924, 0.95923, 1, 1, 0.85771, 1.21968, 1.11437, 1.11437, 0.93109, 0.91202, 0.60411, 0.84164, 0.55572, 1.01173, 0.97361, 0.81818, 0.81818, 0.96635, 0.78032, 0.72727, 0.92366, 0.98601, 1.03405, 0.77968, 1.09799, 1.2, 0.96706, 0.85944, 0.85638, 0.96491, 0.75842, 0.93365, 0.9831, 0.96924, 0.95782, 0.86969, 0.94152, 1.07796, 1.03584, 0.78437, 0.96924, 0.98715, 0.83968, 0.83491, 0.85771, 0.8287, 0.94492, 0.88433, 0.9287, 1.0098, 0.95782, 0.8287, 1.0625, 0.98248, 1.03424, 1.2, 1.01071, 1.0625, 0.95246, 1.03809, 1.04912, 0.98248, 1.00221, 1.03424, 1.05443, 1.2, 1.04785, 0.99609, 1.00169, 1.05176, 0.99346, 1.05356, 0.9087, 1.03004, 0.95542, 0.93117, 1.23362, 1.01071, 1.07831, 1.02512, 1.05205, 1.03502, 1.2, 1.01071, 1.05356, 1.01071, 1.03502, 0.75842, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.03719, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9403, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.04021, 1, 1, 1, 1, 1, 1, 0.98965, 1.00068, 0.98965, 1.00068, 0.98965, 1.00068, 0.8287, 0.96777, 1, 1.20088, 0.89903, 1, 1, 0.75155, 1.03077, 1.03077, 1.03077, 1.03077, 1.13196, 1.13196, 1.13196, 0.67428, 0.67428, 1.16039, 0.73291, 1.20996, 1.22135, 1.06483, 0.94868, 0.94868, 0.95996, 1.24633, 1, 1.07497, 0.87796, 0.96927, 1.01518, 0.96927, 1, 1, 1, 0.77295, 1, 1, 1.10539, 1.10539, 1.11358, 1.06967, 0.86279, 0.94434, 0.86279, 0.94434, 0.86182, 1, 1, 1.083, 1, 0.91578, 0.86507, 1.1714, 1.18416, 1.14589, 0.69825, 0.97622, 1.9697, 1.24822, 1.24822, 1.17238, 1.24822, 1.24822, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.18083, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.10938, 1.10938, 1, 1, 1, 1.05425, 1.09971, 1.09971, 1.09971, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  26034. const SegoeuiRegularMetrics = {
  26035. lineHeight: 1.33008,
  26036. lineGap: 0
  26037. };
  26038. ;// ./src/core/xfa_fonts.js
  26039. const getXFAFontMap = getLookupTableFactory(function (t) {
  26040. t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = {
  26041. name: "LiberationSans-Regular",
  26042. factors: MyriadProRegularFactors,
  26043. baseWidths: LiberationSansRegularWidths,
  26044. baseMapping: LiberationSansRegularMapping,
  26045. metrics: MyriadProRegularMetrics
  26046. };
  26047. t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = {
  26048. name: "LiberationSans-Bold",
  26049. factors: MyriadProBoldFactors,
  26050. baseWidths: LiberationSansBoldWidths,
  26051. baseMapping: LiberationSansBoldMapping,
  26052. metrics: MyriadProBoldMetrics
  26053. };
  26054. t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = {
  26055. name: "LiberationSans-Italic",
  26056. factors: MyriadProItalicFactors,
  26057. baseWidths: LiberationSansItalicWidths,
  26058. baseMapping: LiberationSansItalicMapping,
  26059. metrics: MyriadProItalicMetrics
  26060. };
  26061. t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = {
  26062. name: "LiberationSans-BoldItalic",
  26063. factors: MyriadProBoldItalicFactors,
  26064. baseWidths: LiberationSansBoldItalicWidths,
  26065. baseMapping: LiberationSansBoldItalicMapping,
  26066. metrics: MyriadProBoldItalicMetrics
  26067. };
  26068. t.ArialMT = t.Arial = t["Arial-Regular"] = {
  26069. name: "LiberationSans-Regular",
  26070. baseWidths: LiberationSansRegularWidths,
  26071. baseMapping: LiberationSansRegularMapping
  26072. };
  26073. t["Arial-BoldMT"] = t["Arial-Bold"] = {
  26074. name: "LiberationSans-Bold",
  26075. baseWidths: LiberationSansBoldWidths,
  26076. baseMapping: LiberationSansBoldMapping
  26077. };
  26078. t["Arial-ItalicMT"] = t["Arial-Italic"] = {
  26079. name: "LiberationSans-Italic",
  26080. baseWidths: LiberationSansItalicWidths,
  26081. baseMapping: LiberationSansItalicMapping
  26082. };
  26083. t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = {
  26084. name: "LiberationSans-BoldItalic",
  26085. baseWidths: LiberationSansBoldItalicWidths,
  26086. baseMapping: LiberationSansBoldItalicMapping
  26087. };
  26088. t["Calibri-Regular"] = {
  26089. name: "LiberationSans-Regular",
  26090. factors: CalibriRegularFactors,
  26091. baseWidths: LiberationSansRegularWidths,
  26092. baseMapping: LiberationSansRegularMapping,
  26093. metrics: CalibriRegularMetrics
  26094. };
  26095. t["Calibri-Bold"] = {
  26096. name: "LiberationSans-Bold",
  26097. factors: CalibriBoldFactors,
  26098. baseWidths: LiberationSansBoldWidths,
  26099. baseMapping: LiberationSansBoldMapping,
  26100. metrics: CalibriBoldMetrics
  26101. };
  26102. t["Calibri-Italic"] = {
  26103. name: "LiberationSans-Italic",
  26104. factors: CalibriItalicFactors,
  26105. baseWidths: LiberationSansItalicWidths,
  26106. baseMapping: LiberationSansItalicMapping,
  26107. metrics: CalibriItalicMetrics
  26108. };
  26109. t["Calibri-BoldItalic"] = {
  26110. name: "LiberationSans-BoldItalic",
  26111. factors: CalibriBoldItalicFactors,
  26112. baseWidths: LiberationSansBoldItalicWidths,
  26113. baseMapping: LiberationSansBoldItalicMapping,
  26114. metrics: CalibriBoldItalicMetrics
  26115. };
  26116. t["Segoeui-Regular"] = {
  26117. name: "LiberationSans-Regular",
  26118. factors: SegoeuiRegularFactors,
  26119. baseWidths: LiberationSansRegularWidths,
  26120. baseMapping: LiberationSansRegularMapping,
  26121. metrics: SegoeuiRegularMetrics
  26122. };
  26123. t["Segoeui-Bold"] = {
  26124. name: "LiberationSans-Bold",
  26125. factors: SegoeuiBoldFactors,
  26126. baseWidths: LiberationSansBoldWidths,
  26127. baseMapping: LiberationSansBoldMapping,
  26128. metrics: SegoeuiBoldMetrics
  26129. };
  26130. t["Segoeui-Italic"] = {
  26131. name: "LiberationSans-Italic",
  26132. factors: SegoeuiItalicFactors,
  26133. baseWidths: LiberationSansItalicWidths,
  26134. baseMapping: LiberationSansItalicMapping,
  26135. metrics: SegoeuiItalicMetrics
  26136. };
  26137. t["Segoeui-BoldItalic"] = {
  26138. name: "LiberationSans-BoldItalic",
  26139. factors: SegoeuiBoldItalicFactors,
  26140. baseWidths: LiberationSansBoldItalicWidths,
  26141. baseMapping: LiberationSansBoldItalicMapping,
  26142. metrics: SegoeuiBoldItalicMetrics
  26143. };
  26144. t["Helvetica-Regular"] = t.Helvetica = {
  26145. name: "LiberationSans-Regular",
  26146. factors: HelveticaRegularFactors,
  26147. baseWidths: LiberationSansRegularWidths,
  26148. baseMapping: LiberationSansRegularMapping,
  26149. metrics: HelveticaRegularMetrics
  26150. };
  26151. t["Helvetica-Bold"] = {
  26152. name: "LiberationSans-Bold",
  26153. factors: HelveticaBoldFactors,
  26154. baseWidths: LiberationSansBoldWidths,
  26155. baseMapping: LiberationSansBoldMapping,
  26156. metrics: HelveticaBoldMetrics
  26157. };
  26158. t["Helvetica-Italic"] = {
  26159. name: "LiberationSans-Italic",
  26160. factors: HelveticaItalicFactors,
  26161. baseWidths: LiberationSansItalicWidths,
  26162. baseMapping: LiberationSansItalicMapping,
  26163. metrics: HelveticaItalicMetrics
  26164. };
  26165. t["Helvetica-BoldItalic"] = {
  26166. name: "LiberationSans-BoldItalic",
  26167. factors: HelveticaBoldItalicFactors,
  26168. baseWidths: LiberationSansBoldItalicWidths,
  26169. baseMapping: LiberationSansBoldItalicMapping,
  26170. metrics: HelveticaBoldItalicMetrics
  26171. };
  26172. });
  26173. function getXfaFontName(name) {
  26174. const fontName = normalizeFontName(name);
  26175. const fontMap = getXFAFontMap();
  26176. return fontMap[fontName];
  26177. }
  26178. function getXfaFontWidths(name) {
  26179. const info = getXfaFontName(name);
  26180. if (!info) {
  26181. return null;
  26182. }
  26183. const {
  26184. baseWidths,
  26185. baseMapping,
  26186. factors
  26187. } = info;
  26188. const rescaledBaseWidths = !factors ? baseWidths : baseWidths.map((w, i) => w * factors[i]);
  26189. let currentCode = -2;
  26190. let currentArray;
  26191. const newWidths = [];
  26192. for (const [unicode, glyphIndex] of baseMapping.map((charUnicode, index) => [charUnicode, index]).sort(([unicode1], [unicode2]) => unicode1 - unicode2)) {
  26193. if (unicode === -1) {
  26194. continue;
  26195. }
  26196. if (unicode === currentCode + 1) {
  26197. currentArray.push(rescaledBaseWidths[glyphIndex]);
  26198. currentCode += 1;
  26199. } else {
  26200. currentCode = unicode;
  26201. currentArray = [rescaledBaseWidths[glyphIndex]];
  26202. newWidths.push(unicode, currentArray);
  26203. }
  26204. }
  26205. return newWidths;
  26206. }
  26207. function getXfaFontDict(name) {
  26208. const widths = getXfaFontWidths(name);
  26209. const dict = new Dict(null);
  26210. dict.set("BaseFont", Name.get(name));
  26211. dict.set("Type", Name.get("Font"));
  26212. dict.set("Subtype", Name.get("CIDFontType2"));
  26213. dict.set("Encoding", Name.get("Identity-H"));
  26214. dict.set("CIDToGIDMap", Name.get("Identity"));
  26215. dict.set("W", widths);
  26216. dict.set("FirstChar", widths[0]);
  26217. dict.set("LastChar", widths.at(-2) + widths.at(-1).length - 1);
  26218. const descriptor = new Dict(null);
  26219. dict.set("FontDescriptor", descriptor);
  26220. const systemInfo = new Dict(null);
  26221. systemInfo.set("Ordering", "Identity");
  26222. systemInfo.set("Registry", "Adobe");
  26223. systemInfo.set("Supplement", 0);
  26224. dict.set("CIDSystemInfo", systemInfo);
  26225. return dict;
  26226. }
  26227. ;// ./src/core/ps_parser.js
  26228. class PostScriptParser {
  26229. constructor(lexer) {
  26230. this.lexer = lexer;
  26231. this.operators = [];
  26232. this.token = null;
  26233. this.prev = null;
  26234. }
  26235. nextToken() {
  26236. this.prev = this.token;
  26237. this.token = this.lexer.getToken();
  26238. }
  26239. accept(type) {
  26240. if (this.token.type === type) {
  26241. this.nextToken();
  26242. return true;
  26243. }
  26244. return false;
  26245. }
  26246. expect(type) {
  26247. if (this.accept(type)) {
  26248. return true;
  26249. }
  26250. throw new FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
  26251. }
  26252. parse() {
  26253. this.nextToken();
  26254. this.expect(PostScriptTokenTypes.LBRACE);
  26255. this.parseBlock();
  26256. this.expect(PostScriptTokenTypes.RBRACE);
  26257. return this.operators;
  26258. }
  26259. parseBlock() {
  26260. while (true) {
  26261. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  26262. this.operators.push(this.prev.value);
  26263. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  26264. this.operators.push(this.prev.value);
  26265. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  26266. this.parseCondition();
  26267. } else {
  26268. return;
  26269. }
  26270. }
  26271. }
  26272. parseCondition() {
  26273. const conditionLocation = this.operators.length;
  26274. this.operators.push(null, null);
  26275. this.parseBlock();
  26276. this.expect(PostScriptTokenTypes.RBRACE);
  26277. if (this.accept(PostScriptTokenTypes.IF)) {
  26278. this.operators[conditionLocation] = this.operators.length;
  26279. this.operators[conditionLocation + 1] = "jz";
  26280. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  26281. const jumpLocation = this.operators.length;
  26282. this.operators.push(null, null);
  26283. const endOfTrue = this.operators.length;
  26284. this.parseBlock();
  26285. this.expect(PostScriptTokenTypes.RBRACE);
  26286. this.expect(PostScriptTokenTypes.IFELSE);
  26287. this.operators[jumpLocation] = this.operators.length;
  26288. this.operators[jumpLocation + 1] = "j";
  26289. this.operators[conditionLocation] = endOfTrue;
  26290. this.operators[conditionLocation + 1] = "jz";
  26291. } else {
  26292. throw new FormatError("PS Function: error parsing conditional.");
  26293. }
  26294. }
  26295. }
  26296. const PostScriptTokenTypes = {
  26297. LBRACE: 0,
  26298. RBRACE: 1,
  26299. NUMBER: 2,
  26300. OPERATOR: 3,
  26301. IF: 4,
  26302. IFELSE: 5
  26303. };
  26304. class PostScriptToken {
  26305. static get opCache() {
  26306. return shadow(this, "opCache", Object.create(null));
  26307. }
  26308. constructor(type, value) {
  26309. this.type = type;
  26310. this.value = value;
  26311. }
  26312. static getOperator(op) {
  26313. return PostScriptToken.opCache[op] ||= new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  26314. }
  26315. static get LBRACE() {
  26316. return shadow(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
  26317. }
  26318. static get RBRACE() {
  26319. return shadow(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
  26320. }
  26321. static get IF() {
  26322. return shadow(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
  26323. }
  26324. static get IFELSE() {
  26325. return shadow(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
  26326. }
  26327. }
  26328. class PostScriptLexer {
  26329. constructor(stream) {
  26330. this.stream = stream;
  26331. this.nextChar();
  26332. this.strBuf = [];
  26333. }
  26334. nextChar() {
  26335. return this.currentChar = this.stream.getByte();
  26336. }
  26337. getToken() {
  26338. let comment = false;
  26339. let ch = this.currentChar;
  26340. while (true) {
  26341. if (ch < 0) {
  26342. return EOF;
  26343. }
  26344. if (comment) {
  26345. if (ch === 0x0a || ch === 0x0d) {
  26346. comment = false;
  26347. }
  26348. } else if (ch === 0x25) {
  26349. comment = true;
  26350. } else if (!isWhiteSpace(ch)) {
  26351. break;
  26352. }
  26353. ch = this.nextChar();
  26354. }
  26355. switch (ch | 0) {
  26356. case 0x30:
  26357. case 0x31:
  26358. case 0x32:
  26359. case 0x33:
  26360. case 0x34:
  26361. case 0x35:
  26362. case 0x36:
  26363. case 0x37:
  26364. case 0x38:
  26365. case 0x39:
  26366. case 0x2b:
  26367. case 0x2d:
  26368. case 0x2e:
  26369. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  26370. case 0x7b:
  26371. this.nextChar();
  26372. return PostScriptToken.LBRACE;
  26373. case 0x7d:
  26374. this.nextChar();
  26375. return PostScriptToken.RBRACE;
  26376. }
  26377. const strBuf = this.strBuf;
  26378. strBuf.length = 0;
  26379. strBuf[0] = String.fromCharCode(ch);
  26380. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
  26381. strBuf.push(String.fromCharCode(ch));
  26382. }
  26383. const str = strBuf.join("");
  26384. switch (str.toLowerCase()) {
  26385. case "if":
  26386. return PostScriptToken.IF;
  26387. case "ifelse":
  26388. return PostScriptToken.IFELSE;
  26389. default:
  26390. return PostScriptToken.getOperator(str);
  26391. }
  26392. }
  26393. getNumber() {
  26394. let ch = this.currentChar;
  26395. const strBuf = this.strBuf;
  26396. strBuf.length = 0;
  26397. strBuf[0] = String.fromCharCode(ch);
  26398. while ((ch = this.nextChar()) >= 0) {
  26399. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
  26400. strBuf.push(String.fromCharCode(ch));
  26401. } else {
  26402. break;
  26403. }
  26404. }
  26405. const value = parseFloat(strBuf.join(""));
  26406. if (isNaN(value)) {
  26407. throw new FormatError(`Invalid floating point number: ${value}`);
  26408. }
  26409. return value;
  26410. }
  26411. }
  26412. ;// ./src/core/image_utils.js
  26413. class BaseLocalCache {
  26414. constructor(options) {
  26415. this._onlyRefs = options?.onlyRefs === true;
  26416. if (!this._onlyRefs) {
  26417. this._nameRefMap = new Map();
  26418. this._imageMap = new Map();
  26419. }
  26420. this._imageCache = new RefSetCache();
  26421. }
  26422. getByName(name) {
  26423. if (this._onlyRefs) {
  26424. unreachable("Should not call `getByName` method.");
  26425. }
  26426. const ref = this._nameRefMap.get(name);
  26427. if (ref) {
  26428. return this.getByRef(ref);
  26429. }
  26430. return this._imageMap.get(name) || null;
  26431. }
  26432. getByRef(ref) {
  26433. return this._imageCache.get(ref) || null;
  26434. }
  26435. set(name, ref, data) {
  26436. unreachable("Abstract method `set` called.");
  26437. }
  26438. }
  26439. class LocalImageCache extends BaseLocalCache {
  26440. set(name, ref = null, data) {
  26441. if (typeof name !== "string") {
  26442. throw new Error('LocalImageCache.set - expected "name" argument.');
  26443. }
  26444. if (ref) {
  26445. if (this._imageCache.has(ref)) {
  26446. return;
  26447. }
  26448. this._nameRefMap.set(name, ref);
  26449. this._imageCache.put(ref, data);
  26450. return;
  26451. }
  26452. if (this._imageMap.has(name)) {
  26453. return;
  26454. }
  26455. this._imageMap.set(name, data);
  26456. }
  26457. }
  26458. class LocalColorSpaceCache extends BaseLocalCache {
  26459. set(name = null, ref = null, data) {
  26460. if (typeof name !== "string" && !ref) {
  26461. throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');
  26462. }
  26463. if (ref) {
  26464. if (this._imageCache.has(ref)) {
  26465. return;
  26466. }
  26467. if (name !== null) {
  26468. this._nameRefMap.set(name, ref);
  26469. }
  26470. this._imageCache.put(ref, data);
  26471. return;
  26472. }
  26473. if (this._imageMap.has(name)) {
  26474. return;
  26475. }
  26476. this._imageMap.set(name, data);
  26477. }
  26478. }
  26479. class LocalFunctionCache extends BaseLocalCache {
  26480. constructor(options) {
  26481. super({
  26482. onlyRefs: true
  26483. });
  26484. }
  26485. set(name = null, ref, data) {
  26486. if (!ref) {
  26487. throw new Error('LocalFunctionCache.set - expected "ref" argument.');
  26488. }
  26489. if (this._imageCache.has(ref)) {
  26490. return;
  26491. }
  26492. this._imageCache.put(ref, data);
  26493. }
  26494. }
  26495. class LocalGStateCache extends BaseLocalCache {
  26496. set(name, ref = null, data) {
  26497. if (typeof name !== "string") {
  26498. throw new Error('LocalGStateCache.set - expected "name" argument.');
  26499. }
  26500. if (ref) {
  26501. if (this._imageCache.has(ref)) {
  26502. return;
  26503. }
  26504. this._nameRefMap.set(name, ref);
  26505. this._imageCache.put(ref, data);
  26506. return;
  26507. }
  26508. if (this._imageMap.has(name)) {
  26509. return;
  26510. }
  26511. this._imageMap.set(name, data);
  26512. }
  26513. }
  26514. class LocalTilingPatternCache extends BaseLocalCache {
  26515. constructor(options) {
  26516. super({
  26517. onlyRefs: true
  26518. });
  26519. }
  26520. set(name = null, ref, data) {
  26521. if (!ref) {
  26522. throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');
  26523. }
  26524. if (this._imageCache.has(ref)) {
  26525. return;
  26526. }
  26527. this._imageCache.put(ref, data);
  26528. }
  26529. }
  26530. class RegionalImageCache extends BaseLocalCache {
  26531. constructor(options) {
  26532. super({
  26533. onlyRefs: true
  26534. });
  26535. }
  26536. set(name = null, ref, data) {
  26537. if (!ref) {
  26538. throw new Error('RegionalImageCache.set - expected "ref" argument.');
  26539. }
  26540. if (this._imageCache.has(ref)) {
  26541. return;
  26542. }
  26543. this._imageCache.put(ref, data);
  26544. }
  26545. }
  26546. class GlobalImageCache {
  26547. static NUM_PAGES_THRESHOLD = 2;
  26548. static MIN_IMAGES_TO_CACHE = 10;
  26549. static MAX_BYTE_SIZE = 5 * MAX_IMAGE_SIZE_TO_CACHE;
  26550. #decodeFailedSet = new RefSet();
  26551. constructor() {
  26552. this._refCache = new RefSetCache();
  26553. this._imageCache = new RefSetCache();
  26554. }
  26555. get #byteSize() {
  26556. let byteSize = 0;
  26557. for (const imageData of this._imageCache) {
  26558. byteSize += imageData.byteSize;
  26559. }
  26560. return byteSize;
  26561. }
  26562. get #cacheLimitReached() {
  26563. if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) {
  26564. return false;
  26565. }
  26566. if (this.#byteSize < GlobalImageCache.MAX_BYTE_SIZE) {
  26567. return false;
  26568. }
  26569. return true;
  26570. }
  26571. shouldCache(ref, pageIndex) {
  26572. let pageIndexSet = this._refCache.get(ref);
  26573. if (!pageIndexSet) {
  26574. pageIndexSet = new Set();
  26575. this._refCache.put(ref, pageIndexSet);
  26576. }
  26577. pageIndexSet.add(pageIndex);
  26578. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  26579. return false;
  26580. }
  26581. if (!this._imageCache.has(ref) && this.#cacheLimitReached) {
  26582. return false;
  26583. }
  26584. return true;
  26585. }
  26586. addDecodeFailed(ref) {
  26587. this.#decodeFailedSet.put(ref);
  26588. }
  26589. hasDecodeFailed(ref) {
  26590. return this.#decodeFailedSet.has(ref);
  26591. }
  26592. addByteSize(ref, byteSize) {
  26593. const imageData = this._imageCache.get(ref);
  26594. if (!imageData) {
  26595. return;
  26596. }
  26597. if (imageData.byteSize) {
  26598. return;
  26599. }
  26600. imageData.byteSize = byteSize;
  26601. }
  26602. getData(ref, pageIndex) {
  26603. const pageIndexSet = this._refCache.get(ref);
  26604. if (!pageIndexSet) {
  26605. return null;
  26606. }
  26607. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  26608. return null;
  26609. }
  26610. const imageData = this._imageCache.get(ref);
  26611. if (!imageData) {
  26612. return null;
  26613. }
  26614. pageIndexSet.add(pageIndex);
  26615. return imageData;
  26616. }
  26617. setData(ref, data) {
  26618. if (!this._refCache.has(ref)) {
  26619. throw new Error('GlobalImageCache.setData - expected "shouldCache" to have been called.');
  26620. }
  26621. if (this._imageCache.has(ref)) {
  26622. return;
  26623. }
  26624. if (this.#cacheLimitReached) {
  26625. warn("GlobalImageCache.setData - cache limit reached.");
  26626. return;
  26627. }
  26628. this._imageCache.put(ref, data);
  26629. }
  26630. clear(onlyData = false) {
  26631. if (!onlyData) {
  26632. this.#decodeFailedSet.clear();
  26633. this._refCache.clear();
  26634. }
  26635. this._imageCache.clear();
  26636. }
  26637. }
  26638. ;// ./src/core/function.js
  26639. class PDFFunctionFactory {
  26640. constructor({
  26641. xref,
  26642. isEvalSupported = true
  26643. }) {
  26644. this.xref = xref;
  26645. this.isEvalSupported = isEvalSupported !== false;
  26646. }
  26647. create(fn) {
  26648. const cachedFunction = this.getCached(fn);
  26649. if (cachedFunction) {
  26650. return cachedFunction;
  26651. }
  26652. const parsedFunction = PDFFunction.parse({
  26653. xref: this.xref,
  26654. isEvalSupported: this.isEvalSupported,
  26655. fn: fn instanceof Ref ? this.xref.fetch(fn) : fn
  26656. });
  26657. this._cache(fn, parsedFunction);
  26658. return parsedFunction;
  26659. }
  26660. createFromArray(fnObj) {
  26661. const cachedFunction = this.getCached(fnObj);
  26662. if (cachedFunction) {
  26663. return cachedFunction;
  26664. }
  26665. const parsedFunction = PDFFunction.parseArray({
  26666. xref: this.xref,
  26667. isEvalSupported: this.isEvalSupported,
  26668. fnObj: fnObj instanceof Ref ? this.xref.fetch(fnObj) : fnObj
  26669. });
  26670. this._cache(fnObj, parsedFunction);
  26671. return parsedFunction;
  26672. }
  26673. getCached(cacheKey) {
  26674. let fnRef;
  26675. if (cacheKey instanceof Ref) {
  26676. fnRef = cacheKey;
  26677. } else if (cacheKey instanceof Dict) {
  26678. fnRef = cacheKey.objId;
  26679. } else if (cacheKey instanceof BaseStream) {
  26680. fnRef = cacheKey.dict?.objId;
  26681. }
  26682. if (fnRef) {
  26683. const localFunction = this._localFunctionCache.getByRef(fnRef);
  26684. if (localFunction) {
  26685. return localFunction;
  26686. }
  26687. }
  26688. return null;
  26689. }
  26690. _cache(cacheKey, parsedFunction) {
  26691. if (!parsedFunction) {
  26692. throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.');
  26693. }
  26694. let fnRef;
  26695. if (cacheKey instanceof Ref) {
  26696. fnRef = cacheKey;
  26697. } else if (cacheKey instanceof Dict) {
  26698. fnRef = cacheKey.objId;
  26699. } else if (cacheKey instanceof BaseStream) {
  26700. fnRef = cacheKey.dict?.objId;
  26701. }
  26702. if (fnRef) {
  26703. this._localFunctionCache.set(null, fnRef, parsedFunction);
  26704. }
  26705. }
  26706. get _localFunctionCache() {
  26707. return shadow(this, "_localFunctionCache", new LocalFunctionCache());
  26708. }
  26709. }
  26710. function toNumberArray(arr) {
  26711. if (!Array.isArray(arr)) {
  26712. return null;
  26713. }
  26714. if (!isNumberArray(arr, null)) {
  26715. return arr.map(x => +x);
  26716. }
  26717. return arr;
  26718. }
  26719. class PDFFunction {
  26720. static getSampleArray(size, outputSize, bps, stream) {
  26721. let i, ii;
  26722. let length = 1;
  26723. for (i = 0, ii = size.length; i < ii; i++) {
  26724. length *= size[i];
  26725. }
  26726. length *= outputSize;
  26727. const array = new Array(length);
  26728. let codeSize = 0;
  26729. let codeBuf = 0;
  26730. const sampleMul = 1.0 / (2.0 ** bps - 1);
  26731. const strBytes = stream.getBytes((length * bps + 7) / 8);
  26732. let strIdx = 0;
  26733. for (i = 0; i < length; i++) {
  26734. while (codeSize < bps) {
  26735. codeBuf <<= 8;
  26736. codeBuf |= strBytes[strIdx++];
  26737. codeSize += 8;
  26738. }
  26739. codeSize -= bps;
  26740. array[i] = (codeBuf >> codeSize) * sampleMul;
  26741. codeBuf &= (1 << codeSize) - 1;
  26742. }
  26743. return array;
  26744. }
  26745. static parse({
  26746. xref,
  26747. isEvalSupported,
  26748. fn
  26749. }) {
  26750. const dict = fn.dict || fn;
  26751. const typeNum = dict.get("FunctionType");
  26752. switch (typeNum) {
  26753. case 0:
  26754. return this.constructSampled({
  26755. xref,
  26756. isEvalSupported,
  26757. fn,
  26758. dict
  26759. });
  26760. case 1:
  26761. break;
  26762. case 2:
  26763. return this.constructInterpolated({
  26764. xref,
  26765. isEvalSupported,
  26766. dict
  26767. });
  26768. case 3:
  26769. return this.constructStiched({
  26770. xref,
  26771. isEvalSupported,
  26772. dict
  26773. });
  26774. case 4:
  26775. return this.constructPostScript({
  26776. xref,
  26777. isEvalSupported,
  26778. fn,
  26779. dict
  26780. });
  26781. }
  26782. throw new FormatError("Unknown type of function");
  26783. }
  26784. static parseArray({
  26785. xref,
  26786. isEvalSupported,
  26787. fnObj
  26788. }) {
  26789. if (!Array.isArray(fnObj)) {
  26790. return this.parse({
  26791. xref,
  26792. isEvalSupported,
  26793. fn: fnObj
  26794. });
  26795. }
  26796. const fnArray = [];
  26797. for (const fn of fnObj) {
  26798. fnArray.push(this.parse({
  26799. xref,
  26800. isEvalSupported,
  26801. fn: xref.fetchIfRef(fn)
  26802. }));
  26803. }
  26804. return function (src, srcOffset, dest, destOffset) {
  26805. for (let i = 0, ii = fnArray.length; i < ii; i++) {
  26806. fnArray[i](src, srcOffset, dest, destOffset + i);
  26807. }
  26808. };
  26809. }
  26810. static constructSampled({
  26811. xref,
  26812. isEvalSupported,
  26813. fn,
  26814. dict
  26815. }) {
  26816. function toMultiArray(arr) {
  26817. const inputLength = arr.length;
  26818. const out = [];
  26819. let index = 0;
  26820. for (let i = 0; i < inputLength; i += 2) {
  26821. out[index++] = [arr[i], arr[i + 1]];
  26822. }
  26823. return out;
  26824. }
  26825. function interpolate(x, xmin, xmax, ymin, ymax) {
  26826. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  26827. }
  26828. let domain = toNumberArray(dict.getArray("Domain"));
  26829. let range = toNumberArray(dict.getArray("Range"));
  26830. if (!domain || !range) {
  26831. throw new FormatError("No domain or range");
  26832. }
  26833. const inputSize = domain.length / 2;
  26834. const outputSize = range.length / 2;
  26835. domain = toMultiArray(domain);
  26836. range = toMultiArray(range);
  26837. const size = toNumberArray(dict.getArray("Size"));
  26838. const bps = dict.get("BitsPerSample");
  26839. const order = dict.get("Order") || 1;
  26840. if (order !== 1) {
  26841. info("No support for cubic spline interpolation: " + order);
  26842. }
  26843. let encode = toNumberArray(dict.getArray("Encode"));
  26844. if (!encode) {
  26845. encode = [];
  26846. for (let i = 0; i < inputSize; ++i) {
  26847. encode.push([0, size[i] - 1]);
  26848. }
  26849. } else {
  26850. encode = toMultiArray(encode);
  26851. }
  26852. let decode = toNumberArray(dict.getArray("Decode"));
  26853. decode = !decode ? range : toMultiArray(decode);
  26854. const samples = this.getSampleArray(size, outputSize, bps, fn);
  26855. return function constructSampledFn(src, srcOffset, dest, destOffset) {
  26856. const cubeVertices = 1 << inputSize;
  26857. const cubeN = new Float64Array(cubeVertices);
  26858. const cubeVertex = new Uint32Array(cubeVertices);
  26859. let i, j;
  26860. for (j = 0; j < cubeVertices; j++) {
  26861. cubeN[j] = 1;
  26862. }
  26863. let k = outputSize,
  26864. pos = 1;
  26865. for (i = 0; i < inputSize; ++i) {
  26866. const domain_2i = domain[i][0];
  26867. const domain_2i_1 = domain[i][1];
  26868. const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  26869. let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  26870. const size_i = size[i];
  26871. e = Math.min(Math.max(e, 0), size_i - 1);
  26872. const e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  26873. const n0 = e0 + 1 - e;
  26874. const n1 = e - e0;
  26875. const offset0 = e0 * k;
  26876. const offset1 = offset0 + k;
  26877. for (j = 0; j < cubeVertices; j++) {
  26878. if (j & pos) {
  26879. cubeN[j] *= n1;
  26880. cubeVertex[j] += offset1;
  26881. } else {
  26882. cubeN[j] *= n0;
  26883. cubeVertex[j] += offset0;
  26884. }
  26885. }
  26886. k *= size_i;
  26887. pos <<= 1;
  26888. }
  26889. for (j = 0; j < outputSize; ++j) {
  26890. let rj = 0;
  26891. for (i = 0; i < cubeVertices; i++) {
  26892. rj += samples[cubeVertex[i] + j] * cubeN[i];
  26893. }
  26894. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  26895. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  26896. }
  26897. };
  26898. }
  26899. static constructInterpolated({
  26900. xref,
  26901. isEvalSupported,
  26902. dict
  26903. }) {
  26904. const c0 = toNumberArray(dict.getArray("C0")) || [0];
  26905. const c1 = toNumberArray(dict.getArray("C1")) || [1];
  26906. const n = dict.get("N");
  26907. const diff = [];
  26908. for (let i = 0, ii = c0.length; i < ii; ++i) {
  26909. diff.push(c1[i] - c0[i]);
  26910. }
  26911. const length = diff.length;
  26912. return function constructInterpolatedFn(src, srcOffset, dest, destOffset) {
  26913. const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  26914. for (let j = 0; j < length; ++j) {
  26915. dest[destOffset + j] = c0[j] + x * diff[j];
  26916. }
  26917. };
  26918. }
  26919. static constructStiched({
  26920. xref,
  26921. isEvalSupported,
  26922. dict
  26923. }) {
  26924. const domain = toNumberArray(dict.getArray("Domain"));
  26925. if (!domain) {
  26926. throw new FormatError("No domain");
  26927. }
  26928. const inputSize = domain.length / 2;
  26929. if (inputSize !== 1) {
  26930. throw new FormatError("Bad domain for stiched function");
  26931. }
  26932. const fns = [];
  26933. for (const fn of dict.get("Functions")) {
  26934. fns.push(this.parse({
  26935. xref,
  26936. isEvalSupported,
  26937. fn: xref.fetchIfRef(fn)
  26938. }));
  26939. }
  26940. const bounds = toNumberArray(dict.getArray("Bounds"));
  26941. const encode = toNumberArray(dict.getArray("Encode"));
  26942. const tmpBuf = new Float32Array(1);
  26943. return function constructStichedFn(src, srcOffset, dest, destOffset) {
  26944. const clip = function constructStichedFromIRClip(v, min, max) {
  26945. if (v > max) {
  26946. v = max;
  26947. } else if (v < min) {
  26948. v = min;
  26949. }
  26950. return v;
  26951. };
  26952. const v = clip(src[srcOffset], domain[0], domain[1]);
  26953. const length = bounds.length;
  26954. let i;
  26955. for (i = 0; i < length; ++i) {
  26956. if (v < bounds[i]) {
  26957. break;
  26958. }
  26959. }
  26960. let dmin = domain[0];
  26961. if (i > 0) {
  26962. dmin = bounds[i - 1];
  26963. }
  26964. let dmax = domain[1];
  26965. if (i < bounds.length) {
  26966. dmax = bounds[i];
  26967. }
  26968. const rmin = encode[2 * i];
  26969. const rmax = encode[2 * i + 1];
  26970. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  26971. fns[i](tmpBuf, 0, dest, destOffset);
  26972. };
  26973. }
  26974. static constructPostScript({
  26975. xref,
  26976. isEvalSupported,
  26977. fn,
  26978. dict
  26979. }) {
  26980. const domain = toNumberArray(dict.getArray("Domain"));
  26981. const range = toNumberArray(dict.getArray("Range"));
  26982. if (!domain) {
  26983. throw new FormatError("No domain.");
  26984. }
  26985. if (!range) {
  26986. throw new FormatError("No range.");
  26987. }
  26988. const lexer = new PostScriptLexer(fn);
  26989. const parser = new PostScriptParser(lexer);
  26990. const code = parser.parse();
  26991. if (isEvalSupported && FeatureTest.isEvalSupported) {
  26992. const compiled = new PostScriptCompiler().compile(code, domain, range);
  26993. if (compiled) {
  26994. return new Function("src", "srcOffset", "dest", "destOffset", compiled);
  26995. }
  26996. }
  26997. info("Unable to compile PS function");
  26998. const numOutputs = range.length >> 1;
  26999. const numInputs = domain.length >> 1;
  27000. const evaluator = new PostScriptEvaluator(code);
  27001. const cache = Object.create(null);
  27002. const MAX_CACHE_SIZE = 2048 * 4;
  27003. let cache_available = MAX_CACHE_SIZE;
  27004. const tmpBuf = new Float32Array(numInputs);
  27005. return function constructPostScriptFn(src, srcOffset, dest, destOffset) {
  27006. let i, value;
  27007. let key = "";
  27008. const input = tmpBuf;
  27009. for (i = 0; i < numInputs; i++) {
  27010. value = src[srcOffset + i];
  27011. input[i] = value;
  27012. key += value + "_";
  27013. }
  27014. const cachedValue = cache[key];
  27015. if (cachedValue !== undefined) {
  27016. dest.set(cachedValue, destOffset);
  27017. return;
  27018. }
  27019. const output = new Float32Array(numOutputs);
  27020. const stack = evaluator.execute(input);
  27021. const stackIndex = stack.length - numOutputs;
  27022. for (i = 0; i < numOutputs; i++) {
  27023. value = stack[stackIndex + i];
  27024. let bound = range[i * 2];
  27025. if (value < bound) {
  27026. value = bound;
  27027. } else {
  27028. bound = range[i * 2 + 1];
  27029. if (value > bound) {
  27030. value = bound;
  27031. }
  27032. }
  27033. output[i] = value;
  27034. }
  27035. if (cache_available > 0) {
  27036. cache_available--;
  27037. cache[key] = output;
  27038. }
  27039. dest.set(output, destOffset);
  27040. };
  27041. }
  27042. }
  27043. function isPDFFunction(v) {
  27044. let fnDict;
  27045. if (v instanceof Dict) {
  27046. fnDict = v;
  27047. } else if (v instanceof BaseStream) {
  27048. fnDict = v.dict;
  27049. } else {
  27050. return false;
  27051. }
  27052. return fnDict.has("FunctionType");
  27053. }
  27054. class PostScriptStack {
  27055. static MAX_STACK_SIZE = 100;
  27056. constructor(initialStack) {
  27057. this.stack = initialStack ? Array.from(initialStack) : [];
  27058. }
  27059. push(value) {
  27060. if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) {
  27061. throw new Error("PostScript function stack overflow.");
  27062. }
  27063. this.stack.push(value);
  27064. }
  27065. pop() {
  27066. if (this.stack.length <= 0) {
  27067. throw new Error("PostScript function stack underflow.");
  27068. }
  27069. return this.stack.pop();
  27070. }
  27071. copy(n) {
  27072. if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) {
  27073. throw new Error("PostScript function stack overflow.");
  27074. }
  27075. const stack = this.stack;
  27076. for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  27077. stack.push(stack[i]);
  27078. }
  27079. }
  27080. index(n) {
  27081. this.push(this.stack[this.stack.length - n - 1]);
  27082. }
  27083. roll(n, p) {
  27084. const stack = this.stack;
  27085. const l = stack.length - n;
  27086. const r = stack.length - 1;
  27087. const c = l + (p - Math.floor(p / n) * n);
  27088. for (let i = l, j = r; i < j; i++, j--) {
  27089. const t = stack[i];
  27090. stack[i] = stack[j];
  27091. stack[j] = t;
  27092. }
  27093. for (let i = l, j = c - 1; i < j; i++, j--) {
  27094. const t = stack[i];
  27095. stack[i] = stack[j];
  27096. stack[j] = t;
  27097. }
  27098. for (let i = c, j = r; i < j; i++, j--) {
  27099. const t = stack[i];
  27100. stack[i] = stack[j];
  27101. stack[j] = t;
  27102. }
  27103. }
  27104. }
  27105. class PostScriptEvaluator {
  27106. constructor(operators) {
  27107. this.operators = operators;
  27108. }
  27109. execute(initialStack) {
  27110. const stack = new PostScriptStack(initialStack);
  27111. let counter = 0;
  27112. const operators = this.operators;
  27113. const length = operators.length;
  27114. let operator, a, b;
  27115. while (counter < length) {
  27116. operator = operators[counter++];
  27117. if (typeof operator === "number") {
  27118. stack.push(operator);
  27119. continue;
  27120. }
  27121. switch (operator) {
  27122. case "jz":
  27123. b = stack.pop();
  27124. a = stack.pop();
  27125. if (!a) {
  27126. counter = b;
  27127. }
  27128. break;
  27129. case "j":
  27130. a = stack.pop();
  27131. counter = a;
  27132. break;
  27133. case "abs":
  27134. a = stack.pop();
  27135. stack.push(Math.abs(a));
  27136. break;
  27137. case "add":
  27138. b = stack.pop();
  27139. a = stack.pop();
  27140. stack.push(a + b);
  27141. break;
  27142. case "and":
  27143. b = stack.pop();
  27144. a = stack.pop();
  27145. if (typeof a === "boolean" && typeof b === "boolean") {
  27146. stack.push(a && b);
  27147. } else {
  27148. stack.push(a & b);
  27149. }
  27150. break;
  27151. case "atan":
  27152. b = stack.pop();
  27153. a = stack.pop();
  27154. a = Math.atan2(a, b) / Math.PI * 180;
  27155. if (a < 0) {
  27156. a += 360;
  27157. }
  27158. stack.push(a);
  27159. break;
  27160. case "bitshift":
  27161. b = stack.pop();
  27162. a = stack.pop();
  27163. if (a > 0) {
  27164. stack.push(a << b);
  27165. } else {
  27166. stack.push(a >> b);
  27167. }
  27168. break;
  27169. case "ceiling":
  27170. a = stack.pop();
  27171. stack.push(Math.ceil(a));
  27172. break;
  27173. case "copy":
  27174. a = stack.pop();
  27175. stack.copy(a);
  27176. break;
  27177. case "cos":
  27178. a = stack.pop();
  27179. stack.push(Math.cos(a % 360 / 180 * Math.PI));
  27180. break;
  27181. case "cvi":
  27182. a = stack.pop() | 0;
  27183. stack.push(a);
  27184. break;
  27185. case "cvr":
  27186. break;
  27187. case "div":
  27188. b = stack.pop();
  27189. a = stack.pop();
  27190. stack.push(a / b);
  27191. break;
  27192. case "dup":
  27193. stack.copy(1);
  27194. break;
  27195. case "eq":
  27196. b = stack.pop();
  27197. a = stack.pop();
  27198. stack.push(a === b);
  27199. break;
  27200. case "exch":
  27201. stack.roll(2, 1);
  27202. break;
  27203. case "exp":
  27204. b = stack.pop();
  27205. a = stack.pop();
  27206. stack.push(a ** b);
  27207. break;
  27208. case "false":
  27209. stack.push(false);
  27210. break;
  27211. case "floor":
  27212. a = stack.pop();
  27213. stack.push(Math.floor(a));
  27214. break;
  27215. case "ge":
  27216. b = stack.pop();
  27217. a = stack.pop();
  27218. stack.push(a >= b);
  27219. break;
  27220. case "gt":
  27221. b = stack.pop();
  27222. a = stack.pop();
  27223. stack.push(a > b);
  27224. break;
  27225. case "idiv":
  27226. b = stack.pop();
  27227. a = stack.pop();
  27228. stack.push(a / b | 0);
  27229. break;
  27230. case "index":
  27231. a = stack.pop();
  27232. stack.index(a);
  27233. break;
  27234. case "le":
  27235. b = stack.pop();
  27236. a = stack.pop();
  27237. stack.push(a <= b);
  27238. break;
  27239. case "ln":
  27240. a = stack.pop();
  27241. stack.push(Math.log(a));
  27242. break;
  27243. case "log":
  27244. a = stack.pop();
  27245. stack.push(Math.log10(a));
  27246. break;
  27247. case "lt":
  27248. b = stack.pop();
  27249. a = stack.pop();
  27250. stack.push(a < b);
  27251. break;
  27252. case "mod":
  27253. b = stack.pop();
  27254. a = stack.pop();
  27255. stack.push(a % b);
  27256. break;
  27257. case "mul":
  27258. b = stack.pop();
  27259. a = stack.pop();
  27260. stack.push(a * b);
  27261. break;
  27262. case "ne":
  27263. b = stack.pop();
  27264. a = stack.pop();
  27265. stack.push(a !== b);
  27266. break;
  27267. case "neg":
  27268. a = stack.pop();
  27269. stack.push(-a);
  27270. break;
  27271. case "not":
  27272. a = stack.pop();
  27273. if (typeof a === "boolean") {
  27274. stack.push(!a);
  27275. } else {
  27276. stack.push(~a);
  27277. }
  27278. break;
  27279. case "or":
  27280. b = stack.pop();
  27281. a = stack.pop();
  27282. if (typeof a === "boolean" && typeof b === "boolean") {
  27283. stack.push(a || b);
  27284. } else {
  27285. stack.push(a | b);
  27286. }
  27287. break;
  27288. case "pop":
  27289. stack.pop();
  27290. break;
  27291. case "roll":
  27292. b = stack.pop();
  27293. a = stack.pop();
  27294. stack.roll(a, b);
  27295. break;
  27296. case "round":
  27297. a = stack.pop();
  27298. stack.push(Math.round(a));
  27299. break;
  27300. case "sin":
  27301. a = stack.pop();
  27302. stack.push(Math.sin(a % 360 / 180 * Math.PI));
  27303. break;
  27304. case "sqrt":
  27305. a = stack.pop();
  27306. stack.push(Math.sqrt(a));
  27307. break;
  27308. case "sub":
  27309. b = stack.pop();
  27310. a = stack.pop();
  27311. stack.push(a - b);
  27312. break;
  27313. case "true":
  27314. stack.push(true);
  27315. break;
  27316. case "truncate":
  27317. a = stack.pop();
  27318. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  27319. stack.push(a);
  27320. break;
  27321. case "xor":
  27322. b = stack.pop();
  27323. a = stack.pop();
  27324. if (typeof a === "boolean" && typeof b === "boolean") {
  27325. stack.push(a !== b);
  27326. } else {
  27327. stack.push(a ^ b);
  27328. }
  27329. break;
  27330. default:
  27331. throw new FormatError(`Unknown operator ${operator}`);
  27332. }
  27333. }
  27334. return stack.stack;
  27335. }
  27336. }
  27337. class AstNode {
  27338. constructor(type) {
  27339. this.type = type;
  27340. }
  27341. visit(visitor) {
  27342. unreachable("abstract method");
  27343. }
  27344. }
  27345. class AstArgument extends AstNode {
  27346. constructor(index, min, max) {
  27347. super("args");
  27348. this.index = index;
  27349. this.min = min;
  27350. this.max = max;
  27351. }
  27352. visit(visitor) {
  27353. visitor.visitArgument(this);
  27354. }
  27355. }
  27356. class AstLiteral extends AstNode {
  27357. constructor(number) {
  27358. super("literal");
  27359. this.number = number;
  27360. this.min = number;
  27361. this.max = number;
  27362. }
  27363. visit(visitor) {
  27364. visitor.visitLiteral(this);
  27365. }
  27366. }
  27367. class AstBinaryOperation extends AstNode {
  27368. constructor(op, arg1, arg2, min, max) {
  27369. super("binary");
  27370. this.op = op;
  27371. this.arg1 = arg1;
  27372. this.arg2 = arg2;
  27373. this.min = min;
  27374. this.max = max;
  27375. }
  27376. visit(visitor) {
  27377. visitor.visitBinaryOperation(this);
  27378. }
  27379. }
  27380. class AstMin extends AstNode {
  27381. constructor(arg, max) {
  27382. super("max");
  27383. this.arg = arg;
  27384. this.min = arg.min;
  27385. this.max = max;
  27386. }
  27387. visit(visitor) {
  27388. visitor.visitMin(this);
  27389. }
  27390. }
  27391. class AstVariable extends AstNode {
  27392. constructor(index, min, max) {
  27393. super("var");
  27394. this.index = index;
  27395. this.min = min;
  27396. this.max = max;
  27397. }
  27398. visit(visitor) {
  27399. visitor.visitVariable(this);
  27400. }
  27401. }
  27402. class AstVariableDefinition extends AstNode {
  27403. constructor(variable, arg) {
  27404. super("definition");
  27405. this.variable = variable;
  27406. this.arg = arg;
  27407. }
  27408. visit(visitor) {
  27409. visitor.visitVariableDefinition(this);
  27410. }
  27411. }
  27412. class ExpressionBuilderVisitor {
  27413. constructor() {
  27414. this.parts = [];
  27415. }
  27416. visitArgument(arg) {
  27417. this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
  27418. }
  27419. visitVariable(variable) {
  27420. this.parts.push("v", variable.index);
  27421. }
  27422. visitLiteral(literal) {
  27423. this.parts.push(literal.number);
  27424. }
  27425. visitBinaryOperation(operation) {
  27426. this.parts.push("(");
  27427. operation.arg1.visit(this);
  27428. this.parts.push(" ", operation.op, " ");
  27429. operation.arg2.visit(this);
  27430. this.parts.push(")");
  27431. }
  27432. visitVariableDefinition(definition) {
  27433. this.parts.push("var ");
  27434. definition.variable.visit(this);
  27435. this.parts.push(" = ");
  27436. definition.arg.visit(this);
  27437. this.parts.push(";");
  27438. }
  27439. visitMin(max) {
  27440. this.parts.push("Math.min(");
  27441. max.arg.visit(this);
  27442. this.parts.push(", ", max.max, ")");
  27443. }
  27444. toString() {
  27445. return this.parts.join("");
  27446. }
  27447. }
  27448. function buildAddOperation(num1, num2) {
  27449. if (num2.type === "literal" && num2.number === 0) {
  27450. return num1;
  27451. }
  27452. if (num1.type === "literal" && num1.number === 0) {
  27453. return num2;
  27454. }
  27455. if (num2.type === "literal" && num1.type === "literal") {
  27456. return new AstLiteral(num1.number + num2.number);
  27457. }
  27458. return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
  27459. }
  27460. function buildMulOperation(num1, num2) {
  27461. if (num2.type === "literal") {
  27462. if (num2.number === 0) {
  27463. return new AstLiteral(0);
  27464. } else if (num2.number === 1) {
  27465. return num1;
  27466. } else if (num1.type === "literal") {
  27467. return new AstLiteral(num1.number * num2.number);
  27468. }
  27469. }
  27470. if (num1.type === "literal") {
  27471. if (num1.number === 0) {
  27472. return new AstLiteral(0);
  27473. } else if (num1.number === 1) {
  27474. return num2;
  27475. }
  27476. }
  27477. const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  27478. const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  27479. return new AstBinaryOperation("*", num1, num2, min, max);
  27480. }
  27481. function buildSubOperation(num1, num2) {
  27482. if (num2.type === "literal") {
  27483. if (num2.number === 0) {
  27484. return num1;
  27485. } else if (num1.type === "literal") {
  27486. return new AstLiteral(num1.number - num2.number);
  27487. }
  27488. }
  27489. if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
  27490. return num2.arg2;
  27491. }
  27492. return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
  27493. }
  27494. function buildMinOperation(num1, max) {
  27495. if (num1.min >= max) {
  27496. return new AstLiteral(max);
  27497. } else if (num1.max <= max) {
  27498. return num1;
  27499. }
  27500. return new AstMin(num1, max);
  27501. }
  27502. class PostScriptCompiler {
  27503. compile(code, domain, range) {
  27504. const stack = [];
  27505. const instructions = [];
  27506. const inputSize = domain.length >> 1,
  27507. outputSize = range.length >> 1;
  27508. let lastRegister = 0;
  27509. let n, j;
  27510. let num1, num2, ast1, ast2, tmpVar, item;
  27511. for (let i = 0; i < inputSize; i++) {
  27512. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  27513. }
  27514. for (let i = 0, ii = code.length; i < ii; i++) {
  27515. item = code[i];
  27516. if (typeof item === "number") {
  27517. stack.push(new AstLiteral(item));
  27518. continue;
  27519. }
  27520. switch (item) {
  27521. case "add":
  27522. if (stack.length < 2) {
  27523. return null;
  27524. }
  27525. num2 = stack.pop();
  27526. num1 = stack.pop();
  27527. stack.push(buildAddOperation(num1, num2));
  27528. break;
  27529. case "cvr":
  27530. if (stack.length < 1) {
  27531. return null;
  27532. }
  27533. break;
  27534. case "mul":
  27535. if (stack.length < 2) {
  27536. return null;
  27537. }
  27538. num2 = stack.pop();
  27539. num1 = stack.pop();
  27540. stack.push(buildMulOperation(num1, num2));
  27541. break;
  27542. case "sub":
  27543. if (stack.length < 2) {
  27544. return null;
  27545. }
  27546. num2 = stack.pop();
  27547. num1 = stack.pop();
  27548. stack.push(buildSubOperation(num1, num2));
  27549. break;
  27550. case "exch":
  27551. if (stack.length < 2) {
  27552. return null;
  27553. }
  27554. ast1 = stack.pop();
  27555. ast2 = stack.pop();
  27556. stack.push(ast1, ast2);
  27557. break;
  27558. case "pop":
  27559. if (stack.length < 1) {
  27560. return null;
  27561. }
  27562. stack.pop();
  27563. break;
  27564. case "index":
  27565. if (stack.length < 1) {
  27566. return null;
  27567. }
  27568. num1 = stack.pop();
  27569. if (num1.type !== "literal") {
  27570. return null;
  27571. }
  27572. n = num1.number;
  27573. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  27574. return null;
  27575. }
  27576. ast1 = stack[stack.length - n - 1];
  27577. if (ast1.type === "literal" || ast1.type === "var") {
  27578. stack.push(ast1);
  27579. break;
  27580. }
  27581. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  27582. stack[stack.length - n - 1] = tmpVar;
  27583. stack.push(tmpVar);
  27584. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  27585. break;
  27586. case "dup":
  27587. if (stack.length < 1) {
  27588. return null;
  27589. }
  27590. if (typeof code[i + 1] === "number" && code[i + 2] === "gt" && code[i + 3] === i + 7 && code[i + 4] === "jz" && code[i + 5] === "pop" && code[i + 6] === code[i + 1]) {
  27591. num1 = stack.pop();
  27592. stack.push(buildMinOperation(num1, code[i + 1]));
  27593. i += 6;
  27594. break;
  27595. }
  27596. ast1 = stack.at(-1);
  27597. if (ast1.type === "literal" || ast1.type === "var") {
  27598. stack.push(ast1);
  27599. break;
  27600. }
  27601. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  27602. stack[stack.length - 1] = tmpVar;
  27603. stack.push(tmpVar);
  27604. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  27605. break;
  27606. case "roll":
  27607. if (stack.length < 2) {
  27608. return null;
  27609. }
  27610. num2 = stack.pop();
  27611. num1 = stack.pop();
  27612. if (num2.type !== "literal" || num1.type !== "literal") {
  27613. return null;
  27614. }
  27615. j = num2.number;
  27616. n = num1.number;
  27617. if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
  27618. return null;
  27619. }
  27620. j = (j % n + n) % n;
  27621. if (j === 0) {
  27622. break;
  27623. }
  27624. stack.push(...stack.splice(stack.length - n, n - j));
  27625. break;
  27626. default:
  27627. return null;
  27628. }
  27629. }
  27630. if (stack.length !== outputSize) {
  27631. return null;
  27632. }
  27633. const result = [];
  27634. for (const instruction of instructions) {
  27635. const statementBuilder = new ExpressionBuilderVisitor();
  27636. instruction.visit(statementBuilder);
  27637. result.push(statementBuilder.toString());
  27638. }
  27639. for (let i = 0, ii = stack.length; i < ii; i++) {
  27640. const expr = stack[i],
  27641. statementBuilder = new ExpressionBuilderVisitor();
  27642. expr.visit(statementBuilder);
  27643. const min = range[i * 2],
  27644. max = range[i * 2 + 1];
  27645. const out = [statementBuilder.toString()];
  27646. if (min > expr.min) {
  27647. out.unshift("Math.max(", min, ", ");
  27648. out.push(")");
  27649. }
  27650. if (max < expr.max) {
  27651. out.unshift("Math.min(", max, ", ");
  27652. out.push(")");
  27653. }
  27654. out.unshift("dest[destOffset + ", i, "] = ");
  27655. out.push(";");
  27656. result.push(out.join(""));
  27657. }
  27658. return result.join("\n");
  27659. }
  27660. }
  27661. ;// ./src/core/bidi.js
  27662. const baseTypes = ["BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "S", "B", "S", "WS", "B", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "B", "B", "B", "S", "WS", "ON", "ON", "ET", "ET", "ET", "ON", "ON", "ON", "ON", "ON", "ES", "CS", "ES", "CS", "CS", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "CS", "ON", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "ON", "ON", "ON", "BN", "BN", "BN", "BN", "BN", "BN", "B", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "CS", "ON", "ET", "ET", "ET", "ET", "ON", "ON", "ON", "ON", "L", "ON", "ON", "BN", "ON", "ON", "ET", "ET", "EN", "EN", "ON", "L", "ON", "ON", "ON", "EN", "L", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "L", "L", "L", "L", "L", "L", "L", "L"];
  27663. const arabicTypes = ["AN", "AN", "AN", "AN", "AN", "AN", "ON", "ON", "AL", "ET", "ET", "AL", "CS", "AL", "ON", "ON", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "ET", "AN", "AN", "AL", "AL", "AL", "NSM", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AN", "ON", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "NSM", "NSM", "ON", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "AL", "AL", "AL", "AL", "AL", "AL"];
  27664. function isOdd(i) {
  27665. return (i & 1) !== 0;
  27666. }
  27667. function isEven(i) {
  27668. return (i & 1) === 0;
  27669. }
  27670. function findUnequal(arr, start, value) {
  27671. let j, jj;
  27672. for (j = start, jj = arr.length; j < jj; ++j) {
  27673. if (arr[j] !== value) {
  27674. return j;
  27675. }
  27676. }
  27677. return j;
  27678. }
  27679. function setValues(arr, start, end, value) {
  27680. for (let j = start; j < end; ++j) {
  27681. arr[j] = value;
  27682. }
  27683. }
  27684. function reverseValues(arr, start, end) {
  27685. for (let i = start, j = end - 1; i < j; ++i, --j) {
  27686. const temp = arr[i];
  27687. arr[i] = arr[j];
  27688. arr[j] = temp;
  27689. }
  27690. }
  27691. function createBidiText(str, isLTR, vertical = false) {
  27692. let dir = "ltr";
  27693. if (vertical) {
  27694. dir = "ttb";
  27695. } else if (!isLTR) {
  27696. dir = "rtl";
  27697. }
  27698. return {
  27699. str,
  27700. dir
  27701. };
  27702. }
  27703. const chars = [];
  27704. const types = [];
  27705. function bidi(str, startLevel = -1, vertical = false) {
  27706. let isLTR = true;
  27707. const strLength = str.length;
  27708. if (strLength === 0 || vertical) {
  27709. return createBidiText(str, isLTR, vertical);
  27710. }
  27711. chars.length = strLength;
  27712. types.length = strLength;
  27713. let numBidi = 0;
  27714. let i, ii;
  27715. for (i = 0; i < strLength; ++i) {
  27716. chars[i] = str.charAt(i);
  27717. const charCode = str.charCodeAt(i);
  27718. let charType = "L";
  27719. if (charCode <= 0x00ff) {
  27720. charType = baseTypes[charCode];
  27721. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  27722. charType = "R";
  27723. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  27724. charType = arabicTypes[charCode & 0xff];
  27725. if (!charType) {
  27726. warn("Bidi: invalid Unicode character " + charCode.toString(16));
  27727. }
  27728. } else if (0x0700 <= charCode && charCode <= 0x08ac || 0xfb50 <= charCode && charCode <= 0xfdff || 0xfe70 <= charCode && charCode <= 0xfeff) {
  27729. charType = "AL";
  27730. }
  27731. if (charType === "R" || charType === "AL" || charType === "AN") {
  27732. numBidi++;
  27733. }
  27734. types[i] = charType;
  27735. }
  27736. if (numBidi === 0) {
  27737. isLTR = true;
  27738. return createBidiText(str, isLTR);
  27739. }
  27740. if (startLevel === -1) {
  27741. if (numBidi / strLength < 0.3 && strLength > 4) {
  27742. isLTR = true;
  27743. startLevel = 0;
  27744. } else {
  27745. isLTR = false;
  27746. startLevel = 1;
  27747. }
  27748. }
  27749. const levels = [];
  27750. for (i = 0; i < strLength; ++i) {
  27751. levels[i] = startLevel;
  27752. }
  27753. const e = isOdd(startLevel) ? "R" : "L";
  27754. const sor = e;
  27755. const eor = sor;
  27756. let lastType = sor;
  27757. for (i = 0; i < strLength; ++i) {
  27758. if (types[i] === "NSM") {
  27759. types[i] = lastType;
  27760. } else {
  27761. lastType = types[i];
  27762. }
  27763. }
  27764. lastType = sor;
  27765. let t;
  27766. for (i = 0; i < strLength; ++i) {
  27767. t = types[i];
  27768. if (t === "EN") {
  27769. types[i] = lastType === "AL" ? "AN" : "EN";
  27770. } else if (t === "R" || t === "L" || t === "AL") {
  27771. lastType = t;
  27772. }
  27773. }
  27774. for (i = 0; i < strLength; ++i) {
  27775. t = types[i];
  27776. if (t === "AL") {
  27777. types[i] = "R";
  27778. }
  27779. }
  27780. for (i = 1; i < strLength - 1; ++i) {
  27781. if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
  27782. types[i] = "EN";
  27783. }
  27784. if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
  27785. types[i] = types[i - 1];
  27786. }
  27787. }
  27788. for (i = 0; i < strLength; ++i) {
  27789. if (types[i] === "EN") {
  27790. for (let j = i - 1; j >= 0; --j) {
  27791. if (types[j] !== "ET") {
  27792. break;
  27793. }
  27794. types[j] = "EN";
  27795. }
  27796. for (let j = i + 1; j < strLength; ++j) {
  27797. if (types[j] !== "ET") {
  27798. break;
  27799. }
  27800. types[j] = "EN";
  27801. }
  27802. }
  27803. }
  27804. for (i = 0; i < strLength; ++i) {
  27805. t = types[i];
  27806. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  27807. types[i] = "ON";
  27808. }
  27809. }
  27810. lastType = sor;
  27811. for (i = 0; i < strLength; ++i) {
  27812. t = types[i];
  27813. if (t === "EN") {
  27814. types[i] = lastType === "L" ? "L" : "EN";
  27815. } else if (t === "R" || t === "L") {
  27816. lastType = t;
  27817. }
  27818. }
  27819. for (i = 0; i < strLength; ++i) {
  27820. if (types[i] === "ON") {
  27821. const end = findUnequal(types, i + 1, "ON");
  27822. let before = sor;
  27823. if (i > 0) {
  27824. before = types[i - 1];
  27825. }
  27826. let after = eor;
  27827. if (end + 1 < strLength) {
  27828. after = types[end + 1];
  27829. }
  27830. if (before !== "L") {
  27831. before = "R";
  27832. }
  27833. if (after !== "L") {
  27834. after = "R";
  27835. }
  27836. if (before === after) {
  27837. setValues(types, i, end, before);
  27838. }
  27839. i = end - 1;
  27840. }
  27841. }
  27842. for (i = 0; i < strLength; ++i) {
  27843. if (types[i] === "ON") {
  27844. types[i] = e;
  27845. }
  27846. }
  27847. for (i = 0; i < strLength; ++i) {
  27848. t = types[i];
  27849. if (isEven(levels[i])) {
  27850. if (t === "R") {
  27851. levels[i] += 1;
  27852. } else if (t === "AN" || t === "EN") {
  27853. levels[i] += 2;
  27854. }
  27855. } else if (t === "L" || t === "AN" || t === "EN") {
  27856. levels[i] += 1;
  27857. }
  27858. }
  27859. let highestLevel = -1;
  27860. let lowestOddLevel = 99;
  27861. let level;
  27862. for (i = 0, ii = levels.length; i < ii; ++i) {
  27863. level = levels[i];
  27864. if (highestLevel < level) {
  27865. highestLevel = level;
  27866. }
  27867. if (lowestOddLevel > level && isOdd(level)) {
  27868. lowestOddLevel = level;
  27869. }
  27870. }
  27871. for (level = highestLevel; level >= lowestOddLevel; --level) {
  27872. let start = -1;
  27873. for (i = 0, ii = levels.length; i < ii; ++i) {
  27874. if (levels[i] < level) {
  27875. if (start >= 0) {
  27876. reverseValues(chars, start, i);
  27877. start = -1;
  27878. }
  27879. } else if (start < 0) {
  27880. start = i;
  27881. }
  27882. }
  27883. if (start >= 0) {
  27884. reverseValues(chars, start, levels.length);
  27885. }
  27886. }
  27887. for (i = 0, ii = chars.length; i < ii; ++i) {
  27888. const ch = chars[i];
  27889. if (ch === "<" || ch === ">") {
  27890. chars[i] = "";
  27891. }
  27892. }
  27893. return createBidiText(chars.join(""), isLTR);
  27894. }
  27895. ;// ./src/core/font_substitutions.js
  27896. const NORMAL = {
  27897. style: "normal",
  27898. weight: "normal"
  27899. };
  27900. const BOLD = {
  27901. style: "normal",
  27902. weight: "bold"
  27903. };
  27904. const ITALIC = {
  27905. style: "italic",
  27906. weight: "normal"
  27907. };
  27908. const BOLDITALIC = {
  27909. style: "italic",
  27910. weight: "bold"
  27911. };
  27912. const substitutionMap = new Map([["Times-Roman", {
  27913. local: ["Times New Roman", "Times-Roman", "Times", "Liberation Serif", "Nimbus Roman", "Nimbus Roman L", "Tinos", "Thorndale", "TeX Gyre Termes", "FreeSerif", "Linux Libertine O", "Libertinus Serif", "DejaVu Serif", "Bitstream Vera Serif", "Ubuntu"],
  27914. style: NORMAL,
  27915. ultimate: "serif"
  27916. }], ["Times-Bold", {
  27917. alias: "Times-Roman",
  27918. style: BOLD,
  27919. ultimate: "serif"
  27920. }], ["Times-Italic", {
  27921. alias: "Times-Roman",
  27922. style: ITALIC,
  27923. ultimate: "serif"
  27924. }], ["Times-BoldItalic", {
  27925. alias: "Times-Roman",
  27926. style: BOLDITALIC,
  27927. ultimate: "serif"
  27928. }], ["Helvetica", {
  27929. local: ["Helvetica", "Helvetica Neue", "Arial", "Arial Nova", "Liberation Sans", "Arimo", "Nimbus Sans", "Nimbus Sans L", "A030", "TeX Gyre Heros", "FreeSans", "DejaVu Sans", "Albany", "Bitstream Vera Sans", "Arial Unicode MS", "Microsoft Sans Serif", "Apple Symbols", "Cantarell"],
  27930. path: "LiberationSans-Regular.ttf",
  27931. style: NORMAL,
  27932. ultimate: "sans-serif"
  27933. }], ["Helvetica-Bold", {
  27934. alias: "Helvetica",
  27935. path: "LiberationSans-Bold.ttf",
  27936. style: BOLD,
  27937. ultimate: "sans-serif"
  27938. }], ["Helvetica-Oblique", {
  27939. alias: "Helvetica",
  27940. path: "LiberationSans-Italic.ttf",
  27941. style: ITALIC,
  27942. ultimate: "sans-serif"
  27943. }], ["Helvetica-BoldOblique", {
  27944. alias: "Helvetica",
  27945. path: "LiberationSans-BoldItalic.ttf",
  27946. style: BOLDITALIC,
  27947. ultimate: "sans-serif"
  27948. }], ["Courier", {
  27949. local: ["Courier", "Courier New", "Liberation Mono", "Nimbus Mono", "Nimbus Mono L", "Cousine", "Cumberland", "TeX Gyre Cursor", "FreeMono", "Linux Libertine Mono O", "Libertinus Mono"],
  27950. style: NORMAL,
  27951. ultimate: "monospace"
  27952. }], ["Courier-Bold", {
  27953. alias: "Courier",
  27954. style: BOLD,
  27955. ultimate: "monospace"
  27956. }], ["Courier-Oblique", {
  27957. alias: "Courier",
  27958. style: ITALIC,
  27959. ultimate: "monospace"
  27960. }], ["Courier-BoldOblique", {
  27961. alias: "Courier",
  27962. style: BOLDITALIC,
  27963. ultimate: "monospace"
  27964. }], ["ArialBlack", {
  27965. local: ["Arial Black"],
  27966. style: {
  27967. style: "normal",
  27968. weight: "900"
  27969. },
  27970. fallback: "Helvetica-Bold"
  27971. }], ["ArialBlack-Bold", {
  27972. alias: "ArialBlack"
  27973. }], ["ArialBlack-Italic", {
  27974. alias: "ArialBlack",
  27975. style: {
  27976. style: "italic",
  27977. weight: "900"
  27978. },
  27979. fallback: "Helvetica-BoldOblique"
  27980. }], ["ArialBlack-BoldItalic", {
  27981. alias: "ArialBlack-Italic"
  27982. }], ["ArialNarrow", {
  27983. local: ["Arial Narrow", "Liberation Sans Narrow", "Helvetica Condensed", "Nimbus Sans Narrow", "TeX Gyre Heros Cn"],
  27984. style: NORMAL,
  27985. fallback: "Helvetica"
  27986. }], ["ArialNarrow-Bold", {
  27987. alias: "ArialNarrow",
  27988. style: BOLD,
  27989. fallback: "Helvetica-Bold"
  27990. }], ["ArialNarrow-Italic", {
  27991. alias: "ArialNarrow",
  27992. style: ITALIC,
  27993. fallback: "Helvetica-Oblique"
  27994. }], ["ArialNarrow-BoldItalic", {
  27995. alias: "ArialNarrow",
  27996. style: BOLDITALIC,
  27997. fallback: "Helvetica-BoldOblique"
  27998. }], ["Calibri", {
  27999. local: ["Calibri", "Carlito"],
  28000. style: NORMAL,
  28001. fallback: "Helvetica"
  28002. }], ["Calibri-Bold", {
  28003. alias: "Calibri",
  28004. style: BOLD,
  28005. fallback: "Helvetica-Bold"
  28006. }], ["Calibri-Italic", {
  28007. alias: "Calibri",
  28008. style: ITALIC,
  28009. fallback: "Helvetica-Oblique"
  28010. }], ["Calibri-BoldItalic", {
  28011. alias: "Calibri",
  28012. style: BOLDITALIC,
  28013. fallback: "Helvetica-BoldOblique"
  28014. }], ["Wingdings", {
  28015. local: ["Wingdings", "URW Dingbats"],
  28016. style: NORMAL
  28017. }], ["Wingdings-Regular", {
  28018. alias: "Wingdings"
  28019. }], ["Wingdings-Bold", {
  28020. alias: "Wingdings"
  28021. }]]);
  28022. const fontAliases = new Map([["Arial-Black", "ArialBlack"]]);
  28023. function getStyleToAppend(style) {
  28024. switch (style) {
  28025. case BOLD:
  28026. return "Bold";
  28027. case ITALIC:
  28028. return "Italic";
  28029. case BOLDITALIC:
  28030. return "Bold Italic";
  28031. default:
  28032. if (style?.weight === "bold") {
  28033. return "Bold";
  28034. }
  28035. if (style?.style === "italic") {
  28036. return "Italic";
  28037. }
  28038. }
  28039. return "";
  28040. }
  28041. function getFamilyName(str) {
  28042. const keywords = new Set(["thin", "extralight", "ultralight", "demilight", "semilight", "light", "book", "regular", "normal", "medium", "demibold", "semibold", "bold", "extrabold", "ultrabold", "black", "heavy", "extrablack", "ultrablack", "roman", "italic", "oblique", "ultracondensed", "extracondensed", "condensed", "semicondensed", "normal", "semiexpanded", "expanded", "extraexpanded", "ultraexpanded", "bolditalic"]);
  28043. return str.split(/[- ,+]+/g).filter(tok => !keywords.has(tok.toLowerCase())).join(" ");
  28044. }
  28045. function generateFont({
  28046. alias,
  28047. local,
  28048. path,
  28049. fallback,
  28050. style,
  28051. ultimate
  28052. }, src, localFontPath, useFallback = true, usePath = true, append = "") {
  28053. const result = {
  28054. style: null,
  28055. ultimate: null
  28056. };
  28057. if (local) {
  28058. const extra = append ? ` ${append}` : "";
  28059. for (const name of local) {
  28060. src.push(`local(${name}${extra})`);
  28061. }
  28062. }
  28063. if (alias) {
  28064. const substitution = substitutionMap.get(alias);
  28065. const aliasAppend = append || getStyleToAppend(style);
  28066. Object.assign(result, generateFont(substitution, src, localFontPath, useFallback && !fallback, usePath && !path, aliasAppend));
  28067. }
  28068. if (style) {
  28069. result.style = style;
  28070. }
  28071. if (ultimate) {
  28072. result.ultimate = ultimate;
  28073. }
  28074. if (useFallback && fallback) {
  28075. const fallbackInfo = substitutionMap.get(fallback);
  28076. const {
  28077. ultimate: fallbackUltimate
  28078. } = generateFont(fallbackInfo, src, localFontPath, useFallback, usePath && !path, append);
  28079. result.ultimate ||= fallbackUltimate;
  28080. }
  28081. if (usePath && path && localFontPath) {
  28082. src.push(`url(${localFontPath}${path})`);
  28083. }
  28084. return result;
  28085. }
  28086. function getFontSubstitution(systemFontCache, idFactory, localFontPath, baseFontName, standardFontName, type) {
  28087. if (baseFontName.startsWith("InvalidPDFjsFont_")) {
  28088. return null;
  28089. }
  28090. if ((type === "TrueType" || type === "Type1") && /^[A-Z]{6}\+/.test(baseFontName)) {
  28091. baseFontName = baseFontName.slice(7);
  28092. }
  28093. baseFontName = normalizeFontName(baseFontName);
  28094. const key = baseFontName;
  28095. let substitutionInfo = systemFontCache.get(key);
  28096. if (substitutionInfo) {
  28097. return substitutionInfo;
  28098. }
  28099. let substitution = substitutionMap.get(baseFontName);
  28100. if (!substitution) {
  28101. for (const [alias, subst] of fontAliases) {
  28102. if (baseFontName.startsWith(alias)) {
  28103. baseFontName = `${subst}${baseFontName.substring(alias.length)}`;
  28104. substitution = substitutionMap.get(baseFontName);
  28105. break;
  28106. }
  28107. }
  28108. }
  28109. let mustAddBaseFont = false;
  28110. if (!substitution) {
  28111. substitution = substitutionMap.get(standardFontName);
  28112. mustAddBaseFont = true;
  28113. }
  28114. const loadedName = `${idFactory.getDocId()}_s${idFactory.createFontId()}`;
  28115. if (!substitution) {
  28116. if (!validateFontName(baseFontName)) {
  28117. warn(`Cannot substitute the font because of its name: ${baseFontName}`);
  28118. systemFontCache.set(key, null);
  28119. return null;
  28120. }
  28121. const bold = /bold/gi.test(baseFontName);
  28122. const italic = /oblique|italic/gi.test(baseFontName);
  28123. const style = bold && italic && BOLDITALIC || bold && BOLD || italic && ITALIC || NORMAL;
  28124. substitutionInfo = {
  28125. css: `"${getFamilyName(baseFontName)}",${loadedName}`,
  28126. guessFallback: true,
  28127. loadedName,
  28128. baseFontName,
  28129. src: `local(${baseFontName})`,
  28130. style
  28131. };
  28132. systemFontCache.set(key, substitutionInfo);
  28133. return substitutionInfo;
  28134. }
  28135. const src = [];
  28136. if (mustAddBaseFont && validateFontName(baseFontName)) {
  28137. src.push(`local(${baseFontName})`);
  28138. }
  28139. const {
  28140. style,
  28141. ultimate
  28142. } = generateFont(substitution, src, localFontPath);
  28143. const guessFallback = ultimate === null;
  28144. const fallback = guessFallback ? "" : `,${ultimate}`;
  28145. substitutionInfo = {
  28146. css: `"${getFamilyName(baseFontName)}",${loadedName}${fallback}`,
  28147. guessFallback,
  28148. loadedName,
  28149. baseFontName,
  28150. src: src.join(","),
  28151. style
  28152. };
  28153. systemFontCache.set(key, substitutionInfo);
  28154. return substitutionInfo;
  28155. }
  28156. ;// ./src/core/image_resizer.js
  28157. const MIN_IMAGE_DIM = 2048;
  28158. const MAX_IMAGE_DIM = 65537;
  28159. const MAX_ERROR = 128;
  28160. class ImageResizer {
  28161. static #goodSquareLength = MIN_IMAGE_DIM;
  28162. static #isChrome = false;
  28163. constructor(imgData, isMask) {
  28164. this._imgData = imgData;
  28165. this._isMask = isMask;
  28166. }
  28167. static get canUseImageDecoder() {
  28168. return shadow(this, "canUseImageDecoder", this.#isChrome || typeof ImageDecoder === "undefined" ? Promise.resolve(false) : ImageDecoder.isTypeSupported("image/bmp"));
  28169. }
  28170. static needsToBeResized(width, height) {
  28171. if (width <= this.#goodSquareLength && height <= this.#goodSquareLength) {
  28172. return false;
  28173. }
  28174. const {
  28175. MAX_DIM
  28176. } = this;
  28177. if (width > MAX_DIM || height > MAX_DIM) {
  28178. return true;
  28179. }
  28180. const area = width * height;
  28181. if (this._hasMaxArea) {
  28182. return area > this.MAX_AREA;
  28183. }
  28184. if (area < this.#goodSquareLength ** 2) {
  28185. return false;
  28186. }
  28187. if (this._areGoodDims(width, height)) {
  28188. this.#goodSquareLength = Math.max(this.#goodSquareLength, Math.floor(Math.sqrt(width * height)));
  28189. return false;
  28190. }
  28191. this.#goodSquareLength = this._guessMax(this.#goodSquareLength, MAX_DIM, MAX_ERROR, 0);
  28192. const maxArea = this.MAX_AREA = this.#goodSquareLength ** 2;
  28193. return area > maxArea;
  28194. }
  28195. static get MAX_DIM() {
  28196. return shadow(this, "MAX_DIM", this._guessMax(MIN_IMAGE_DIM, MAX_IMAGE_DIM, 0, 1));
  28197. }
  28198. static get MAX_AREA() {
  28199. this._hasMaxArea = true;
  28200. return shadow(this, "MAX_AREA", this._guessMax(this.#goodSquareLength, this.MAX_DIM, MAX_ERROR, 0) ** 2);
  28201. }
  28202. static set MAX_AREA(area) {
  28203. if (area >= 0) {
  28204. this._hasMaxArea = true;
  28205. shadow(this, "MAX_AREA", area);
  28206. }
  28207. }
  28208. static setMaxArea(area) {
  28209. if (!this._hasMaxArea) {
  28210. this.MAX_AREA = area >> 2;
  28211. }
  28212. }
  28213. static setOptions(opts) {
  28214. this.setMaxArea(opts.maxArea ?? -1);
  28215. this.#isChrome = opts.isChrome ?? false;
  28216. }
  28217. static _areGoodDims(width, height) {
  28218. try {
  28219. const canvas = new OffscreenCanvas(width, height);
  28220. const ctx = canvas.getContext("2d");
  28221. ctx.fillRect(0, 0, 1, 1);
  28222. const opacity = ctx.getImageData(0, 0, 1, 1).data[3];
  28223. canvas.width = canvas.height = 1;
  28224. return opacity !== 0;
  28225. } catch {
  28226. return false;
  28227. }
  28228. }
  28229. static _guessMax(start, end, tolerance, defaultHeight) {
  28230. while (start + tolerance + 1 < end) {
  28231. const middle = Math.floor((start + end) / 2);
  28232. const height = defaultHeight || middle;
  28233. if (this._areGoodDims(middle, height)) {
  28234. start = middle;
  28235. } else {
  28236. end = middle;
  28237. }
  28238. }
  28239. return start;
  28240. }
  28241. static async createImage(imgData, isMask = false) {
  28242. return new ImageResizer(imgData, isMask)._createImage();
  28243. }
  28244. async _createImage() {
  28245. const data = this._encodeBMP();
  28246. let decoder, imagePromise;
  28247. if (await ImageResizer.canUseImageDecoder) {
  28248. decoder = new ImageDecoder({
  28249. data,
  28250. type: "image/bmp",
  28251. preferAnimation: false,
  28252. transfer: [data.buffer]
  28253. });
  28254. imagePromise = decoder.decode().catch(reason => {
  28255. warn(`BMP image decoding failed: ${reason}`);
  28256. return createImageBitmap(new Blob([this._encodeBMP().buffer], {
  28257. type: "image/bmp"
  28258. }));
  28259. }).finally(() => {
  28260. decoder.close();
  28261. });
  28262. } else {
  28263. imagePromise = createImageBitmap(new Blob([data.buffer], {
  28264. type: "image/bmp"
  28265. }));
  28266. }
  28267. const {
  28268. MAX_AREA,
  28269. MAX_DIM
  28270. } = ImageResizer;
  28271. const {
  28272. _imgData: imgData
  28273. } = this;
  28274. const {
  28275. width,
  28276. height
  28277. } = imgData;
  28278. const minFactor = Math.max(width / MAX_DIM, height / MAX_DIM, Math.sqrt(width * height / MAX_AREA));
  28279. const firstFactor = Math.max(minFactor, 2);
  28280. const factor = Math.round(10 * (minFactor + 1.25)) / 10 / firstFactor;
  28281. const N = Math.floor(Math.log2(factor));
  28282. const steps = new Array(N + 2).fill(2);
  28283. steps[0] = firstFactor;
  28284. steps.splice(-1, 1, factor / (1 << N));
  28285. let newWidth = width;
  28286. let newHeight = height;
  28287. const result = await imagePromise;
  28288. let bitmap = result.image || result;
  28289. for (const step of steps) {
  28290. const prevWidth = newWidth;
  28291. const prevHeight = newHeight;
  28292. newWidth = Math.floor(newWidth / step) - 1;
  28293. newHeight = Math.floor(newHeight / step) - 1;
  28294. const canvas = new OffscreenCanvas(newWidth, newHeight);
  28295. const ctx = canvas.getContext("2d");
  28296. ctx.drawImage(bitmap, 0, 0, prevWidth, prevHeight, 0, 0, newWidth, newHeight);
  28297. bitmap.close();
  28298. bitmap = canvas.transferToImageBitmap();
  28299. }
  28300. imgData.data = null;
  28301. imgData.bitmap = bitmap;
  28302. imgData.width = newWidth;
  28303. imgData.height = newHeight;
  28304. return imgData;
  28305. }
  28306. _encodeBMP() {
  28307. const {
  28308. width,
  28309. height,
  28310. kind
  28311. } = this._imgData;
  28312. let data = this._imgData.data;
  28313. let bitPerPixel;
  28314. let colorTable = new Uint8Array(0);
  28315. let maskTable = colorTable;
  28316. let compression = 0;
  28317. switch (kind) {
  28318. case ImageKind.GRAYSCALE_1BPP:
  28319. {
  28320. bitPerPixel = 1;
  28321. colorTable = new Uint8Array(this._isMask ? [255, 255, 255, 255, 0, 0, 0, 0] : [0, 0, 0, 0, 255, 255, 255, 255]);
  28322. const rowLen = width + 7 >> 3;
  28323. const rowSize = rowLen + 3 & -4;
  28324. if (rowLen !== rowSize) {
  28325. const newData = new Uint8Array(rowSize * height);
  28326. let k = 0;
  28327. for (let i = 0, ii = height * rowLen; i < ii; i += rowLen, k += rowSize) {
  28328. newData.set(data.subarray(i, i + rowLen), k);
  28329. }
  28330. data = newData;
  28331. }
  28332. break;
  28333. }
  28334. case ImageKind.RGB_24BPP:
  28335. {
  28336. bitPerPixel = 24;
  28337. if (width & 3) {
  28338. const rowLen = 3 * width;
  28339. const rowSize = rowLen + 3 & -4;
  28340. const extraLen = rowSize - rowLen;
  28341. const newData = new Uint8Array(rowSize * height);
  28342. let k = 0;
  28343. for (let i = 0, ii = height * rowLen; i < ii; i += rowLen) {
  28344. const row = data.subarray(i, i + rowLen);
  28345. for (let j = 0; j < rowLen; j += 3) {
  28346. newData[k++] = row[j + 2];
  28347. newData[k++] = row[j + 1];
  28348. newData[k++] = row[j];
  28349. }
  28350. k += extraLen;
  28351. }
  28352. data = newData;
  28353. } else {
  28354. for (let i = 0, ii = data.length; i < ii; i += 3) {
  28355. const tmp = data[i];
  28356. data[i] = data[i + 2];
  28357. data[i + 2] = tmp;
  28358. }
  28359. }
  28360. break;
  28361. }
  28362. case ImageKind.RGBA_32BPP:
  28363. bitPerPixel = 32;
  28364. compression = 3;
  28365. maskTable = new Uint8Array(4 + 4 + 4 + 4 + 52);
  28366. const view = new DataView(maskTable.buffer);
  28367. if (FeatureTest.isLittleEndian) {
  28368. view.setUint32(0, 0x000000ff, true);
  28369. view.setUint32(4, 0x0000ff00, true);
  28370. view.setUint32(8, 0x00ff0000, true);
  28371. view.setUint32(12, 0xff000000, true);
  28372. } else {
  28373. view.setUint32(0, 0xff000000, true);
  28374. view.setUint32(4, 0x00ff0000, true);
  28375. view.setUint32(8, 0x0000ff00, true);
  28376. view.setUint32(12, 0x000000ff, true);
  28377. }
  28378. break;
  28379. default:
  28380. throw new Error("invalid format");
  28381. }
  28382. let i = 0;
  28383. const headerLength = 40 + maskTable.length;
  28384. const fileLength = 14 + headerLength + colorTable.length + data.length;
  28385. const bmpData = new Uint8Array(fileLength);
  28386. const view = new DataView(bmpData.buffer);
  28387. view.setUint16(i, 0x4d42, true);
  28388. i += 2;
  28389. view.setUint32(i, fileLength, true);
  28390. i += 4;
  28391. view.setUint32(i, 0, true);
  28392. i += 4;
  28393. view.setUint32(i, 14 + headerLength + colorTable.length, true);
  28394. i += 4;
  28395. view.setUint32(i, headerLength, true);
  28396. i += 4;
  28397. view.setInt32(i, width, true);
  28398. i += 4;
  28399. view.setInt32(i, -height, true);
  28400. i += 4;
  28401. view.setUint16(i, 1, true);
  28402. i += 2;
  28403. view.setUint16(i, bitPerPixel, true);
  28404. i += 2;
  28405. view.setUint32(i, compression, true);
  28406. i += 4;
  28407. view.setUint32(i, 0, true);
  28408. i += 4;
  28409. view.setInt32(i, 0, true);
  28410. i += 4;
  28411. view.setInt32(i, 0, true);
  28412. i += 4;
  28413. view.setUint32(i, colorTable.length / 4, true);
  28414. i += 4;
  28415. view.setUint32(i, 0, true);
  28416. i += 4;
  28417. bmpData.set(maskTable, i);
  28418. i += maskTable.length;
  28419. bmpData.set(colorTable, i);
  28420. i += colorTable.length;
  28421. bmpData.set(data, i);
  28422. return bmpData;
  28423. }
  28424. }
  28425. ;// ./src/shared/murmurhash3.js
  28426. const SEED = 0xc3d2e1f0;
  28427. const MASK_HIGH = 0xffff0000;
  28428. const MASK_LOW = 0xffff;
  28429. class MurmurHash3_64 {
  28430. constructor(seed) {
  28431. this.h1 = seed ? seed & 0xffffffff : SEED;
  28432. this.h2 = seed ? seed & 0xffffffff : SEED;
  28433. }
  28434. update(input) {
  28435. let data, length;
  28436. if (typeof input === "string") {
  28437. data = new Uint8Array(input.length * 2);
  28438. length = 0;
  28439. for (let i = 0, ii = input.length; i < ii; i++) {
  28440. const code = input.charCodeAt(i);
  28441. if (code <= 0xff) {
  28442. data[length++] = code;
  28443. } else {
  28444. data[length++] = code >>> 8;
  28445. data[length++] = code & 0xff;
  28446. }
  28447. }
  28448. } else if (ArrayBuffer.isView(input)) {
  28449. data = input.slice();
  28450. length = data.byteLength;
  28451. } else {
  28452. throw new Error("Invalid data format, must be a string or TypedArray.");
  28453. }
  28454. const blockCounts = length >> 2;
  28455. const tailLength = length - blockCounts * 4;
  28456. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  28457. let k1 = 0,
  28458. k2 = 0;
  28459. let h1 = this.h1,
  28460. h2 = this.h2;
  28461. const C1 = 0xcc9e2d51,
  28462. C2 = 0x1b873593;
  28463. const C1_LOW = C1 & MASK_LOW,
  28464. C2_LOW = C2 & MASK_LOW;
  28465. for (let i = 0; i < blockCounts; i++) {
  28466. if (i & 1) {
  28467. k1 = dataUint32[i];
  28468. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  28469. k1 = k1 << 15 | k1 >>> 17;
  28470. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  28471. h1 ^= k1;
  28472. h1 = h1 << 13 | h1 >>> 19;
  28473. h1 = h1 * 5 + 0xe6546b64;
  28474. } else {
  28475. k2 = dataUint32[i];
  28476. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  28477. k2 = k2 << 15 | k2 >>> 17;
  28478. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  28479. h2 ^= k2;
  28480. h2 = h2 << 13 | h2 >>> 19;
  28481. h2 = h2 * 5 + 0xe6546b64;
  28482. }
  28483. }
  28484. k1 = 0;
  28485. switch (tailLength) {
  28486. case 3:
  28487. k1 ^= data[blockCounts * 4 + 2] << 16;
  28488. case 2:
  28489. k1 ^= data[blockCounts * 4 + 1] << 8;
  28490. case 1:
  28491. k1 ^= data[blockCounts * 4];
  28492. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  28493. k1 = k1 << 15 | k1 >>> 17;
  28494. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  28495. if (blockCounts & 1) {
  28496. h1 ^= k1;
  28497. } else {
  28498. h2 ^= k1;
  28499. }
  28500. }
  28501. this.h1 = h1;
  28502. this.h2 = h2;
  28503. }
  28504. hexdigest() {
  28505. let h1 = this.h1,
  28506. h2 = this.h2;
  28507. h1 ^= h2 >>> 1;
  28508. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  28509. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  28510. h1 ^= h2 >>> 1;
  28511. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  28512. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  28513. h1 ^= h2 >>> 1;
  28514. return (h1 >>> 0).toString(16).padStart(8, "0") + (h2 >>> 0).toString(16).padStart(8, "0");
  28515. }
  28516. }
  28517. ;// ./src/core/operator_list.js
  28518. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  28519. let state = parentState;
  28520. for (let i = 0, ii = pattern.length - 1; i < ii; i++) {
  28521. const item = pattern[i];
  28522. state = state[item] ||= [];
  28523. }
  28524. state[pattern.at(-1)] = {
  28525. checkFn,
  28526. iterateFn,
  28527. processFn
  28528. };
  28529. }
  28530. const InitialState = [];
  28531. addState(InitialState, [OPS.save, OPS.transform, OPS.paintInlineImageXObject, OPS.restore], null, function iterateInlineImageGroup(context, i) {
  28532. const fnArray = context.fnArray;
  28533. const iFirstSave = context.iCurr - 3;
  28534. const pos = (i - iFirstSave) % 4;
  28535. switch (pos) {
  28536. case 0:
  28537. return fnArray[i] === OPS.save;
  28538. case 1:
  28539. return fnArray[i] === OPS.transform;
  28540. case 2:
  28541. return fnArray[i] === OPS.paintInlineImageXObject;
  28542. case 3:
  28543. return fnArray[i] === OPS.restore;
  28544. }
  28545. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  28546. }, function foundInlineImageGroup(context, i) {
  28547. const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  28548. const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  28549. const MAX_WIDTH = 1000;
  28550. const IMAGE_PADDING = 1;
  28551. const fnArray = context.fnArray,
  28552. argsArray = context.argsArray;
  28553. const curr = context.iCurr;
  28554. const iFirstSave = curr - 3;
  28555. const iFirstTransform = curr - 2;
  28556. const iFirstPIIXO = curr - 1;
  28557. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  28558. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  28559. return i - (i - iFirstSave) % 4;
  28560. }
  28561. let maxX = 0;
  28562. const map = [];
  28563. let maxLineHeight = 0;
  28564. let currentX = IMAGE_PADDING,
  28565. currentY = IMAGE_PADDING;
  28566. for (let q = 0; q < count; q++) {
  28567. const transform = argsArray[iFirstTransform + (q << 2)];
  28568. const img = argsArray[iFirstPIIXO + (q << 2)][0];
  28569. if (currentX + img.width > MAX_WIDTH) {
  28570. maxX = Math.max(maxX, currentX);
  28571. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  28572. currentX = 0;
  28573. maxLineHeight = 0;
  28574. }
  28575. map.push({
  28576. transform,
  28577. x: currentX,
  28578. y: currentY,
  28579. w: img.width,
  28580. h: img.height
  28581. });
  28582. currentX += img.width + 2 * IMAGE_PADDING;
  28583. maxLineHeight = Math.max(maxLineHeight, img.height);
  28584. }
  28585. const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  28586. const imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  28587. const imgData = new Uint8Array(imgWidth * imgHeight * 4);
  28588. const imgRowSize = imgWidth << 2;
  28589. for (let q = 0; q < count; q++) {
  28590. const data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  28591. const rowSize = map[q].w << 2;
  28592. let dataOffset = 0;
  28593. let offset = map[q].x + map[q].y * imgWidth << 2;
  28594. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  28595. for (let k = 0, kk = map[q].h; k < kk; k++) {
  28596. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  28597. dataOffset += rowSize;
  28598. offset += imgRowSize;
  28599. }
  28600. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  28601. while (offset >= 0) {
  28602. data[offset - 4] = data[offset];
  28603. data[offset - 3] = data[offset + 1];
  28604. data[offset - 2] = data[offset + 2];
  28605. data[offset - 1] = data[offset + 3];
  28606. data[offset + rowSize] = data[offset + rowSize - 4];
  28607. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  28608. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  28609. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  28610. offset -= imgRowSize;
  28611. }
  28612. }
  28613. const img = {
  28614. width: imgWidth,
  28615. height: imgHeight
  28616. };
  28617. if (context.isOffscreenCanvasSupported) {
  28618. const canvas = new OffscreenCanvas(imgWidth, imgHeight);
  28619. const ctx = canvas.getContext("2d");
  28620. ctx.putImageData(new ImageData(new Uint8ClampedArray(imgData.buffer), imgWidth, imgHeight), 0, 0);
  28621. img.bitmap = canvas.transferToImageBitmap();
  28622. img.data = null;
  28623. } else {
  28624. img.kind = ImageKind.RGBA_32BPP;
  28625. img.data = imgData;
  28626. }
  28627. fnArray.splice(iFirstSave, count * 4, OPS.paintInlineImageXObjectGroup);
  28628. argsArray.splice(iFirstSave, count * 4, [img, map]);
  28629. return iFirstSave + 1;
  28630. });
  28631. addState(InitialState, [OPS.save, OPS.transform, OPS.paintImageMaskXObject, OPS.restore], null, function iterateImageMaskGroup(context, i) {
  28632. const fnArray = context.fnArray;
  28633. const iFirstSave = context.iCurr - 3;
  28634. const pos = (i - iFirstSave) % 4;
  28635. switch (pos) {
  28636. case 0:
  28637. return fnArray[i] === OPS.save;
  28638. case 1:
  28639. return fnArray[i] === OPS.transform;
  28640. case 2:
  28641. return fnArray[i] === OPS.paintImageMaskXObject;
  28642. case 3:
  28643. return fnArray[i] === OPS.restore;
  28644. }
  28645. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  28646. }, function foundImageMaskGroup(context, i) {
  28647. const MIN_IMAGES_IN_MASKS_BLOCK = 10;
  28648. const MAX_IMAGES_IN_MASKS_BLOCK = 100;
  28649. const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  28650. const fnArray = context.fnArray,
  28651. argsArray = context.argsArray;
  28652. const curr = context.iCurr;
  28653. const iFirstSave = curr - 3;
  28654. const iFirstTransform = curr - 2;
  28655. const iFirstPIMXO = curr - 1;
  28656. let count = Math.floor((i - iFirstSave) / 4);
  28657. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  28658. return i - (i - iFirstSave) % 4;
  28659. }
  28660. let isSameImage = false;
  28661. let iTransform, transformArgs;
  28662. const firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  28663. const firstTransformArg0 = argsArray[iFirstTransform][0],
  28664. firstTransformArg1 = argsArray[iFirstTransform][1],
  28665. firstTransformArg2 = argsArray[iFirstTransform][2],
  28666. firstTransformArg3 = argsArray[iFirstTransform][3];
  28667. if (firstTransformArg1 === firstTransformArg2) {
  28668. isSameImage = true;
  28669. iTransform = iFirstTransform + 4;
  28670. let iPIMXO = iFirstPIMXO + 4;
  28671. for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  28672. transformArgs = argsArray[iTransform];
  28673. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) {
  28674. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  28675. isSameImage = false;
  28676. } else {
  28677. count = q;
  28678. }
  28679. break;
  28680. }
  28681. }
  28682. }
  28683. if (isSameImage) {
  28684. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  28685. const positions = new Float32Array(count * 2);
  28686. iTransform = iFirstTransform;
  28687. for (let q = 0; q < count; q++, iTransform += 4) {
  28688. transformArgs = argsArray[iTransform];
  28689. positions[q << 1] = transformArgs[4];
  28690. positions[(q << 1) + 1] = transformArgs[5];
  28691. }
  28692. fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectRepeat);
  28693. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]);
  28694. } else {
  28695. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  28696. const images = [];
  28697. for (let q = 0; q < count; q++) {
  28698. transformArgs = argsArray[iFirstTransform + (q << 2)];
  28699. const maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  28700. images.push({
  28701. data: maskParams.data,
  28702. width: maskParams.width,
  28703. height: maskParams.height,
  28704. interpolate: maskParams.interpolate,
  28705. count: maskParams.count,
  28706. transform: transformArgs
  28707. });
  28708. }
  28709. fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectGroup);
  28710. argsArray.splice(iFirstSave, count * 4, [images]);
  28711. }
  28712. return iFirstSave + 1;
  28713. });
  28714. addState(InitialState, [OPS.save, OPS.transform, OPS.paintImageXObject, OPS.restore], function (context) {
  28715. const argsArray = context.argsArray;
  28716. const iFirstTransform = context.iCurr - 2;
  28717. return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
  28718. }, function iterateImageGroup(context, i) {
  28719. const fnArray = context.fnArray,
  28720. argsArray = context.argsArray;
  28721. const iFirstSave = context.iCurr - 3;
  28722. const pos = (i - iFirstSave) % 4;
  28723. switch (pos) {
  28724. case 0:
  28725. return fnArray[i] === OPS.save;
  28726. case 1:
  28727. if (fnArray[i] !== OPS.transform) {
  28728. return false;
  28729. }
  28730. const iFirstTransform = context.iCurr - 2;
  28731. const firstTransformArg0 = argsArray[iFirstTransform][0];
  28732. const firstTransformArg3 = argsArray[iFirstTransform][3];
  28733. if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
  28734. return false;
  28735. }
  28736. return true;
  28737. case 2:
  28738. if (fnArray[i] !== OPS.paintImageXObject) {
  28739. return false;
  28740. }
  28741. const iFirstPIXO = context.iCurr - 1;
  28742. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  28743. if (argsArray[i][0] !== firstPIXOArg0) {
  28744. return false;
  28745. }
  28746. return true;
  28747. case 3:
  28748. return fnArray[i] === OPS.restore;
  28749. }
  28750. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  28751. }, function (context, i) {
  28752. const MIN_IMAGES_IN_BLOCK = 3;
  28753. const MAX_IMAGES_IN_BLOCK = 1000;
  28754. const fnArray = context.fnArray,
  28755. argsArray = context.argsArray;
  28756. const curr = context.iCurr;
  28757. const iFirstSave = curr - 3;
  28758. const iFirstTransform = curr - 2;
  28759. const iFirstPIXO = curr - 1;
  28760. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  28761. const firstTransformArg0 = argsArray[iFirstTransform][0];
  28762. const firstTransformArg3 = argsArray[iFirstTransform][3];
  28763. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
  28764. if (count < MIN_IMAGES_IN_BLOCK) {
  28765. return i - (i - iFirstSave) % 4;
  28766. }
  28767. const positions = new Float32Array(count * 2);
  28768. let iTransform = iFirstTransform;
  28769. for (let q = 0; q < count; q++, iTransform += 4) {
  28770. const transformArgs = argsArray[iTransform];
  28771. positions[q << 1] = transformArgs[4];
  28772. positions[(q << 1) + 1] = transformArgs[5];
  28773. }
  28774. const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  28775. fnArray.splice(iFirstSave, count * 4, OPS.paintImageXObjectRepeat);
  28776. argsArray.splice(iFirstSave, count * 4, args);
  28777. return iFirstSave + 1;
  28778. });
  28779. addState(InitialState, [OPS.beginText, OPS.setFont, OPS.setTextMatrix, OPS.showText, OPS.endText], null, function iterateShowTextGroup(context, i) {
  28780. const fnArray = context.fnArray,
  28781. argsArray = context.argsArray;
  28782. const iFirstSave = context.iCurr - 4;
  28783. const pos = (i - iFirstSave) % 5;
  28784. switch (pos) {
  28785. case 0:
  28786. return fnArray[i] === OPS.beginText;
  28787. case 1:
  28788. return fnArray[i] === OPS.setFont;
  28789. case 2:
  28790. return fnArray[i] === OPS.setTextMatrix;
  28791. case 3:
  28792. if (fnArray[i] !== OPS.showText) {
  28793. return false;
  28794. }
  28795. const iFirstSetFont = context.iCurr - 3;
  28796. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  28797. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  28798. if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
  28799. return false;
  28800. }
  28801. return true;
  28802. case 4:
  28803. return fnArray[i] === OPS.endText;
  28804. }
  28805. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  28806. }, function (context, i) {
  28807. const MIN_CHARS_IN_BLOCK = 3;
  28808. const MAX_CHARS_IN_BLOCK = 1000;
  28809. const fnArray = context.fnArray,
  28810. argsArray = context.argsArray;
  28811. const curr = context.iCurr;
  28812. const iFirstBeginText = curr - 4;
  28813. const iFirstSetFont = curr - 3;
  28814. const iFirstSetTextMatrix = curr - 2;
  28815. const iFirstShowText = curr - 1;
  28816. const iFirstEndText = curr;
  28817. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  28818. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  28819. let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
  28820. if (count < MIN_CHARS_IN_BLOCK) {
  28821. return i - (i - iFirstBeginText) % 5;
  28822. }
  28823. let iFirst = iFirstBeginText;
  28824. if (iFirstBeginText >= 4 && fnArray[iFirstBeginText - 4] === fnArray[iFirstSetFont] && fnArray[iFirstBeginText - 3] === fnArray[iFirstSetTextMatrix] && fnArray[iFirstBeginText - 2] === fnArray[iFirstShowText] && fnArray[iFirstBeginText - 1] === fnArray[iFirstEndText] && argsArray[iFirstBeginText - 4][0] === firstSetFontArg0 && argsArray[iFirstBeginText - 4][1] === firstSetFontArg1) {
  28825. count++;
  28826. iFirst -= 5;
  28827. }
  28828. let iEndText = iFirst + 4;
  28829. for (let q = 1; q < count; q++) {
  28830. fnArray.splice(iEndText, 3);
  28831. argsArray.splice(iEndText, 3);
  28832. iEndText += 2;
  28833. }
  28834. return iEndText + 1;
  28835. });
  28836. class NullOptimizer {
  28837. constructor(queue) {
  28838. this.queue = queue;
  28839. }
  28840. _optimize() {}
  28841. push(fn, args) {
  28842. this.queue.fnArray.push(fn);
  28843. this.queue.argsArray.push(args);
  28844. this._optimize();
  28845. }
  28846. flush() {}
  28847. reset() {}
  28848. }
  28849. class QueueOptimizer extends NullOptimizer {
  28850. constructor(queue) {
  28851. super(queue);
  28852. this.state = null;
  28853. this.context = {
  28854. iCurr: 0,
  28855. fnArray: queue.fnArray,
  28856. argsArray: queue.argsArray,
  28857. isOffscreenCanvasSupported: false
  28858. };
  28859. this.match = null;
  28860. this.lastProcessed = 0;
  28861. }
  28862. set isOffscreenCanvasSupported(value) {
  28863. this.context.isOffscreenCanvasSupported = value;
  28864. }
  28865. _optimize() {
  28866. const fnArray = this.queue.fnArray;
  28867. let i = this.lastProcessed,
  28868. ii = fnArray.length;
  28869. let state = this.state;
  28870. let match = this.match;
  28871. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  28872. this.lastProcessed = ii;
  28873. return;
  28874. }
  28875. const context = this.context;
  28876. while (i < ii) {
  28877. if (match) {
  28878. const iterate = (0, match.iterateFn)(context, i);
  28879. if (iterate) {
  28880. i++;
  28881. continue;
  28882. }
  28883. i = (0, match.processFn)(context, i + 1);
  28884. ii = fnArray.length;
  28885. match = null;
  28886. state = null;
  28887. if (i >= ii) {
  28888. break;
  28889. }
  28890. }
  28891. state = (state || InitialState)[fnArray[i]];
  28892. if (!state || Array.isArray(state)) {
  28893. i++;
  28894. continue;
  28895. }
  28896. context.iCurr = i;
  28897. i++;
  28898. if (state.checkFn && !(0, state.checkFn)(context)) {
  28899. state = null;
  28900. continue;
  28901. }
  28902. match = state;
  28903. state = null;
  28904. }
  28905. this.state = state;
  28906. this.match = match;
  28907. this.lastProcessed = i;
  28908. }
  28909. flush() {
  28910. while (this.match) {
  28911. const length = this.queue.fnArray.length;
  28912. this.lastProcessed = (0, this.match.processFn)(this.context, length);
  28913. this.match = null;
  28914. this.state = null;
  28915. this._optimize();
  28916. }
  28917. }
  28918. reset() {
  28919. this.state = null;
  28920. this.match = null;
  28921. this.lastProcessed = 0;
  28922. }
  28923. }
  28924. class OperatorList {
  28925. static CHUNK_SIZE = 1000;
  28926. static CHUNK_SIZE_ABOUT = this.CHUNK_SIZE - 5;
  28927. constructor(intent = 0, streamSink) {
  28928. this._streamSink = streamSink;
  28929. this.fnArray = [];
  28930. this.argsArray = [];
  28931. this.optimizer = streamSink && !(intent & RenderingIntentFlag.OPLIST) ? new QueueOptimizer(this) : new NullOptimizer(this);
  28932. this.dependencies = new Set();
  28933. this._totalLength = 0;
  28934. this.weight = 0;
  28935. this._resolved = streamSink ? null : Promise.resolve();
  28936. }
  28937. set isOffscreenCanvasSupported(value) {
  28938. this.optimizer.isOffscreenCanvasSupported = value;
  28939. }
  28940. get length() {
  28941. return this.argsArray.length;
  28942. }
  28943. get ready() {
  28944. return this._resolved || this._streamSink.ready;
  28945. }
  28946. get totalLength() {
  28947. return this._totalLength + this.length;
  28948. }
  28949. addOp(fn, args) {
  28950. this.optimizer.push(fn, args);
  28951. this.weight++;
  28952. if (this._streamSink) {
  28953. if (this.weight >= OperatorList.CHUNK_SIZE) {
  28954. this.flush();
  28955. } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === OPS.restore || fn === OPS.endText)) {
  28956. this.flush();
  28957. }
  28958. }
  28959. }
  28960. addImageOps(fn, args, optionalContent) {
  28961. if (optionalContent !== undefined) {
  28962. this.addOp(OPS.beginMarkedContentProps, ["OC", optionalContent]);
  28963. }
  28964. this.addOp(fn, args);
  28965. if (optionalContent !== undefined) {
  28966. this.addOp(OPS.endMarkedContent, []);
  28967. }
  28968. }
  28969. addDependency(dependency) {
  28970. if (this.dependencies.has(dependency)) {
  28971. return;
  28972. }
  28973. this.dependencies.add(dependency);
  28974. this.addOp(OPS.dependency, [dependency]);
  28975. }
  28976. addDependencies(dependencies) {
  28977. for (const dependency of dependencies) {
  28978. this.addDependency(dependency);
  28979. }
  28980. }
  28981. addOpList(opList) {
  28982. if (!(opList instanceof OperatorList)) {
  28983. warn('addOpList - ignoring invalid "opList" parameter.');
  28984. return;
  28985. }
  28986. for (const dependency of opList.dependencies) {
  28987. this.dependencies.add(dependency);
  28988. }
  28989. for (let i = 0, ii = opList.length; i < ii; i++) {
  28990. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  28991. }
  28992. }
  28993. getIR() {
  28994. return {
  28995. fnArray: this.fnArray,
  28996. argsArray: this.argsArray,
  28997. length: this.length
  28998. };
  28999. }
  29000. get _transfers() {
  29001. const transfers = [];
  29002. const {
  29003. fnArray,
  29004. argsArray,
  29005. length
  29006. } = this;
  29007. for (let i = 0; i < length; i++) {
  29008. switch (fnArray[i]) {
  29009. case OPS.paintInlineImageXObject:
  29010. case OPS.paintInlineImageXObjectGroup:
  29011. case OPS.paintImageMaskXObject:
  29012. const arg = argsArray[i][0];
  29013. if (!arg.cached && arg.data?.buffer instanceof ArrayBuffer) {
  29014. transfers.push(arg.data.buffer);
  29015. }
  29016. break;
  29017. }
  29018. }
  29019. return transfers;
  29020. }
  29021. flush(lastChunk = false, separateAnnots = null) {
  29022. this.optimizer.flush();
  29023. const length = this.length;
  29024. this._totalLength += length;
  29025. this._streamSink.enqueue({
  29026. fnArray: this.fnArray,
  29027. argsArray: this.argsArray,
  29028. lastChunk,
  29029. separateAnnots,
  29030. length
  29031. }, 1, this._transfers);
  29032. this.dependencies.clear();
  29033. this.fnArray.length = 0;
  29034. this.argsArray.length = 0;
  29035. this.weight = 0;
  29036. this.optimizer.reset();
  29037. }
  29038. }
  29039. ;// ./src/core/image.js
  29040. function decodeAndClamp(value, addend, coefficient, max) {
  29041. value = addend + value * coefficient;
  29042. if (value < 0) {
  29043. value = 0;
  29044. } else if (value > max) {
  29045. value = max;
  29046. }
  29047. return value;
  29048. }
  29049. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  29050. const length = w2 * h2;
  29051. let dest;
  29052. if (bpc <= 8) {
  29053. dest = new Uint8Array(length);
  29054. } else if (bpc <= 16) {
  29055. dest = new Uint16Array(length);
  29056. } else {
  29057. dest = new Uint32Array(length);
  29058. }
  29059. const xRatio = w1 / w2;
  29060. const yRatio = h1 / h2;
  29061. let i,
  29062. j,
  29063. py,
  29064. newIndex = 0,
  29065. oldIndex;
  29066. const xScaled = new Uint16Array(w2);
  29067. const w1Scanline = w1;
  29068. for (i = 0; i < w2; i++) {
  29069. xScaled[i] = Math.floor(i * xRatio);
  29070. }
  29071. for (i = 0; i < h2; i++) {
  29072. py = Math.floor(i * yRatio) * w1Scanline;
  29073. for (j = 0; j < w2; j++) {
  29074. oldIndex = py + xScaled[j];
  29075. dest[newIndex++] = src[oldIndex];
  29076. }
  29077. }
  29078. return dest;
  29079. }
  29080. class PDFImage {
  29081. constructor({
  29082. xref,
  29083. res,
  29084. image,
  29085. isInline = false,
  29086. smask = null,
  29087. mask = null,
  29088. isMask = false,
  29089. pdfFunctionFactory,
  29090. localColorSpaceCache
  29091. }) {
  29092. this.image = image;
  29093. const dict = image.dict;
  29094. const filter = dict.get("F", "Filter");
  29095. let filterName;
  29096. if (filter instanceof Name) {
  29097. filterName = filter.name;
  29098. } else if (Array.isArray(filter)) {
  29099. const filterZero = xref.fetchIfRef(filter[0]);
  29100. if (filterZero instanceof Name) {
  29101. filterName = filterZero.name;
  29102. }
  29103. }
  29104. switch (filterName) {
  29105. case "JPXDecode":
  29106. ({
  29107. width: image.width,
  29108. height: image.height,
  29109. componentsCount: image.numComps,
  29110. bitsPerComponent: image.bitsPerComponent
  29111. } = JpxImage.parseImageProperties(image.stream));
  29112. image.stream.reset();
  29113. this.jpxDecoderOptions = {
  29114. numComponents: 0,
  29115. isIndexedColormap: false,
  29116. smaskInData: dict.has("SMaskInData")
  29117. };
  29118. break;
  29119. case "JBIG2Decode":
  29120. image.bitsPerComponent = 1;
  29121. image.numComps = 1;
  29122. break;
  29123. }
  29124. let width = dict.get("W", "Width");
  29125. let height = dict.get("H", "Height");
  29126. if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
  29127. warn("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
  29128. width = image.width;
  29129. height = image.height;
  29130. }
  29131. if (width < 1 || height < 1) {
  29132. throw new FormatError(`Invalid image width: ${width} or height: ${height}`);
  29133. }
  29134. this.width = width;
  29135. this.height = height;
  29136. this.interpolate = dict.get("I", "Interpolate");
  29137. this.imageMask = dict.get("IM", "ImageMask") || false;
  29138. this.matte = dict.get("Matte") || false;
  29139. let bitsPerComponent = image.bitsPerComponent;
  29140. if (!bitsPerComponent) {
  29141. bitsPerComponent = dict.get("BPC", "BitsPerComponent");
  29142. if (!bitsPerComponent) {
  29143. if (this.imageMask) {
  29144. bitsPerComponent = 1;
  29145. } else {
  29146. throw new FormatError(`Bits per component missing in image: ${this.imageMask}`);
  29147. }
  29148. }
  29149. }
  29150. this.bpc = bitsPerComponent;
  29151. if (!this.imageMask) {
  29152. let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace");
  29153. const hasColorSpace = !!colorSpace;
  29154. if (!hasColorSpace) {
  29155. if (this.jpxDecoderOptions) {
  29156. colorSpace = Name.get("DeviceRGBA");
  29157. } else {
  29158. switch (image.numComps) {
  29159. case 1:
  29160. colorSpace = Name.get("DeviceGray");
  29161. break;
  29162. case 3:
  29163. colorSpace = Name.get("DeviceRGB");
  29164. break;
  29165. case 4:
  29166. colorSpace = Name.get("DeviceCMYK");
  29167. break;
  29168. default:
  29169. throw new Error(`Images with ${image.numComps} color components not supported.`);
  29170. }
  29171. }
  29172. } else if (this.jpxDecoderOptions?.smaskInData) {
  29173. colorSpace = Name.get("DeviceRGBA");
  29174. }
  29175. this.colorSpace = ColorSpace.parse({
  29176. cs: colorSpace,
  29177. xref,
  29178. resources: isInline ? res : null,
  29179. pdfFunctionFactory,
  29180. localColorSpaceCache
  29181. });
  29182. this.numComps = this.colorSpace.numComps;
  29183. if (this.jpxDecoderOptions) {
  29184. this.jpxDecoderOptions.numComponents = hasColorSpace ? this.numComp : 0;
  29185. this.jpxDecoderOptions.isIndexedColormap = this.colorSpace.name === "Indexed";
  29186. }
  29187. }
  29188. this.decode = dict.getArray("D", "Decode");
  29189. this.needsDecode = false;
  29190. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !ColorSpace.isDefaultDecode(this.decode, 1))) {
  29191. this.needsDecode = true;
  29192. const max = (1 << bitsPerComponent) - 1;
  29193. this.decodeCoefficients = [];
  29194. this.decodeAddends = [];
  29195. const isIndexed = this.colorSpace?.name === "Indexed";
  29196. for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  29197. const dmin = this.decode[i];
  29198. const dmax = this.decode[i + 1];
  29199. this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
  29200. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  29201. }
  29202. }
  29203. if (smask) {
  29204. this.smask = new PDFImage({
  29205. xref,
  29206. res,
  29207. image: smask,
  29208. isInline,
  29209. pdfFunctionFactory,
  29210. localColorSpaceCache
  29211. });
  29212. } else if (mask) {
  29213. if (mask instanceof BaseStream) {
  29214. const maskDict = mask.dict,
  29215. imageMask = maskDict.get("IM", "ImageMask");
  29216. if (!imageMask) {
  29217. warn("Ignoring /Mask in image without /ImageMask.");
  29218. } else {
  29219. this.mask = new PDFImage({
  29220. xref,
  29221. res,
  29222. image: mask,
  29223. isInline,
  29224. isMask: true,
  29225. pdfFunctionFactory,
  29226. localColorSpaceCache
  29227. });
  29228. }
  29229. } else {
  29230. this.mask = mask;
  29231. }
  29232. }
  29233. }
  29234. static async buildImage({
  29235. xref,
  29236. res,
  29237. image,
  29238. isInline = false,
  29239. pdfFunctionFactory,
  29240. localColorSpaceCache
  29241. }) {
  29242. const imageData = image;
  29243. let smaskData = null;
  29244. let maskData = null;
  29245. const smask = image.dict.get("SMask");
  29246. const mask = image.dict.get("Mask");
  29247. if (smask) {
  29248. if (smask instanceof BaseStream) {
  29249. smaskData = smask;
  29250. } else {
  29251. warn("Unsupported /SMask format.");
  29252. }
  29253. } else if (mask) {
  29254. if (mask instanceof BaseStream || Array.isArray(mask)) {
  29255. maskData = mask;
  29256. } else {
  29257. warn("Unsupported /Mask format.");
  29258. }
  29259. }
  29260. return new PDFImage({
  29261. xref,
  29262. res,
  29263. image: imageData,
  29264. isInline,
  29265. smask: smaskData,
  29266. mask: maskData,
  29267. pdfFunctionFactory,
  29268. localColorSpaceCache
  29269. });
  29270. }
  29271. static createRawMask({
  29272. imgArray,
  29273. width,
  29274. height,
  29275. imageIsFromDecodeStream,
  29276. inverseDecode,
  29277. interpolate
  29278. }) {
  29279. const computedLength = (width + 7 >> 3) * height;
  29280. const actualLength = imgArray.byteLength;
  29281. const haveFullData = computedLength === actualLength;
  29282. let data, i;
  29283. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  29284. data = imgArray;
  29285. } else if (!inverseDecode) {
  29286. data = new Uint8Array(imgArray);
  29287. } else {
  29288. data = new Uint8Array(computedLength);
  29289. data.set(imgArray);
  29290. data.fill(0xff, actualLength);
  29291. }
  29292. if (inverseDecode) {
  29293. for (i = 0; i < actualLength; i++) {
  29294. data[i] ^= 0xff;
  29295. }
  29296. }
  29297. return {
  29298. data,
  29299. width,
  29300. height,
  29301. interpolate
  29302. };
  29303. }
  29304. static async createMask({
  29305. imgArray,
  29306. width,
  29307. height,
  29308. imageIsFromDecodeStream,
  29309. inverseDecode,
  29310. interpolate,
  29311. isOffscreenCanvasSupported = false
  29312. }) {
  29313. const isSingleOpaquePixel = width === 1 && height === 1 && inverseDecode === (imgArray.length === 0 || !!(imgArray[0] & 128));
  29314. if (isSingleOpaquePixel) {
  29315. return {
  29316. isSingleOpaquePixel
  29317. };
  29318. }
  29319. if (isOffscreenCanvasSupported) {
  29320. if (ImageResizer.needsToBeResized(width, height)) {
  29321. const data = new Uint8ClampedArray(width * height * 4);
  29322. convertBlackAndWhiteToRGBA({
  29323. src: imgArray,
  29324. dest: data,
  29325. width,
  29326. height,
  29327. nonBlackColor: 0,
  29328. inverseDecode
  29329. });
  29330. return ImageResizer.createImage({
  29331. kind: ImageKind.RGBA_32BPP,
  29332. data,
  29333. width,
  29334. height,
  29335. interpolate
  29336. });
  29337. }
  29338. const canvas = new OffscreenCanvas(width, height);
  29339. const ctx = canvas.getContext("2d");
  29340. const imgData = ctx.createImageData(width, height);
  29341. convertBlackAndWhiteToRGBA({
  29342. src: imgArray,
  29343. dest: imgData.data,
  29344. width,
  29345. height,
  29346. nonBlackColor: 0,
  29347. inverseDecode
  29348. });
  29349. ctx.putImageData(imgData, 0, 0);
  29350. const bitmap = canvas.transferToImageBitmap();
  29351. return {
  29352. data: null,
  29353. width,
  29354. height,
  29355. interpolate,
  29356. bitmap
  29357. };
  29358. }
  29359. return this.createRawMask({
  29360. imgArray,
  29361. width,
  29362. height,
  29363. inverseDecode,
  29364. imageIsFromDecodeStream,
  29365. interpolate
  29366. });
  29367. }
  29368. get drawWidth() {
  29369. return Math.max(this.width, this.smask?.width || 0, this.mask?.width || 0);
  29370. }
  29371. get drawHeight() {
  29372. return Math.max(this.height, this.smask?.height || 0, this.mask?.height || 0);
  29373. }
  29374. decodeBuffer(buffer) {
  29375. const bpc = this.bpc;
  29376. const numComps = this.numComps;
  29377. const decodeAddends = this.decodeAddends;
  29378. const decodeCoefficients = this.decodeCoefficients;
  29379. const max = (1 << bpc) - 1;
  29380. let i, ii;
  29381. if (bpc === 1) {
  29382. for (i = 0, ii = buffer.length; i < ii; i++) {
  29383. buffer[i] = +!buffer[i];
  29384. }
  29385. return;
  29386. }
  29387. let index = 0;
  29388. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  29389. for (let j = 0; j < numComps; j++) {
  29390. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  29391. index++;
  29392. }
  29393. }
  29394. }
  29395. getComponents(buffer) {
  29396. const bpc = this.bpc;
  29397. if (bpc === 8) {
  29398. return buffer;
  29399. }
  29400. const width = this.width;
  29401. const height = this.height;
  29402. const numComps = this.numComps;
  29403. const length = width * height * numComps;
  29404. let bufferPos = 0;
  29405. let output;
  29406. if (bpc <= 8) {
  29407. output = new Uint8Array(length);
  29408. } else if (bpc <= 16) {
  29409. output = new Uint16Array(length);
  29410. } else {
  29411. output = new Uint32Array(length);
  29412. }
  29413. const rowComps = width * numComps;
  29414. const max = (1 << bpc) - 1;
  29415. let i = 0,
  29416. ii,
  29417. buf;
  29418. if (bpc === 1) {
  29419. let mask, loop1End, loop2End;
  29420. for (let j = 0; j < height; j++) {
  29421. loop1End = i + (rowComps & ~7);
  29422. loop2End = i + rowComps;
  29423. while (i < loop1End) {
  29424. buf = buffer[bufferPos++];
  29425. output[i] = buf >> 7 & 1;
  29426. output[i + 1] = buf >> 6 & 1;
  29427. output[i + 2] = buf >> 5 & 1;
  29428. output[i + 3] = buf >> 4 & 1;
  29429. output[i + 4] = buf >> 3 & 1;
  29430. output[i + 5] = buf >> 2 & 1;
  29431. output[i + 6] = buf >> 1 & 1;
  29432. output[i + 7] = buf & 1;
  29433. i += 8;
  29434. }
  29435. if (i < loop2End) {
  29436. buf = buffer[bufferPos++];
  29437. mask = 128;
  29438. while (i < loop2End) {
  29439. output[i++] = +!!(buf & mask);
  29440. mask >>= 1;
  29441. }
  29442. }
  29443. }
  29444. } else {
  29445. let bits = 0;
  29446. buf = 0;
  29447. for (i = 0, ii = length; i < ii; ++i) {
  29448. if (i % rowComps === 0) {
  29449. buf = 0;
  29450. bits = 0;
  29451. }
  29452. while (bits < bpc) {
  29453. buf = buf << 8 | buffer[bufferPos++];
  29454. bits += 8;
  29455. }
  29456. const remainingBits = bits - bpc;
  29457. let value = buf >> remainingBits;
  29458. if (value < 0) {
  29459. value = 0;
  29460. } else if (value > max) {
  29461. value = max;
  29462. }
  29463. output[i] = value;
  29464. buf &= (1 << remainingBits) - 1;
  29465. bits = remainingBits;
  29466. }
  29467. }
  29468. return output;
  29469. }
  29470. async fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  29471. const smask = this.smask;
  29472. const mask = this.mask;
  29473. let alphaBuf, sw, sh, i, ii, j;
  29474. if (smask) {
  29475. sw = smask.width;
  29476. sh = smask.height;
  29477. alphaBuf = new Uint8ClampedArray(sw * sh);
  29478. await smask.fillGrayBuffer(alphaBuf);
  29479. if (sw !== width || sh !== height) {
  29480. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  29481. }
  29482. } else if (mask) {
  29483. if (mask instanceof PDFImage) {
  29484. sw = mask.width;
  29485. sh = mask.height;
  29486. alphaBuf = new Uint8ClampedArray(sw * sh);
  29487. mask.numComps = 1;
  29488. await mask.fillGrayBuffer(alphaBuf);
  29489. for (i = 0, ii = sw * sh; i < ii; ++i) {
  29490. alphaBuf[i] = 255 - alphaBuf[i];
  29491. }
  29492. if (sw !== width || sh !== height) {
  29493. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  29494. }
  29495. } else if (Array.isArray(mask)) {
  29496. alphaBuf = new Uint8ClampedArray(width * height);
  29497. const numComps = this.numComps;
  29498. for (i = 0, ii = width * height; i < ii; ++i) {
  29499. let opacity = 0;
  29500. const imageOffset = i * numComps;
  29501. for (j = 0; j < numComps; ++j) {
  29502. const color = image[imageOffset + j];
  29503. const maskOffset = j * 2;
  29504. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  29505. opacity = 255;
  29506. break;
  29507. }
  29508. }
  29509. alphaBuf[i] = opacity;
  29510. }
  29511. } else {
  29512. throw new FormatError("Unknown mask format.");
  29513. }
  29514. }
  29515. if (alphaBuf) {
  29516. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  29517. rgbaBuf[j] = alphaBuf[i];
  29518. }
  29519. } else {
  29520. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  29521. rgbaBuf[j] = 255;
  29522. }
  29523. }
  29524. }
  29525. undoPreblend(buffer, width, height) {
  29526. const matte = this.smask?.matte;
  29527. if (!matte) {
  29528. return;
  29529. }
  29530. const matteRgb = this.colorSpace.getRgb(matte, 0);
  29531. const matteR = matteRgb[0];
  29532. const matteG = matteRgb[1];
  29533. const matteB = matteRgb[2];
  29534. const length = width * height * 4;
  29535. for (let i = 0; i < length; i += 4) {
  29536. const alpha = buffer[i + 3];
  29537. if (alpha === 0) {
  29538. buffer[i] = 255;
  29539. buffer[i + 1] = 255;
  29540. buffer[i + 2] = 255;
  29541. continue;
  29542. }
  29543. const k = 255 / alpha;
  29544. buffer[i] = (buffer[i] - matteR) * k + matteR;
  29545. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  29546. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  29547. }
  29548. }
  29549. async createImageData(forceRGBA = false, isOffscreenCanvasSupported = false) {
  29550. const drawWidth = this.drawWidth;
  29551. const drawHeight = this.drawHeight;
  29552. const imgData = {
  29553. width: drawWidth,
  29554. height: drawHeight,
  29555. interpolate: this.interpolate,
  29556. kind: 0,
  29557. data: null
  29558. };
  29559. const numComps = this.numComps;
  29560. const originalWidth = this.width;
  29561. const originalHeight = this.height;
  29562. const bpc = this.bpc;
  29563. const rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  29564. const mustBeResized = isOffscreenCanvasSupported && ImageResizer.needsToBeResized(drawWidth, drawHeight);
  29565. if (!this.smask && !this.mask && this.colorSpace.name === "DeviceRGBA") {
  29566. imgData.kind = ImageKind.RGBA_32BPP;
  29567. const imgArray = imgData.data = await this.getImageBytes(originalHeight * originalWidth * 4, {});
  29568. if (isOffscreenCanvasSupported) {
  29569. if (!mustBeResized) {
  29570. return this.createBitmap(ImageKind.RGBA_32BPP, drawWidth, drawHeight, imgArray);
  29571. }
  29572. return ImageResizer.createImage(imgData, false);
  29573. }
  29574. return imgData;
  29575. }
  29576. if (!forceRGBA) {
  29577. let kind;
  29578. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  29579. kind = ImageKind.GRAYSCALE_1BPP;
  29580. } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
  29581. kind = ImageKind.RGB_24BPP;
  29582. }
  29583. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  29584. const image = await this.#getImage(originalWidth, originalHeight);
  29585. if (image) {
  29586. return image;
  29587. }
  29588. const data = await this.getImageBytes(originalHeight * rowBytes, {});
  29589. if (isOffscreenCanvasSupported) {
  29590. if (mustBeResized) {
  29591. return ImageResizer.createImage({
  29592. data,
  29593. kind,
  29594. width: drawWidth,
  29595. height: drawHeight,
  29596. interpolate: this.interpolate
  29597. }, this.needsDecode);
  29598. }
  29599. return this.createBitmap(kind, originalWidth, originalHeight, data);
  29600. }
  29601. imgData.kind = kind;
  29602. imgData.data = data;
  29603. if (this.needsDecode) {
  29604. assert(kind === ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
  29605. const buffer = imgData.data;
  29606. for (let i = 0, ii = buffer.length; i < ii; i++) {
  29607. buffer[i] ^= 0xff;
  29608. }
  29609. }
  29610. return imgData;
  29611. }
  29612. if (this.image instanceof JpegStream && !this.smask && !this.mask && !this.needsDecode) {
  29613. let imageLength = originalHeight * rowBytes;
  29614. if (isOffscreenCanvasSupported && !mustBeResized) {
  29615. let isHandled = false;
  29616. switch (this.colorSpace.name) {
  29617. case "DeviceGray":
  29618. imageLength *= 4;
  29619. isHandled = true;
  29620. break;
  29621. case "DeviceRGB":
  29622. imageLength = imageLength / 3 * 4;
  29623. isHandled = true;
  29624. break;
  29625. case "DeviceCMYK":
  29626. isHandled = true;
  29627. break;
  29628. }
  29629. if (isHandled) {
  29630. const image = await this.#getImage(drawWidth, drawHeight);
  29631. if (image) {
  29632. return image;
  29633. }
  29634. const rgba = await this.getImageBytes(imageLength, {
  29635. drawWidth,
  29636. drawHeight,
  29637. forceRGBA: true
  29638. });
  29639. return this.createBitmap(ImageKind.RGBA_32BPP, drawWidth, drawHeight, rgba);
  29640. }
  29641. } else {
  29642. switch (this.colorSpace.name) {
  29643. case "DeviceGray":
  29644. imageLength *= 3;
  29645. case "DeviceRGB":
  29646. case "DeviceCMYK":
  29647. imgData.kind = ImageKind.RGB_24BPP;
  29648. imgData.data = await this.getImageBytes(imageLength, {
  29649. drawWidth,
  29650. drawHeight,
  29651. forceRGB: true
  29652. });
  29653. if (mustBeResized) {
  29654. return ImageResizer.createImage(imgData);
  29655. }
  29656. return imgData;
  29657. }
  29658. }
  29659. }
  29660. }
  29661. const imgArray = await this.getImageBytes(originalHeight * rowBytes, {
  29662. internal: true
  29663. });
  29664. const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  29665. const comps = this.getComponents(imgArray);
  29666. let alpha01, maybeUndoPreblend;
  29667. let canvas, ctx, canvasImgData, data;
  29668. if (isOffscreenCanvasSupported && !mustBeResized) {
  29669. canvas = new OffscreenCanvas(drawWidth, drawHeight);
  29670. ctx = canvas.getContext("2d");
  29671. canvasImgData = ctx.createImageData(drawWidth, drawHeight);
  29672. data = canvasImgData.data;
  29673. }
  29674. imgData.kind = ImageKind.RGBA_32BPP;
  29675. if (!forceRGBA && !this.smask && !this.mask) {
  29676. if (!isOffscreenCanvasSupported || mustBeResized) {
  29677. imgData.kind = ImageKind.RGB_24BPP;
  29678. data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  29679. alpha01 = 0;
  29680. } else {
  29681. const arr = new Uint32Array(data.buffer);
  29682. arr.fill(FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff);
  29683. alpha01 = 1;
  29684. }
  29685. maybeUndoPreblend = false;
  29686. } else {
  29687. if (!isOffscreenCanvasSupported || mustBeResized) {
  29688. data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  29689. }
  29690. alpha01 = 1;
  29691. maybeUndoPreblend = true;
  29692. await this.fillOpacity(data, drawWidth, drawHeight, actualHeight, comps);
  29693. }
  29694. if (this.needsDecode) {
  29695. this.decodeBuffer(comps);
  29696. }
  29697. this.colorSpace.fillRgb(data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  29698. if (maybeUndoPreblend) {
  29699. this.undoPreblend(data, drawWidth, actualHeight);
  29700. }
  29701. if (isOffscreenCanvasSupported && !mustBeResized) {
  29702. ctx.putImageData(canvasImgData, 0, 0);
  29703. const bitmap = canvas.transferToImageBitmap();
  29704. return {
  29705. data: null,
  29706. width: drawWidth,
  29707. height: drawHeight,
  29708. bitmap,
  29709. interpolate: this.interpolate
  29710. };
  29711. }
  29712. imgData.data = data;
  29713. if (mustBeResized) {
  29714. return ImageResizer.createImage(imgData);
  29715. }
  29716. return imgData;
  29717. }
  29718. async fillGrayBuffer(buffer) {
  29719. const numComps = this.numComps;
  29720. if (numComps !== 1) {
  29721. throw new FormatError(`Reading gray scale from a color image: ${numComps}`);
  29722. }
  29723. const width = this.width;
  29724. const height = this.height;
  29725. const bpc = this.bpc;
  29726. const rowBytes = width * numComps * bpc + 7 >> 3;
  29727. const imgArray = await this.getImageBytes(height * rowBytes, {
  29728. internal: true
  29729. });
  29730. const comps = this.getComponents(imgArray);
  29731. let i, length;
  29732. if (bpc === 1) {
  29733. length = width * height;
  29734. if (this.needsDecode) {
  29735. for (i = 0; i < length; ++i) {
  29736. buffer[i] = comps[i] - 1 & 255;
  29737. }
  29738. } else {
  29739. for (i = 0; i < length; ++i) {
  29740. buffer[i] = -comps[i] & 255;
  29741. }
  29742. }
  29743. return;
  29744. }
  29745. if (this.needsDecode) {
  29746. this.decodeBuffer(comps);
  29747. }
  29748. length = width * height;
  29749. const scale = 255 / ((1 << bpc) - 1);
  29750. for (i = 0; i < length; ++i) {
  29751. buffer[i] = scale * comps[i];
  29752. }
  29753. }
  29754. createBitmap(kind, width, height, src) {
  29755. const canvas = new OffscreenCanvas(width, height);
  29756. const ctx = canvas.getContext("2d");
  29757. let imgData;
  29758. if (kind === ImageKind.RGBA_32BPP) {
  29759. imgData = new ImageData(src, width, height);
  29760. } else {
  29761. imgData = ctx.createImageData(width, height);
  29762. convertToRGBA({
  29763. kind,
  29764. src,
  29765. dest: new Uint32Array(imgData.data.buffer),
  29766. width,
  29767. height,
  29768. inverseDecode: this.needsDecode
  29769. });
  29770. }
  29771. ctx.putImageData(imgData, 0, 0);
  29772. const bitmap = canvas.transferToImageBitmap();
  29773. return {
  29774. data: null,
  29775. width,
  29776. height,
  29777. bitmap,
  29778. interpolate: this.interpolate
  29779. };
  29780. }
  29781. async #getImage(width, height) {
  29782. const bitmap = await this.image.getTransferableImage();
  29783. if (!bitmap) {
  29784. return null;
  29785. }
  29786. return {
  29787. data: null,
  29788. width,
  29789. height,
  29790. bitmap,
  29791. interpolate: this.interpolate
  29792. };
  29793. }
  29794. async getImageBytes(length, {
  29795. drawWidth,
  29796. drawHeight,
  29797. forceRGBA = false,
  29798. forceRGB = false,
  29799. internal = false
  29800. }) {
  29801. this.image.reset();
  29802. this.image.drawWidth = drawWidth || this.width;
  29803. this.image.drawHeight = drawHeight || this.height;
  29804. this.image.forceRGBA = !!forceRGBA;
  29805. this.image.forceRGB = !!forceRGB;
  29806. const imageBytes = await this.image.getImageData(length, this.jpxDecoderOptions);
  29807. if (internal || this.image instanceof DecodeStream) {
  29808. return imageBytes;
  29809. }
  29810. assert(imageBytes instanceof Uint8Array, 'PDFImage.getImageBytes: Unsupported "imageBytes" type.');
  29811. return new Uint8Array(imageBytes);
  29812. }
  29813. }
  29814. ;// ./src/core/evaluator.js
  29815. const DefaultPartialEvaluatorOptions = Object.freeze({
  29816. maxImageSize: -1,
  29817. disableFontFace: false,
  29818. ignoreErrors: false,
  29819. isEvalSupported: true,
  29820. isOffscreenCanvasSupported: false,
  29821. isChrome: false,
  29822. canvasMaxAreaInBytes: -1,
  29823. fontExtraProperties: false,
  29824. useSystemFonts: true,
  29825. cMapUrl: null,
  29826. standardFontDataUrl: null
  29827. });
  29828. const PatternType = {
  29829. TILING: 1,
  29830. SHADING: 2
  29831. };
  29832. const TEXT_CHUNK_BATCH_SIZE = 10;
  29833. const deferred = Promise.resolve();
  29834. function normalizeBlendMode(value, parsingArray = false) {
  29835. if (Array.isArray(value)) {
  29836. for (const val of value) {
  29837. const maybeBM = normalizeBlendMode(val, true);
  29838. if (maybeBM) {
  29839. return maybeBM;
  29840. }
  29841. }
  29842. warn(`Unsupported blend mode Array: ${value}`);
  29843. return "source-over";
  29844. }
  29845. if (!(value instanceof Name)) {
  29846. if (parsingArray) {
  29847. return null;
  29848. }
  29849. return "source-over";
  29850. }
  29851. switch (value.name) {
  29852. case "Normal":
  29853. case "Compatible":
  29854. return "source-over";
  29855. case "Multiply":
  29856. return "multiply";
  29857. case "Screen":
  29858. return "screen";
  29859. case "Overlay":
  29860. return "overlay";
  29861. case "Darken":
  29862. return "darken";
  29863. case "Lighten":
  29864. return "lighten";
  29865. case "ColorDodge":
  29866. return "color-dodge";
  29867. case "ColorBurn":
  29868. return "color-burn";
  29869. case "HardLight":
  29870. return "hard-light";
  29871. case "SoftLight":
  29872. return "soft-light";
  29873. case "Difference":
  29874. return "difference";
  29875. case "Exclusion":
  29876. return "exclusion";
  29877. case "Hue":
  29878. return "hue";
  29879. case "Saturation":
  29880. return "saturation";
  29881. case "Color":
  29882. return "color";
  29883. case "Luminosity":
  29884. return "luminosity";
  29885. }
  29886. if (parsingArray) {
  29887. return null;
  29888. }
  29889. warn(`Unsupported blend mode: ${value.name}`);
  29890. return "source-over";
  29891. }
  29892. function addLocallyCachedImageOps(opList, data) {
  29893. if (data.objId) {
  29894. opList.addDependency(data.objId);
  29895. }
  29896. opList.addImageOps(data.fn, data.args, data.optionalContent);
  29897. if (data.fn === OPS.paintImageMaskXObject && data.args[0]?.count > 0) {
  29898. data.args[0].count++;
  29899. }
  29900. }
  29901. class TimeSlotManager {
  29902. static TIME_SLOT_DURATION_MS = 20;
  29903. static CHECK_TIME_EVERY = 100;
  29904. constructor() {
  29905. this.reset();
  29906. }
  29907. check() {
  29908. if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
  29909. return false;
  29910. }
  29911. this.checked = 0;
  29912. return this.endTime <= Date.now();
  29913. }
  29914. reset() {
  29915. this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
  29916. this.checked = 0;
  29917. }
  29918. }
  29919. class PartialEvaluator {
  29920. constructor({
  29921. xref,
  29922. handler,
  29923. pageIndex,
  29924. idFactory,
  29925. fontCache,
  29926. builtInCMapCache,
  29927. standardFontDataCache,
  29928. globalImageCache,
  29929. systemFontCache,
  29930. options = null
  29931. }) {
  29932. this.xref = xref;
  29933. this.handler = handler;
  29934. this.pageIndex = pageIndex;
  29935. this.idFactory = idFactory;
  29936. this.fontCache = fontCache;
  29937. this.builtInCMapCache = builtInCMapCache;
  29938. this.standardFontDataCache = standardFontDataCache;
  29939. this.globalImageCache = globalImageCache;
  29940. this.systemFontCache = systemFontCache;
  29941. this.options = options || DefaultPartialEvaluatorOptions;
  29942. this.type3FontRefs = null;
  29943. this._regionalImageCache = new RegionalImageCache();
  29944. this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
  29945. ImageResizer.setOptions({
  29946. isChrome: this.options.isChrome,
  29947. maxArea: this.options.canvasMaxAreaInBytes
  29948. });
  29949. }
  29950. get _pdfFunctionFactory() {
  29951. const pdfFunctionFactory = new PDFFunctionFactory({
  29952. xref: this.xref,
  29953. isEvalSupported: this.options.isEvalSupported
  29954. });
  29955. return shadow(this, "_pdfFunctionFactory", pdfFunctionFactory);
  29956. }
  29957. get parsingType3Font() {
  29958. return !!this.type3FontRefs;
  29959. }
  29960. clone(newOptions = null) {
  29961. const newEvaluator = Object.create(this);
  29962. newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
  29963. return newEvaluator;
  29964. }
  29965. hasBlendModes(resources, nonBlendModesSet) {
  29966. if (!(resources instanceof Dict)) {
  29967. return false;
  29968. }
  29969. if (resources.objId && nonBlendModesSet.has(resources.objId)) {
  29970. return false;
  29971. }
  29972. const processed = new RefSet(nonBlendModesSet);
  29973. if (resources.objId) {
  29974. processed.put(resources.objId);
  29975. }
  29976. const nodes = [resources],
  29977. xref = this.xref;
  29978. while (nodes.length) {
  29979. const node = nodes.shift();
  29980. const graphicStates = node.get("ExtGState");
  29981. if (graphicStates instanceof Dict) {
  29982. for (let graphicState of graphicStates.getRawValues()) {
  29983. if (graphicState instanceof Ref) {
  29984. if (processed.has(graphicState)) {
  29985. continue;
  29986. }
  29987. try {
  29988. graphicState = xref.fetch(graphicState);
  29989. } catch (ex) {
  29990. processed.put(graphicState);
  29991. info(`hasBlendModes - ignoring ExtGState: "${ex}".`);
  29992. continue;
  29993. }
  29994. }
  29995. if (!(graphicState instanceof Dict)) {
  29996. continue;
  29997. }
  29998. if (graphicState.objId) {
  29999. processed.put(graphicState.objId);
  30000. }
  30001. const bm = graphicState.get("BM");
  30002. if (bm instanceof Name) {
  30003. if (bm.name !== "Normal") {
  30004. return true;
  30005. }
  30006. continue;
  30007. }
  30008. if (bm !== undefined && Array.isArray(bm)) {
  30009. for (const element of bm) {
  30010. if (element instanceof Name && element.name !== "Normal") {
  30011. return true;
  30012. }
  30013. }
  30014. }
  30015. }
  30016. }
  30017. const xObjects = node.get("XObject");
  30018. if (!(xObjects instanceof Dict)) {
  30019. continue;
  30020. }
  30021. for (let xObject of xObjects.getRawValues()) {
  30022. if (xObject instanceof Ref) {
  30023. if (processed.has(xObject)) {
  30024. continue;
  30025. }
  30026. try {
  30027. xObject = xref.fetch(xObject);
  30028. } catch (ex) {
  30029. processed.put(xObject);
  30030. info(`hasBlendModes - ignoring XObject: "${ex}".`);
  30031. continue;
  30032. }
  30033. }
  30034. if (!(xObject instanceof BaseStream)) {
  30035. continue;
  30036. }
  30037. if (xObject.dict.objId) {
  30038. processed.put(xObject.dict.objId);
  30039. }
  30040. const xResources = xObject.dict.get("Resources");
  30041. if (!(xResources instanceof Dict)) {
  30042. continue;
  30043. }
  30044. if (xResources.objId && processed.has(xResources.objId)) {
  30045. continue;
  30046. }
  30047. nodes.push(xResources);
  30048. if (xResources.objId) {
  30049. processed.put(xResources.objId);
  30050. }
  30051. }
  30052. }
  30053. for (const ref of processed) {
  30054. nonBlendModesSet.put(ref);
  30055. }
  30056. return false;
  30057. }
  30058. async fetchBuiltInCMap(name) {
  30059. const cachedData = this.builtInCMapCache.get(name);
  30060. if (cachedData) {
  30061. return cachedData;
  30062. }
  30063. let data;
  30064. if (this.options.cMapUrl !== null) {
  30065. const url = `${this.options.cMapUrl}${name}.bcmap`;
  30066. const response = await fetch(url);
  30067. if (!response.ok) {
  30068. throw new Error(`fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`);
  30069. }
  30070. data = {
  30071. cMapData: new Uint8Array(await response.arrayBuffer()),
  30072. isCompressed: true
  30073. };
  30074. } else {
  30075. data = await this.handler.sendWithPromise("FetchBuiltInCMap", {
  30076. name
  30077. });
  30078. }
  30079. this.builtInCMapCache.set(name, data);
  30080. return data;
  30081. }
  30082. async fetchStandardFontData(name) {
  30083. const cachedData = this.standardFontDataCache.get(name);
  30084. if (cachedData) {
  30085. return new Stream(cachedData);
  30086. }
  30087. if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") {
  30088. return null;
  30089. }
  30090. const standardFontNameToFileName = getFontNameToFileMap(),
  30091. filename = standardFontNameToFileName[name];
  30092. let data;
  30093. if (this.options.standardFontDataUrl !== null) {
  30094. const url = `${this.options.standardFontDataUrl}${filename}`;
  30095. const response = await fetch(url);
  30096. if (!response.ok) {
  30097. warn(`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`);
  30098. } else {
  30099. data = new Uint8Array(await response.arrayBuffer());
  30100. }
  30101. } else {
  30102. try {
  30103. data = await this.handler.sendWithPromise("FetchStandardFontData", {
  30104. filename
  30105. });
  30106. } catch (e) {
  30107. warn(`fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`);
  30108. }
  30109. }
  30110. if (!data) {
  30111. return null;
  30112. }
  30113. this.standardFontDataCache.set(name, data);
  30114. return new Stream(data);
  30115. }
  30116. async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) {
  30117. const dict = xobj.dict;
  30118. const matrix = lookupMatrix(dict.getArray("Matrix"), null);
  30119. const bbox = lookupNormalRect(dict.getArray("BBox"), null);
  30120. let optionalContent, groupOptions;
  30121. if (dict.has("OC")) {
  30122. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  30123. }
  30124. if (optionalContent !== undefined) {
  30125. operatorList.addOp(OPS.beginMarkedContentProps, ["OC", optionalContent]);
  30126. }
  30127. const group = dict.get("Group");
  30128. if (group) {
  30129. groupOptions = {
  30130. matrix,
  30131. bbox,
  30132. smask,
  30133. isolated: false,
  30134. knockout: false
  30135. };
  30136. const groupSubtype = group.get("S");
  30137. let colorSpace = null;
  30138. if (isName(groupSubtype, "Transparency")) {
  30139. groupOptions.isolated = group.get("I") || false;
  30140. groupOptions.knockout = group.get("K") || false;
  30141. if (group.has("CS")) {
  30142. const cs = group.getRaw("CS");
  30143. const cachedColorSpace = ColorSpace.getCached(cs, this.xref, localColorSpaceCache);
  30144. if (cachedColorSpace) {
  30145. colorSpace = cachedColorSpace;
  30146. } else {
  30147. colorSpace = await this.parseColorSpace({
  30148. cs,
  30149. resources,
  30150. localColorSpaceCache
  30151. });
  30152. }
  30153. }
  30154. }
  30155. if (smask?.backdrop) {
  30156. colorSpace ||= ColorSpace.singletons.rgb;
  30157. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  30158. }
  30159. operatorList.addOp(OPS.beginGroup, [groupOptions]);
  30160. }
  30161. const args = group ? [matrix, null] : [matrix, bbox];
  30162. operatorList.addOp(OPS.paintFormXObjectBegin, args);
  30163. await this.getOperatorList({
  30164. stream: xobj,
  30165. task,
  30166. resources: dict.get("Resources") || resources,
  30167. operatorList,
  30168. initialState
  30169. });
  30170. operatorList.addOp(OPS.paintFormXObjectEnd, []);
  30171. if (group) {
  30172. operatorList.addOp(OPS.endGroup, [groupOptions]);
  30173. }
  30174. if (optionalContent !== undefined) {
  30175. operatorList.addOp(OPS.endMarkedContent, []);
  30176. }
  30177. }
  30178. _sendImgData(objId, imgData, cacheGlobally = false) {
  30179. const transfers = imgData ? [imgData.bitmap || imgData.data.buffer] : null;
  30180. if (this.parsingType3Font || cacheGlobally) {
  30181. return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
  30182. }
  30183. return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
  30184. }
  30185. async buildPaintImageXObject({
  30186. resources,
  30187. image,
  30188. isInline = false,
  30189. operatorList,
  30190. cacheKey,
  30191. localImageCache,
  30192. localColorSpaceCache
  30193. }) {
  30194. const dict = image.dict;
  30195. const imageRef = dict.objId;
  30196. const w = dict.get("W", "Width");
  30197. const h = dict.get("H", "Height");
  30198. if (!(w && typeof w === "number") || !(h && typeof h === "number")) {
  30199. warn("Image dimensions are missing, or not numbers.");
  30200. return;
  30201. }
  30202. const maxImageSize = this.options.maxImageSize;
  30203. if (maxImageSize !== -1 && w * h > maxImageSize) {
  30204. const msg = "Image exceeded maximum allowed size and was removed.";
  30205. if (this.options.ignoreErrors) {
  30206. warn(msg);
  30207. return;
  30208. }
  30209. throw new Error(msg);
  30210. }
  30211. let optionalContent;
  30212. if (dict.has("OC")) {
  30213. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  30214. }
  30215. const imageMask = dict.get("IM", "ImageMask") || false;
  30216. let imgData, args;
  30217. if (imageMask) {
  30218. const interpolate = dict.get("I", "Interpolate");
  30219. const bitStrideLength = w + 7 >> 3;
  30220. const imgArray = image.getBytes(bitStrideLength * h);
  30221. const decode = dict.getArray("D", "Decode");
  30222. if (this.parsingType3Font) {
  30223. imgData = PDFImage.createRawMask({
  30224. imgArray,
  30225. width: w,
  30226. height: h,
  30227. imageIsFromDecodeStream: image instanceof DecodeStream,
  30228. inverseDecode: decode?.[0] > 0,
  30229. interpolate
  30230. });
  30231. imgData.cached = !!cacheKey;
  30232. args = [imgData];
  30233. operatorList.addImageOps(OPS.paintImageMaskXObject, args, optionalContent);
  30234. if (cacheKey) {
  30235. const cacheData = {
  30236. fn: OPS.paintImageMaskXObject,
  30237. args,
  30238. optionalContent
  30239. };
  30240. localImageCache.set(cacheKey, imageRef, cacheData);
  30241. if (imageRef) {
  30242. this._regionalImageCache.set(null, imageRef, cacheData);
  30243. }
  30244. }
  30245. return;
  30246. }
  30247. imgData = await PDFImage.createMask({
  30248. imgArray,
  30249. width: w,
  30250. height: h,
  30251. imageIsFromDecodeStream: image instanceof DecodeStream,
  30252. inverseDecode: decode?.[0] > 0,
  30253. interpolate,
  30254. isOffscreenCanvasSupported: this.options.isOffscreenCanvasSupported
  30255. });
  30256. if (imgData.isSingleOpaquePixel) {
  30257. operatorList.addImageOps(OPS.paintSolidColorImageMask, [], optionalContent);
  30258. if (cacheKey) {
  30259. const cacheData = {
  30260. fn: OPS.paintSolidColorImageMask,
  30261. args: [],
  30262. optionalContent
  30263. };
  30264. localImageCache.set(cacheKey, imageRef, cacheData);
  30265. if (imageRef) {
  30266. this._regionalImageCache.set(null, imageRef, cacheData);
  30267. }
  30268. }
  30269. return;
  30270. }
  30271. const objId = `mask_${this.idFactory.createObjId()}`;
  30272. operatorList.addDependency(objId);
  30273. imgData.dataLen = imgData.bitmap ? imgData.width * imgData.height * 4 : imgData.data.length;
  30274. this._sendImgData(objId, imgData);
  30275. args = [{
  30276. data: objId,
  30277. width: imgData.width,
  30278. height: imgData.height,
  30279. interpolate: imgData.interpolate,
  30280. count: 1
  30281. }];
  30282. operatorList.addImageOps(OPS.paintImageMaskXObject, args, optionalContent);
  30283. if (cacheKey) {
  30284. const cacheData = {
  30285. objId,
  30286. fn: OPS.paintImageMaskXObject,
  30287. args,
  30288. optionalContent
  30289. };
  30290. localImageCache.set(cacheKey, imageRef, cacheData);
  30291. if (imageRef) {
  30292. this._regionalImageCache.set(null, imageRef, cacheData);
  30293. }
  30294. }
  30295. return;
  30296. }
  30297. const SMALL_IMAGE_DIMENSIONS = 200;
  30298. if (isInline && w + h < SMALL_IMAGE_DIMENSIONS && !dict.has("SMask") && !dict.has("Mask")) {
  30299. try {
  30300. const imageObj = new PDFImage({
  30301. xref: this.xref,
  30302. res: resources,
  30303. image,
  30304. isInline,
  30305. pdfFunctionFactory: this._pdfFunctionFactory,
  30306. localColorSpaceCache
  30307. });
  30308. imgData = await imageObj.createImageData(true, false);
  30309. operatorList.isOffscreenCanvasSupported = this.options.isOffscreenCanvasSupported;
  30310. operatorList.addImageOps(OPS.paintInlineImageXObject, [imgData], optionalContent);
  30311. } catch (reason) {
  30312. const msg = `Unable to decode inline image: "${reason}".`;
  30313. if (!this.options.ignoreErrors) {
  30314. throw new Error(msg);
  30315. }
  30316. warn(msg);
  30317. }
  30318. return;
  30319. }
  30320. let objId = `img_${this.idFactory.createObjId()}`,
  30321. cacheGlobally = false;
  30322. if (this.parsingType3Font) {
  30323. objId = `${this.idFactory.getDocId()}_type3_${objId}`;
  30324. } else if (cacheKey && imageRef) {
  30325. cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
  30326. if (cacheGlobally) {
  30327. assert(!isInline, "Cannot cache an inline image globally.");
  30328. objId = `${this.idFactory.getDocId()}_${objId}`;
  30329. }
  30330. }
  30331. operatorList.addDependency(objId);
  30332. args = [objId, w, h];
  30333. operatorList.addImageOps(OPS.paintImageXObject, args, optionalContent);
  30334. if (cacheGlobally) {
  30335. if (this.globalImageCache.hasDecodeFailed(imageRef)) {
  30336. this.globalImageCache.setData(imageRef, {
  30337. objId,
  30338. fn: OPS.paintImageXObject,
  30339. args,
  30340. optionalContent,
  30341. byteSize: 0
  30342. });
  30343. this._sendImgData(objId, null, cacheGlobally);
  30344. return;
  30345. }
  30346. if (w * h > 250000 || dict.has("SMask") || dict.has("Mask")) {
  30347. const localLength = await this.handler.sendWithPromise("commonobj", [objId, "CopyLocalImage", {
  30348. imageRef
  30349. }]);
  30350. if (localLength) {
  30351. this.globalImageCache.setData(imageRef, {
  30352. objId,
  30353. fn: OPS.paintImageXObject,
  30354. args,
  30355. optionalContent,
  30356. byteSize: 0
  30357. });
  30358. this.globalImageCache.addByteSize(imageRef, localLength);
  30359. return;
  30360. }
  30361. }
  30362. }
  30363. PDFImage.buildImage({
  30364. xref: this.xref,
  30365. res: resources,
  30366. image,
  30367. isInline,
  30368. pdfFunctionFactory: this._pdfFunctionFactory,
  30369. localColorSpaceCache
  30370. }).then(async imageObj => {
  30371. imgData = await imageObj.createImageData(false, this.options.isOffscreenCanvasSupported);
  30372. imgData.dataLen = imgData.bitmap ? imgData.width * imgData.height * 4 : imgData.data.length;
  30373. imgData.ref = imageRef;
  30374. if (cacheGlobally) {
  30375. this.globalImageCache.addByteSize(imageRef, imgData.dataLen);
  30376. }
  30377. return this._sendImgData(objId, imgData, cacheGlobally);
  30378. }).catch(reason => {
  30379. warn(`Unable to decode image "${objId}": "${reason}".`);
  30380. if (imageRef) {
  30381. this.globalImageCache.addDecodeFailed(imageRef);
  30382. }
  30383. return this._sendImgData(objId, null, cacheGlobally);
  30384. });
  30385. if (cacheKey) {
  30386. const cacheData = {
  30387. objId,
  30388. fn: OPS.paintImageXObject,
  30389. args,
  30390. optionalContent
  30391. };
  30392. localImageCache.set(cacheKey, imageRef, cacheData);
  30393. if (imageRef) {
  30394. this._regionalImageCache.set(null, imageRef, cacheData);
  30395. if (cacheGlobally) {
  30396. this.globalImageCache.setData(imageRef, {
  30397. objId,
  30398. fn: OPS.paintImageXObject,
  30399. args,
  30400. optionalContent,
  30401. byteSize: 0
  30402. });
  30403. }
  30404. }
  30405. }
  30406. }
  30407. handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) {
  30408. const smaskContent = smask.get("G");
  30409. const smaskOptions = {
  30410. subtype: smask.get("S").name,
  30411. backdrop: smask.get("BC")
  30412. };
  30413. const transferObj = smask.get("TR");
  30414. if (isPDFFunction(transferObj)) {
  30415. const transferFn = this._pdfFunctionFactory.create(transferObj);
  30416. const transferMap = new Uint8Array(256);
  30417. const tmp = new Float32Array(1);
  30418. for (let i = 0; i < 256; i++) {
  30419. tmp[0] = i / 255;
  30420. transferFn(tmp, 0, tmp, 0);
  30421. transferMap[i] = tmp[0] * 255 | 0;
  30422. }
  30423. smaskOptions.transferMap = transferMap;
  30424. }
  30425. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache);
  30426. }
  30427. handleTransferFunction(tr) {
  30428. let transferArray;
  30429. if (Array.isArray(tr)) {
  30430. transferArray = tr;
  30431. } else if (isPDFFunction(tr)) {
  30432. transferArray = [tr];
  30433. } else {
  30434. return null;
  30435. }
  30436. const transferMaps = [];
  30437. let numFns = 0,
  30438. numEffectfulFns = 0;
  30439. for (const entry of transferArray) {
  30440. const transferObj = this.xref.fetchIfRef(entry);
  30441. numFns++;
  30442. if (isName(transferObj, "Identity")) {
  30443. transferMaps.push(null);
  30444. continue;
  30445. } else if (!isPDFFunction(transferObj)) {
  30446. return null;
  30447. }
  30448. const transferFn = this._pdfFunctionFactory.create(transferObj);
  30449. const transferMap = new Uint8Array(256),
  30450. tmp = new Float32Array(1);
  30451. for (let j = 0; j < 256; j++) {
  30452. tmp[0] = j / 255;
  30453. transferFn(tmp, 0, tmp, 0);
  30454. transferMap[j] = tmp[0] * 255 | 0;
  30455. }
  30456. transferMaps.push(transferMap);
  30457. numEffectfulFns++;
  30458. }
  30459. if (!(numFns === 1 || numFns === 4)) {
  30460. return null;
  30461. }
  30462. if (numEffectfulFns === 0) {
  30463. return null;
  30464. }
  30465. return transferMaps;
  30466. }
  30467. handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) {
  30468. const tilingOpList = new OperatorList();
  30469. const patternResources = Dict.merge({
  30470. xref: this.xref,
  30471. dictArray: [patternDict.get("Resources"), resources]
  30472. });
  30473. return this.getOperatorList({
  30474. stream: pattern,
  30475. task,
  30476. resources: patternResources,
  30477. operatorList: tilingOpList
  30478. }).then(function () {
  30479. const operatorListIR = tilingOpList.getIR();
  30480. const tilingPatternIR = getTilingPatternIR(operatorListIR, patternDict, color);
  30481. operatorList.addDependencies(tilingOpList.dependencies);
  30482. operatorList.addOp(fn, tilingPatternIR);
  30483. if (patternDict.objId) {
  30484. localTilingPatternCache.set(null, patternDict.objId, {
  30485. operatorListIR,
  30486. dict: patternDict
  30487. });
  30488. }
  30489. }).catch(reason => {
  30490. if (reason instanceof AbortException) {
  30491. return;
  30492. }
  30493. if (this.options.ignoreErrors) {
  30494. warn(`handleTilingType - ignoring pattern: "${reason}".`);
  30495. return;
  30496. }
  30497. throw reason;
  30498. });
  30499. }
  30500. async handleSetFont(resources, fontArgs, fontRef, operatorList, task, state, fallbackFontDict = null, cssFontInfo = null) {
  30501. const fontName = fontArgs?.[0] instanceof Name ? fontArgs[0].name : null;
  30502. let translated = await this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo);
  30503. if (translated.font.isType3Font) {
  30504. try {
  30505. await translated.loadType3Data(this, resources, task);
  30506. operatorList.addDependencies(translated.type3Dependencies);
  30507. } catch (reason) {
  30508. translated = new TranslatedFont({
  30509. loadedName: "g_font_error",
  30510. font: new ErrorFont(`Type3 font load error: ${reason}`),
  30511. dict: translated.font,
  30512. evaluatorOptions: this.options
  30513. });
  30514. }
  30515. }
  30516. state.font = translated.font;
  30517. translated.send(this.handler);
  30518. return translated.loadedName;
  30519. }
  30520. handleText(chars, state) {
  30521. const font = state.font;
  30522. const glyphs = font.charsToGlyphs(chars);
  30523. if (font.data) {
  30524. const isAddToPathSet = !!(state.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
  30525. if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
  30526. PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options);
  30527. }
  30528. }
  30529. return glyphs;
  30530. }
  30531. ensureStateFont(state) {
  30532. if (state.font) {
  30533. return;
  30534. }
  30535. const reason = new FormatError("Missing setFont (Tf) operator before text rendering operator.");
  30536. if (this.options.ignoreErrors) {
  30537. warn(`ensureStateFont: "${reason}".`);
  30538. return;
  30539. }
  30540. throw reason;
  30541. }
  30542. async setGState({
  30543. resources,
  30544. gState,
  30545. operatorList,
  30546. cacheKey,
  30547. task,
  30548. stateManager,
  30549. localGStateCache,
  30550. localColorSpaceCache
  30551. }) {
  30552. const gStateRef = gState.objId;
  30553. let isSimpleGState = true;
  30554. const gStateObj = [];
  30555. let promise = Promise.resolve();
  30556. for (const key of gState.getKeys()) {
  30557. const value = gState.get(key);
  30558. switch (key) {
  30559. case "Type":
  30560. break;
  30561. case "LW":
  30562. case "LC":
  30563. case "LJ":
  30564. case "ML":
  30565. case "D":
  30566. case "RI":
  30567. case "FL":
  30568. case "CA":
  30569. case "ca":
  30570. gStateObj.push([key, value]);
  30571. break;
  30572. case "Font":
  30573. isSimpleGState = false;
  30574. promise = promise.then(() => this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  30575. operatorList.addDependency(loadedName);
  30576. gStateObj.push([key, [loadedName, value[1]]]);
  30577. }));
  30578. break;
  30579. case "BM":
  30580. gStateObj.push([key, normalizeBlendMode(value)]);
  30581. break;
  30582. case "SMask":
  30583. if (isName(value, "None")) {
  30584. gStateObj.push([key, false]);
  30585. break;
  30586. }
  30587. if (value instanceof Dict) {
  30588. isSimpleGState = false;
  30589. promise = promise.then(() => this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache));
  30590. gStateObj.push([key, true]);
  30591. } else {
  30592. warn("Unsupported SMask type");
  30593. }
  30594. break;
  30595. case "TR":
  30596. const transferMaps = this.handleTransferFunction(value);
  30597. gStateObj.push([key, transferMaps]);
  30598. break;
  30599. case "OP":
  30600. case "op":
  30601. case "OPM":
  30602. case "BG":
  30603. case "BG2":
  30604. case "UCR":
  30605. case "UCR2":
  30606. case "TR2":
  30607. case "HT":
  30608. case "SM":
  30609. case "SA":
  30610. case "AIS":
  30611. case "TK":
  30612. info("graphic state operator " + key);
  30613. break;
  30614. default:
  30615. info("Unknown graphic state operator " + key);
  30616. break;
  30617. }
  30618. }
  30619. await promise;
  30620. if (gStateObj.length > 0) {
  30621. operatorList.addOp(OPS.setGState, [gStateObj]);
  30622. }
  30623. if (isSimpleGState) {
  30624. localGStateCache.set(cacheKey, gStateRef, gStateObj);
  30625. }
  30626. }
  30627. loadFont(fontName, font, resources, fallbackFontDict = null, cssFontInfo = null) {
  30628. const errorFont = async () => {
  30629. return new TranslatedFont({
  30630. loadedName: "g_font_error",
  30631. font: new ErrorFont(`Font "${fontName}" is not available.`),
  30632. dict: font,
  30633. evaluatorOptions: this.options
  30634. });
  30635. };
  30636. let fontRef;
  30637. if (font) {
  30638. if (font instanceof Ref) {
  30639. fontRef = font;
  30640. }
  30641. } else {
  30642. const fontRes = resources.get("Font");
  30643. if (fontRes) {
  30644. fontRef = fontRes.getRaw(fontName);
  30645. }
  30646. }
  30647. if (fontRef) {
  30648. if (this.type3FontRefs?.has(fontRef)) {
  30649. return errorFont();
  30650. }
  30651. if (this.fontCache.has(fontRef)) {
  30652. return this.fontCache.get(fontRef);
  30653. }
  30654. try {
  30655. font = this.xref.fetchIfRef(fontRef);
  30656. } catch (ex) {
  30657. warn(`loadFont - lookup failed: "${ex}".`);
  30658. }
  30659. }
  30660. if (!(font instanceof Dict)) {
  30661. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  30662. warn(`Font "${fontName}" is not available.`);
  30663. return errorFont();
  30664. }
  30665. warn(`Font "${fontName}" is not available -- attempting to fallback to a default font.`);
  30666. font = fallbackFontDict || PartialEvaluator.fallbackFontDict;
  30667. }
  30668. if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
  30669. return this.fontCache.get(font.cacheKey);
  30670. }
  30671. const {
  30672. promise,
  30673. resolve
  30674. } = Promise.withResolvers();
  30675. let preEvaluatedFont;
  30676. try {
  30677. preEvaluatedFont = this.preEvaluateFont(font);
  30678. preEvaluatedFont.cssFontInfo = cssFontInfo;
  30679. } catch (reason) {
  30680. warn(`loadFont - preEvaluateFont failed: "${reason}".`);
  30681. return errorFont();
  30682. }
  30683. const {
  30684. descriptor,
  30685. hash
  30686. } = preEvaluatedFont;
  30687. const fontRefIsRef = fontRef instanceof Ref;
  30688. let fontID;
  30689. if (hash && descriptor instanceof Dict) {
  30690. const fontAliases = descriptor.fontAliases ||= Object.create(null);
  30691. if (fontAliases[hash]) {
  30692. const aliasFontRef = fontAliases[hash].aliasRef;
  30693. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  30694. this.fontCache.putAlias(fontRef, aliasFontRef);
  30695. return this.fontCache.get(fontRef);
  30696. }
  30697. } else {
  30698. fontAliases[hash] = {
  30699. fontID: this.idFactory.createFontId()
  30700. };
  30701. }
  30702. if (fontRefIsRef) {
  30703. fontAliases[hash].aliasRef = fontRef;
  30704. }
  30705. fontID = fontAliases[hash].fontID;
  30706. } else {
  30707. fontID = this.idFactory.createFontId();
  30708. }
  30709. assert(fontID?.startsWith("f"), 'The "fontID" must be (correctly) defined.');
  30710. if (fontRefIsRef) {
  30711. this.fontCache.put(fontRef, promise);
  30712. } else {
  30713. font.cacheKey = `cacheKey_${fontID}`;
  30714. this.fontCache.put(font.cacheKey, promise);
  30715. }
  30716. font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
  30717. this.translateFont(preEvaluatedFont).then(translatedFont => {
  30718. resolve(new TranslatedFont({
  30719. loadedName: font.loadedName,
  30720. font: translatedFont,
  30721. dict: font,
  30722. evaluatorOptions: this.options
  30723. }));
  30724. }).catch(reason => {
  30725. warn(`loadFont - translateFont failed: "${reason}".`);
  30726. resolve(new TranslatedFont({
  30727. loadedName: font.loadedName,
  30728. font: new ErrorFont(reason instanceof Error ? reason.message : reason),
  30729. dict: font,
  30730. evaluatorOptions: this.options
  30731. }));
  30732. });
  30733. return promise;
  30734. }
  30735. buildPath(operatorList, fn, args, parsingText = false) {
  30736. const lastIndex = operatorList.length - 1;
  30737. if (!args) {
  30738. args = [];
  30739. }
  30740. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== OPS.constructPath) {
  30741. if (parsingText) {
  30742. warn(`Encountered path operator "${fn}" inside of a text object.`);
  30743. operatorList.addOp(OPS.save, null);
  30744. }
  30745. let minMax;
  30746. switch (fn) {
  30747. case OPS.rectangle:
  30748. const x = args[0] + args[2];
  30749. const y = args[1] + args[3];
  30750. minMax = [Math.min(args[0], x), Math.min(args[1], y), Math.max(args[0], x), Math.max(args[1], y)];
  30751. break;
  30752. case OPS.moveTo:
  30753. case OPS.lineTo:
  30754. minMax = [args[0], args[1], args[0], args[1]];
  30755. break;
  30756. default:
  30757. minMax = [Infinity, Infinity, -Infinity, -Infinity];
  30758. break;
  30759. }
  30760. operatorList.addOp(OPS.constructPath, [[fn], args, minMax]);
  30761. if (parsingText) {
  30762. operatorList.addOp(OPS.restore, null);
  30763. }
  30764. } else {
  30765. const opArgs = operatorList.argsArray[lastIndex];
  30766. opArgs[0].push(fn);
  30767. opArgs[1].push(...args);
  30768. const minMax = opArgs[2];
  30769. switch (fn) {
  30770. case OPS.rectangle:
  30771. const x = args[0] + args[2];
  30772. const y = args[1] + args[3];
  30773. minMax[0] = Math.min(minMax[0], args[0], x);
  30774. minMax[1] = Math.min(minMax[1], args[1], y);
  30775. minMax[2] = Math.max(minMax[2], args[0], x);
  30776. minMax[3] = Math.max(minMax[3], args[1], y);
  30777. break;
  30778. case OPS.moveTo:
  30779. case OPS.lineTo:
  30780. minMax[0] = Math.min(minMax[0], args[0]);
  30781. minMax[1] = Math.min(minMax[1], args[1]);
  30782. minMax[2] = Math.max(minMax[2], args[0]);
  30783. minMax[3] = Math.max(minMax[3], args[1]);
  30784. break;
  30785. }
  30786. }
  30787. }
  30788. parseColorSpace({
  30789. cs,
  30790. resources,
  30791. localColorSpaceCache
  30792. }) {
  30793. return ColorSpace.parseAsync({
  30794. cs,
  30795. xref: this.xref,
  30796. resources,
  30797. pdfFunctionFactory: this._pdfFunctionFactory,
  30798. localColorSpaceCache
  30799. }).catch(reason => {
  30800. if (reason instanceof AbortException) {
  30801. return null;
  30802. }
  30803. if (this.options.ignoreErrors) {
  30804. warn(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
  30805. return null;
  30806. }
  30807. throw reason;
  30808. });
  30809. }
  30810. parseShading({
  30811. shading,
  30812. resources,
  30813. localColorSpaceCache,
  30814. localShadingPatternCache
  30815. }) {
  30816. let id = localShadingPatternCache.get(shading);
  30817. if (id) {
  30818. return id;
  30819. }
  30820. let patternIR;
  30821. try {
  30822. const shadingFill = Pattern.parseShading(shading, this.xref, resources, this._pdfFunctionFactory, localColorSpaceCache);
  30823. patternIR = shadingFill.getIR();
  30824. } catch (reason) {
  30825. if (reason instanceof AbortException) {
  30826. return null;
  30827. }
  30828. if (this.options.ignoreErrors) {
  30829. warn(`parseShading - ignoring shading: "${reason}".`);
  30830. localShadingPatternCache.set(shading, null);
  30831. return null;
  30832. }
  30833. throw reason;
  30834. }
  30835. id = `pattern_${this.idFactory.createObjId()}`;
  30836. if (this.parsingType3Font) {
  30837. id = `${this.idFactory.getDocId()}_type3_${id}`;
  30838. }
  30839. localShadingPatternCache.set(shading, id);
  30840. if (this.parsingType3Font) {
  30841. this.handler.send("commonobj", [id, "Pattern", patternIR]);
  30842. } else {
  30843. this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
  30844. }
  30845. return id;
  30846. }
  30847. handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) {
  30848. const patternName = args.pop();
  30849. if (patternName instanceof Name) {
  30850. const rawPattern = patterns.getRaw(patternName.name);
  30851. const localTilingPattern = rawPattern instanceof Ref && localTilingPatternCache.getByRef(rawPattern);
  30852. if (localTilingPattern) {
  30853. try {
  30854. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  30855. const tilingPatternIR = getTilingPatternIR(localTilingPattern.operatorListIR, localTilingPattern.dict, color);
  30856. operatorList.addOp(fn, tilingPatternIR);
  30857. return undefined;
  30858. } catch {}
  30859. }
  30860. const pattern = this.xref.fetchIfRef(rawPattern);
  30861. if (pattern) {
  30862. const dict = pattern instanceof BaseStream ? pattern.dict : pattern;
  30863. const typeNum = dict.get("PatternType");
  30864. if (typeNum === PatternType.TILING) {
  30865. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  30866. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache);
  30867. } else if (typeNum === PatternType.SHADING) {
  30868. const shading = dict.get("Shading");
  30869. const objId = this.parseShading({
  30870. shading,
  30871. resources,
  30872. localColorSpaceCache,
  30873. localShadingPatternCache
  30874. });
  30875. if (objId) {
  30876. const matrix = lookupMatrix(dict.getArray("Matrix"), null);
  30877. operatorList.addOp(fn, ["Shading", objId, matrix]);
  30878. }
  30879. return undefined;
  30880. }
  30881. throw new FormatError(`Unknown PatternType: ${typeNum}`);
  30882. }
  30883. }
  30884. throw new FormatError(`Unknown PatternName: ${patternName}`);
  30885. }
  30886. _parseVisibilityExpression(array, nestingCounter, currentResult) {
  30887. const MAX_NESTING = 10;
  30888. if (++nestingCounter > MAX_NESTING) {
  30889. warn("Visibility expression is too deeply nested");
  30890. return;
  30891. }
  30892. const length = array.length;
  30893. const operator = this.xref.fetchIfRef(array[0]);
  30894. if (length < 2 || !(operator instanceof Name)) {
  30895. warn("Invalid visibility expression");
  30896. return;
  30897. }
  30898. switch (operator.name) {
  30899. case "And":
  30900. case "Or":
  30901. case "Not":
  30902. currentResult.push(operator.name);
  30903. break;
  30904. default:
  30905. warn(`Invalid operator ${operator.name} in visibility expression`);
  30906. return;
  30907. }
  30908. for (let i = 1; i < length; i++) {
  30909. const raw = array[i];
  30910. const object = this.xref.fetchIfRef(raw);
  30911. if (Array.isArray(object)) {
  30912. const nestedResult = [];
  30913. currentResult.push(nestedResult);
  30914. this._parseVisibilityExpression(object, nestingCounter, nestedResult);
  30915. } else if (raw instanceof Ref) {
  30916. currentResult.push(raw.toString());
  30917. }
  30918. }
  30919. }
  30920. async parseMarkedContentProps(contentProperties, resources) {
  30921. let optionalContent;
  30922. if (contentProperties instanceof Name) {
  30923. const properties = resources.get("Properties");
  30924. optionalContent = properties.get(contentProperties.name);
  30925. } else if (contentProperties instanceof Dict) {
  30926. optionalContent = contentProperties;
  30927. } else {
  30928. throw new FormatError("Optional content properties malformed.");
  30929. }
  30930. const optionalContentType = optionalContent.get("Type")?.name;
  30931. if (optionalContentType === "OCG") {
  30932. return {
  30933. type: optionalContentType,
  30934. id: optionalContent.objId
  30935. };
  30936. } else if (optionalContentType === "OCMD") {
  30937. const expression = optionalContent.get("VE");
  30938. if (Array.isArray(expression)) {
  30939. const result = [];
  30940. this._parseVisibilityExpression(expression, 0, result);
  30941. if (result.length > 0) {
  30942. return {
  30943. type: "OCMD",
  30944. expression: result
  30945. };
  30946. }
  30947. }
  30948. const optionalContentGroups = optionalContent.get("OCGs");
  30949. if (Array.isArray(optionalContentGroups) || optionalContentGroups instanceof Dict) {
  30950. const groupIds = [];
  30951. if (Array.isArray(optionalContentGroups)) {
  30952. for (const ocg of optionalContentGroups) {
  30953. groupIds.push(ocg.toString());
  30954. }
  30955. } else {
  30956. groupIds.push(optionalContentGroups.objId);
  30957. }
  30958. return {
  30959. type: optionalContentType,
  30960. ids: groupIds,
  30961. policy: optionalContent.get("P") instanceof Name ? optionalContent.get("P").name : null,
  30962. expression: null
  30963. };
  30964. } else if (optionalContentGroups instanceof Ref) {
  30965. return {
  30966. type: optionalContentType,
  30967. id: optionalContentGroups.toString()
  30968. };
  30969. }
  30970. }
  30971. return null;
  30972. }
  30973. getOperatorList({
  30974. stream,
  30975. task,
  30976. resources,
  30977. operatorList,
  30978. initialState = null,
  30979. fallbackFontDict = null
  30980. }) {
  30981. resources ||= Dict.empty;
  30982. initialState ||= new EvalState();
  30983. if (!operatorList) {
  30984. throw new Error('getOperatorList: missing "operatorList" parameter');
  30985. }
  30986. const self = this;
  30987. const xref = this.xref;
  30988. let parsingText = false;
  30989. const localImageCache = new LocalImageCache();
  30990. const localColorSpaceCache = new LocalColorSpaceCache();
  30991. const localGStateCache = new LocalGStateCache();
  30992. const localTilingPatternCache = new LocalTilingPatternCache();
  30993. const localShadingPatternCache = new Map();
  30994. const xobjs = resources.get("XObject") || Dict.empty;
  30995. const patterns = resources.get("Pattern") || Dict.empty;
  30996. const stateManager = new StateManager(initialState);
  30997. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  30998. const timeSlotManager = new TimeSlotManager();
  30999. function closePendingRestoreOPS(argument) {
  31000. for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  31001. operatorList.addOp(OPS.restore, []);
  31002. }
  31003. }
  31004. return new Promise(function promiseBody(resolve, reject) {
  31005. const next = function (promise) {
  31006. Promise.all([promise, operatorList.ready]).then(function () {
  31007. try {
  31008. promiseBody(resolve, reject);
  31009. } catch (ex) {
  31010. reject(ex);
  31011. }
  31012. }, reject);
  31013. };
  31014. task.ensureNotTerminated();
  31015. timeSlotManager.reset();
  31016. const operation = {};
  31017. let stop, i, ii, cs, name, isValidName;
  31018. while (!(stop = timeSlotManager.check())) {
  31019. operation.args = null;
  31020. if (!preprocessor.read(operation)) {
  31021. break;
  31022. }
  31023. let args = operation.args;
  31024. let fn = operation.fn;
  31025. switch (fn | 0) {
  31026. case OPS.paintXObject:
  31027. isValidName = args[0] instanceof Name;
  31028. name = args[0].name;
  31029. if (isValidName) {
  31030. const localImage = localImageCache.getByName(name);
  31031. if (localImage) {
  31032. addLocallyCachedImageOps(operatorList, localImage);
  31033. args = null;
  31034. continue;
  31035. }
  31036. }
  31037. next(new Promise(function (resolveXObject, rejectXObject) {
  31038. if (!isValidName) {
  31039. throw new FormatError("XObject must be referred to by name.");
  31040. }
  31041. let xobj = xobjs.getRaw(name);
  31042. if (xobj instanceof Ref) {
  31043. const localImage = localImageCache.getByRef(xobj) || self._regionalImageCache.getByRef(xobj);
  31044. if (localImage) {
  31045. addLocallyCachedImageOps(operatorList, localImage);
  31046. resolveXObject();
  31047. return;
  31048. }
  31049. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  31050. if (globalImage) {
  31051. operatorList.addDependency(globalImage.objId);
  31052. operatorList.addImageOps(globalImage.fn, globalImage.args, globalImage.optionalContent);
  31053. resolveXObject();
  31054. return;
  31055. }
  31056. xobj = xref.fetch(xobj);
  31057. }
  31058. if (!(xobj instanceof BaseStream)) {
  31059. throw new FormatError("XObject should be a stream");
  31060. }
  31061. const type = xobj.dict.get("Subtype");
  31062. if (!(type instanceof Name)) {
  31063. throw new FormatError("XObject should have a Name subtype");
  31064. }
  31065. if (type.name === "Form") {
  31066. stateManager.save();
  31067. self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () {
  31068. stateManager.restore();
  31069. resolveXObject();
  31070. }, rejectXObject);
  31071. return;
  31072. } else if (type.name === "Image") {
  31073. self.buildPaintImageXObject({
  31074. resources,
  31075. image: xobj,
  31076. operatorList,
  31077. cacheKey: name,
  31078. localImageCache,
  31079. localColorSpaceCache
  31080. }).then(resolveXObject, rejectXObject);
  31081. return;
  31082. } else if (type.name === "PS") {
  31083. info("Ignored XObject subtype PS");
  31084. } else {
  31085. throw new FormatError(`Unhandled XObject subtype ${type.name}`);
  31086. }
  31087. resolveXObject();
  31088. }).catch(function (reason) {
  31089. if (reason instanceof AbortException) {
  31090. return;
  31091. }
  31092. if (self.options.ignoreErrors) {
  31093. warn(`getOperatorList - ignoring XObject: "${reason}".`);
  31094. return;
  31095. }
  31096. throw reason;
  31097. }));
  31098. return;
  31099. case OPS.setFont:
  31100. var fontSize = args[1];
  31101. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) {
  31102. operatorList.addDependency(loadedName);
  31103. operatorList.addOp(OPS.setFont, [loadedName, fontSize]);
  31104. }));
  31105. return;
  31106. case OPS.beginText:
  31107. parsingText = true;
  31108. break;
  31109. case OPS.endText:
  31110. parsingText = false;
  31111. break;
  31112. case OPS.endInlineImage:
  31113. var cacheKey = args[0].cacheKey;
  31114. if (cacheKey) {
  31115. const localImage = localImageCache.getByName(cacheKey);
  31116. if (localImage) {
  31117. addLocallyCachedImageOps(operatorList, localImage);
  31118. args = null;
  31119. continue;
  31120. }
  31121. }
  31122. next(self.buildPaintImageXObject({
  31123. resources,
  31124. image: args[0],
  31125. isInline: true,
  31126. operatorList,
  31127. cacheKey,
  31128. localImageCache,
  31129. localColorSpaceCache
  31130. }));
  31131. return;
  31132. case OPS.showText:
  31133. if (!stateManager.state.font) {
  31134. self.ensureStateFont(stateManager.state);
  31135. continue;
  31136. }
  31137. args[0] = self.handleText(args[0], stateManager.state);
  31138. break;
  31139. case OPS.showSpacedText:
  31140. if (!stateManager.state.font) {
  31141. self.ensureStateFont(stateManager.state);
  31142. continue;
  31143. }
  31144. var combinedGlyphs = [];
  31145. var state = stateManager.state;
  31146. for (const arrItem of args[0]) {
  31147. if (typeof arrItem === "string") {
  31148. combinedGlyphs.push(...self.handleText(arrItem, state));
  31149. } else if (typeof arrItem === "number") {
  31150. combinedGlyphs.push(arrItem);
  31151. }
  31152. }
  31153. args[0] = combinedGlyphs;
  31154. fn = OPS.showText;
  31155. break;
  31156. case OPS.nextLineShowText:
  31157. if (!stateManager.state.font) {
  31158. self.ensureStateFont(stateManager.state);
  31159. continue;
  31160. }
  31161. operatorList.addOp(OPS.nextLine);
  31162. args[0] = self.handleText(args[0], stateManager.state);
  31163. fn = OPS.showText;
  31164. break;
  31165. case OPS.nextLineSetSpacingShowText:
  31166. if (!stateManager.state.font) {
  31167. self.ensureStateFont(stateManager.state);
  31168. continue;
  31169. }
  31170. operatorList.addOp(OPS.nextLine);
  31171. operatorList.addOp(OPS.setWordSpacing, [args.shift()]);
  31172. operatorList.addOp(OPS.setCharSpacing, [args.shift()]);
  31173. args[0] = self.handleText(args[0], stateManager.state);
  31174. fn = OPS.showText;
  31175. break;
  31176. case OPS.setTextRenderingMode:
  31177. stateManager.state.textRenderingMode = args[0];
  31178. break;
  31179. case OPS.setFillColorSpace:
  31180. {
  31181. const cachedColorSpace = ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  31182. if (cachedColorSpace) {
  31183. stateManager.state.fillColorSpace = cachedColorSpace;
  31184. continue;
  31185. }
  31186. next(self.parseColorSpace({
  31187. cs: args[0],
  31188. resources,
  31189. localColorSpaceCache
  31190. }).then(function (colorSpace) {
  31191. stateManager.state.fillColorSpace = colorSpace || ColorSpace.singletons.gray;
  31192. }));
  31193. return;
  31194. }
  31195. case OPS.setStrokeColorSpace:
  31196. {
  31197. const cachedColorSpace = ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  31198. if (cachedColorSpace) {
  31199. stateManager.state.strokeColorSpace = cachedColorSpace;
  31200. continue;
  31201. }
  31202. next(self.parseColorSpace({
  31203. cs: args[0],
  31204. resources,
  31205. localColorSpaceCache
  31206. }).then(function (colorSpace) {
  31207. stateManager.state.strokeColorSpace = colorSpace || ColorSpace.singletons.gray;
  31208. }));
  31209. return;
  31210. }
  31211. case OPS.setFillColor:
  31212. cs = stateManager.state.fillColorSpace;
  31213. args = cs.getRgb(args, 0);
  31214. fn = OPS.setFillRGBColor;
  31215. break;
  31216. case OPS.setStrokeColor:
  31217. cs = stateManager.state.strokeColorSpace;
  31218. args = cs.getRgb(args, 0);
  31219. fn = OPS.setStrokeRGBColor;
  31220. break;
  31221. case OPS.setFillGray:
  31222. stateManager.state.fillColorSpace = ColorSpace.singletons.gray;
  31223. args = ColorSpace.singletons.gray.getRgb(args, 0);
  31224. fn = OPS.setFillRGBColor;
  31225. break;
  31226. case OPS.setStrokeGray:
  31227. stateManager.state.strokeColorSpace = ColorSpace.singletons.gray;
  31228. args = ColorSpace.singletons.gray.getRgb(args, 0);
  31229. fn = OPS.setStrokeRGBColor;
  31230. break;
  31231. case OPS.setFillCMYKColor:
  31232. stateManager.state.fillColorSpace = ColorSpace.singletons.cmyk;
  31233. args = ColorSpace.singletons.cmyk.getRgb(args, 0);
  31234. fn = OPS.setFillRGBColor;
  31235. break;
  31236. case OPS.setStrokeCMYKColor:
  31237. stateManager.state.strokeColorSpace = ColorSpace.singletons.cmyk;
  31238. args = ColorSpace.singletons.cmyk.getRgb(args, 0);
  31239. fn = OPS.setStrokeRGBColor;
  31240. break;
  31241. case OPS.setFillRGBColor:
  31242. stateManager.state.fillColorSpace = ColorSpace.singletons.rgb;
  31243. args = ColorSpace.singletons.rgb.getRgb(args, 0);
  31244. break;
  31245. case OPS.setStrokeRGBColor:
  31246. stateManager.state.strokeColorSpace = ColorSpace.singletons.rgb;
  31247. args = ColorSpace.singletons.rgb.getRgb(args, 0);
  31248. break;
  31249. case OPS.setFillColorN:
  31250. cs = stateManager.state.patternFillColorSpace;
  31251. if (!cs) {
  31252. if (isNumberArray(args, null)) {
  31253. args = ColorSpace.singletons.gray.getRgb(args, 0);
  31254. fn = OPS.setFillRGBColor;
  31255. break;
  31256. }
  31257. args = [];
  31258. fn = OPS.setFillTransparent;
  31259. break;
  31260. }
  31261. if (cs.name === "Pattern") {
  31262. next(self.handleColorN(operatorList, OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  31263. return;
  31264. }
  31265. args = cs.getRgb(args, 0);
  31266. fn = OPS.setFillRGBColor;
  31267. break;
  31268. case OPS.setStrokeColorN:
  31269. cs = stateManager.state.patternStrokeColorSpace;
  31270. if (!cs) {
  31271. if (isNumberArray(args, null)) {
  31272. args = ColorSpace.singletons.gray.getRgb(args, 0);
  31273. fn = OPS.setStrokeRGBColor;
  31274. break;
  31275. }
  31276. args = [];
  31277. fn = OPS.setStrokeTransparent;
  31278. break;
  31279. }
  31280. if (cs.name === "Pattern") {
  31281. next(self.handleColorN(operatorList, OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  31282. return;
  31283. }
  31284. args = cs.getRgb(args, 0);
  31285. fn = OPS.setStrokeRGBColor;
  31286. break;
  31287. case OPS.shadingFill:
  31288. let shading;
  31289. try {
  31290. const shadingRes = resources.get("Shading");
  31291. if (!shadingRes) {
  31292. throw new FormatError("No shading resource found");
  31293. }
  31294. shading = shadingRes.get(args[0].name);
  31295. if (!shading) {
  31296. throw new FormatError("No shading object found");
  31297. }
  31298. } catch (reason) {
  31299. if (reason instanceof AbortException) {
  31300. continue;
  31301. }
  31302. if (self.options.ignoreErrors) {
  31303. warn(`getOperatorList - ignoring Shading: "${reason}".`);
  31304. continue;
  31305. }
  31306. throw reason;
  31307. }
  31308. const patternId = self.parseShading({
  31309. shading,
  31310. resources,
  31311. localColorSpaceCache,
  31312. localShadingPatternCache
  31313. });
  31314. if (!patternId) {
  31315. continue;
  31316. }
  31317. args = [patternId];
  31318. fn = OPS.shadingFill;
  31319. break;
  31320. case OPS.setGState:
  31321. isValidName = args[0] instanceof Name;
  31322. name = args[0].name;
  31323. if (isValidName) {
  31324. const localGStateObj = localGStateCache.getByName(name);
  31325. if (localGStateObj) {
  31326. if (localGStateObj.length > 0) {
  31327. operatorList.addOp(OPS.setGState, [localGStateObj]);
  31328. }
  31329. args = null;
  31330. continue;
  31331. }
  31332. }
  31333. next(new Promise(function (resolveGState, rejectGState) {
  31334. if (!isValidName) {
  31335. throw new FormatError("GState must be referred to by name.");
  31336. }
  31337. const extGState = resources.get("ExtGState");
  31338. if (!(extGState instanceof Dict)) {
  31339. throw new FormatError("ExtGState should be a dictionary.");
  31340. }
  31341. const gState = extGState.get(name);
  31342. if (!(gState instanceof Dict)) {
  31343. throw new FormatError("GState should be a dictionary.");
  31344. }
  31345. self.setGState({
  31346. resources,
  31347. gState,
  31348. operatorList,
  31349. cacheKey: name,
  31350. task,
  31351. stateManager,
  31352. localGStateCache,
  31353. localColorSpaceCache
  31354. }).then(resolveGState, rejectGState);
  31355. }).catch(function (reason) {
  31356. if (reason instanceof AbortException) {
  31357. return;
  31358. }
  31359. if (self.options.ignoreErrors) {
  31360. warn(`getOperatorList - ignoring ExtGState: "${reason}".`);
  31361. return;
  31362. }
  31363. throw reason;
  31364. }));
  31365. return;
  31366. case OPS.moveTo:
  31367. case OPS.lineTo:
  31368. case OPS.curveTo:
  31369. case OPS.curveTo2:
  31370. case OPS.curveTo3:
  31371. case OPS.closePath:
  31372. case OPS.rectangle:
  31373. self.buildPath(operatorList, fn, args, parsingText);
  31374. continue;
  31375. case OPS.markPoint:
  31376. case OPS.markPointProps:
  31377. case OPS.beginCompat:
  31378. case OPS.endCompat:
  31379. continue;
  31380. case OPS.beginMarkedContentProps:
  31381. if (!(args[0] instanceof Name)) {
  31382. warn(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
  31383. operatorList.addOp(OPS.beginMarkedContentProps, ["OC", null]);
  31384. continue;
  31385. }
  31386. if (args[0].name === "OC") {
  31387. next(self.parseMarkedContentProps(args[1], resources).then(data => {
  31388. operatorList.addOp(OPS.beginMarkedContentProps, ["OC", data]);
  31389. }).catch(reason => {
  31390. if (reason instanceof AbortException) {
  31391. return;
  31392. }
  31393. if (self.options.ignoreErrors) {
  31394. warn(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
  31395. operatorList.addOp(OPS.beginMarkedContentProps, ["OC", null]);
  31396. return;
  31397. }
  31398. throw reason;
  31399. }));
  31400. return;
  31401. }
  31402. args = [args[0].name, args[1] instanceof Dict ? args[1].get("MCID") : null];
  31403. break;
  31404. case OPS.beginMarkedContent:
  31405. case OPS.endMarkedContent:
  31406. default:
  31407. if (args !== null) {
  31408. for (i = 0, ii = args.length; i < ii; i++) {
  31409. if (args[i] instanceof Dict) {
  31410. break;
  31411. }
  31412. }
  31413. if (i < ii) {
  31414. warn("getOperatorList - ignoring operator: " + fn);
  31415. continue;
  31416. }
  31417. }
  31418. }
  31419. operatorList.addOp(fn, args);
  31420. }
  31421. if (stop) {
  31422. next(deferred);
  31423. return;
  31424. }
  31425. closePendingRestoreOPS();
  31426. resolve();
  31427. }).catch(reason => {
  31428. if (reason instanceof AbortException) {
  31429. return;
  31430. }
  31431. if (this.options.ignoreErrors) {
  31432. warn(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  31433. closePendingRestoreOPS();
  31434. return;
  31435. }
  31436. throw reason;
  31437. });
  31438. }
  31439. getTextContent({
  31440. stream,
  31441. task,
  31442. resources,
  31443. stateManager = null,
  31444. includeMarkedContent = false,
  31445. sink,
  31446. seenStyles = new Set(),
  31447. viewBox,
  31448. lang = null,
  31449. markedContentData = null,
  31450. disableNormalization = false,
  31451. keepWhiteSpace = false
  31452. }) {
  31453. resources ||= Dict.empty;
  31454. stateManager ||= new StateManager(new TextState());
  31455. if (includeMarkedContent) {
  31456. markedContentData ||= {
  31457. level: 0
  31458. };
  31459. }
  31460. const textContent = {
  31461. items: [],
  31462. styles: Object.create(null),
  31463. lang
  31464. };
  31465. const textContentItem = {
  31466. initialized: false,
  31467. str: [],
  31468. totalWidth: 0,
  31469. totalHeight: 0,
  31470. width: 0,
  31471. height: 0,
  31472. vertical: false,
  31473. prevTransform: null,
  31474. textAdvanceScale: 0,
  31475. spaceInFlowMin: 0,
  31476. spaceInFlowMax: 0,
  31477. trackingSpaceMin: Infinity,
  31478. negativeSpaceMax: -Infinity,
  31479. notASpace: -Infinity,
  31480. transform: null,
  31481. fontName: null,
  31482. hasEOL: false
  31483. };
  31484. const twoLastChars = [" ", " "];
  31485. let twoLastCharsPos = 0;
  31486. function saveLastChar(char) {
  31487. const nextPos = (twoLastCharsPos + 1) % 2;
  31488. const ret = twoLastChars[twoLastCharsPos] !== " " && twoLastChars[nextPos] === " ";
  31489. twoLastChars[twoLastCharsPos] = char;
  31490. twoLastCharsPos = nextPos;
  31491. return !keepWhiteSpace && ret;
  31492. }
  31493. function shouldAddWhitepsace() {
  31494. return !keepWhiteSpace && twoLastChars[twoLastCharsPos] !== " " && twoLastChars[(twoLastCharsPos + 1) % 2] === " ";
  31495. }
  31496. function resetLastChars() {
  31497. twoLastChars[0] = twoLastChars[1] = " ";
  31498. twoLastCharsPos = 0;
  31499. }
  31500. const TRACKING_SPACE_FACTOR = 0.102;
  31501. const NOT_A_SPACE_FACTOR = 0.03;
  31502. const NEGATIVE_SPACE_FACTOR = -0.2;
  31503. const SPACE_IN_FLOW_MIN_FACTOR = 0.102;
  31504. const SPACE_IN_FLOW_MAX_FACTOR = 0.6;
  31505. const VERTICAL_SHIFT_RATIO = 0.25;
  31506. const self = this;
  31507. const xref = this.xref;
  31508. const showSpacedTextBuffer = [];
  31509. let xobjs = null;
  31510. const emptyXObjectCache = new LocalImageCache();
  31511. const emptyGStateCache = new LocalGStateCache();
  31512. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  31513. let textState;
  31514. function pushWhitespace({
  31515. width = 0,
  31516. height = 0,
  31517. transform = textContentItem.prevTransform,
  31518. fontName = textContentItem.fontName
  31519. }) {
  31520. textContent.items.push({
  31521. str: " ",
  31522. dir: "ltr",
  31523. width,
  31524. height,
  31525. transform,
  31526. fontName,
  31527. hasEOL: false
  31528. });
  31529. }
  31530. function getCurrentTextTransform() {
  31531. const font = textState.font;
  31532. const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  31533. if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !isArrayEqual(textState.fontMatrix, FONT_IDENTITY_MATRIX)) {
  31534. const glyphHeight = font.bbox[3] - font.bbox[1];
  31535. if (glyphHeight > 0) {
  31536. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  31537. }
  31538. }
  31539. return Util.transform(textState.ctm, Util.transform(textState.textMatrix, tsm));
  31540. }
  31541. function ensureTextContentItem() {
  31542. if (textContentItem.initialized) {
  31543. return textContentItem;
  31544. }
  31545. const {
  31546. font,
  31547. loadedName
  31548. } = textState;
  31549. if (!seenStyles.has(loadedName)) {
  31550. seenStyles.add(loadedName);
  31551. textContent.styles[loadedName] = {
  31552. fontFamily: font.fallbackName,
  31553. ascent: font.ascent,
  31554. descent: font.descent,
  31555. vertical: font.vertical
  31556. };
  31557. if (self.options.fontExtraProperties && font.systemFontInfo) {
  31558. const style = textContent.styles[loadedName];
  31559. style.fontSubstitution = font.systemFontInfo.css;
  31560. style.fontSubstitutionLoadedName = font.systemFontInfo.loadedName;
  31561. }
  31562. }
  31563. textContentItem.fontName = loadedName;
  31564. const trm = textContentItem.transform = getCurrentTextTransform();
  31565. if (!font.vertical) {
  31566. textContentItem.width = textContentItem.totalWidth = 0;
  31567. textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]);
  31568. textContentItem.vertical = false;
  31569. } else {
  31570. textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]);
  31571. textContentItem.height = textContentItem.totalHeight = 0;
  31572. textContentItem.vertical = true;
  31573. }
  31574. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  31575. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  31576. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  31577. const {
  31578. fontSize
  31579. } = textState;
  31580. textContentItem.trackingSpaceMin = fontSize * TRACKING_SPACE_FACTOR;
  31581. textContentItem.notASpace = fontSize * NOT_A_SPACE_FACTOR;
  31582. textContentItem.negativeSpaceMax = fontSize * NEGATIVE_SPACE_FACTOR;
  31583. textContentItem.spaceInFlowMin = fontSize * SPACE_IN_FLOW_MIN_FACTOR;
  31584. textContentItem.spaceInFlowMax = fontSize * SPACE_IN_FLOW_MAX_FACTOR;
  31585. textContentItem.hasEOL = false;
  31586. textContentItem.initialized = true;
  31587. return textContentItem;
  31588. }
  31589. function updateAdvanceScale() {
  31590. if (!textContentItem.initialized) {
  31591. return;
  31592. }
  31593. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  31594. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  31595. const scaleFactor = scaleCtmX * scaleLineX;
  31596. if (scaleFactor === textContentItem.textAdvanceScale) {
  31597. return;
  31598. }
  31599. if (!textContentItem.vertical) {
  31600. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  31601. textContentItem.width = 0;
  31602. } else {
  31603. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  31604. textContentItem.height = 0;
  31605. }
  31606. textContentItem.textAdvanceScale = scaleFactor;
  31607. }
  31608. function runBidiTransform(textChunk) {
  31609. let text = textChunk.str.join("");
  31610. if (!disableNormalization) {
  31611. text = normalizeUnicode(text);
  31612. }
  31613. const bidiResult = bidi(text, -1, textChunk.vertical);
  31614. return {
  31615. str: bidiResult.str,
  31616. dir: bidiResult.dir,
  31617. width: Math.abs(textChunk.totalWidth),
  31618. height: Math.abs(textChunk.totalHeight),
  31619. transform: textChunk.transform,
  31620. fontName: textChunk.fontName,
  31621. hasEOL: textChunk.hasEOL
  31622. };
  31623. }
  31624. async function handleSetFont(fontName, fontRef) {
  31625. const translated = await self.loadFont(fontName, fontRef, resources);
  31626. if (translated.font.isType3Font) {
  31627. try {
  31628. await translated.loadType3Data(self, resources, task);
  31629. } catch {}
  31630. }
  31631. textState.loadedName = translated.loadedName;
  31632. textState.font = translated.font;
  31633. textState.fontMatrix = translated.font.fontMatrix || FONT_IDENTITY_MATRIX;
  31634. }
  31635. function applyInverseRotation(x, y, matrix) {
  31636. const scale = Math.hypot(matrix[0], matrix[1]);
  31637. return [(matrix[0] * x + matrix[1] * y) / scale, (matrix[2] * x + matrix[3] * y) / scale];
  31638. }
  31639. function compareWithLastPosition(glyphWidth) {
  31640. const currentTransform = getCurrentTextTransform();
  31641. let posX = currentTransform[4];
  31642. let posY = currentTransform[5];
  31643. if (textState.font?.vertical) {
  31644. if (posX < viewBox[0] || posX > viewBox[2] || posY + glyphWidth < viewBox[1] || posY > viewBox[3]) {
  31645. return false;
  31646. }
  31647. } else if (posX + glyphWidth < viewBox[0] || posX > viewBox[2] || posY < viewBox[1] || posY > viewBox[3]) {
  31648. return false;
  31649. }
  31650. if (!textState.font || !textContentItem.prevTransform) {
  31651. return true;
  31652. }
  31653. let lastPosX = textContentItem.prevTransform[4];
  31654. let lastPosY = textContentItem.prevTransform[5];
  31655. if (lastPosX === posX && lastPosY === posY) {
  31656. return true;
  31657. }
  31658. let rotate = -1;
  31659. if (currentTransform[0] && currentTransform[1] === 0 && currentTransform[2] === 0) {
  31660. rotate = currentTransform[0] > 0 ? 0 : 180;
  31661. } else if (currentTransform[1] && currentTransform[0] === 0 && currentTransform[3] === 0) {
  31662. rotate = currentTransform[1] > 0 ? 90 : 270;
  31663. }
  31664. switch (rotate) {
  31665. case 0:
  31666. break;
  31667. case 90:
  31668. [posX, posY] = [posY, posX];
  31669. [lastPosX, lastPosY] = [lastPosY, lastPosX];
  31670. break;
  31671. case 180:
  31672. [posX, posY, lastPosX, lastPosY] = [-posX, -posY, -lastPosX, -lastPosY];
  31673. break;
  31674. case 270:
  31675. [posX, posY] = [-posY, -posX];
  31676. [lastPosX, lastPosY] = [-lastPosY, -lastPosX];
  31677. break;
  31678. default:
  31679. [posX, posY] = applyInverseRotation(posX, posY, currentTransform);
  31680. [lastPosX, lastPosY] = applyInverseRotation(lastPosX, lastPosY, textContentItem.prevTransform);
  31681. }
  31682. if (textState.font.vertical) {
  31683. const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale;
  31684. const advanceX = posX - lastPosX;
  31685. const textOrientation = Math.sign(textContentItem.height);
  31686. if (advanceY < textOrientation * textContentItem.negativeSpaceMax) {
  31687. if (Math.abs(advanceX) > 0.5 * textContentItem.width) {
  31688. appendEOL();
  31689. return true;
  31690. }
  31691. resetLastChars();
  31692. flushTextContentItem();
  31693. return true;
  31694. }
  31695. if (Math.abs(advanceX) > textContentItem.width) {
  31696. appendEOL();
  31697. return true;
  31698. }
  31699. if (advanceY <= textOrientation * textContentItem.notASpace) {
  31700. resetLastChars();
  31701. }
  31702. if (advanceY <= textOrientation * textContentItem.trackingSpaceMin) {
  31703. if (shouldAddWhitepsace()) {
  31704. resetLastChars();
  31705. flushTextContentItem();
  31706. pushWhitespace({
  31707. height: Math.abs(advanceY)
  31708. });
  31709. } else {
  31710. textContentItem.height += advanceY;
  31711. }
  31712. } else if (!addFakeSpaces(advanceY, textContentItem.prevTransform, textOrientation)) {
  31713. if (textContentItem.str.length === 0) {
  31714. resetLastChars();
  31715. pushWhitespace({
  31716. height: Math.abs(advanceY)
  31717. });
  31718. } else {
  31719. textContentItem.height += advanceY;
  31720. }
  31721. }
  31722. if (Math.abs(advanceX) > textContentItem.width * VERTICAL_SHIFT_RATIO) {
  31723. flushTextContentItem();
  31724. }
  31725. return true;
  31726. }
  31727. const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
  31728. const advanceY = posY - lastPosY;
  31729. const textOrientation = Math.sign(textContentItem.width);
  31730. if (advanceX < textOrientation * textContentItem.negativeSpaceMax) {
  31731. if (Math.abs(advanceY) > 0.5 * textContentItem.height) {
  31732. appendEOL();
  31733. return true;
  31734. }
  31735. resetLastChars();
  31736. flushTextContentItem();
  31737. return true;
  31738. }
  31739. if (Math.abs(advanceY) > textContentItem.height) {
  31740. appendEOL();
  31741. return true;
  31742. }
  31743. if (advanceX <= textOrientation * textContentItem.notASpace) {
  31744. resetLastChars();
  31745. }
  31746. if (advanceX <= textOrientation * textContentItem.trackingSpaceMin) {
  31747. if (shouldAddWhitepsace()) {
  31748. resetLastChars();
  31749. flushTextContentItem();
  31750. pushWhitespace({
  31751. width: Math.abs(advanceX)
  31752. });
  31753. } else {
  31754. textContentItem.width += advanceX;
  31755. }
  31756. } else if (!addFakeSpaces(advanceX, textContentItem.prevTransform, textOrientation)) {
  31757. if (textContentItem.str.length === 0) {
  31758. resetLastChars();
  31759. pushWhitespace({
  31760. width: Math.abs(advanceX)
  31761. });
  31762. } else {
  31763. textContentItem.width += advanceX;
  31764. }
  31765. }
  31766. if (Math.abs(advanceY) > textContentItem.height * VERTICAL_SHIFT_RATIO) {
  31767. flushTextContentItem();
  31768. }
  31769. return true;
  31770. }
  31771. function buildTextContentItem({
  31772. chars,
  31773. extraSpacing
  31774. }) {
  31775. const font = textState.font;
  31776. if (!chars) {
  31777. const charSpacing = textState.charSpacing + extraSpacing;
  31778. if (charSpacing) {
  31779. if (!font.vertical) {
  31780. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  31781. } else {
  31782. textState.translateTextMatrix(0, -charSpacing);
  31783. }
  31784. }
  31785. if (keepWhiteSpace) {
  31786. compareWithLastPosition(0);
  31787. }
  31788. return;
  31789. }
  31790. const glyphs = font.charsToGlyphs(chars);
  31791. const scale = textState.fontMatrix[0] * textState.fontSize;
  31792. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  31793. const glyph = glyphs[i];
  31794. const {
  31795. category
  31796. } = glyph;
  31797. if (category.isInvisibleFormatMark) {
  31798. continue;
  31799. }
  31800. let charSpacing = textState.charSpacing + (i + 1 === ii ? extraSpacing : 0);
  31801. let glyphWidth = glyph.width;
  31802. if (font.vertical) {
  31803. glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth;
  31804. }
  31805. let scaledDim = glyphWidth * scale;
  31806. if (!keepWhiteSpace && category.isWhitespace) {
  31807. if (!font.vertical) {
  31808. charSpacing += scaledDim + textState.wordSpacing;
  31809. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  31810. } else {
  31811. charSpacing += -scaledDim + textState.wordSpacing;
  31812. textState.translateTextMatrix(0, -charSpacing);
  31813. }
  31814. saveLastChar(" ");
  31815. continue;
  31816. }
  31817. if (!category.isZeroWidthDiacritic && !compareWithLastPosition(scaledDim)) {
  31818. if (!font.vertical) {
  31819. textState.translateTextMatrix(scaledDim * textState.textHScale, 0);
  31820. } else {
  31821. textState.translateTextMatrix(0, scaledDim);
  31822. }
  31823. continue;
  31824. }
  31825. const textChunk = ensureTextContentItem();
  31826. if (category.isZeroWidthDiacritic) {
  31827. scaledDim = 0;
  31828. }
  31829. if (!font.vertical) {
  31830. scaledDim *= textState.textHScale;
  31831. textState.translateTextMatrix(scaledDim, 0);
  31832. textChunk.width += scaledDim;
  31833. } else {
  31834. textState.translateTextMatrix(0, scaledDim);
  31835. scaledDim = Math.abs(scaledDim);
  31836. textChunk.height += scaledDim;
  31837. }
  31838. if (scaledDim) {
  31839. textChunk.prevTransform = getCurrentTextTransform();
  31840. }
  31841. const glyphUnicode = glyph.unicode;
  31842. if (saveLastChar(glyphUnicode)) {
  31843. textChunk.str.push(" ");
  31844. }
  31845. textChunk.str.push(glyphUnicode);
  31846. if (charSpacing) {
  31847. if (!font.vertical) {
  31848. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  31849. } else {
  31850. textState.translateTextMatrix(0, -charSpacing);
  31851. }
  31852. }
  31853. }
  31854. }
  31855. function appendEOL() {
  31856. resetLastChars();
  31857. if (textContentItem.initialized) {
  31858. textContentItem.hasEOL = true;
  31859. flushTextContentItem();
  31860. } else {
  31861. textContent.items.push({
  31862. str: "",
  31863. dir: "ltr",
  31864. width: 0,
  31865. height: 0,
  31866. transform: getCurrentTextTransform(),
  31867. fontName: textState.loadedName,
  31868. hasEOL: true
  31869. });
  31870. }
  31871. }
  31872. function addFakeSpaces(width, transf, textOrientation) {
  31873. if (textOrientation * textContentItem.spaceInFlowMin <= width && width <= textOrientation * textContentItem.spaceInFlowMax) {
  31874. if (textContentItem.initialized) {
  31875. resetLastChars();
  31876. textContentItem.str.push(" ");
  31877. }
  31878. return false;
  31879. }
  31880. const fontName = textContentItem.fontName;
  31881. let height = 0;
  31882. if (textContentItem.vertical) {
  31883. height = width;
  31884. width = 0;
  31885. }
  31886. flushTextContentItem();
  31887. resetLastChars();
  31888. pushWhitespace({
  31889. width: Math.abs(width),
  31890. height: Math.abs(height),
  31891. transform: transf || getCurrentTextTransform(),
  31892. fontName
  31893. });
  31894. return true;
  31895. }
  31896. function flushTextContentItem() {
  31897. if (!textContentItem.initialized || !textContentItem.str) {
  31898. return;
  31899. }
  31900. if (!textContentItem.vertical) {
  31901. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  31902. } else {
  31903. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  31904. }
  31905. textContent.items.push(runBidiTransform(textContentItem));
  31906. textContentItem.initialized = false;
  31907. textContentItem.str.length = 0;
  31908. }
  31909. function enqueueChunk(batch = false) {
  31910. const length = textContent.items.length;
  31911. if (length === 0) {
  31912. return;
  31913. }
  31914. if (batch && length < TEXT_CHUNK_BATCH_SIZE) {
  31915. return;
  31916. }
  31917. sink.enqueue(textContent, length);
  31918. textContent.items = [];
  31919. textContent.styles = Object.create(null);
  31920. }
  31921. const timeSlotManager = new TimeSlotManager();
  31922. return new Promise(function promiseBody(resolve, reject) {
  31923. const next = function (promise) {
  31924. enqueueChunk(true);
  31925. Promise.all([promise, sink.ready]).then(function () {
  31926. try {
  31927. promiseBody(resolve, reject);
  31928. } catch (ex) {
  31929. reject(ex);
  31930. }
  31931. }, reject);
  31932. };
  31933. task.ensureNotTerminated();
  31934. timeSlotManager.reset();
  31935. const operation = {};
  31936. let stop,
  31937. args = [];
  31938. while (!(stop = timeSlotManager.check())) {
  31939. args.length = 0;
  31940. operation.args = args;
  31941. if (!preprocessor.read(operation)) {
  31942. break;
  31943. }
  31944. const previousState = textState;
  31945. textState = stateManager.state;
  31946. const fn = operation.fn;
  31947. args = operation.args;
  31948. switch (fn | 0) {
  31949. case OPS.setFont:
  31950. var fontNameArg = args[0].name,
  31951. fontSizeArg = args[1];
  31952. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  31953. break;
  31954. }
  31955. flushTextContentItem();
  31956. textState.fontName = fontNameArg;
  31957. textState.fontSize = fontSizeArg;
  31958. next(handleSetFont(fontNameArg, null));
  31959. return;
  31960. case OPS.setTextRise:
  31961. textState.textRise = args[0];
  31962. break;
  31963. case OPS.setHScale:
  31964. textState.textHScale = args[0] / 100;
  31965. break;
  31966. case OPS.setLeading:
  31967. textState.leading = args[0];
  31968. break;
  31969. case OPS.moveText:
  31970. textState.translateTextLineMatrix(args[0], args[1]);
  31971. textState.textMatrix = textState.textLineMatrix.slice();
  31972. break;
  31973. case OPS.setLeadingMoveText:
  31974. textState.leading = -args[1];
  31975. textState.translateTextLineMatrix(args[0], args[1]);
  31976. textState.textMatrix = textState.textLineMatrix.slice();
  31977. break;
  31978. case OPS.nextLine:
  31979. textState.carriageReturn();
  31980. break;
  31981. case OPS.setTextMatrix:
  31982. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  31983. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  31984. updateAdvanceScale();
  31985. break;
  31986. case OPS.setCharSpacing:
  31987. textState.charSpacing = args[0];
  31988. break;
  31989. case OPS.setWordSpacing:
  31990. textState.wordSpacing = args[0];
  31991. break;
  31992. case OPS.beginText:
  31993. textState.textMatrix = IDENTITY_MATRIX.slice();
  31994. textState.textLineMatrix = IDENTITY_MATRIX.slice();
  31995. break;
  31996. case OPS.showSpacedText:
  31997. if (!stateManager.state.font) {
  31998. self.ensureStateFont(stateManager.state);
  31999. continue;
  32000. }
  32001. const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000;
  32002. const elements = args[0];
  32003. for (let i = 0, ii = elements.length; i < ii; i++) {
  32004. const item = elements[i];
  32005. if (typeof item === "string") {
  32006. showSpacedTextBuffer.push(item);
  32007. } else if (typeof item === "number" && item !== 0) {
  32008. const str = showSpacedTextBuffer.join("");
  32009. showSpacedTextBuffer.length = 0;
  32010. buildTextContentItem({
  32011. chars: str,
  32012. extraSpacing: item * spaceFactor
  32013. });
  32014. }
  32015. }
  32016. if (showSpacedTextBuffer.length > 0) {
  32017. const str = showSpacedTextBuffer.join("");
  32018. showSpacedTextBuffer.length = 0;
  32019. buildTextContentItem({
  32020. chars: str,
  32021. extraSpacing: 0
  32022. });
  32023. }
  32024. break;
  32025. case OPS.showText:
  32026. if (!stateManager.state.font) {
  32027. self.ensureStateFont(stateManager.state);
  32028. continue;
  32029. }
  32030. buildTextContentItem({
  32031. chars: args[0],
  32032. extraSpacing: 0
  32033. });
  32034. break;
  32035. case OPS.nextLineShowText:
  32036. if (!stateManager.state.font) {
  32037. self.ensureStateFont(stateManager.state);
  32038. continue;
  32039. }
  32040. textState.carriageReturn();
  32041. buildTextContentItem({
  32042. chars: args[0],
  32043. extraSpacing: 0
  32044. });
  32045. break;
  32046. case OPS.nextLineSetSpacingShowText:
  32047. if (!stateManager.state.font) {
  32048. self.ensureStateFont(stateManager.state);
  32049. continue;
  32050. }
  32051. textState.wordSpacing = args[0];
  32052. textState.charSpacing = args[1];
  32053. textState.carriageReturn();
  32054. buildTextContentItem({
  32055. chars: args[2],
  32056. extraSpacing: 0
  32057. });
  32058. break;
  32059. case OPS.paintXObject:
  32060. flushTextContentItem();
  32061. if (!xobjs) {
  32062. xobjs = resources.get("XObject") || Dict.empty;
  32063. }
  32064. var isValidName = args[0] instanceof Name;
  32065. var name = args[0].name;
  32066. if (isValidName && emptyXObjectCache.getByName(name)) {
  32067. break;
  32068. }
  32069. next(new Promise(function (resolveXObject, rejectXObject) {
  32070. if (!isValidName) {
  32071. throw new FormatError("XObject must be referred to by name.");
  32072. }
  32073. let xobj = xobjs.getRaw(name);
  32074. if (xobj instanceof Ref) {
  32075. if (emptyXObjectCache.getByRef(xobj)) {
  32076. resolveXObject();
  32077. return;
  32078. }
  32079. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  32080. if (globalImage) {
  32081. resolveXObject();
  32082. return;
  32083. }
  32084. xobj = xref.fetch(xobj);
  32085. }
  32086. if (!(xobj instanceof BaseStream)) {
  32087. throw new FormatError("XObject should be a stream");
  32088. }
  32089. const type = xobj.dict.get("Subtype");
  32090. if (!(type instanceof Name)) {
  32091. throw new FormatError("XObject should have a Name subtype");
  32092. }
  32093. if (type.name !== "Form") {
  32094. emptyXObjectCache.set(name, xobj.dict.objId, true);
  32095. resolveXObject();
  32096. return;
  32097. }
  32098. const currentState = stateManager.state.clone();
  32099. const xObjStateManager = new StateManager(currentState);
  32100. const matrix = lookupMatrix(xobj.dict.getArray("Matrix"), null);
  32101. if (matrix) {
  32102. xObjStateManager.transform(matrix);
  32103. }
  32104. enqueueChunk();
  32105. const sinkWrapper = {
  32106. enqueueInvoked: false,
  32107. enqueue(chunk, size) {
  32108. this.enqueueInvoked = true;
  32109. sink.enqueue(chunk, size);
  32110. },
  32111. get desiredSize() {
  32112. return sink.desiredSize;
  32113. },
  32114. get ready() {
  32115. return sink.ready;
  32116. }
  32117. };
  32118. self.getTextContent({
  32119. stream: xobj,
  32120. task,
  32121. resources: xobj.dict.get("Resources") || resources,
  32122. stateManager: xObjStateManager,
  32123. includeMarkedContent,
  32124. sink: sinkWrapper,
  32125. seenStyles,
  32126. viewBox,
  32127. lang,
  32128. markedContentData,
  32129. disableNormalization,
  32130. keepWhiteSpace
  32131. }).then(function () {
  32132. if (!sinkWrapper.enqueueInvoked) {
  32133. emptyXObjectCache.set(name, xobj.dict.objId, true);
  32134. }
  32135. resolveXObject();
  32136. }, rejectXObject);
  32137. }).catch(function (reason) {
  32138. if (reason instanceof AbortException) {
  32139. return;
  32140. }
  32141. if (self.options.ignoreErrors) {
  32142. warn(`getTextContent - ignoring XObject: "${reason}".`);
  32143. return;
  32144. }
  32145. throw reason;
  32146. }));
  32147. return;
  32148. case OPS.setGState:
  32149. isValidName = args[0] instanceof Name;
  32150. name = args[0].name;
  32151. if (isValidName && emptyGStateCache.getByName(name)) {
  32152. break;
  32153. }
  32154. next(new Promise(function (resolveGState, rejectGState) {
  32155. if (!isValidName) {
  32156. throw new FormatError("GState must be referred to by name.");
  32157. }
  32158. const extGState = resources.get("ExtGState");
  32159. if (!(extGState instanceof Dict)) {
  32160. throw new FormatError("ExtGState should be a dictionary.");
  32161. }
  32162. const gState = extGState.get(name);
  32163. if (!(gState instanceof Dict)) {
  32164. throw new FormatError("GState should be a dictionary.");
  32165. }
  32166. const gStateFont = gState.get("Font");
  32167. if (!gStateFont) {
  32168. emptyGStateCache.set(name, gState.objId, true);
  32169. resolveGState();
  32170. return;
  32171. }
  32172. flushTextContentItem();
  32173. textState.fontName = null;
  32174. textState.fontSize = gStateFont[1];
  32175. handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
  32176. }).catch(function (reason) {
  32177. if (reason instanceof AbortException) {
  32178. return;
  32179. }
  32180. if (self.options.ignoreErrors) {
  32181. warn(`getTextContent - ignoring ExtGState: "${reason}".`);
  32182. return;
  32183. }
  32184. throw reason;
  32185. }));
  32186. return;
  32187. case OPS.beginMarkedContent:
  32188. flushTextContentItem();
  32189. if (includeMarkedContent) {
  32190. markedContentData.level++;
  32191. textContent.items.push({
  32192. type: "beginMarkedContent",
  32193. tag: args[0] instanceof Name ? args[0].name : null
  32194. });
  32195. }
  32196. break;
  32197. case OPS.beginMarkedContentProps:
  32198. flushTextContentItem();
  32199. if (includeMarkedContent) {
  32200. markedContentData.level++;
  32201. let mcid = null;
  32202. if (args[1] instanceof Dict) {
  32203. mcid = args[1].get("MCID");
  32204. }
  32205. textContent.items.push({
  32206. type: "beginMarkedContentProps",
  32207. id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mc${mcid}` : null,
  32208. tag: args[0] instanceof Name ? args[0].name : null
  32209. });
  32210. }
  32211. break;
  32212. case OPS.endMarkedContent:
  32213. flushTextContentItem();
  32214. if (includeMarkedContent) {
  32215. if (markedContentData.level === 0) {
  32216. break;
  32217. }
  32218. markedContentData.level--;
  32219. textContent.items.push({
  32220. type: "endMarkedContent"
  32221. });
  32222. }
  32223. break;
  32224. case OPS.restore:
  32225. if (previousState && (previousState.font !== textState.font || previousState.fontSize !== textState.fontSize || previousState.fontName !== textState.fontName)) {
  32226. flushTextContentItem();
  32227. }
  32228. break;
  32229. }
  32230. if (textContent.items.length >= sink.desiredSize) {
  32231. stop = true;
  32232. break;
  32233. }
  32234. }
  32235. if (stop) {
  32236. next(deferred);
  32237. return;
  32238. }
  32239. flushTextContentItem();
  32240. enqueueChunk();
  32241. resolve();
  32242. }).catch(reason => {
  32243. if (reason instanceof AbortException) {
  32244. return;
  32245. }
  32246. if (this.options.ignoreErrors) {
  32247. warn(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  32248. flushTextContentItem();
  32249. enqueueChunk();
  32250. return;
  32251. }
  32252. throw reason;
  32253. });
  32254. }
  32255. async extractDataStructures(dict, properties) {
  32256. const xref = this.xref;
  32257. let cidToGidBytes;
  32258. const toUnicodePromise = this.readToUnicode(properties.toUnicode);
  32259. if (properties.composite) {
  32260. const cidSystemInfo = dict.get("CIDSystemInfo");
  32261. if (cidSystemInfo instanceof Dict) {
  32262. properties.cidSystemInfo = {
  32263. registry: stringToPDFString(cidSystemInfo.get("Registry")),
  32264. ordering: stringToPDFString(cidSystemInfo.get("Ordering")),
  32265. supplement: cidSystemInfo.get("Supplement")
  32266. };
  32267. }
  32268. try {
  32269. const cidToGidMap = dict.get("CIDToGIDMap");
  32270. if (cidToGidMap instanceof BaseStream) {
  32271. cidToGidBytes = cidToGidMap.getBytes();
  32272. }
  32273. } catch (ex) {
  32274. if (!this.options.ignoreErrors) {
  32275. throw ex;
  32276. }
  32277. warn(`extractDataStructures - ignoring CIDToGIDMap data: "${ex}".`);
  32278. }
  32279. }
  32280. const differences = [];
  32281. let baseEncodingName = null;
  32282. let encoding;
  32283. if (dict.has("Encoding")) {
  32284. encoding = dict.get("Encoding");
  32285. if (encoding instanceof Dict) {
  32286. baseEncodingName = encoding.get("BaseEncoding");
  32287. baseEncodingName = baseEncodingName instanceof Name ? baseEncodingName.name : null;
  32288. if (encoding.has("Differences")) {
  32289. const diffEncoding = encoding.get("Differences");
  32290. let index = 0;
  32291. for (const entry of diffEncoding) {
  32292. const data = xref.fetchIfRef(entry);
  32293. if (typeof data === "number") {
  32294. index = data;
  32295. } else if (data instanceof Name) {
  32296. differences[index++] = data.name;
  32297. } else {
  32298. throw new FormatError(`Invalid entry in 'Differences' array: ${data}`);
  32299. }
  32300. }
  32301. }
  32302. } else if (encoding instanceof Name) {
  32303. baseEncodingName = encoding.name;
  32304. } else {
  32305. const msg = "Encoding is not a Name nor a Dict";
  32306. if (!this.options.ignoreErrors) {
  32307. throw new FormatError(msg);
  32308. }
  32309. warn(msg);
  32310. }
  32311. if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
  32312. baseEncodingName = null;
  32313. }
  32314. }
  32315. const nonEmbeddedFont = !properties.file || properties.isInternalFont,
  32316. isSymbolsFontName = getSymbolsFonts()[properties.name];
  32317. if (baseEncodingName && nonEmbeddedFont && isSymbolsFontName) {
  32318. baseEncodingName = null;
  32319. }
  32320. if (baseEncodingName) {
  32321. properties.defaultEncoding = getEncoding(baseEncodingName);
  32322. } else {
  32323. const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  32324. const isNonsymbolicFont = !!(properties.flags & FontFlags.Nonsymbolic);
  32325. encoding = StandardEncoding;
  32326. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  32327. encoding = WinAnsiEncoding;
  32328. }
  32329. if (isSymbolicFont || isSymbolsFontName) {
  32330. encoding = MacRomanEncoding;
  32331. if (nonEmbeddedFont) {
  32332. if (/Symbol/i.test(properties.name)) {
  32333. encoding = SymbolSetEncoding;
  32334. } else if (/Dingbats/i.test(properties.name)) {
  32335. encoding = ZapfDingbatsEncoding;
  32336. } else if (/Wingdings/i.test(properties.name)) {
  32337. encoding = WinAnsiEncoding;
  32338. }
  32339. }
  32340. }
  32341. properties.defaultEncoding = encoding;
  32342. }
  32343. properties.differences = differences;
  32344. properties.baseEncodingName = baseEncodingName;
  32345. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  32346. properties.dict = dict;
  32347. properties.toUnicode = await toUnicodePromise;
  32348. const builtToUnicode = await this.buildToUnicode(properties);
  32349. properties.toUnicode = builtToUnicode;
  32350. if (cidToGidBytes) {
  32351. properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
  32352. }
  32353. return properties;
  32354. }
  32355. _simpleFontToUnicode(properties, forceGlyphs = false) {
  32356. assert(!properties.composite, "Must be a simple font.");
  32357. const toUnicode = [];
  32358. const encoding = properties.defaultEncoding.slice();
  32359. const baseEncodingName = properties.baseEncodingName;
  32360. const differences = properties.differences;
  32361. for (const charcode in differences) {
  32362. const glyphName = differences[charcode];
  32363. if (glyphName === ".notdef") {
  32364. continue;
  32365. }
  32366. encoding[charcode] = glyphName;
  32367. }
  32368. const glyphsUnicodeMap = getGlyphsUnicode();
  32369. for (const charcode in encoding) {
  32370. let glyphName = encoding[charcode];
  32371. if (glyphName === "") {
  32372. continue;
  32373. }
  32374. let unicode = glyphsUnicodeMap[glyphName];
  32375. if (unicode !== undefined) {
  32376. toUnicode[charcode] = String.fromCharCode(unicode);
  32377. continue;
  32378. }
  32379. let code = 0;
  32380. switch (glyphName[0]) {
  32381. case "G":
  32382. if (glyphName.length === 3) {
  32383. code = parseInt(glyphName.substring(1), 16);
  32384. }
  32385. break;
  32386. case "g":
  32387. if (glyphName.length === 5) {
  32388. code = parseInt(glyphName.substring(1), 16);
  32389. }
  32390. break;
  32391. case "C":
  32392. case "c":
  32393. if (glyphName.length >= 3 && glyphName.length <= 4) {
  32394. const codeStr = glyphName.substring(1);
  32395. if (forceGlyphs) {
  32396. code = parseInt(codeStr, 16);
  32397. break;
  32398. }
  32399. code = +codeStr;
  32400. if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
  32401. return this._simpleFontToUnicode(properties, true);
  32402. }
  32403. }
  32404. break;
  32405. case "u":
  32406. unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  32407. if (unicode !== -1) {
  32408. code = unicode;
  32409. }
  32410. break;
  32411. default:
  32412. switch (glyphName) {
  32413. case "f_h":
  32414. case "f_t":
  32415. case "T_h":
  32416. toUnicode[charcode] = glyphName.replaceAll("_", "");
  32417. continue;
  32418. }
  32419. break;
  32420. }
  32421. if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
  32422. if (baseEncodingName && code === +charcode) {
  32423. const baseEncoding = getEncoding(baseEncodingName);
  32424. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  32425. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  32426. continue;
  32427. }
  32428. }
  32429. toUnicode[charcode] = String.fromCodePoint(code);
  32430. }
  32431. }
  32432. return toUnicode;
  32433. }
  32434. async buildToUnicode(properties) {
  32435. properties.hasIncludedToUnicodeMap = properties.toUnicode?.length > 0;
  32436. if (properties.hasIncludedToUnicodeMap) {
  32437. if (!properties.composite && properties.hasEncoding) {
  32438. properties.fallbackToUnicode = this._simpleFontToUnicode(properties);
  32439. }
  32440. return properties.toUnicode;
  32441. }
  32442. if (!properties.composite) {
  32443. return new ToUnicodeMap(this._simpleFontToUnicode(properties));
  32444. }
  32445. if (properties.composite && (properties.cMap.builtInCMap && !(properties.cMap instanceof IdentityCMap) || properties.cidSystemInfo?.registry === "Adobe" && (properties.cidSystemInfo.ordering === "GB1" || properties.cidSystemInfo.ordering === "CNS1" || properties.cidSystemInfo.ordering === "Japan1" || properties.cidSystemInfo.ordering === "Korea1"))) {
  32446. const {
  32447. registry,
  32448. ordering
  32449. } = properties.cidSystemInfo;
  32450. const ucs2CMapName = Name.get(`${registry}-${ordering}-UCS2`);
  32451. const ucs2CMap = await CMapFactory.create({
  32452. encoding: ucs2CMapName,
  32453. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  32454. useCMap: null
  32455. });
  32456. const toUnicode = [],
  32457. buf = [];
  32458. properties.cMap.forEach(function (charcode, cid) {
  32459. if (cid > 0xffff) {
  32460. throw new FormatError("Max size of CID is 65,535");
  32461. }
  32462. const ucs2 = ucs2CMap.lookup(cid);
  32463. if (ucs2) {
  32464. buf.length = 0;
  32465. for (let i = 0, ii = ucs2.length; i < ii; i += 2) {
  32466. buf.push((ucs2.charCodeAt(i) << 8) + ucs2.charCodeAt(i + 1));
  32467. }
  32468. toUnicode[charcode] = String.fromCharCode(...buf);
  32469. }
  32470. });
  32471. return new ToUnicodeMap(toUnicode);
  32472. }
  32473. return new IdentityToUnicodeMap(properties.firstChar, properties.lastChar);
  32474. }
  32475. async readToUnicode(cmapObj) {
  32476. if (!cmapObj) {
  32477. return null;
  32478. }
  32479. if (cmapObj instanceof Name) {
  32480. const cmap = await CMapFactory.create({
  32481. encoding: cmapObj,
  32482. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  32483. useCMap: null
  32484. });
  32485. if (cmap instanceof IdentityCMap) {
  32486. return new IdentityToUnicodeMap(0, 0xffff);
  32487. }
  32488. return new ToUnicodeMap(cmap.getMap());
  32489. }
  32490. if (cmapObj instanceof BaseStream) {
  32491. try {
  32492. const cmap = await CMapFactory.create({
  32493. encoding: cmapObj,
  32494. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  32495. useCMap: null
  32496. });
  32497. if (cmap instanceof IdentityCMap) {
  32498. return new IdentityToUnicodeMap(0, 0xffff);
  32499. }
  32500. const map = new Array(cmap.length);
  32501. cmap.forEach(function (charCode, token) {
  32502. if (typeof token === "number") {
  32503. map[charCode] = String.fromCodePoint(token);
  32504. return;
  32505. }
  32506. if (token.length % 2 !== 0) {
  32507. token = "\u0000" + token;
  32508. }
  32509. const str = [];
  32510. for (let k = 0; k < token.length; k += 2) {
  32511. const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  32512. if ((w1 & 0xf800) !== 0xd800) {
  32513. str.push(w1);
  32514. continue;
  32515. }
  32516. k += 2;
  32517. const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  32518. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  32519. }
  32520. map[charCode] = String.fromCodePoint(...str);
  32521. });
  32522. return new ToUnicodeMap(map);
  32523. } catch (reason) {
  32524. if (reason instanceof AbortException) {
  32525. return null;
  32526. }
  32527. if (this.options.ignoreErrors) {
  32528. warn(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
  32529. return null;
  32530. }
  32531. throw reason;
  32532. }
  32533. }
  32534. return null;
  32535. }
  32536. readCidToGidMap(glyphsData, toUnicode) {
  32537. const result = [];
  32538. for (let j = 0, jj = glyphsData.length; j < jj; j++) {
  32539. const glyphID = glyphsData[j++] << 8 | glyphsData[j];
  32540. const code = j >> 1;
  32541. if (glyphID === 0 && !toUnicode.has(code)) {
  32542. continue;
  32543. }
  32544. result[code] = glyphID;
  32545. }
  32546. return result;
  32547. }
  32548. extractWidths(dict, descriptor, properties) {
  32549. const xref = this.xref;
  32550. let glyphsWidths = [];
  32551. let defaultWidth = 0;
  32552. const glyphsVMetrics = [];
  32553. let defaultVMetrics;
  32554. if (properties.composite) {
  32555. const dw = dict.get("DW");
  32556. defaultWidth = typeof dw === "number" ? Math.ceil(dw) : 1000;
  32557. const widths = dict.get("W");
  32558. if (Array.isArray(widths)) {
  32559. for (let i = 0, ii = widths.length; i < ii; i++) {
  32560. let start = xref.fetchIfRef(widths[i++]);
  32561. if (!Number.isInteger(start)) {
  32562. break;
  32563. }
  32564. const code = xref.fetchIfRef(widths[i]);
  32565. if (Array.isArray(code)) {
  32566. for (const c of code) {
  32567. const width = xref.fetchIfRef(c);
  32568. if (typeof width === "number") {
  32569. glyphsWidths[start] = width;
  32570. }
  32571. start++;
  32572. }
  32573. } else if (Number.isInteger(code)) {
  32574. const width = xref.fetchIfRef(widths[++i]);
  32575. if (typeof width !== "number") {
  32576. continue;
  32577. }
  32578. for (let j = start; j <= code; j++) {
  32579. glyphsWidths[j] = width;
  32580. }
  32581. } else {
  32582. break;
  32583. }
  32584. }
  32585. }
  32586. if (properties.vertical) {
  32587. const dw2 = dict.getArray("DW2");
  32588. let vmetrics = isNumberArray(dw2, 2) ? dw2 : [880, -1000];
  32589. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  32590. vmetrics = dict.get("W2");
  32591. if (Array.isArray(vmetrics)) {
  32592. for (let i = 0, ii = vmetrics.length; i < ii; i++) {
  32593. let start = xref.fetchIfRef(vmetrics[i++]);
  32594. if (!Number.isInteger(start)) {
  32595. break;
  32596. }
  32597. const code = xref.fetchIfRef(vmetrics[i]);
  32598. if (Array.isArray(code)) {
  32599. for (let j = 0, jj = code.length; j < jj; j++) {
  32600. const vmetric = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  32601. if (isNumberArray(vmetric, null)) {
  32602. glyphsVMetrics[start] = vmetric;
  32603. }
  32604. start++;
  32605. }
  32606. } else if (Number.isInteger(code)) {
  32607. const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  32608. if (!isNumberArray(vmetric, null)) {
  32609. continue;
  32610. }
  32611. for (let j = start; j <= code; j++) {
  32612. glyphsVMetrics[j] = vmetric;
  32613. }
  32614. } else {
  32615. break;
  32616. }
  32617. }
  32618. }
  32619. }
  32620. } else {
  32621. const widths = dict.get("Widths");
  32622. if (Array.isArray(widths)) {
  32623. let j = properties.firstChar;
  32624. for (const w of widths) {
  32625. const width = xref.fetchIfRef(w);
  32626. if (typeof width === "number") {
  32627. glyphsWidths[j] = width;
  32628. }
  32629. j++;
  32630. }
  32631. const missingWidth = descriptor.get("MissingWidth");
  32632. defaultWidth = typeof missingWidth === "number" ? missingWidth : 0;
  32633. } else {
  32634. const baseFontName = dict.get("BaseFont");
  32635. if (baseFontName instanceof Name) {
  32636. const metrics = this.getBaseFontMetrics(baseFontName.name);
  32637. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  32638. defaultWidth = metrics.defaultWidth;
  32639. }
  32640. }
  32641. }
  32642. let isMonospace = true;
  32643. let firstWidth = defaultWidth;
  32644. for (const glyph in glyphsWidths) {
  32645. const glyphWidth = glyphsWidths[glyph];
  32646. if (!glyphWidth) {
  32647. continue;
  32648. }
  32649. if (!firstWidth) {
  32650. firstWidth = glyphWidth;
  32651. continue;
  32652. }
  32653. if (firstWidth !== glyphWidth) {
  32654. isMonospace = false;
  32655. break;
  32656. }
  32657. }
  32658. if (isMonospace) {
  32659. properties.flags |= FontFlags.FixedPitch;
  32660. } else {
  32661. properties.flags &= ~FontFlags.FixedPitch;
  32662. }
  32663. properties.defaultWidth = defaultWidth;
  32664. properties.widths = glyphsWidths;
  32665. properties.defaultVMetrics = defaultVMetrics;
  32666. properties.vmetrics = glyphsVMetrics;
  32667. }
  32668. isSerifFont(baseFontName) {
  32669. const fontNameWoStyle = baseFontName.split("-", 1)[0];
  32670. return fontNameWoStyle in getSerifFonts() || /serif/gi.test(fontNameWoStyle);
  32671. }
  32672. getBaseFontMetrics(name) {
  32673. let defaultWidth = 0;
  32674. let widths = Object.create(null);
  32675. let monospace = false;
  32676. const stdFontMap = getStdFontMap();
  32677. let lookupName = stdFontMap[name] || name;
  32678. const Metrics = getMetrics();
  32679. if (!(lookupName in Metrics)) {
  32680. lookupName = this.isSerifFont(name) ? "Times-Roman" : "Helvetica";
  32681. }
  32682. const glyphWidths = Metrics[lookupName];
  32683. if (typeof glyphWidths === "number") {
  32684. defaultWidth = glyphWidths;
  32685. monospace = true;
  32686. } else {
  32687. widths = glyphWidths();
  32688. }
  32689. return {
  32690. defaultWidth,
  32691. monospace,
  32692. widths
  32693. };
  32694. }
  32695. buildCharCodeToWidth(widthsByGlyphName, properties) {
  32696. const widths = Object.create(null);
  32697. const differences = properties.differences;
  32698. const encoding = properties.defaultEncoding;
  32699. for (let charCode = 0; charCode < 256; charCode++) {
  32700. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  32701. widths[charCode] = widthsByGlyphName[differences[charCode]];
  32702. continue;
  32703. }
  32704. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  32705. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  32706. continue;
  32707. }
  32708. }
  32709. return widths;
  32710. }
  32711. preEvaluateFont(dict) {
  32712. const baseDict = dict;
  32713. let type = dict.get("Subtype");
  32714. if (!(type instanceof Name)) {
  32715. throw new FormatError("invalid font Subtype");
  32716. }
  32717. let composite = false;
  32718. let hash;
  32719. if (type.name === "Type0") {
  32720. const df = dict.get("DescendantFonts");
  32721. if (!df) {
  32722. throw new FormatError("Descendant fonts are not specified");
  32723. }
  32724. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  32725. if (!(dict instanceof Dict)) {
  32726. throw new FormatError("Descendant font is not a dictionary.");
  32727. }
  32728. type = dict.get("Subtype");
  32729. if (!(type instanceof Name)) {
  32730. throw new FormatError("invalid font Subtype");
  32731. }
  32732. composite = true;
  32733. }
  32734. let firstChar = dict.get("FirstChar");
  32735. if (!Number.isInteger(firstChar)) {
  32736. firstChar = 0;
  32737. }
  32738. let lastChar = dict.get("LastChar");
  32739. if (!Number.isInteger(lastChar)) {
  32740. lastChar = composite ? 0xffff : 0xff;
  32741. }
  32742. const descriptor = dict.get("FontDescriptor");
  32743. const toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  32744. if (descriptor) {
  32745. hash = new MurmurHash3_64();
  32746. const encoding = baseDict.getRaw("Encoding");
  32747. if (encoding instanceof Name) {
  32748. hash.update(encoding.name);
  32749. } else if (encoding instanceof Ref) {
  32750. hash.update(encoding.toString());
  32751. } else if (encoding instanceof Dict) {
  32752. for (const entry of encoding.getRawValues()) {
  32753. if (entry instanceof Name) {
  32754. hash.update(entry.name);
  32755. } else if (entry instanceof Ref) {
  32756. hash.update(entry.toString());
  32757. } else if (Array.isArray(entry)) {
  32758. const diffLength = entry.length,
  32759. diffBuf = new Array(diffLength);
  32760. for (let j = 0; j < diffLength; j++) {
  32761. const diffEntry = entry[j];
  32762. if (diffEntry instanceof Name) {
  32763. diffBuf[j] = diffEntry.name;
  32764. } else if (typeof diffEntry === "number" || diffEntry instanceof Ref) {
  32765. diffBuf[j] = diffEntry.toString();
  32766. }
  32767. }
  32768. hash.update(diffBuf.join());
  32769. }
  32770. }
  32771. }
  32772. hash.update(`${firstChar}-${lastChar}`);
  32773. if (toUnicode instanceof BaseStream) {
  32774. const stream = toUnicode.str || toUnicode;
  32775. const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  32776. hash.update(uint8array);
  32777. } else if (toUnicode instanceof Name) {
  32778. hash.update(toUnicode.name);
  32779. }
  32780. const widths = dict.get("Widths") || baseDict.get("Widths");
  32781. if (Array.isArray(widths)) {
  32782. const widthsBuf = [];
  32783. for (const entry of widths) {
  32784. if (typeof entry === "number" || entry instanceof Ref) {
  32785. widthsBuf.push(entry.toString());
  32786. }
  32787. }
  32788. hash.update(widthsBuf.join());
  32789. }
  32790. if (composite) {
  32791. hash.update("compositeFont");
  32792. const compositeWidths = dict.get("W") || baseDict.get("W");
  32793. if (Array.isArray(compositeWidths)) {
  32794. const widthsBuf = [];
  32795. for (const entry of compositeWidths) {
  32796. if (typeof entry === "number" || entry instanceof Ref) {
  32797. widthsBuf.push(entry.toString());
  32798. } else if (Array.isArray(entry)) {
  32799. const subWidthsBuf = [];
  32800. for (const element of entry) {
  32801. if (typeof element === "number" || element instanceof Ref) {
  32802. subWidthsBuf.push(element.toString());
  32803. }
  32804. }
  32805. widthsBuf.push(`[${subWidthsBuf.join()}]`);
  32806. }
  32807. }
  32808. hash.update(widthsBuf.join());
  32809. }
  32810. const cidToGidMap = dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap");
  32811. if (cidToGidMap instanceof Name) {
  32812. hash.update(cidToGidMap.name);
  32813. } else if (cidToGidMap instanceof Ref) {
  32814. hash.update(cidToGidMap.toString());
  32815. } else if (cidToGidMap instanceof BaseStream) {
  32816. hash.update(cidToGidMap.peekBytes());
  32817. }
  32818. }
  32819. }
  32820. return {
  32821. descriptor,
  32822. dict,
  32823. baseDict,
  32824. composite,
  32825. type: type.name,
  32826. firstChar,
  32827. lastChar,
  32828. toUnicode,
  32829. hash: hash ? hash.hexdigest() : ""
  32830. };
  32831. }
  32832. async translateFont({
  32833. descriptor,
  32834. dict,
  32835. baseDict,
  32836. composite,
  32837. type,
  32838. firstChar,
  32839. lastChar,
  32840. toUnicode,
  32841. cssFontInfo
  32842. }) {
  32843. const isType3Font = type === "Type3";
  32844. if (!descriptor) {
  32845. if (isType3Font) {
  32846. const bbox = lookupNormalRect(dict.getArray("FontBBox"), [0, 0, 0, 0]);
  32847. descriptor = new Dict(null);
  32848. descriptor.set("FontName", Name.get(type));
  32849. descriptor.set("FontBBox", bbox);
  32850. } else {
  32851. let baseFontName = dict.get("BaseFont");
  32852. if (!(baseFontName instanceof Name)) {
  32853. throw new FormatError("Base font is not specified");
  32854. }
  32855. baseFontName = baseFontName.name.replaceAll(/[,_]/g, "-");
  32856. const metrics = this.getBaseFontMetrics(baseFontName);
  32857. const fontNameWoStyle = baseFontName.split("-", 1)[0];
  32858. const flags = (this.isSerifFont(fontNameWoStyle) ? FontFlags.Serif : 0) | (metrics.monospace ? FontFlags.FixedPitch : 0) | (getSymbolsFonts()[fontNameWoStyle] ? FontFlags.Symbolic : FontFlags.Nonsymbolic);
  32859. const properties = {
  32860. type,
  32861. name: baseFontName,
  32862. loadedName: baseDict.loadedName,
  32863. systemFontInfo: null,
  32864. widths: metrics.widths,
  32865. defaultWidth: metrics.defaultWidth,
  32866. isSimulatedFlags: true,
  32867. flags,
  32868. firstChar,
  32869. lastChar,
  32870. toUnicode,
  32871. xHeight: 0,
  32872. capHeight: 0,
  32873. italicAngle: 0,
  32874. isType3Font
  32875. };
  32876. const widths = dict.get("Widths");
  32877. const standardFontName = getStandardFontName(baseFontName);
  32878. let file = null;
  32879. if (standardFontName) {
  32880. file = await this.fetchStandardFontData(standardFontName);
  32881. properties.isInternalFont = !!file;
  32882. }
  32883. if (!properties.isInternalFont && this.options.useSystemFonts) {
  32884. properties.systemFontInfo = getFontSubstitution(this.systemFontCache, this.idFactory, this.options.standardFontDataUrl, baseFontName, standardFontName, type);
  32885. }
  32886. const newProperties = await this.extractDataStructures(dict, properties);
  32887. if (Array.isArray(widths)) {
  32888. const glyphWidths = [];
  32889. let j = firstChar;
  32890. for (const w of widths) {
  32891. const width = this.xref.fetchIfRef(w);
  32892. if (typeof width === "number") {
  32893. glyphWidths[j] = width;
  32894. }
  32895. j++;
  32896. }
  32897. newProperties.widths = glyphWidths;
  32898. } else {
  32899. newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
  32900. }
  32901. return new Font(baseFontName, file, newProperties);
  32902. }
  32903. }
  32904. let fontName = descriptor.get("FontName");
  32905. let baseFont = dict.get("BaseFont");
  32906. if (typeof fontName === "string") {
  32907. fontName = Name.get(fontName);
  32908. }
  32909. if (typeof baseFont === "string") {
  32910. baseFont = Name.get(baseFont);
  32911. }
  32912. const fontNameStr = fontName?.name;
  32913. const baseFontStr = baseFont?.name;
  32914. if (!isType3Font && fontNameStr !== baseFontStr) {
  32915. info(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`);
  32916. if (fontNameStr && baseFontStr && (baseFontStr.startsWith(fontNameStr) || !isKnownFontName(fontNameStr) && isKnownFontName(baseFontStr))) {
  32917. fontName = null;
  32918. }
  32919. }
  32920. fontName ||= baseFont;
  32921. if (!(fontName instanceof Name)) {
  32922. throw new FormatError("invalid font name");
  32923. }
  32924. let fontFile, subtype, length1, length2, length3;
  32925. try {
  32926. fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  32927. if (fontFile) {
  32928. if (!(fontFile instanceof BaseStream)) {
  32929. throw new FormatError("FontFile should be a stream");
  32930. } else if (fontFile.isEmpty) {
  32931. throw new FormatError("FontFile is empty");
  32932. }
  32933. }
  32934. } catch (ex) {
  32935. if (!this.options.ignoreErrors) {
  32936. throw ex;
  32937. }
  32938. warn(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
  32939. fontFile = null;
  32940. }
  32941. let isInternalFont = false;
  32942. let glyphScaleFactors = null;
  32943. let systemFontInfo = null;
  32944. if (fontFile) {
  32945. if (fontFile.dict) {
  32946. const subtypeEntry = fontFile.dict.get("Subtype");
  32947. if (subtypeEntry instanceof Name) {
  32948. subtype = subtypeEntry.name;
  32949. }
  32950. length1 = fontFile.dict.get("Length1");
  32951. length2 = fontFile.dict.get("Length2");
  32952. length3 = fontFile.dict.get("Length3");
  32953. }
  32954. } else if (cssFontInfo) {
  32955. const standardFontName = getXfaFontName(fontName.name);
  32956. if (standardFontName) {
  32957. cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`;
  32958. cssFontInfo.metrics = standardFontName.metrics || null;
  32959. glyphScaleFactors = standardFontName.factors || null;
  32960. fontFile = await this.fetchStandardFontData(standardFontName.name);
  32961. isInternalFont = !!fontFile;
  32962. baseDict = dict = getXfaFontDict(fontName.name);
  32963. composite = true;
  32964. }
  32965. } else if (!isType3Font) {
  32966. const standardFontName = getStandardFontName(fontName.name);
  32967. if (standardFontName) {
  32968. fontFile = await this.fetchStandardFontData(standardFontName);
  32969. isInternalFont = !!fontFile;
  32970. }
  32971. if (!isInternalFont && this.options.useSystemFonts) {
  32972. systemFontInfo = getFontSubstitution(this.systemFontCache, this.idFactory, this.options.standardFontDataUrl, fontName.name, standardFontName, type);
  32973. }
  32974. }
  32975. const fontMatrix = lookupMatrix(dict.getArray("FontMatrix"), FONT_IDENTITY_MATRIX);
  32976. const bbox = lookupNormalRect(descriptor.getArray("FontBBox") || dict.getArray("FontBBox"), undefined);
  32977. let ascent = descriptor.get("Ascent");
  32978. if (typeof ascent !== "number") {
  32979. ascent = undefined;
  32980. }
  32981. let descent = descriptor.get("Descent");
  32982. if (typeof descent !== "number") {
  32983. descent = undefined;
  32984. }
  32985. let xHeight = descriptor.get("XHeight");
  32986. if (typeof xHeight !== "number") {
  32987. xHeight = 0;
  32988. }
  32989. let capHeight = descriptor.get("CapHeight");
  32990. if (typeof capHeight !== "number") {
  32991. capHeight = 0;
  32992. }
  32993. let flags = descriptor.get("Flags");
  32994. if (!Number.isInteger(flags)) {
  32995. flags = 0;
  32996. }
  32997. let italicAngle = descriptor.get("ItalicAngle");
  32998. if (typeof italicAngle !== "number") {
  32999. italicAngle = 0;
  33000. }
  33001. const properties = {
  33002. type,
  33003. name: fontName.name,
  33004. subtype,
  33005. file: fontFile,
  33006. length1,
  33007. length2,
  33008. length3,
  33009. isInternalFont,
  33010. loadedName: baseDict.loadedName,
  33011. composite,
  33012. fixedPitch: false,
  33013. fontMatrix,
  33014. firstChar,
  33015. lastChar,
  33016. toUnicode,
  33017. bbox,
  33018. ascent,
  33019. descent,
  33020. xHeight,
  33021. capHeight,
  33022. flags,
  33023. italicAngle,
  33024. isType3Font,
  33025. cssFontInfo,
  33026. scaleFactors: glyphScaleFactors,
  33027. systemFontInfo
  33028. };
  33029. if (composite) {
  33030. const cidEncoding = baseDict.get("Encoding");
  33031. if (cidEncoding instanceof Name) {
  33032. properties.cidEncoding = cidEncoding.name;
  33033. }
  33034. const cMap = await CMapFactory.create({
  33035. encoding: cidEncoding,
  33036. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  33037. useCMap: null
  33038. });
  33039. properties.cMap = cMap;
  33040. properties.vertical = properties.cMap.vertical;
  33041. }
  33042. const newProperties = await this.extractDataStructures(dict, properties);
  33043. this.extractWidths(dict, descriptor, newProperties);
  33044. return new Font(fontName.name, fontFile, newProperties);
  33045. }
  33046. static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
  33047. function buildPath(fontChar) {
  33048. const glyphName = `${font.loadedName}_path_${fontChar}`;
  33049. try {
  33050. if (font.renderer.hasBuiltPath(fontChar)) {
  33051. return;
  33052. }
  33053. handler.send("commonobj", [glyphName, "FontPath", font.renderer.getPathJs(fontChar)]);
  33054. } catch (reason) {
  33055. if (evaluatorOptions.ignoreErrors) {
  33056. warn(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
  33057. return;
  33058. }
  33059. throw reason;
  33060. }
  33061. }
  33062. for (const glyph of glyphs) {
  33063. buildPath(glyph.fontChar);
  33064. const accent = glyph.accent;
  33065. if (accent?.fontChar) {
  33066. buildPath(accent.fontChar);
  33067. }
  33068. }
  33069. }
  33070. static get fallbackFontDict() {
  33071. const dict = new Dict();
  33072. dict.set("BaseFont", Name.get("Helvetica"));
  33073. dict.set("Type", Name.get("FallbackType"));
  33074. dict.set("Subtype", Name.get("FallbackType"));
  33075. dict.set("Encoding", Name.get("WinAnsiEncoding"));
  33076. return shadow(this, "fallbackFontDict", dict);
  33077. }
  33078. }
  33079. class TranslatedFont {
  33080. constructor({
  33081. loadedName,
  33082. font,
  33083. dict,
  33084. evaluatorOptions
  33085. }) {
  33086. this.loadedName = loadedName;
  33087. this.font = font;
  33088. this.dict = dict;
  33089. this._evaluatorOptions = evaluatorOptions || DefaultPartialEvaluatorOptions;
  33090. this.type3Loaded = null;
  33091. this.type3Dependencies = font.isType3Font ? new Set() : null;
  33092. this.sent = false;
  33093. }
  33094. send(handler) {
  33095. if (this.sent) {
  33096. return;
  33097. }
  33098. this.sent = true;
  33099. handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._evaluatorOptions.fontExtraProperties)]);
  33100. }
  33101. fallback(handler) {
  33102. if (!this.font.data) {
  33103. return;
  33104. }
  33105. this.font.disableFontFace = true;
  33106. PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, this._evaluatorOptions);
  33107. }
  33108. loadType3Data(evaluator, resources, task) {
  33109. if (this.type3Loaded) {
  33110. return this.type3Loaded;
  33111. }
  33112. if (!this.font.isType3Font) {
  33113. throw new Error("Must be a Type3 font.");
  33114. }
  33115. const type3Evaluator = evaluator.clone({
  33116. ignoreErrors: false
  33117. });
  33118. const type3FontRefs = new RefSet(evaluator.type3FontRefs);
  33119. if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
  33120. type3FontRefs.put(this.dict.objId);
  33121. }
  33122. type3Evaluator.type3FontRefs = type3FontRefs;
  33123. const translatedFont = this.font,
  33124. type3Dependencies = this.type3Dependencies;
  33125. let loadCharProcsPromise = Promise.resolve();
  33126. const charProcs = this.dict.get("CharProcs");
  33127. const fontResources = this.dict.get("Resources") || resources;
  33128. const charProcOperatorList = Object.create(null);
  33129. const fontBBox = Util.normalizeRect(translatedFont.bbox || [0, 0, 0, 0]),
  33130. width = fontBBox[2] - fontBBox[0],
  33131. height = fontBBox[3] - fontBBox[1];
  33132. const fontBBoxSize = Math.hypot(width, height);
  33133. for (const key of charProcs.getKeys()) {
  33134. loadCharProcsPromise = loadCharProcsPromise.then(() => {
  33135. const glyphStream = charProcs.get(key);
  33136. const operatorList = new OperatorList();
  33137. return type3Evaluator.getOperatorList({
  33138. stream: glyphStream,
  33139. task,
  33140. resources: fontResources,
  33141. operatorList
  33142. }).then(() => {
  33143. if (operatorList.fnArray[0] === OPS.setCharWidthAndBounds) {
  33144. this._removeType3ColorOperators(operatorList, fontBBoxSize);
  33145. }
  33146. charProcOperatorList[key] = operatorList.getIR();
  33147. for (const dependency of operatorList.dependencies) {
  33148. type3Dependencies.add(dependency);
  33149. }
  33150. }).catch(function (reason) {
  33151. warn(`Type3 font resource "${key}" is not available.`);
  33152. const dummyOperatorList = new OperatorList();
  33153. charProcOperatorList[key] = dummyOperatorList.getIR();
  33154. });
  33155. });
  33156. }
  33157. this.type3Loaded = loadCharProcsPromise.then(() => {
  33158. translatedFont.charProcOperatorList = charProcOperatorList;
  33159. if (this._bbox) {
  33160. translatedFont.isCharBBox = true;
  33161. translatedFont.bbox = this._bbox;
  33162. }
  33163. });
  33164. return this.type3Loaded;
  33165. }
  33166. _removeType3ColorOperators(operatorList, fontBBoxSize = NaN) {
  33167. const charBBox = Util.normalizeRect(operatorList.argsArray[0].slice(2)),
  33168. width = charBBox[2] - charBBox[0],
  33169. height = charBBox[3] - charBBox[1];
  33170. const charBBoxSize = Math.hypot(width, height);
  33171. if (width === 0 || height === 0) {
  33172. operatorList.fnArray.splice(0, 1);
  33173. operatorList.argsArray.splice(0, 1);
  33174. } else if (fontBBoxSize === 0 || Math.round(charBBoxSize / fontBBoxSize) >= 10) {
  33175. if (!this._bbox) {
  33176. this._bbox = [Infinity, Infinity, -Infinity, -Infinity];
  33177. }
  33178. this._bbox[0] = Math.min(this._bbox[0], charBBox[0]);
  33179. this._bbox[1] = Math.min(this._bbox[1], charBBox[1]);
  33180. this._bbox[2] = Math.max(this._bbox[2], charBBox[2]);
  33181. this._bbox[3] = Math.max(this._bbox[3], charBBox[3]);
  33182. }
  33183. let i = 0,
  33184. ii = operatorList.length;
  33185. while (i < ii) {
  33186. switch (operatorList.fnArray[i]) {
  33187. case OPS.setCharWidthAndBounds:
  33188. break;
  33189. case OPS.setStrokeColorSpace:
  33190. case OPS.setFillColorSpace:
  33191. case OPS.setStrokeColor:
  33192. case OPS.setStrokeColorN:
  33193. case OPS.setFillColor:
  33194. case OPS.setFillColorN:
  33195. case OPS.setStrokeGray:
  33196. case OPS.setFillGray:
  33197. case OPS.setStrokeRGBColor:
  33198. case OPS.setFillRGBColor:
  33199. case OPS.setStrokeCMYKColor:
  33200. case OPS.setFillCMYKColor:
  33201. case OPS.shadingFill:
  33202. case OPS.setRenderingIntent:
  33203. operatorList.fnArray.splice(i, 1);
  33204. operatorList.argsArray.splice(i, 1);
  33205. ii--;
  33206. continue;
  33207. case OPS.setGState:
  33208. const [gStateObj] = operatorList.argsArray[i];
  33209. let j = 0,
  33210. jj = gStateObj.length;
  33211. while (j < jj) {
  33212. const [gStateKey] = gStateObj[j];
  33213. switch (gStateKey) {
  33214. case "TR":
  33215. case "TR2":
  33216. case "HT":
  33217. case "BG":
  33218. case "BG2":
  33219. case "UCR":
  33220. case "UCR2":
  33221. gStateObj.splice(j, 1);
  33222. jj--;
  33223. continue;
  33224. }
  33225. j++;
  33226. }
  33227. break;
  33228. }
  33229. i++;
  33230. }
  33231. }
  33232. }
  33233. class StateManager {
  33234. constructor(initialState = new EvalState()) {
  33235. this.state = initialState;
  33236. this.stateStack = [];
  33237. }
  33238. save() {
  33239. const old = this.state;
  33240. this.stateStack.push(this.state);
  33241. this.state = old.clone();
  33242. }
  33243. restore() {
  33244. const prev = this.stateStack.pop();
  33245. if (prev) {
  33246. this.state = prev;
  33247. }
  33248. }
  33249. transform(args) {
  33250. this.state.ctm = Util.transform(this.state.ctm, args);
  33251. }
  33252. }
  33253. class TextState {
  33254. constructor() {
  33255. this.ctm = new Float32Array(IDENTITY_MATRIX);
  33256. this.fontName = null;
  33257. this.fontSize = 0;
  33258. this.loadedName = null;
  33259. this.font = null;
  33260. this.fontMatrix = FONT_IDENTITY_MATRIX;
  33261. this.textMatrix = IDENTITY_MATRIX.slice();
  33262. this.textLineMatrix = IDENTITY_MATRIX.slice();
  33263. this.charSpacing = 0;
  33264. this.wordSpacing = 0;
  33265. this.leading = 0;
  33266. this.textHScale = 1;
  33267. this.textRise = 0;
  33268. }
  33269. setTextMatrix(a, b, c, d, e, f) {
  33270. const m = this.textMatrix;
  33271. m[0] = a;
  33272. m[1] = b;
  33273. m[2] = c;
  33274. m[3] = d;
  33275. m[4] = e;
  33276. m[5] = f;
  33277. }
  33278. setTextLineMatrix(a, b, c, d, e, f) {
  33279. const m = this.textLineMatrix;
  33280. m[0] = a;
  33281. m[1] = b;
  33282. m[2] = c;
  33283. m[3] = d;
  33284. m[4] = e;
  33285. m[5] = f;
  33286. }
  33287. translateTextMatrix(x, y) {
  33288. const m = this.textMatrix;
  33289. m[4] = m[0] * x + m[2] * y + m[4];
  33290. m[5] = m[1] * x + m[3] * y + m[5];
  33291. }
  33292. translateTextLineMatrix(x, y) {
  33293. const m = this.textLineMatrix;
  33294. m[4] = m[0] * x + m[2] * y + m[4];
  33295. m[5] = m[1] * x + m[3] * y + m[5];
  33296. }
  33297. carriageReturn() {
  33298. this.translateTextLineMatrix(0, -this.leading);
  33299. this.textMatrix = this.textLineMatrix.slice();
  33300. }
  33301. clone() {
  33302. const clone = Object.create(this);
  33303. clone.textMatrix = this.textMatrix.slice();
  33304. clone.textLineMatrix = this.textLineMatrix.slice();
  33305. clone.fontMatrix = this.fontMatrix.slice();
  33306. return clone;
  33307. }
  33308. }
  33309. class EvalState {
  33310. constructor() {
  33311. this.ctm = new Float32Array(IDENTITY_MATRIX);
  33312. this.font = null;
  33313. this.textRenderingMode = TextRenderingMode.FILL;
  33314. this._fillColorSpace = ColorSpace.singletons.gray;
  33315. this._strokeColorSpace = ColorSpace.singletons.gray;
  33316. this.patternFillColorSpace = null;
  33317. this.patternStrokeColorSpace = null;
  33318. }
  33319. get fillColorSpace() {
  33320. return this._fillColorSpace;
  33321. }
  33322. set fillColorSpace(colorSpace) {
  33323. this._fillColorSpace = this.patternFillColorSpace = colorSpace;
  33324. }
  33325. get strokeColorSpace() {
  33326. return this._strokeColorSpace;
  33327. }
  33328. set strokeColorSpace(colorSpace) {
  33329. this._strokeColorSpace = this.patternStrokeColorSpace = colorSpace;
  33330. }
  33331. clone() {
  33332. return Object.create(this);
  33333. }
  33334. }
  33335. class EvaluatorPreprocessor {
  33336. static get opMap() {
  33337. return shadow(this, "opMap", Object.assign(Object.create(null), {
  33338. w: {
  33339. id: OPS.setLineWidth,
  33340. numArgs: 1,
  33341. variableArgs: false
  33342. },
  33343. J: {
  33344. id: OPS.setLineCap,
  33345. numArgs: 1,
  33346. variableArgs: false
  33347. },
  33348. j: {
  33349. id: OPS.setLineJoin,
  33350. numArgs: 1,
  33351. variableArgs: false
  33352. },
  33353. M: {
  33354. id: OPS.setMiterLimit,
  33355. numArgs: 1,
  33356. variableArgs: false
  33357. },
  33358. d: {
  33359. id: OPS.setDash,
  33360. numArgs: 2,
  33361. variableArgs: false
  33362. },
  33363. ri: {
  33364. id: OPS.setRenderingIntent,
  33365. numArgs: 1,
  33366. variableArgs: false
  33367. },
  33368. i: {
  33369. id: OPS.setFlatness,
  33370. numArgs: 1,
  33371. variableArgs: false
  33372. },
  33373. gs: {
  33374. id: OPS.setGState,
  33375. numArgs: 1,
  33376. variableArgs: false
  33377. },
  33378. q: {
  33379. id: OPS.save,
  33380. numArgs: 0,
  33381. variableArgs: false
  33382. },
  33383. Q: {
  33384. id: OPS.restore,
  33385. numArgs: 0,
  33386. variableArgs: false
  33387. },
  33388. cm: {
  33389. id: OPS.transform,
  33390. numArgs: 6,
  33391. variableArgs: false
  33392. },
  33393. m: {
  33394. id: OPS.moveTo,
  33395. numArgs: 2,
  33396. variableArgs: false
  33397. },
  33398. l: {
  33399. id: OPS.lineTo,
  33400. numArgs: 2,
  33401. variableArgs: false
  33402. },
  33403. c: {
  33404. id: OPS.curveTo,
  33405. numArgs: 6,
  33406. variableArgs: false
  33407. },
  33408. v: {
  33409. id: OPS.curveTo2,
  33410. numArgs: 4,
  33411. variableArgs: false
  33412. },
  33413. y: {
  33414. id: OPS.curveTo3,
  33415. numArgs: 4,
  33416. variableArgs: false
  33417. },
  33418. h: {
  33419. id: OPS.closePath,
  33420. numArgs: 0,
  33421. variableArgs: false
  33422. },
  33423. re: {
  33424. id: OPS.rectangle,
  33425. numArgs: 4,
  33426. variableArgs: false
  33427. },
  33428. S: {
  33429. id: OPS.stroke,
  33430. numArgs: 0,
  33431. variableArgs: false
  33432. },
  33433. s: {
  33434. id: OPS.closeStroke,
  33435. numArgs: 0,
  33436. variableArgs: false
  33437. },
  33438. f: {
  33439. id: OPS.fill,
  33440. numArgs: 0,
  33441. variableArgs: false
  33442. },
  33443. F: {
  33444. id: OPS.fill,
  33445. numArgs: 0,
  33446. variableArgs: false
  33447. },
  33448. "f*": {
  33449. id: OPS.eoFill,
  33450. numArgs: 0,
  33451. variableArgs: false
  33452. },
  33453. B: {
  33454. id: OPS.fillStroke,
  33455. numArgs: 0,
  33456. variableArgs: false
  33457. },
  33458. "B*": {
  33459. id: OPS.eoFillStroke,
  33460. numArgs: 0,
  33461. variableArgs: false
  33462. },
  33463. b: {
  33464. id: OPS.closeFillStroke,
  33465. numArgs: 0,
  33466. variableArgs: false
  33467. },
  33468. "b*": {
  33469. id: OPS.closeEOFillStroke,
  33470. numArgs: 0,
  33471. variableArgs: false
  33472. },
  33473. n: {
  33474. id: OPS.endPath,
  33475. numArgs: 0,
  33476. variableArgs: false
  33477. },
  33478. W: {
  33479. id: OPS.clip,
  33480. numArgs: 0,
  33481. variableArgs: false
  33482. },
  33483. "W*": {
  33484. id: OPS.eoClip,
  33485. numArgs: 0,
  33486. variableArgs: false
  33487. },
  33488. BT: {
  33489. id: OPS.beginText,
  33490. numArgs: 0,
  33491. variableArgs: false
  33492. },
  33493. ET: {
  33494. id: OPS.endText,
  33495. numArgs: 0,
  33496. variableArgs: false
  33497. },
  33498. Tc: {
  33499. id: OPS.setCharSpacing,
  33500. numArgs: 1,
  33501. variableArgs: false
  33502. },
  33503. Tw: {
  33504. id: OPS.setWordSpacing,
  33505. numArgs: 1,
  33506. variableArgs: false
  33507. },
  33508. Tz: {
  33509. id: OPS.setHScale,
  33510. numArgs: 1,
  33511. variableArgs: false
  33512. },
  33513. TL: {
  33514. id: OPS.setLeading,
  33515. numArgs: 1,
  33516. variableArgs: false
  33517. },
  33518. Tf: {
  33519. id: OPS.setFont,
  33520. numArgs: 2,
  33521. variableArgs: false
  33522. },
  33523. Tr: {
  33524. id: OPS.setTextRenderingMode,
  33525. numArgs: 1,
  33526. variableArgs: false
  33527. },
  33528. Ts: {
  33529. id: OPS.setTextRise,
  33530. numArgs: 1,
  33531. variableArgs: false
  33532. },
  33533. Td: {
  33534. id: OPS.moveText,
  33535. numArgs: 2,
  33536. variableArgs: false
  33537. },
  33538. TD: {
  33539. id: OPS.setLeadingMoveText,
  33540. numArgs: 2,
  33541. variableArgs: false
  33542. },
  33543. Tm: {
  33544. id: OPS.setTextMatrix,
  33545. numArgs: 6,
  33546. variableArgs: false
  33547. },
  33548. "T*": {
  33549. id: OPS.nextLine,
  33550. numArgs: 0,
  33551. variableArgs: false
  33552. },
  33553. Tj: {
  33554. id: OPS.showText,
  33555. numArgs: 1,
  33556. variableArgs: false
  33557. },
  33558. TJ: {
  33559. id: OPS.showSpacedText,
  33560. numArgs: 1,
  33561. variableArgs: false
  33562. },
  33563. "'": {
  33564. id: OPS.nextLineShowText,
  33565. numArgs: 1,
  33566. variableArgs: false
  33567. },
  33568. '"': {
  33569. id: OPS.nextLineSetSpacingShowText,
  33570. numArgs: 3,
  33571. variableArgs: false
  33572. },
  33573. d0: {
  33574. id: OPS.setCharWidth,
  33575. numArgs: 2,
  33576. variableArgs: false
  33577. },
  33578. d1: {
  33579. id: OPS.setCharWidthAndBounds,
  33580. numArgs: 6,
  33581. variableArgs: false
  33582. },
  33583. CS: {
  33584. id: OPS.setStrokeColorSpace,
  33585. numArgs: 1,
  33586. variableArgs: false
  33587. },
  33588. cs: {
  33589. id: OPS.setFillColorSpace,
  33590. numArgs: 1,
  33591. variableArgs: false
  33592. },
  33593. SC: {
  33594. id: OPS.setStrokeColor,
  33595. numArgs: 4,
  33596. variableArgs: true
  33597. },
  33598. SCN: {
  33599. id: OPS.setStrokeColorN,
  33600. numArgs: 33,
  33601. variableArgs: true
  33602. },
  33603. sc: {
  33604. id: OPS.setFillColor,
  33605. numArgs: 4,
  33606. variableArgs: true
  33607. },
  33608. scn: {
  33609. id: OPS.setFillColorN,
  33610. numArgs: 33,
  33611. variableArgs: true
  33612. },
  33613. G: {
  33614. id: OPS.setStrokeGray,
  33615. numArgs: 1,
  33616. variableArgs: false
  33617. },
  33618. g: {
  33619. id: OPS.setFillGray,
  33620. numArgs: 1,
  33621. variableArgs: false
  33622. },
  33623. RG: {
  33624. id: OPS.setStrokeRGBColor,
  33625. numArgs: 3,
  33626. variableArgs: false
  33627. },
  33628. rg: {
  33629. id: OPS.setFillRGBColor,
  33630. numArgs: 3,
  33631. variableArgs: false
  33632. },
  33633. K: {
  33634. id: OPS.setStrokeCMYKColor,
  33635. numArgs: 4,
  33636. variableArgs: false
  33637. },
  33638. k: {
  33639. id: OPS.setFillCMYKColor,
  33640. numArgs: 4,
  33641. variableArgs: false
  33642. },
  33643. sh: {
  33644. id: OPS.shadingFill,
  33645. numArgs: 1,
  33646. variableArgs: false
  33647. },
  33648. BI: {
  33649. id: OPS.beginInlineImage,
  33650. numArgs: 0,
  33651. variableArgs: false
  33652. },
  33653. ID: {
  33654. id: OPS.beginImageData,
  33655. numArgs: 0,
  33656. variableArgs: false
  33657. },
  33658. EI: {
  33659. id: OPS.endInlineImage,
  33660. numArgs: 1,
  33661. variableArgs: false
  33662. },
  33663. Do: {
  33664. id: OPS.paintXObject,
  33665. numArgs: 1,
  33666. variableArgs: false
  33667. },
  33668. MP: {
  33669. id: OPS.markPoint,
  33670. numArgs: 1,
  33671. variableArgs: false
  33672. },
  33673. DP: {
  33674. id: OPS.markPointProps,
  33675. numArgs: 2,
  33676. variableArgs: false
  33677. },
  33678. BMC: {
  33679. id: OPS.beginMarkedContent,
  33680. numArgs: 1,
  33681. variableArgs: false
  33682. },
  33683. BDC: {
  33684. id: OPS.beginMarkedContentProps,
  33685. numArgs: 2,
  33686. variableArgs: false
  33687. },
  33688. EMC: {
  33689. id: OPS.endMarkedContent,
  33690. numArgs: 0,
  33691. variableArgs: false
  33692. },
  33693. BX: {
  33694. id: OPS.beginCompat,
  33695. numArgs: 0,
  33696. variableArgs: false
  33697. },
  33698. EX: {
  33699. id: OPS.endCompat,
  33700. numArgs: 0,
  33701. variableArgs: false
  33702. },
  33703. BM: null,
  33704. BD: null,
  33705. true: null,
  33706. fa: null,
  33707. fal: null,
  33708. fals: null,
  33709. false: null,
  33710. nu: null,
  33711. nul: null,
  33712. null: null
  33713. }));
  33714. }
  33715. static MAX_INVALID_PATH_OPS = 10;
  33716. constructor(stream, xref, stateManager = new StateManager()) {
  33717. this.parser = new Parser({
  33718. lexer: new Lexer(stream, EvaluatorPreprocessor.opMap),
  33719. xref
  33720. });
  33721. this.stateManager = stateManager;
  33722. this.nonProcessedArgs = [];
  33723. this._isPathOp = false;
  33724. this._numInvalidPathOPS = 0;
  33725. }
  33726. get savedStatesDepth() {
  33727. return this.stateManager.stateStack.length;
  33728. }
  33729. read(operation) {
  33730. let args = operation.args;
  33731. while (true) {
  33732. const obj = this.parser.getObj();
  33733. if (obj instanceof Cmd) {
  33734. const cmd = obj.cmd;
  33735. const opSpec = EvaluatorPreprocessor.opMap[cmd];
  33736. if (!opSpec) {
  33737. warn(`Unknown command "${cmd}".`);
  33738. continue;
  33739. }
  33740. const fn = opSpec.id;
  33741. const numArgs = opSpec.numArgs;
  33742. let argsLength = args !== null ? args.length : 0;
  33743. if (!this._isPathOp) {
  33744. this._numInvalidPathOPS = 0;
  33745. }
  33746. this._isPathOp = fn >= OPS.moveTo && fn <= OPS.endPath;
  33747. if (!opSpec.variableArgs) {
  33748. if (argsLength !== numArgs) {
  33749. const nonProcessedArgs = this.nonProcessedArgs;
  33750. while (argsLength > numArgs) {
  33751. nonProcessedArgs.push(args.shift());
  33752. argsLength--;
  33753. }
  33754. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  33755. if (args === null) {
  33756. args = [];
  33757. }
  33758. args.unshift(nonProcessedArgs.pop());
  33759. argsLength++;
  33760. }
  33761. }
  33762. if (argsLength < numArgs) {
  33763. const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
  33764. if (this._isPathOp && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
  33765. throw new FormatError(`Invalid ${partialMsg}`);
  33766. }
  33767. warn(`Skipping ${partialMsg}`);
  33768. if (args !== null) {
  33769. args.length = 0;
  33770. }
  33771. continue;
  33772. }
  33773. } else if (argsLength > numArgs) {
  33774. info(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
  33775. }
  33776. this.preprocessCommand(fn, args);
  33777. operation.fn = fn;
  33778. operation.args = args;
  33779. return true;
  33780. }
  33781. if (obj === EOF) {
  33782. return false;
  33783. }
  33784. if (obj !== null) {
  33785. if (args === null) {
  33786. args = [];
  33787. }
  33788. args.push(obj);
  33789. if (args.length > 33) {
  33790. throw new FormatError("Too many arguments");
  33791. }
  33792. }
  33793. }
  33794. }
  33795. preprocessCommand(fn, args) {
  33796. switch (fn | 0) {
  33797. case OPS.save:
  33798. this.stateManager.save();
  33799. break;
  33800. case OPS.restore:
  33801. this.stateManager.restore();
  33802. break;
  33803. case OPS.transform:
  33804. this.stateManager.transform(args);
  33805. break;
  33806. }
  33807. }
  33808. }
  33809. ;// ./src/core/default_appearance.js
  33810. class DefaultAppearanceEvaluator extends EvaluatorPreprocessor {
  33811. constructor(str) {
  33812. super(new StringStream(str));
  33813. }
  33814. parse() {
  33815. const operation = {
  33816. fn: 0,
  33817. args: []
  33818. };
  33819. const result = {
  33820. fontSize: 0,
  33821. fontName: "",
  33822. fontColor: new Uint8ClampedArray(3)
  33823. };
  33824. try {
  33825. while (true) {
  33826. operation.args.length = 0;
  33827. if (!this.read(operation)) {
  33828. break;
  33829. }
  33830. if (this.savedStatesDepth !== 0) {
  33831. continue;
  33832. }
  33833. const {
  33834. fn,
  33835. args
  33836. } = operation;
  33837. switch (fn | 0) {
  33838. case OPS.setFont:
  33839. const [fontName, fontSize] = args;
  33840. if (fontName instanceof Name) {
  33841. result.fontName = fontName.name;
  33842. }
  33843. if (typeof fontSize === "number" && fontSize > 0) {
  33844. result.fontSize = fontSize;
  33845. }
  33846. break;
  33847. case OPS.setFillRGBColor:
  33848. ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
  33849. break;
  33850. case OPS.setFillGray:
  33851. ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
  33852. break;
  33853. case OPS.setFillCMYKColor:
  33854. ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
  33855. break;
  33856. }
  33857. }
  33858. } catch (reason) {
  33859. warn(`parseDefaultAppearance - ignoring errors: "${reason}".`);
  33860. }
  33861. return result;
  33862. }
  33863. }
  33864. function parseDefaultAppearance(str) {
  33865. return new DefaultAppearanceEvaluator(str).parse();
  33866. }
  33867. class AppearanceStreamEvaluator extends EvaluatorPreprocessor {
  33868. constructor(stream, evaluatorOptions, xref) {
  33869. super(stream);
  33870. this.stream = stream;
  33871. this.evaluatorOptions = evaluatorOptions;
  33872. this.xref = xref;
  33873. this.resources = stream.dict?.get("Resources");
  33874. }
  33875. parse() {
  33876. const operation = {
  33877. fn: 0,
  33878. args: []
  33879. };
  33880. let result = {
  33881. scaleFactor: 1,
  33882. fontSize: 0,
  33883. fontName: "",
  33884. fontColor: new Uint8ClampedArray(3),
  33885. fillColorSpace: ColorSpace.singletons.gray
  33886. };
  33887. let breakLoop = false;
  33888. const stack = [];
  33889. try {
  33890. while (true) {
  33891. operation.args.length = 0;
  33892. if (breakLoop || !this.read(operation)) {
  33893. break;
  33894. }
  33895. const {
  33896. fn,
  33897. args
  33898. } = operation;
  33899. switch (fn | 0) {
  33900. case OPS.save:
  33901. stack.push({
  33902. scaleFactor: result.scaleFactor,
  33903. fontSize: result.fontSize,
  33904. fontName: result.fontName,
  33905. fontColor: result.fontColor.slice(),
  33906. fillColorSpace: result.fillColorSpace
  33907. });
  33908. break;
  33909. case OPS.restore:
  33910. result = stack.pop() || result;
  33911. break;
  33912. case OPS.setTextMatrix:
  33913. result.scaleFactor *= Math.hypot(args[0], args[1]);
  33914. break;
  33915. case OPS.setFont:
  33916. const [fontName, fontSize] = args;
  33917. if (fontName instanceof Name) {
  33918. result.fontName = fontName.name;
  33919. }
  33920. if (typeof fontSize === "number" && fontSize > 0) {
  33921. result.fontSize = fontSize * result.scaleFactor;
  33922. }
  33923. break;
  33924. case OPS.setFillColorSpace:
  33925. result.fillColorSpace = ColorSpace.parse({
  33926. cs: args[0],
  33927. xref: this.xref,
  33928. resources: this.resources,
  33929. pdfFunctionFactory: this._pdfFunctionFactory,
  33930. localColorSpaceCache: this._localColorSpaceCache
  33931. });
  33932. break;
  33933. case OPS.setFillColor:
  33934. const cs = result.fillColorSpace;
  33935. cs.getRgbItem(args, 0, result.fontColor, 0);
  33936. break;
  33937. case OPS.setFillRGBColor:
  33938. ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
  33939. break;
  33940. case OPS.setFillGray:
  33941. ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
  33942. break;
  33943. case OPS.setFillCMYKColor:
  33944. ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
  33945. break;
  33946. case OPS.showText:
  33947. case OPS.showSpacedText:
  33948. case OPS.nextLineShowText:
  33949. case OPS.nextLineSetSpacingShowText:
  33950. breakLoop = true;
  33951. break;
  33952. }
  33953. }
  33954. } catch (reason) {
  33955. warn(`parseAppearanceStream - ignoring errors: "${reason}".`);
  33956. }
  33957. this.stream.reset();
  33958. delete result.scaleFactor;
  33959. delete result.fillColorSpace;
  33960. return result;
  33961. }
  33962. get _localColorSpaceCache() {
  33963. return shadow(this, "_localColorSpaceCache", new LocalColorSpaceCache());
  33964. }
  33965. get _pdfFunctionFactory() {
  33966. const pdfFunctionFactory = new PDFFunctionFactory({
  33967. xref: this.xref,
  33968. isEvalSupported: this.evaluatorOptions.isEvalSupported
  33969. });
  33970. return shadow(this, "_pdfFunctionFactory", pdfFunctionFactory);
  33971. }
  33972. }
  33973. function parseAppearanceStream(stream, evaluatorOptions, xref) {
  33974. return new AppearanceStreamEvaluator(stream, evaluatorOptions, xref).parse();
  33975. }
  33976. function getPdfColor(color, isFill) {
  33977. if (color[0] === color[1] && color[1] === color[2]) {
  33978. const gray = color[0] / 255;
  33979. return `${numberToString(gray)} ${isFill ? "g" : "G"}`;
  33980. }
  33981. return Array.from(color, c => numberToString(c / 255)).join(" ") + ` ${isFill ? "rg" : "RG"}`;
  33982. }
  33983. function createDefaultAppearance({
  33984. fontSize,
  33985. fontName,
  33986. fontColor
  33987. }) {
  33988. return `/${escapePDFName(fontName)} ${fontSize} Tf ${getPdfColor(fontColor, true)}`;
  33989. }
  33990. class FakeUnicodeFont {
  33991. constructor(xref, fontFamily) {
  33992. this.xref = xref;
  33993. this.widths = null;
  33994. this.firstChar = Infinity;
  33995. this.lastChar = -Infinity;
  33996. this.fontFamily = fontFamily;
  33997. const canvas = new OffscreenCanvas(1, 1);
  33998. this.ctxMeasure = canvas.getContext("2d", {
  33999. willReadFrequently: true
  34000. });
  34001. if (!FakeUnicodeFont._fontNameId) {
  34002. FakeUnicodeFont._fontNameId = 1;
  34003. }
  34004. this.fontName = Name.get(`InvalidPDFjsFont_${fontFamily}_${FakeUnicodeFont._fontNameId++}`);
  34005. }
  34006. get fontDescriptorRef() {
  34007. if (!FakeUnicodeFont._fontDescriptorRef) {
  34008. const fontDescriptor = new Dict(this.xref);
  34009. fontDescriptor.set("Type", Name.get("FontDescriptor"));
  34010. fontDescriptor.set("FontName", this.fontName);
  34011. fontDescriptor.set("FontFamily", "MyriadPro Regular");
  34012. fontDescriptor.set("FontBBox", [0, 0, 0, 0]);
  34013. fontDescriptor.set("FontStretch", Name.get("Normal"));
  34014. fontDescriptor.set("FontWeight", 400);
  34015. fontDescriptor.set("ItalicAngle", 0);
  34016. FakeUnicodeFont._fontDescriptorRef = this.xref.getNewPersistentRef(fontDescriptor);
  34017. }
  34018. return FakeUnicodeFont._fontDescriptorRef;
  34019. }
  34020. get descendantFontRef() {
  34021. const descendantFont = new Dict(this.xref);
  34022. descendantFont.set("BaseFont", this.fontName);
  34023. descendantFont.set("Type", Name.get("Font"));
  34024. descendantFont.set("Subtype", Name.get("CIDFontType0"));
  34025. descendantFont.set("CIDToGIDMap", Name.get("Identity"));
  34026. descendantFont.set("FirstChar", this.firstChar);
  34027. descendantFont.set("LastChar", this.lastChar);
  34028. descendantFont.set("FontDescriptor", this.fontDescriptorRef);
  34029. descendantFont.set("DW", 1000);
  34030. const widths = [];
  34031. const chars = [...this.widths.entries()].sort();
  34032. let currentChar = null;
  34033. let currentWidths = null;
  34034. for (const [char, width] of chars) {
  34035. if (!currentChar) {
  34036. currentChar = char;
  34037. currentWidths = [width];
  34038. continue;
  34039. }
  34040. if (char === currentChar + currentWidths.length) {
  34041. currentWidths.push(width);
  34042. } else {
  34043. widths.push(currentChar, currentWidths);
  34044. currentChar = char;
  34045. currentWidths = [width];
  34046. }
  34047. }
  34048. if (currentChar) {
  34049. widths.push(currentChar, currentWidths);
  34050. }
  34051. descendantFont.set("W", widths);
  34052. const cidSystemInfo = new Dict(this.xref);
  34053. cidSystemInfo.set("Ordering", "Identity");
  34054. cidSystemInfo.set("Registry", "Adobe");
  34055. cidSystemInfo.set("Supplement", 0);
  34056. descendantFont.set("CIDSystemInfo", cidSystemInfo);
  34057. return this.xref.getNewPersistentRef(descendantFont);
  34058. }
  34059. get baseFontRef() {
  34060. const baseFont = new Dict(this.xref);
  34061. baseFont.set("BaseFont", this.fontName);
  34062. baseFont.set("Type", Name.get("Font"));
  34063. baseFont.set("Subtype", Name.get("Type0"));
  34064. baseFont.set("Encoding", Name.get("Identity-H"));
  34065. baseFont.set("DescendantFonts", [this.descendantFontRef]);
  34066. baseFont.set("ToUnicode", Name.get("Identity-H"));
  34067. return this.xref.getNewPersistentRef(baseFont);
  34068. }
  34069. get resources() {
  34070. const resources = new Dict(this.xref);
  34071. const font = new Dict(this.xref);
  34072. font.set(this.fontName.name, this.baseFontRef);
  34073. resources.set("Font", font);
  34074. return resources;
  34075. }
  34076. _createContext() {
  34077. this.widths = new Map();
  34078. this.ctxMeasure.font = `1000px ${this.fontFamily}`;
  34079. return this.ctxMeasure;
  34080. }
  34081. createFontResources(text) {
  34082. const ctx = this._createContext();
  34083. for (const line of text.split(/\r\n?|\n/)) {
  34084. for (const char of line.split("")) {
  34085. const code = char.charCodeAt(0);
  34086. if (this.widths.has(code)) {
  34087. continue;
  34088. }
  34089. const metrics = ctx.measureText(char);
  34090. const width = Math.ceil(metrics.width);
  34091. this.widths.set(code, width);
  34092. this.firstChar = Math.min(code, this.firstChar);
  34093. this.lastChar = Math.max(code, this.lastChar);
  34094. }
  34095. }
  34096. return this.resources;
  34097. }
  34098. static getFirstPositionInfo(rect, rotation, fontSize) {
  34099. const [x1, y1, x2, y2] = rect;
  34100. let w = x2 - x1;
  34101. let h = y2 - y1;
  34102. if (rotation % 180 !== 0) {
  34103. [w, h] = [h, w];
  34104. }
  34105. const lineHeight = LINE_FACTOR * fontSize;
  34106. const lineDescent = LINE_DESCENT_FACTOR * fontSize;
  34107. return {
  34108. coords: [0, h + lineDescent - lineHeight],
  34109. bbox: [0, 0, w, h],
  34110. matrix: rotation !== 0 ? getRotationMatrix(rotation, h, lineHeight) : undefined
  34111. };
  34112. }
  34113. createAppearance(text, rect, rotation, fontSize, bgColor, strokeAlpha) {
  34114. const ctx = this._createContext();
  34115. const lines = [];
  34116. let maxWidth = -Infinity;
  34117. for (const line of text.split(/\r\n?|\n/)) {
  34118. lines.push(line);
  34119. const lineWidth = ctx.measureText(line).width;
  34120. maxWidth = Math.max(maxWidth, lineWidth);
  34121. for (const code of codePointIter(line)) {
  34122. const char = String.fromCodePoint(code);
  34123. let width = this.widths.get(code);
  34124. if (width === undefined) {
  34125. const metrics = ctx.measureText(char);
  34126. width = Math.ceil(metrics.width);
  34127. this.widths.set(code, width);
  34128. this.firstChar = Math.min(code, this.firstChar);
  34129. this.lastChar = Math.max(code, this.lastChar);
  34130. }
  34131. }
  34132. }
  34133. maxWidth *= fontSize / 1000;
  34134. const [x1, y1, x2, y2] = rect;
  34135. let w = x2 - x1;
  34136. let h = y2 - y1;
  34137. if (rotation % 180 !== 0) {
  34138. [w, h] = [h, w];
  34139. }
  34140. let hscale = 1;
  34141. if (maxWidth > w) {
  34142. hscale = w / maxWidth;
  34143. }
  34144. let vscale = 1;
  34145. const lineHeight = LINE_FACTOR * fontSize;
  34146. const lineDescent = LINE_DESCENT_FACTOR * fontSize;
  34147. const maxHeight = lineHeight * lines.length;
  34148. if (maxHeight > h) {
  34149. vscale = h / maxHeight;
  34150. }
  34151. const fscale = Math.min(hscale, vscale);
  34152. const newFontSize = fontSize * fscale;
  34153. const buffer = ["q", `0 0 ${numberToString(w)} ${numberToString(h)} re W n`, `BT`, `1 0 0 1 0 ${numberToString(h + lineDescent)} Tm 0 Tc ${getPdfColor(bgColor, true)}`, `/${this.fontName.name} ${numberToString(newFontSize)} Tf`];
  34154. const {
  34155. resources
  34156. } = this;
  34157. strokeAlpha = typeof strokeAlpha === "number" && strokeAlpha >= 0 && strokeAlpha <= 1 ? strokeAlpha : 1;
  34158. if (strokeAlpha !== 1) {
  34159. buffer.push("/R0 gs");
  34160. const extGState = new Dict(this.xref);
  34161. const r0 = new Dict(this.xref);
  34162. r0.set("ca", strokeAlpha);
  34163. r0.set("CA", strokeAlpha);
  34164. r0.set("Type", Name.get("ExtGState"));
  34165. extGState.set("R0", r0);
  34166. resources.set("ExtGState", extGState);
  34167. }
  34168. const vShift = numberToString(lineHeight);
  34169. for (const line of lines) {
  34170. buffer.push(`0 -${vShift} Td <${stringToUTF16HexString(line)}> Tj`);
  34171. }
  34172. buffer.push("ET", "Q");
  34173. const appearance = buffer.join("\n");
  34174. const appearanceStreamDict = new Dict(this.xref);
  34175. appearanceStreamDict.set("Subtype", Name.get("Form"));
  34176. appearanceStreamDict.set("Type", Name.get("XObject"));
  34177. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  34178. appearanceStreamDict.set("Length", appearance.length);
  34179. appearanceStreamDict.set("Resources", resources);
  34180. if (rotation) {
  34181. const matrix = getRotationMatrix(rotation, w, h);
  34182. appearanceStreamDict.set("Matrix", matrix);
  34183. }
  34184. const ap = new StringStream(appearance);
  34185. ap.dict = appearanceStreamDict;
  34186. return ap;
  34187. }
  34188. }
  34189. ;// ./src/core/name_number_tree.js
  34190. class NameOrNumberTree {
  34191. constructor(root, xref, type) {
  34192. this.root = root;
  34193. this.xref = xref;
  34194. this._type = type;
  34195. }
  34196. getAll() {
  34197. const map = new Map();
  34198. if (!this.root) {
  34199. return map;
  34200. }
  34201. const xref = this.xref;
  34202. const processed = new RefSet();
  34203. processed.put(this.root);
  34204. const queue = [this.root];
  34205. while (queue.length > 0) {
  34206. const obj = xref.fetchIfRef(queue.shift());
  34207. if (!(obj instanceof Dict)) {
  34208. continue;
  34209. }
  34210. if (obj.has("Kids")) {
  34211. const kids = obj.get("Kids");
  34212. if (!Array.isArray(kids)) {
  34213. continue;
  34214. }
  34215. for (const kid of kids) {
  34216. if (processed.has(kid)) {
  34217. throw new FormatError(`Duplicate entry in "${this._type}" tree.`);
  34218. }
  34219. queue.push(kid);
  34220. processed.put(kid);
  34221. }
  34222. continue;
  34223. }
  34224. const entries = obj.get(this._type);
  34225. if (!Array.isArray(entries)) {
  34226. continue;
  34227. }
  34228. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  34229. map.set(xref.fetchIfRef(entries[i]), xref.fetchIfRef(entries[i + 1]));
  34230. }
  34231. }
  34232. return map;
  34233. }
  34234. getRaw(key) {
  34235. if (!this.root) {
  34236. return null;
  34237. }
  34238. const xref = this.xref;
  34239. let kidsOrEntries = xref.fetchIfRef(this.root);
  34240. let loopCount = 0;
  34241. const MAX_LEVELS = 10;
  34242. while (kidsOrEntries.has("Kids")) {
  34243. if (++loopCount > MAX_LEVELS) {
  34244. warn(`Search depth limit reached for "${this._type}" tree.`);
  34245. return null;
  34246. }
  34247. const kids = kidsOrEntries.get("Kids");
  34248. if (!Array.isArray(kids)) {
  34249. return null;
  34250. }
  34251. let l = 0,
  34252. r = kids.length - 1;
  34253. while (l <= r) {
  34254. const m = l + r >> 1;
  34255. const kid = xref.fetchIfRef(kids[m]);
  34256. const limits = kid.get("Limits");
  34257. if (key < xref.fetchIfRef(limits[0])) {
  34258. r = m - 1;
  34259. } else if (key > xref.fetchIfRef(limits[1])) {
  34260. l = m + 1;
  34261. } else {
  34262. kidsOrEntries = kid;
  34263. break;
  34264. }
  34265. }
  34266. if (l > r) {
  34267. return null;
  34268. }
  34269. }
  34270. const entries = kidsOrEntries.get(this._type);
  34271. if (Array.isArray(entries)) {
  34272. let l = 0,
  34273. r = entries.length - 2;
  34274. while (l <= r) {
  34275. const tmp = l + r >> 1,
  34276. m = tmp + (tmp & 1);
  34277. const currentKey = xref.fetchIfRef(entries[m]);
  34278. if (key < currentKey) {
  34279. r = m - 2;
  34280. } else if (key > currentKey) {
  34281. l = m + 2;
  34282. } else {
  34283. return entries[m + 1];
  34284. }
  34285. }
  34286. }
  34287. return null;
  34288. }
  34289. get(key) {
  34290. return this.xref.fetchIfRef(this.getRaw(key));
  34291. }
  34292. }
  34293. class NameTree extends NameOrNumberTree {
  34294. constructor(root, xref) {
  34295. super(root, xref, "Names");
  34296. }
  34297. }
  34298. class NumberTree extends NameOrNumberTree {
  34299. constructor(root, xref) {
  34300. super(root, xref, "Nums");
  34301. }
  34302. }
  34303. ;// ./src/core/cleanup_helper.js
  34304. function clearGlobalCaches() {
  34305. clearPatternCaches();
  34306. clearPrimitiveCaches();
  34307. clearUnicodeCaches();
  34308. JpxImage.cleanup();
  34309. }
  34310. ;// ./src/core/file_spec.js
  34311. function pickPlatformItem(dict) {
  34312. if (!(dict instanceof Dict)) {
  34313. return null;
  34314. }
  34315. if (dict.has("UF")) {
  34316. return dict.get("UF");
  34317. } else if (dict.has("F")) {
  34318. return dict.get("F");
  34319. } else if (dict.has("Unix")) {
  34320. return dict.get("Unix");
  34321. } else if (dict.has("Mac")) {
  34322. return dict.get("Mac");
  34323. } else if (dict.has("DOS")) {
  34324. return dict.get("DOS");
  34325. }
  34326. return null;
  34327. }
  34328. function stripPath(str) {
  34329. return str.substring(str.lastIndexOf("/") + 1);
  34330. }
  34331. class FileSpec {
  34332. #contentAvailable = false;
  34333. constructor(root, xref, skipContent = false) {
  34334. if (!(root instanceof Dict)) {
  34335. return;
  34336. }
  34337. this.xref = xref;
  34338. this.root = root;
  34339. if (root.has("FS")) {
  34340. this.fs = root.get("FS");
  34341. }
  34342. if (root.has("RF")) {
  34343. warn("Related file specifications are not supported");
  34344. }
  34345. if (!skipContent) {
  34346. if (root.has("EF")) {
  34347. this.#contentAvailable = true;
  34348. } else {
  34349. warn("Non-embedded file specifications are not supported");
  34350. }
  34351. }
  34352. }
  34353. get filename() {
  34354. let filename = "";
  34355. const item = pickPlatformItem(this.root);
  34356. if (item && typeof item === "string") {
  34357. filename = stringToPDFString(item).replaceAll("\\\\", "\\").replaceAll("\\/", "/").replaceAll("\\", "/");
  34358. }
  34359. return shadow(this, "filename", filename || "unnamed");
  34360. }
  34361. get content() {
  34362. if (!this.#contentAvailable) {
  34363. return null;
  34364. }
  34365. this._contentRef ||= pickPlatformItem(this.root?.get("EF"));
  34366. let content = null;
  34367. if (this._contentRef) {
  34368. const fileObj = this.xref.fetchIfRef(this._contentRef);
  34369. if (fileObj instanceof BaseStream) {
  34370. content = fileObj.getBytes();
  34371. } else {
  34372. warn("Embedded file specification points to non-existing/invalid content");
  34373. }
  34374. } else {
  34375. warn("Embedded file specification does not have any content");
  34376. }
  34377. return content;
  34378. }
  34379. get description() {
  34380. let description = "";
  34381. const desc = this.root?.get("Desc");
  34382. if (desc && typeof desc === "string") {
  34383. description = stringToPDFString(desc);
  34384. }
  34385. return shadow(this, "description", description);
  34386. }
  34387. get serializable() {
  34388. return {
  34389. rawFilename: this.filename,
  34390. filename: stripPath(this.filename),
  34391. content: this.content,
  34392. description: this.description
  34393. };
  34394. }
  34395. }
  34396. ;// ./src/core/xml_parser.js
  34397. const XMLParserErrorCode = {
  34398. NoError: 0,
  34399. EndOfDocument: -1,
  34400. UnterminatedCdat: -2,
  34401. UnterminatedXmlDeclaration: -3,
  34402. UnterminatedDoctypeDeclaration: -4,
  34403. UnterminatedComment: -5,
  34404. MalformedElement: -6,
  34405. OutOfMemory: -7,
  34406. UnterminatedAttributeValue: -8,
  34407. UnterminatedElement: -9,
  34408. ElementNeverBegun: -10
  34409. };
  34410. function isWhitespace(s, index) {
  34411. const ch = s[index];
  34412. return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
  34413. }
  34414. function isWhitespaceString(s) {
  34415. for (let i = 0, ii = s.length; i < ii; i++) {
  34416. if (!isWhitespace(s, i)) {
  34417. return false;
  34418. }
  34419. }
  34420. return true;
  34421. }
  34422. class XMLParserBase {
  34423. _resolveEntities(s) {
  34424. return s.replaceAll(/&([^;]+);/g, (all, entity) => {
  34425. if (entity.substring(0, 2) === "#x") {
  34426. return String.fromCodePoint(parseInt(entity.substring(2), 16));
  34427. } else if (entity.substring(0, 1) === "#") {
  34428. return String.fromCodePoint(parseInt(entity.substring(1), 10));
  34429. }
  34430. switch (entity) {
  34431. case "lt":
  34432. return "<";
  34433. case "gt":
  34434. return ">";
  34435. case "amp":
  34436. return "&";
  34437. case "quot":
  34438. return '"';
  34439. case "apos":
  34440. return "'";
  34441. }
  34442. return this.onResolveEntity(entity);
  34443. });
  34444. }
  34445. _parseContent(s, start) {
  34446. const attributes = [];
  34447. let pos = start;
  34448. function skipWs() {
  34449. while (pos < s.length && isWhitespace(s, pos)) {
  34450. ++pos;
  34451. }
  34452. }
  34453. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  34454. ++pos;
  34455. }
  34456. const name = s.substring(start, pos);
  34457. skipWs();
  34458. while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
  34459. skipWs();
  34460. let attrName = "",
  34461. attrValue = "";
  34462. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
  34463. attrName += s[pos];
  34464. ++pos;
  34465. }
  34466. skipWs();
  34467. if (s[pos] !== "=") {
  34468. return null;
  34469. }
  34470. ++pos;
  34471. skipWs();
  34472. const attrEndChar = s[pos];
  34473. if (attrEndChar !== '"' && attrEndChar !== "'") {
  34474. return null;
  34475. }
  34476. const attrEndIndex = s.indexOf(attrEndChar, ++pos);
  34477. if (attrEndIndex < 0) {
  34478. return null;
  34479. }
  34480. attrValue = s.substring(pos, attrEndIndex);
  34481. attributes.push({
  34482. name: attrName,
  34483. value: this._resolveEntities(attrValue)
  34484. });
  34485. pos = attrEndIndex + 1;
  34486. skipWs();
  34487. }
  34488. return {
  34489. name,
  34490. attributes,
  34491. parsed: pos - start
  34492. };
  34493. }
  34494. _parseProcessingInstruction(s, start) {
  34495. let pos = start;
  34496. function skipWs() {
  34497. while (pos < s.length && isWhitespace(s, pos)) {
  34498. ++pos;
  34499. }
  34500. }
  34501. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") {
  34502. ++pos;
  34503. }
  34504. const name = s.substring(start, pos);
  34505. skipWs();
  34506. const attrStart = pos;
  34507. while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
  34508. ++pos;
  34509. }
  34510. const value = s.substring(attrStart, pos);
  34511. return {
  34512. name,
  34513. value,
  34514. parsed: pos - start
  34515. };
  34516. }
  34517. parseXml(s) {
  34518. let i = 0;
  34519. while (i < s.length) {
  34520. const ch = s[i];
  34521. let j = i;
  34522. if (ch === "<") {
  34523. ++j;
  34524. const ch2 = s[j];
  34525. let q;
  34526. switch (ch2) {
  34527. case "/":
  34528. ++j;
  34529. q = s.indexOf(">", j);
  34530. if (q < 0) {
  34531. this.onError(XMLParserErrorCode.UnterminatedElement);
  34532. return;
  34533. }
  34534. this.onEndElement(s.substring(j, q));
  34535. j = q + 1;
  34536. break;
  34537. case "?":
  34538. ++j;
  34539. const pi = this._parseProcessingInstruction(s, j);
  34540. if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
  34541. this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
  34542. return;
  34543. }
  34544. this.onPi(pi.name, pi.value);
  34545. j += pi.parsed + 2;
  34546. break;
  34547. case "!":
  34548. if (s.substring(j + 1, j + 3) === "--") {
  34549. q = s.indexOf("-->", j + 3);
  34550. if (q < 0) {
  34551. this.onError(XMLParserErrorCode.UnterminatedComment);
  34552. return;
  34553. }
  34554. this.onComment(s.substring(j + 3, q));
  34555. j = q + 3;
  34556. } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
  34557. q = s.indexOf("]]>", j + 8);
  34558. if (q < 0) {
  34559. this.onError(XMLParserErrorCode.UnterminatedCdat);
  34560. return;
  34561. }
  34562. this.onCdata(s.substring(j + 8, q));
  34563. j = q + 3;
  34564. } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
  34565. const q2 = s.indexOf("[", j + 8);
  34566. let complexDoctype = false;
  34567. q = s.indexOf(">", j + 8);
  34568. if (q < 0) {
  34569. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  34570. return;
  34571. }
  34572. if (q2 > 0 && q > q2) {
  34573. q = s.indexOf("]>", j + 8);
  34574. if (q < 0) {
  34575. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  34576. return;
  34577. }
  34578. complexDoctype = true;
  34579. }
  34580. const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
  34581. this.onDoctype(doctypeContent);
  34582. j = q + (complexDoctype ? 2 : 1);
  34583. } else {
  34584. this.onError(XMLParserErrorCode.MalformedElement);
  34585. return;
  34586. }
  34587. break;
  34588. default:
  34589. const content = this._parseContent(s, j);
  34590. if (content === null) {
  34591. this.onError(XMLParserErrorCode.MalformedElement);
  34592. return;
  34593. }
  34594. let isClosed = false;
  34595. if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
  34596. isClosed = true;
  34597. } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
  34598. this.onError(XMLParserErrorCode.UnterminatedElement);
  34599. return;
  34600. }
  34601. this.onBeginElement(content.name, content.attributes, isClosed);
  34602. j += content.parsed + (isClosed ? 2 : 1);
  34603. break;
  34604. }
  34605. } else {
  34606. while (j < s.length && s[j] !== "<") {
  34607. j++;
  34608. }
  34609. const text = s.substring(i, j);
  34610. this.onText(this._resolveEntities(text));
  34611. }
  34612. i = j;
  34613. }
  34614. }
  34615. onResolveEntity(name) {
  34616. return `&${name};`;
  34617. }
  34618. onPi(name, value) {}
  34619. onComment(text) {}
  34620. onCdata(text) {}
  34621. onDoctype(doctypeContent) {}
  34622. onText(text) {}
  34623. onBeginElement(name, attributes, isEmpty) {}
  34624. onEndElement(name) {}
  34625. onError(code) {}
  34626. }
  34627. class SimpleDOMNode {
  34628. constructor(nodeName, nodeValue) {
  34629. this.nodeName = nodeName;
  34630. this.nodeValue = nodeValue;
  34631. Object.defineProperty(this, "parentNode", {
  34632. value: null,
  34633. writable: true
  34634. });
  34635. }
  34636. get firstChild() {
  34637. return this.childNodes?.[0];
  34638. }
  34639. get nextSibling() {
  34640. const childNodes = this.parentNode.childNodes;
  34641. if (!childNodes) {
  34642. return undefined;
  34643. }
  34644. const index = childNodes.indexOf(this);
  34645. if (index === -1) {
  34646. return undefined;
  34647. }
  34648. return childNodes[index + 1];
  34649. }
  34650. get textContent() {
  34651. if (!this.childNodes) {
  34652. return this.nodeValue || "";
  34653. }
  34654. return this.childNodes.map(function (child) {
  34655. return child.textContent;
  34656. }).join("");
  34657. }
  34658. get children() {
  34659. return this.childNodes || [];
  34660. }
  34661. hasChildNodes() {
  34662. return this.childNodes?.length > 0;
  34663. }
  34664. searchNode(paths, pos) {
  34665. if (pos >= paths.length) {
  34666. return this;
  34667. }
  34668. const component = paths[pos];
  34669. if (component.name.startsWith("#") && pos < paths.length - 1) {
  34670. return this.searchNode(paths, pos + 1);
  34671. }
  34672. const stack = [];
  34673. let node = this;
  34674. while (true) {
  34675. if (component.name === node.nodeName) {
  34676. if (component.pos === 0) {
  34677. const res = node.searchNode(paths, pos + 1);
  34678. if (res !== null) {
  34679. return res;
  34680. }
  34681. } else if (stack.length === 0) {
  34682. return null;
  34683. } else {
  34684. const [parent] = stack.pop();
  34685. let siblingPos = 0;
  34686. for (const child of parent.childNodes) {
  34687. if (component.name === child.nodeName) {
  34688. if (siblingPos === component.pos) {
  34689. return child.searchNode(paths, pos + 1);
  34690. }
  34691. siblingPos++;
  34692. }
  34693. }
  34694. return node.searchNode(paths, pos + 1);
  34695. }
  34696. }
  34697. if (node.childNodes?.length > 0) {
  34698. stack.push([node, 0]);
  34699. node = node.childNodes[0];
  34700. } else if (stack.length === 0) {
  34701. return null;
  34702. } else {
  34703. while (stack.length !== 0) {
  34704. const [parent, currentPos] = stack.pop();
  34705. const newPos = currentPos + 1;
  34706. if (newPos < parent.childNodes.length) {
  34707. stack.push([parent, newPos]);
  34708. node = parent.childNodes[newPos];
  34709. break;
  34710. }
  34711. }
  34712. if (stack.length === 0) {
  34713. return null;
  34714. }
  34715. }
  34716. }
  34717. }
  34718. dump(buffer) {
  34719. if (this.nodeName === "#text") {
  34720. buffer.push(encodeToXmlString(this.nodeValue));
  34721. return;
  34722. }
  34723. buffer.push(`<${this.nodeName}`);
  34724. if (this.attributes) {
  34725. for (const attribute of this.attributes) {
  34726. buffer.push(` ${attribute.name}="${encodeToXmlString(attribute.value)}"`);
  34727. }
  34728. }
  34729. if (this.hasChildNodes()) {
  34730. buffer.push(">");
  34731. for (const child of this.childNodes) {
  34732. child.dump(buffer);
  34733. }
  34734. buffer.push(`</${this.nodeName}>`);
  34735. } else if (this.nodeValue) {
  34736. buffer.push(`>${encodeToXmlString(this.nodeValue)}</${this.nodeName}>`);
  34737. } else {
  34738. buffer.push("/>");
  34739. }
  34740. }
  34741. }
  34742. class SimpleXMLParser extends XMLParserBase {
  34743. constructor({
  34744. hasAttributes = false,
  34745. lowerCaseName = false
  34746. }) {
  34747. super();
  34748. this._currentFragment = null;
  34749. this._stack = null;
  34750. this._errorCode = XMLParserErrorCode.NoError;
  34751. this._hasAttributes = hasAttributes;
  34752. this._lowerCaseName = lowerCaseName;
  34753. }
  34754. parseFromString(data) {
  34755. this._currentFragment = [];
  34756. this._stack = [];
  34757. this._errorCode = XMLParserErrorCode.NoError;
  34758. this.parseXml(data);
  34759. if (this._errorCode !== XMLParserErrorCode.NoError) {
  34760. return undefined;
  34761. }
  34762. const [documentElement] = this._currentFragment;
  34763. if (!documentElement) {
  34764. return undefined;
  34765. }
  34766. return {
  34767. documentElement
  34768. };
  34769. }
  34770. onText(text) {
  34771. if (isWhitespaceString(text)) {
  34772. return;
  34773. }
  34774. const node = new SimpleDOMNode("#text", text);
  34775. this._currentFragment.push(node);
  34776. }
  34777. onCdata(text) {
  34778. const node = new SimpleDOMNode("#text", text);
  34779. this._currentFragment.push(node);
  34780. }
  34781. onBeginElement(name, attributes, isEmpty) {
  34782. if (this._lowerCaseName) {
  34783. name = name.toLowerCase();
  34784. }
  34785. const node = new SimpleDOMNode(name);
  34786. node.childNodes = [];
  34787. if (this._hasAttributes) {
  34788. node.attributes = attributes;
  34789. }
  34790. this._currentFragment.push(node);
  34791. if (isEmpty) {
  34792. return;
  34793. }
  34794. this._stack.push(this._currentFragment);
  34795. this._currentFragment = node.childNodes;
  34796. }
  34797. onEndElement(name) {
  34798. this._currentFragment = this._stack.pop() || [];
  34799. const lastElement = this._currentFragment.at(-1);
  34800. if (!lastElement) {
  34801. return null;
  34802. }
  34803. for (const childNode of lastElement.childNodes) {
  34804. childNode.parentNode = lastElement;
  34805. }
  34806. return lastElement;
  34807. }
  34808. onError(code) {
  34809. this._errorCode = code;
  34810. }
  34811. }
  34812. ;// ./src/core/metadata_parser.js
  34813. class MetadataParser {
  34814. constructor(data) {
  34815. data = this._repair(data);
  34816. const parser = new SimpleXMLParser({
  34817. lowerCaseName: true
  34818. });
  34819. const xmlDocument = parser.parseFromString(data);
  34820. this._metadataMap = new Map();
  34821. this._data = data;
  34822. if (xmlDocument) {
  34823. this._parse(xmlDocument);
  34824. }
  34825. }
  34826. _repair(data) {
  34827. return data.replace(/^[^<]+/, "").replaceAll(/>\\376\\377([^<]+)/g, function (all, codes) {
  34828. const bytes = codes.replaceAll(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
  34829. return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
  34830. }).replaceAll(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
  34831. switch (name) {
  34832. case "amp":
  34833. return "&";
  34834. case "apos":
  34835. return "'";
  34836. case "gt":
  34837. return ">";
  34838. case "lt":
  34839. return "<";
  34840. case "quot":
  34841. return '"';
  34842. }
  34843. throw new Error(`_repair: ${name} isn't defined.`);
  34844. });
  34845. const charBuf = [">"];
  34846. for (let i = 0, ii = bytes.length; i < ii; i += 2) {
  34847. const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
  34848. if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
  34849. charBuf.push(String.fromCharCode(code));
  34850. } else {
  34851. charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";");
  34852. }
  34853. }
  34854. return charBuf.join("");
  34855. });
  34856. }
  34857. _getSequence(entry) {
  34858. const name = entry.nodeName;
  34859. if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") {
  34860. return null;
  34861. }
  34862. return entry.childNodes.filter(node => node.nodeName === "rdf:li");
  34863. }
  34864. _parseArray(entry) {
  34865. if (!entry.hasChildNodes()) {
  34866. return;
  34867. }
  34868. const [seqNode] = entry.childNodes;
  34869. const sequence = this._getSequence(seqNode) || [];
  34870. this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim()));
  34871. }
  34872. _parse(xmlDocument) {
  34873. let rdf = xmlDocument.documentElement;
  34874. if (rdf.nodeName !== "rdf:rdf") {
  34875. rdf = rdf.firstChild;
  34876. while (rdf && rdf.nodeName !== "rdf:rdf") {
  34877. rdf = rdf.nextSibling;
  34878. }
  34879. }
  34880. if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
  34881. return;
  34882. }
  34883. for (const desc of rdf.childNodes) {
  34884. if (desc.nodeName !== "rdf:description") {
  34885. continue;
  34886. }
  34887. for (const entry of desc.childNodes) {
  34888. const name = entry.nodeName;
  34889. switch (name) {
  34890. case "#text":
  34891. continue;
  34892. case "dc:creator":
  34893. case "dc:subject":
  34894. this._parseArray(entry);
  34895. continue;
  34896. }
  34897. this._metadataMap.set(name, entry.textContent.trim());
  34898. }
  34899. }
  34900. }
  34901. get serializable() {
  34902. return {
  34903. parsedData: this._metadataMap,
  34904. rawData: this._data
  34905. };
  34906. }
  34907. }
  34908. ;// ./src/core/decrypt_stream.js
  34909. const chunkSize = 512;
  34910. class DecryptStream extends DecodeStream {
  34911. constructor(str, maybeLength, decrypt) {
  34912. super(maybeLength);
  34913. this.str = str;
  34914. this.dict = str.dict;
  34915. this.decrypt = decrypt;
  34916. this.nextChunk = null;
  34917. this.initialized = false;
  34918. }
  34919. readBlock() {
  34920. let chunk;
  34921. if (this.initialized) {
  34922. chunk = this.nextChunk;
  34923. } else {
  34924. chunk = this.str.getBytes(chunkSize);
  34925. this.initialized = true;
  34926. }
  34927. if (!chunk || chunk.length === 0) {
  34928. this.eof = true;
  34929. return;
  34930. }
  34931. this.nextChunk = this.str.getBytes(chunkSize);
  34932. const hasMoreData = this.nextChunk?.length > 0;
  34933. const decrypt = this.decrypt;
  34934. chunk = decrypt(chunk, !hasMoreData);
  34935. const bufferLength = this.bufferLength,
  34936. newLength = bufferLength + chunk.length,
  34937. buffer = this.ensureBuffer(newLength);
  34938. buffer.set(chunk, bufferLength);
  34939. this.bufferLength = newLength;
  34940. }
  34941. }
  34942. ;// ./src/core/crypto.js
  34943. class ARCFourCipher {
  34944. constructor(key) {
  34945. this.a = 0;
  34946. this.b = 0;
  34947. const s = new Uint8Array(256);
  34948. const keyLength = key.length;
  34949. for (let i = 0; i < 256; ++i) {
  34950. s[i] = i;
  34951. }
  34952. for (let i = 0, j = 0; i < 256; ++i) {
  34953. const tmp = s[i];
  34954. j = j + tmp + key[i % keyLength] & 0xff;
  34955. s[i] = s[j];
  34956. s[j] = tmp;
  34957. }
  34958. this.s = s;
  34959. }
  34960. encryptBlock(data) {
  34961. let a = this.a,
  34962. b = this.b;
  34963. const s = this.s;
  34964. const n = data.length;
  34965. const output = new Uint8Array(n);
  34966. for (let i = 0; i < n; ++i) {
  34967. a = a + 1 & 0xff;
  34968. const tmp = s[a];
  34969. b = b + tmp & 0xff;
  34970. const tmp2 = s[b];
  34971. s[a] = tmp2;
  34972. s[b] = tmp;
  34973. output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
  34974. }
  34975. this.a = a;
  34976. this.b = b;
  34977. return output;
  34978. }
  34979. decryptBlock(data) {
  34980. return this.encryptBlock(data);
  34981. }
  34982. encrypt(data) {
  34983. return this.encryptBlock(data);
  34984. }
  34985. }
  34986. const calculateMD5 = function calculateMD5Closure() {
  34987. const r = new Uint8Array([7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21]);
  34988. const k = new Int32Array([-680876936, -389564586, 606105819, -1044525330, -176418897, 1200080426, -1473231341, -45705983, 1770035416, -1958414417, -42063, -1990404162, 1804603682, -40341101, -1502002290, 1236535329, -165796510, -1069501632, 643717713, -373897302, -701558691, 38016083, -660478335, -405537848, 568446438, -1019803690, -187363961, 1163531501, -1444681467, -51403784, 1735328473, -1926607734, -378558, -2022574463, 1839030562, -35309556, -1530992060, 1272893353, -155497632, -1094730640, 681279174, -358537222, -722521979, 76029189, -640364487, -421815835, 530742520, -995338651, -198630844, 1126891415, -1416354905, -57434055, 1700485571, -1894986606, -1051523, -2054922799, 1873313359, -30611744, -1560198380, 1309151649, -145523070, -1120210379, 718787259, -343485551]);
  34989. function hash(data, offset, length) {
  34990. let h0 = 1732584193,
  34991. h1 = -271733879,
  34992. h2 = -1732584194,
  34993. h3 = 271733878;
  34994. const paddedLength = length + 72 & ~63;
  34995. const padded = new Uint8Array(paddedLength);
  34996. let i, j;
  34997. for (i = 0; i < length; ++i) {
  34998. padded[i] = data[offset++];
  34999. }
  35000. padded[i++] = 0x80;
  35001. const n = paddedLength - 8;
  35002. while (i < n) {
  35003. padded[i++] = 0;
  35004. }
  35005. padded[i++] = length << 3 & 0xff;
  35006. padded[i++] = length >> 5 & 0xff;
  35007. padded[i++] = length >> 13 & 0xff;
  35008. padded[i++] = length >> 21 & 0xff;
  35009. padded[i++] = length >>> 29 & 0xff;
  35010. padded[i++] = 0;
  35011. padded[i++] = 0;
  35012. padded[i++] = 0;
  35013. const w = new Int32Array(16);
  35014. for (i = 0; i < paddedLength;) {
  35015. for (j = 0; j < 16; ++j, i += 4) {
  35016. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  35017. }
  35018. let a = h0,
  35019. b = h1,
  35020. c = h2,
  35021. d = h3,
  35022. f,
  35023. g;
  35024. for (j = 0; j < 64; ++j) {
  35025. if (j < 16) {
  35026. f = b & c | ~b & d;
  35027. g = j;
  35028. } else if (j < 32) {
  35029. f = d & b | ~d & c;
  35030. g = 5 * j + 1 & 15;
  35031. } else if (j < 48) {
  35032. f = b ^ c ^ d;
  35033. g = 3 * j + 5 & 15;
  35034. } else {
  35035. f = c ^ (b | ~d);
  35036. g = 7 * j & 15;
  35037. }
  35038. const tmp = d,
  35039. rotateArg = a + f + k[j] + w[g] | 0,
  35040. rotate = r[j];
  35041. d = c;
  35042. c = b;
  35043. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  35044. a = tmp;
  35045. }
  35046. h0 = h0 + a | 0;
  35047. h1 = h1 + b | 0;
  35048. h2 = h2 + c | 0;
  35049. h3 = h3 + d | 0;
  35050. }
  35051. return new Uint8Array([h0 & 0xFF, h0 >> 8 & 0xFF, h0 >> 16 & 0xFF, h0 >>> 24 & 0xFF, h1 & 0xFF, h1 >> 8 & 0xFF, h1 >> 16 & 0xFF, h1 >>> 24 & 0xFF, h2 & 0xFF, h2 >> 8 & 0xFF, h2 >> 16 & 0xFF, h2 >>> 24 & 0xFF, h3 & 0xFF, h3 >> 8 & 0xFF, h3 >> 16 & 0xFF, h3 >>> 24 & 0xFF]);
  35052. }
  35053. return hash;
  35054. }();
  35055. class Word64 {
  35056. constructor(highInteger, lowInteger) {
  35057. this.high = highInteger | 0;
  35058. this.low = lowInteger | 0;
  35059. }
  35060. and(word) {
  35061. this.high &= word.high;
  35062. this.low &= word.low;
  35063. }
  35064. xor(word) {
  35065. this.high ^= word.high;
  35066. this.low ^= word.low;
  35067. }
  35068. or(word) {
  35069. this.high |= word.high;
  35070. this.low |= word.low;
  35071. }
  35072. shiftRight(places) {
  35073. if (places >= 32) {
  35074. this.low = this.high >>> places - 32 | 0;
  35075. this.high = 0;
  35076. } else {
  35077. this.low = this.low >>> places | this.high << 32 - places;
  35078. this.high = this.high >>> places | 0;
  35079. }
  35080. }
  35081. shiftLeft(places) {
  35082. if (places >= 32) {
  35083. this.high = this.low << places - 32;
  35084. this.low = 0;
  35085. } else {
  35086. this.high = this.high << places | this.low >>> 32 - places;
  35087. this.low <<= places;
  35088. }
  35089. }
  35090. rotateRight(places) {
  35091. let low, high;
  35092. if (places & 32) {
  35093. high = this.low;
  35094. low = this.high;
  35095. } else {
  35096. low = this.low;
  35097. high = this.high;
  35098. }
  35099. places &= 31;
  35100. this.low = low >>> places | high << 32 - places;
  35101. this.high = high >>> places | low << 32 - places;
  35102. }
  35103. not() {
  35104. this.high = ~this.high;
  35105. this.low = ~this.low;
  35106. }
  35107. add(word) {
  35108. const lowAdd = (this.low >>> 0) + (word.low >>> 0);
  35109. let highAdd = (this.high >>> 0) + (word.high >>> 0);
  35110. if (lowAdd > 0xffffffff) {
  35111. highAdd += 1;
  35112. }
  35113. this.low = lowAdd | 0;
  35114. this.high = highAdd | 0;
  35115. }
  35116. copyTo(bytes, offset) {
  35117. bytes[offset] = this.high >>> 24 & 0xff;
  35118. bytes[offset + 1] = this.high >> 16 & 0xff;
  35119. bytes[offset + 2] = this.high >> 8 & 0xff;
  35120. bytes[offset + 3] = this.high & 0xff;
  35121. bytes[offset + 4] = this.low >>> 24 & 0xff;
  35122. bytes[offset + 5] = this.low >> 16 & 0xff;
  35123. bytes[offset + 6] = this.low >> 8 & 0xff;
  35124. bytes[offset + 7] = this.low & 0xff;
  35125. }
  35126. assign(word) {
  35127. this.high = word.high;
  35128. this.low = word.low;
  35129. }
  35130. }
  35131. const calculateSHA256 = function calculateSHA256Closure() {
  35132. function rotr(x, n) {
  35133. return x >>> n | x << 32 - n;
  35134. }
  35135. function ch(x, y, z) {
  35136. return x & y ^ ~x & z;
  35137. }
  35138. function maj(x, y, z) {
  35139. return x & y ^ x & z ^ y & z;
  35140. }
  35141. function sigma(x) {
  35142. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  35143. }
  35144. function sigmaPrime(x) {
  35145. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  35146. }
  35147. function littleSigma(x) {
  35148. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  35149. }
  35150. function littleSigmaPrime(x) {
  35151. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  35152. }
  35153. const k = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2];
  35154. function hash(data, offset, length) {
  35155. let h0 = 0x6a09e667,
  35156. h1 = 0xbb67ae85,
  35157. h2 = 0x3c6ef372,
  35158. h3 = 0xa54ff53a,
  35159. h4 = 0x510e527f,
  35160. h5 = 0x9b05688c,
  35161. h6 = 0x1f83d9ab,
  35162. h7 = 0x5be0cd19;
  35163. const paddedLength = Math.ceil((length + 9) / 64) * 64;
  35164. const padded = new Uint8Array(paddedLength);
  35165. let i, j;
  35166. for (i = 0; i < length; ++i) {
  35167. padded[i] = data[offset++];
  35168. }
  35169. padded[i++] = 0x80;
  35170. const n = paddedLength - 8;
  35171. while (i < n) {
  35172. padded[i++] = 0;
  35173. }
  35174. padded[i++] = 0;
  35175. padded[i++] = 0;
  35176. padded[i++] = 0;
  35177. padded[i++] = length >>> 29 & 0xff;
  35178. padded[i++] = length >> 21 & 0xff;
  35179. padded[i++] = length >> 13 & 0xff;
  35180. padded[i++] = length >> 5 & 0xff;
  35181. padded[i++] = length << 3 & 0xff;
  35182. const w = new Uint32Array(64);
  35183. for (i = 0; i < paddedLength;) {
  35184. for (j = 0; j < 16; ++j) {
  35185. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  35186. i += 4;
  35187. }
  35188. for (j = 16; j < 64; ++j) {
  35189. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  35190. }
  35191. let a = h0,
  35192. b = h1,
  35193. c = h2,
  35194. d = h3,
  35195. e = h4,
  35196. f = h5,
  35197. g = h6,
  35198. h = h7,
  35199. t1,
  35200. t2;
  35201. for (j = 0; j < 64; ++j) {
  35202. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  35203. t2 = sigma(a) + maj(a, b, c);
  35204. h = g;
  35205. g = f;
  35206. f = e;
  35207. e = d + t1 | 0;
  35208. d = c;
  35209. c = b;
  35210. b = a;
  35211. a = t1 + t2 | 0;
  35212. }
  35213. h0 = h0 + a | 0;
  35214. h1 = h1 + b | 0;
  35215. h2 = h2 + c | 0;
  35216. h3 = h3 + d | 0;
  35217. h4 = h4 + e | 0;
  35218. h5 = h5 + f | 0;
  35219. h6 = h6 + g | 0;
  35220. h7 = h7 + h | 0;
  35221. }
  35222. return new Uint8Array([h0 >> 24 & 0xFF, h0 >> 16 & 0xFF, h0 >> 8 & 0xFF, h0 & 0xFF, h1 >> 24 & 0xFF, h1 >> 16 & 0xFF, h1 >> 8 & 0xFF, h1 & 0xFF, h2 >> 24 & 0xFF, h2 >> 16 & 0xFF, h2 >> 8 & 0xFF, h2 & 0xFF, h3 >> 24 & 0xFF, h3 >> 16 & 0xFF, h3 >> 8 & 0xFF, h3 & 0xFF, h4 >> 24 & 0xFF, h4 >> 16 & 0xFF, h4 >> 8 & 0xFF, h4 & 0xFF, h5 >> 24 & 0xFF, h5 >> 16 & 0xFF, h5 >> 8 & 0xFF, h5 & 0xFF, h6 >> 24 & 0xFF, h6 >> 16 & 0xFF, h6 >> 8 & 0xFF, h6 & 0xFF, h7 >> 24 & 0xFF, h7 >> 16 & 0xFF, h7 >> 8 & 0xFF, h7 & 0xFF]);
  35223. }
  35224. return hash;
  35225. }();
  35226. const calculateSHA512 = function calculateSHA512Closure() {
  35227. function ch(result, x, y, z, tmp) {
  35228. result.assign(x);
  35229. result.and(y);
  35230. tmp.assign(x);
  35231. tmp.not();
  35232. tmp.and(z);
  35233. result.xor(tmp);
  35234. }
  35235. function maj(result, x, y, z, tmp) {
  35236. result.assign(x);
  35237. result.and(y);
  35238. tmp.assign(x);
  35239. tmp.and(z);
  35240. result.xor(tmp);
  35241. tmp.assign(y);
  35242. tmp.and(z);
  35243. result.xor(tmp);
  35244. }
  35245. function sigma(result, x, tmp) {
  35246. result.assign(x);
  35247. result.rotateRight(28);
  35248. tmp.assign(x);
  35249. tmp.rotateRight(34);
  35250. result.xor(tmp);
  35251. tmp.assign(x);
  35252. tmp.rotateRight(39);
  35253. result.xor(tmp);
  35254. }
  35255. function sigmaPrime(result, x, tmp) {
  35256. result.assign(x);
  35257. result.rotateRight(14);
  35258. tmp.assign(x);
  35259. tmp.rotateRight(18);
  35260. result.xor(tmp);
  35261. tmp.assign(x);
  35262. tmp.rotateRight(41);
  35263. result.xor(tmp);
  35264. }
  35265. function littleSigma(result, x, tmp) {
  35266. result.assign(x);
  35267. result.rotateRight(1);
  35268. tmp.assign(x);
  35269. tmp.rotateRight(8);
  35270. result.xor(tmp);
  35271. tmp.assign(x);
  35272. tmp.shiftRight(7);
  35273. result.xor(tmp);
  35274. }
  35275. function littleSigmaPrime(result, x, tmp) {
  35276. result.assign(x);
  35277. result.rotateRight(19);
  35278. tmp.assign(x);
  35279. tmp.rotateRight(61);
  35280. result.xor(tmp);
  35281. tmp.assign(x);
  35282. tmp.shiftRight(6);
  35283. result.xor(tmp);
  35284. }
  35285. const k = [new Word64(0x428a2f98, 0xd728ae22), new Word64(0x71374491, 0x23ef65cd), new Word64(0xb5c0fbcf, 0xec4d3b2f), new Word64(0xe9b5dba5, 0x8189dbbc), new Word64(0x3956c25b, 0xf348b538), new Word64(0x59f111f1, 0xb605d019), new Word64(0x923f82a4, 0xaf194f9b), new Word64(0xab1c5ed5, 0xda6d8118), new Word64(0xd807aa98, 0xa3030242), new Word64(0x12835b01, 0x45706fbe), new Word64(0x243185be, 0x4ee4b28c), new Word64(0x550c7dc3, 0xd5ffb4e2), new Word64(0x72be5d74, 0xf27b896f), new Word64(0x80deb1fe, 0x3b1696b1), new Word64(0x9bdc06a7, 0x25c71235), new Word64(0xc19bf174, 0xcf692694), new Word64(0xe49b69c1, 0x9ef14ad2), new Word64(0xefbe4786, 0x384f25e3), new Word64(0x0fc19dc6, 0x8b8cd5b5), new Word64(0x240ca1cc, 0x77ac9c65), new Word64(0x2de92c6f, 0x592b0275), new Word64(0x4a7484aa, 0x6ea6e483), new Word64(0x5cb0a9dc, 0xbd41fbd4), new Word64(0x76f988da, 0x831153b5), new Word64(0x983e5152, 0xee66dfab), new Word64(0xa831c66d, 0x2db43210), new Word64(0xb00327c8, 0x98fb213f), new Word64(0xbf597fc7, 0xbeef0ee4), new Word64(0xc6e00bf3, 0x3da88fc2), new Word64(0xd5a79147, 0x930aa725), new Word64(0x06ca6351, 0xe003826f), new Word64(0x14292967, 0x0a0e6e70), new Word64(0x27b70a85, 0x46d22ffc), new Word64(0x2e1b2138, 0x5c26c926), new Word64(0x4d2c6dfc, 0x5ac42aed), new Word64(0x53380d13, 0x9d95b3df), new Word64(0x650a7354, 0x8baf63de), new Word64(0x766a0abb, 0x3c77b2a8), new Word64(0x81c2c92e, 0x47edaee6), new Word64(0x92722c85, 0x1482353b), new Word64(0xa2bfe8a1, 0x4cf10364), new Word64(0xa81a664b, 0xbc423001), new Word64(0xc24b8b70, 0xd0f89791), new Word64(0xc76c51a3, 0x0654be30), new Word64(0xd192e819, 0xd6ef5218), new Word64(0xd6990624, 0x5565a910), new Word64(0xf40e3585, 0x5771202a), new Word64(0x106aa070, 0x32bbd1b8), new Word64(0x19a4c116, 0xb8d2d0c8), new Word64(0x1e376c08, 0x5141ab53), new Word64(0x2748774c, 0xdf8eeb99), new Word64(0x34b0bcb5, 0xe19b48a8), new Word64(0x391c0cb3, 0xc5c95a63), new Word64(0x4ed8aa4a, 0xe3418acb), new Word64(0x5b9cca4f, 0x7763e373), new Word64(0x682e6ff3, 0xd6b2b8a3), new Word64(0x748f82ee, 0x5defb2fc), new Word64(0x78a5636f, 0x43172f60), new Word64(0x84c87814, 0xa1f0ab72), new Word64(0x8cc70208, 0x1a6439ec), new Word64(0x90befffa, 0x23631e28), new Word64(0xa4506ceb, 0xde82bde9), new Word64(0xbef9a3f7, 0xb2c67915), new Word64(0xc67178f2, 0xe372532b), new Word64(0xca273ece, 0xea26619c), new Word64(0xd186b8c7, 0x21c0c207), new Word64(0xeada7dd6, 0xcde0eb1e), new Word64(0xf57d4f7f, 0xee6ed178), new Word64(0x06f067aa, 0x72176fba), new Word64(0x0a637dc5, 0xa2c898a6), new Word64(0x113f9804, 0xbef90dae), new Word64(0x1b710b35, 0x131c471b), new Word64(0x28db77f5, 0x23047d84), new Word64(0x32caab7b, 0x40c72493), new Word64(0x3c9ebe0a, 0x15c9bebc), new Word64(0x431d67c4, 0x9c100d4c), new Word64(0x4cc5d4be, 0xcb3e42b6), new Word64(0x597f299c, 0xfc657e2a), new Word64(0x5fcb6fab, 0x3ad6faec), new Word64(0x6c44198c, 0x4a475817)];
  35286. function hash(data, offset, length, mode384 = false) {
  35287. let h0, h1, h2, h3, h4, h5, h6, h7;
  35288. if (!mode384) {
  35289. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  35290. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  35291. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  35292. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  35293. h4 = new Word64(0x510e527f, 0xade682d1);
  35294. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  35295. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  35296. h7 = new Word64(0x5be0cd19, 0x137e2179);
  35297. } else {
  35298. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  35299. h1 = new Word64(0x629a292a, 0x367cd507);
  35300. h2 = new Word64(0x9159015a, 0x3070dd17);
  35301. h3 = new Word64(0x152fecd8, 0xf70e5939);
  35302. h4 = new Word64(0x67332667, 0xffc00b31);
  35303. h5 = new Word64(0x8eb44a87, 0x68581511);
  35304. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  35305. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  35306. }
  35307. const paddedLength = Math.ceil((length + 17) / 128) * 128;
  35308. const padded = new Uint8Array(paddedLength);
  35309. let i, j;
  35310. for (i = 0; i < length; ++i) {
  35311. padded[i] = data[offset++];
  35312. }
  35313. padded[i++] = 0x80;
  35314. const n = paddedLength - 16;
  35315. while (i < n) {
  35316. padded[i++] = 0;
  35317. }
  35318. padded[i++] = 0;
  35319. padded[i++] = 0;
  35320. padded[i++] = 0;
  35321. padded[i++] = 0;
  35322. padded[i++] = 0;
  35323. padded[i++] = 0;
  35324. padded[i++] = 0;
  35325. padded[i++] = 0;
  35326. padded[i++] = 0;
  35327. padded[i++] = 0;
  35328. padded[i++] = 0;
  35329. padded[i++] = length >>> 29 & 0xff;
  35330. padded[i++] = length >> 21 & 0xff;
  35331. padded[i++] = length >> 13 & 0xff;
  35332. padded[i++] = length >> 5 & 0xff;
  35333. padded[i++] = length << 3 & 0xff;
  35334. const w = new Array(80);
  35335. for (i = 0; i < 80; i++) {
  35336. w[i] = new Word64(0, 0);
  35337. }
  35338. let a = new Word64(0, 0),
  35339. b = new Word64(0, 0),
  35340. c = new Word64(0, 0);
  35341. let d = new Word64(0, 0),
  35342. e = new Word64(0, 0),
  35343. f = new Word64(0, 0);
  35344. let g = new Word64(0, 0),
  35345. h = new Word64(0, 0);
  35346. const t1 = new Word64(0, 0),
  35347. t2 = new Word64(0, 0);
  35348. const tmp1 = new Word64(0, 0),
  35349. tmp2 = new Word64(0, 0);
  35350. let tmp3;
  35351. for (i = 0; i < paddedLength;) {
  35352. for (j = 0; j < 16; ++j) {
  35353. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  35354. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  35355. i += 8;
  35356. }
  35357. for (j = 16; j < 80; ++j) {
  35358. tmp3 = w[j];
  35359. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  35360. tmp3.add(w[j - 7]);
  35361. littleSigma(tmp1, w[j - 15], tmp2);
  35362. tmp3.add(tmp1);
  35363. tmp3.add(w[j - 16]);
  35364. }
  35365. a.assign(h0);
  35366. b.assign(h1);
  35367. c.assign(h2);
  35368. d.assign(h3);
  35369. e.assign(h4);
  35370. f.assign(h5);
  35371. g.assign(h6);
  35372. h.assign(h7);
  35373. for (j = 0; j < 80; ++j) {
  35374. t1.assign(h);
  35375. sigmaPrime(tmp1, e, tmp2);
  35376. t1.add(tmp1);
  35377. ch(tmp1, e, f, g, tmp2);
  35378. t1.add(tmp1);
  35379. t1.add(k[j]);
  35380. t1.add(w[j]);
  35381. sigma(t2, a, tmp2);
  35382. maj(tmp1, a, b, c, tmp2);
  35383. t2.add(tmp1);
  35384. tmp3 = h;
  35385. h = g;
  35386. g = f;
  35387. f = e;
  35388. d.add(t1);
  35389. e = d;
  35390. d = c;
  35391. c = b;
  35392. b = a;
  35393. tmp3.assign(t1);
  35394. tmp3.add(t2);
  35395. a = tmp3;
  35396. }
  35397. h0.add(a);
  35398. h1.add(b);
  35399. h2.add(c);
  35400. h3.add(d);
  35401. h4.add(e);
  35402. h5.add(f);
  35403. h6.add(g);
  35404. h7.add(h);
  35405. }
  35406. let result;
  35407. if (!mode384) {
  35408. result = new Uint8Array(64);
  35409. h0.copyTo(result, 0);
  35410. h1.copyTo(result, 8);
  35411. h2.copyTo(result, 16);
  35412. h3.copyTo(result, 24);
  35413. h4.copyTo(result, 32);
  35414. h5.copyTo(result, 40);
  35415. h6.copyTo(result, 48);
  35416. h7.copyTo(result, 56);
  35417. } else {
  35418. result = new Uint8Array(48);
  35419. h0.copyTo(result, 0);
  35420. h1.copyTo(result, 8);
  35421. h2.copyTo(result, 16);
  35422. h3.copyTo(result, 24);
  35423. h4.copyTo(result, 32);
  35424. h5.copyTo(result, 40);
  35425. }
  35426. return result;
  35427. }
  35428. return hash;
  35429. }();
  35430. function calculateSHA384(data, offset, length) {
  35431. return calculateSHA512(data, offset, length, true);
  35432. }
  35433. class NullCipher {
  35434. decryptBlock(data) {
  35435. return data;
  35436. }
  35437. encrypt(data) {
  35438. return data;
  35439. }
  35440. }
  35441. class AESBaseCipher {
  35442. constructor() {
  35443. this._s = new Uint8Array([0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16]);
  35444. this._inv_s = new Uint8Array([0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3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5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d]);
  35445. this._mix = new Uint32Array([0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]);
  35446. this._mixCol = new Uint8Array(256);
  35447. for (let i = 0; i < 256; i++) {
  35448. this._mixCol[i] = i < 128 ? i << 1 : i << 1 ^ 0x1b;
  35449. }
  35450. this.buffer = new Uint8Array(16);
  35451. this.bufferPosition = 0;
  35452. }
  35453. _expandKey(cipherKey) {
  35454. unreachable("Cannot call `_expandKey` on the base class");
  35455. }
  35456. _decrypt(input, key) {
  35457. let t, u, v;
  35458. const state = new Uint8Array(16);
  35459. state.set(input);
  35460. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  35461. state[j] ^= key[k];
  35462. }
  35463. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  35464. t = state[13];
  35465. state[13] = state[9];
  35466. state[9] = state[5];
  35467. state[5] = state[1];
  35468. state[1] = t;
  35469. t = state[14];
  35470. u = state[10];
  35471. state[14] = state[6];
  35472. state[10] = state[2];
  35473. state[6] = t;
  35474. state[2] = u;
  35475. t = state[15];
  35476. u = state[11];
  35477. v = state[7];
  35478. state[15] = state[3];
  35479. state[11] = t;
  35480. state[7] = u;
  35481. state[3] = v;
  35482. for (let j = 0; j < 16; ++j) {
  35483. state[j] = this._inv_s[state[j]];
  35484. }
  35485. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  35486. state[j] ^= key[k];
  35487. }
  35488. for (let j = 0; j < 16; j += 4) {
  35489. const s0 = this._mix[state[j]];
  35490. const s1 = this._mix[state[j + 1]];
  35491. const s2 = this._mix[state[j + 2]];
  35492. const s3 = this._mix[state[j + 3]];
  35493. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  35494. state[j] = t >>> 24 & 0xff;
  35495. state[j + 1] = t >> 16 & 0xff;
  35496. state[j + 2] = t >> 8 & 0xff;
  35497. state[j + 3] = t & 0xff;
  35498. }
  35499. }
  35500. t = state[13];
  35501. state[13] = state[9];
  35502. state[9] = state[5];
  35503. state[5] = state[1];
  35504. state[1] = t;
  35505. t = state[14];
  35506. u = state[10];
  35507. state[14] = state[6];
  35508. state[10] = state[2];
  35509. state[6] = t;
  35510. state[2] = u;
  35511. t = state[15];
  35512. u = state[11];
  35513. v = state[7];
  35514. state[15] = state[3];
  35515. state[11] = t;
  35516. state[7] = u;
  35517. state[3] = v;
  35518. for (let j = 0; j < 16; ++j) {
  35519. state[j] = this._inv_s[state[j]];
  35520. state[j] ^= key[j];
  35521. }
  35522. return state;
  35523. }
  35524. _encrypt(input, key) {
  35525. const s = this._s;
  35526. let t, u, v;
  35527. const state = new Uint8Array(16);
  35528. state.set(input);
  35529. for (let j = 0; j < 16; ++j) {
  35530. state[j] ^= key[j];
  35531. }
  35532. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  35533. for (let j = 0; j < 16; ++j) {
  35534. state[j] = s[state[j]];
  35535. }
  35536. v = state[1];
  35537. state[1] = state[5];
  35538. state[5] = state[9];
  35539. state[9] = state[13];
  35540. state[13] = v;
  35541. v = state[2];
  35542. u = state[6];
  35543. state[2] = state[10];
  35544. state[6] = state[14];
  35545. state[10] = v;
  35546. state[14] = u;
  35547. v = state[3];
  35548. u = state[7];
  35549. t = state[11];
  35550. state[3] = state[15];
  35551. state[7] = v;
  35552. state[11] = u;
  35553. state[15] = t;
  35554. for (let j = 0; j < 16; j += 4) {
  35555. const s0 = state[j + 0];
  35556. const s1 = state[j + 1];
  35557. const s2 = state[j + 2];
  35558. const s3 = state[j + 3];
  35559. t = s0 ^ s1 ^ s2 ^ s3;
  35560. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  35561. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  35562. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  35563. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  35564. }
  35565. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  35566. state[j] ^= key[k];
  35567. }
  35568. }
  35569. for (let j = 0; j < 16; ++j) {
  35570. state[j] = s[state[j]];
  35571. }
  35572. v = state[1];
  35573. state[1] = state[5];
  35574. state[5] = state[9];
  35575. state[9] = state[13];
  35576. state[13] = v;
  35577. v = state[2];
  35578. u = state[6];
  35579. state[2] = state[10];
  35580. state[6] = state[14];
  35581. state[10] = v;
  35582. state[14] = u;
  35583. v = state[3];
  35584. u = state[7];
  35585. t = state[11];
  35586. state[3] = state[15];
  35587. state[7] = v;
  35588. state[11] = u;
  35589. state[15] = t;
  35590. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  35591. state[j] ^= key[k];
  35592. }
  35593. return state;
  35594. }
  35595. _decryptBlock2(data, finalize) {
  35596. const sourceLength = data.length;
  35597. let buffer = this.buffer,
  35598. bufferLength = this.bufferPosition;
  35599. const result = [];
  35600. let iv = this.iv;
  35601. for (let i = 0; i < sourceLength; ++i) {
  35602. buffer[bufferLength] = data[i];
  35603. ++bufferLength;
  35604. if (bufferLength < 16) {
  35605. continue;
  35606. }
  35607. const plain = this._decrypt(buffer, this._key);
  35608. for (let j = 0; j < 16; ++j) {
  35609. plain[j] ^= iv[j];
  35610. }
  35611. iv = buffer;
  35612. result.push(plain);
  35613. buffer = new Uint8Array(16);
  35614. bufferLength = 0;
  35615. }
  35616. this.buffer = buffer;
  35617. this.bufferLength = bufferLength;
  35618. this.iv = iv;
  35619. if (result.length === 0) {
  35620. return new Uint8Array(0);
  35621. }
  35622. let outputLength = 16 * result.length;
  35623. if (finalize) {
  35624. const lastBlock = result.at(-1);
  35625. let psLen = lastBlock[15];
  35626. if (psLen <= 16) {
  35627. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  35628. if (lastBlock[i] !== psLen) {
  35629. psLen = 0;
  35630. break;
  35631. }
  35632. }
  35633. outputLength -= psLen;
  35634. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  35635. }
  35636. }
  35637. const output = new Uint8Array(outputLength);
  35638. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  35639. output.set(result[i], j);
  35640. }
  35641. return output;
  35642. }
  35643. decryptBlock(data, finalize, iv = null) {
  35644. const sourceLength = data.length;
  35645. const buffer = this.buffer;
  35646. let bufferLength = this.bufferPosition;
  35647. if (iv) {
  35648. this.iv = iv;
  35649. } else {
  35650. for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  35651. buffer[bufferLength] = data[i];
  35652. }
  35653. if (bufferLength < 16) {
  35654. this.bufferLength = bufferLength;
  35655. return new Uint8Array(0);
  35656. }
  35657. this.iv = buffer;
  35658. data = data.subarray(16);
  35659. }
  35660. this.buffer = new Uint8Array(16);
  35661. this.bufferLength = 0;
  35662. this.decryptBlock = this._decryptBlock2;
  35663. return this.decryptBlock(data, finalize);
  35664. }
  35665. encrypt(data, iv) {
  35666. const sourceLength = data.length;
  35667. let buffer = this.buffer,
  35668. bufferLength = this.bufferPosition;
  35669. const result = [];
  35670. if (!iv) {
  35671. iv = new Uint8Array(16);
  35672. }
  35673. for (let i = 0; i < sourceLength; ++i) {
  35674. buffer[bufferLength] = data[i];
  35675. ++bufferLength;
  35676. if (bufferLength < 16) {
  35677. continue;
  35678. }
  35679. for (let j = 0; j < 16; ++j) {
  35680. buffer[j] ^= iv[j];
  35681. }
  35682. const cipher = this._encrypt(buffer, this._key);
  35683. iv = cipher;
  35684. result.push(cipher);
  35685. buffer = new Uint8Array(16);
  35686. bufferLength = 0;
  35687. }
  35688. this.buffer = buffer;
  35689. this.bufferLength = bufferLength;
  35690. this.iv = iv;
  35691. if (result.length === 0) {
  35692. return new Uint8Array(0);
  35693. }
  35694. const outputLength = 16 * result.length;
  35695. const output = new Uint8Array(outputLength);
  35696. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  35697. output.set(result[i], j);
  35698. }
  35699. return output;
  35700. }
  35701. }
  35702. class AES128Cipher extends AESBaseCipher {
  35703. constructor(key) {
  35704. super();
  35705. this._cyclesOfRepetition = 10;
  35706. this._keySize = 160;
  35707. this._rcon = new Uint8Array([0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d]);
  35708. this._key = this._expandKey(key);
  35709. }
  35710. _expandKey(cipherKey) {
  35711. const b = 176;
  35712. const s = this._s;
  35713. const rcon = this._rcon;
  35714. const result = new Uint8Array(b);
  35715. result.set(cipherKey);
  35716. for (let j = 16, i = 1; j < b; ++i) {
  35717. let t1 = result[j - 3];
  35718. let t2 = result[j - 2];
  35719. let t3 = result[j - 1];
  35720. let t4 = result[j - 4];
  35721. t1 = s[t1];
  35722. t2 = s[t2];
  35723. t3 = s[t3];
  35724. t4 = s[t4];
  35725. t1 ^= rcon[i];
  35726. for (let n = 0; n < 4; ++n) {
  35727. result[j] = t1 ^= result[j - 16];
  35728. j++;
  35729. result[j] = t2 ^= result[j - 16];
  35730. j++;
  35731. result[j] = t3 ^= result[j - 16];
  35732. j++;
  35733. result[j] = t4 ^= result[j - 16];
  35734. j++;
  35735. }
  35736. }
  35737. return result;
  35738. }
  35739. }
  35740. class AES256Cipher extends AESBaseCipher {
  35741. constructor(key) {
  35742. super();
  35743. this._cyclesOfRepetition = 14;
  35744. this._keySize = 224;
  35745. this._key = this._expandKey(key);
  35746. }
  35747. _expandKey(cipherKey) {
  35748. const b = 240;
  35749. const s = this._s;
  35750. const result = new Uint8Array(b);
  35751. result.set(cipherKey);
  35752. let r = 1;
  35753. let t1, t2, t3, t4;
  35754. for (let j = 32, i = 1; j < b; ++i) {
  35755. if (j % 32 === 16) {
  35756. t1 = s[t1];
  35757. t2 = s[t2];
  35758. t3 = s[t3];
  35759. t4 = s[t4];
  35760. } else if (j % 32 === 0) {
  35761. t1 = result[j - 3];
  35762. t2 = result[j - 2];
  35763. t3 = result[j - 1];
  35764. t4 = result[j - 4];
  35765. t1 = s[t1];
  35766. t2 = s[t2];
  35767. t3 = s[t3];
  35768. t4 = s[t4];
  35769. t1 ^= r;
  35770. if ((r <<= 1) >= 256) {
  35771. r = (r ^ 0x1b) & 0xff;
  35772. }
  35773. }
  35774. for (let n = 0; n < 4; ++n) {
  35775. result[j] = t1 ^= result[j - 32];
  35776. j++;
  35777. result[j] = t2 ^= result[j - 32];
  35778. j++;
  35779. result[j] = t3 ^= result[j - 32];
  35780. j++;
  35781. result[j] = t4 ^= result[j - 32];
  35782. j++;
  35783. }
  35784. }
  35785. return result;
  35786. }
  35787. }
  35788. class PDF17 {
  35789. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  35790. const hashData = new Uint8Array(password.length + 56);
  35791. hashData.set(password, 0);
  35792. hashData.set(ownerValidationSalt, password.length);
  35793. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  35794. const result = calculateSHA256(hashData, 0, hashData.length);
  35795. return isArrayEqual(result, ownerPassword);
  35796. }
  35797. checkUserPassword(password, userValidationSalt, userPassword) {
  35798. const hashData = new Uint8Array(password.length + 8);
  35799. hashData.set(password, 0);
  35800. hashData.set(userValidationSalt, password.length);
  35801. const result = calculateSHA256(hashData, 0, hashData.length);
  35802. return isArrayEqual(result, userPassword);
  35803. }
  35804. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  35805. const hashData = new Uint8Array(password.length + 56);
  35806. hashData.set(password, 0);
  35807. hashData.set(ownerKeySalt, password.length);
  35808. hashData.set(userBytes, password.length + ownerKeySalt.length);
  35809. const key = calculateSHA256(hashData, 0, hashData.length);
  35810. const cipher = new AES256Cipher(key);
  35811. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  35812. }
  35813. getUserKey(password, userKeySalt, userEncryption) {
  35814. const hashData = new Uint8Array(password.length + 8);
  35815. hashData.set(password, 0);
  35816. hashData.set(userKeySalt, password.length);
  35817. const key = calculateSHA256(hashData, 0, hashData.length);
  35818. const cipher = new AES256Cipher(key);
  35819. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  35820. }
  35821. }
  35822. class PDF20 {
  35823. _hash(password, input, userBytes) {
  35824. let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  35825. let e = [0];
  35826. let i = 0;
  35827. while (i < 64 || e.at(-1) > i - 32) {
  35828. const combinedLength = password.length + k.length + userBytes.length,
  35829. combinedArray = new Uint8Array(combinedLength);
  35830. let writeOffset = 0;
  35831. combinedArray.set(password, writeOffset);
  35832. writeOffset += password.length;
  35833. combinedArray.set(k, writeOffset);
  35834. writeOffset += k.length;
  35835. combinedArray.set(userBytes, writeOffset);
  35836. const k1 = new Uint8Array(combinedLength * 64);
  35837. for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) {
  35838. k1.set(combinedArray, pos);
  35839. }
  35840. const cipher = new AES128Cipher(k.subarray(0, 16));
  35841. e = cipher.encrypt(k1, k.subarray(16, 32));
  35842. const remainder = e.slice(0, 16).reduce((a, b) => a + b, 0) % 3;
  35843. if (remainder === 0) {
  35844. k = calculateSHA256(e, 0, e.length);
  35845. } else if (remainder === 1) {
  35846. k = calculateSHA384(e, 0, e.length);
  35847. } else if (remainder === 2) {
  35848. k = calculateSHA512(e, 0, e.length);
  35849. }
  35850. i++;
  35851. }
  35852. return k.subarray(0, 32);
  35853. }
  35854. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  35855. const hashData = new Uint8Array(password.length + 56);
  35856. hashData.set(password, 0);
  35857. hashData.set(ownerValidationSalt, password.length);
  35858. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  35859. const result = this._hash(password, hashData, userBytes);
  35860. return isArrayEqual(result, ownerPassword);
  35861. }
  35862. checkUserPassword(password, userValidationSalt, userPassword) {
  35863. const hashData = new Uint8Array(password.length + 8);
  35864. hashData.set(password, 0);
  35865. hashData.set(userValidationSalt, password.length);
  35866. const result = this._hash(password, hashData, []);
  35867. return isArrayEqual(result, userPassword);
  35868. }
  35869. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  35870. const hashData = new Uint8Array(password.length + 56);
  35871. hashData.set(password, 0);
  35872. hashData.set(ownerKeySalt, password.length);
  35873. hashData.set(userBytes, password.length + ownerKeySalt.length);
  35874. const key = this._hash(password, hashData, userBytes);
  35875. const cipher = new AES256Cipher(key);
  35876. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  35877. }
  35878. getUserKey(password, userKeySalt, userEncryption) {
  35879. const hashData = new Uint8Array(password.length + 8);
  35880. hashData.set(password, 0);
  35881. hashData.set(userKeySalt, password.length);
  35882. const key = this._hash(password, hashData, []);
  35883. const cipher = new AES256Cipher(key);
  35884. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  35885. }
  35886. }
  35887. class CipherTransform {
  35888. constructor(stringCipherConstructor, streamCipherConstructor) {
  35889. this.StringCipherConstructor = stringCipherConstructor;
  35890. this.StreamCipherConstructor = streamCipherConstructor;
  35891. }
  35892. createStream(stream, length) {
  35893. const cipher = new this.StreamCipherConstructor();
  35894. return new DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  35895. return cipher.decryptBlock(data, finalize);
  35896. });
  35897. }
  35898. decryptString(s) {
  35899. const cipher = new this.StringCipherConstructor();
  35900. let data = stringToBytes(s);
  35901. data = cipher.decryptBlock(data, true);
  35902. return bytesToString(data);
  35903. }
  35904. encryptString(s) {
  35905. const cipher = new this.StringCipherConstructor();
  35906. if (cipher instanceof AESBaseCipher) {
  35907. const strLen = s.length;
  35908. const pad = 16 - strLen % 16;
  35909. s += String.fromCharCode(pad).repeat(pad);
  35910. const iv = new Uint8Array(16);
  35911. if (typeof crypto !== "undefined") {
  35912. crypto.getRandomValues(iv);
  35913. } else {
  35914. for (let i = 0; i < 16; i++) {
  35915. iv[i] = Math.floor(256 * Math.random());
  35916. }
  35917. }
  35918. let data = stringToBytes(s);
  35919. data = cipher.encrypt(data, iv);
  35920. const buf = new Uint8Array(16 + data.length);
  35921. buf.set(iv);
  35922. buf.set(data, 16);
  35923. return bytesToString(buf);
  35924. }
  35925. let data = stringToBytes(s);
  35926. data = cipher.encrypt(data);
  35927. return bytesToString(data);
  35928. }
  35929. }
  35930. class CipherTransformFactory {
  35931. static #defaultPasswordBytes = new Uint8Array([0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x64, 0x00, 0x4e, 0x56, 0xff, 0xfa, 0x01, 0x08, 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80, 0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a]);
  35932. #createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  35933. if (password) {
  35934. const passwordLength = Math.min(127, password.length);
  35935. password = password.subarray(0, passwordLength);
  35936. } else {
  35937. password = [];
  35938. }
  35939. const pdfAlgorithm = revision === 6 ? new PDF20() : new PDF17();
  35940. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  35941. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  35942. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  35943. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  35944. }
  35945. return null;
  35946. }
  35947. #prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  35948. const hashDataSize = 40 + ownerPassword.length + fileId.length;
  35949. const hashData = new Uint8Array(hashDataSize);
  35950. let i = 0,
  35951. j,
  35952. n;
  35953. if (password) {
  35954. n = Math.min(32, password.length);
  35955. for (; i < n; ++i) {
  35956. hashData[i] = password[i];
  35957. }
  35958. }
  35959. j = 0;
  35960. while (i < 32) {
  35961. hashData[i++] = CipherTransformFactory.#defaultPasswordBytes[j++];
  35962. }
  35963. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  35964. hashData[i++] = ownerPassword[j];
  35965. }
  35966. hashData[i++] = flags & 0xff;
  35967. hashData[i++] = flags >> 8 & 0xff;
  35968. hashData[i++] = flags >> 16 & 0xff;
  35969. hashData[i++] = flags >>> 24 & 0xff;
  35970. for (j = 0, n = fileId.length; j < n; ++j) {
  35971. hashData[i++] = fileId[j];
  35972. }
  35973. if (revision >= 4 && !encryptMetadata) {
  35974. hashData[i++] = 0xff;
  35975. hashData[i++] = 0xff;
  35976. hashData[i++] = 0xff;
  35977. hashData[i++] = 0xff;
  35978. }
  35979. let hash = calculateMD5(hashData, 0, i);
  35980. const keyLengthInBytes = keyLength >> 3;
  35981. if (revision >= 3) {
  35982. for (j = 0; j < 50; ++j) {
  35983. hash = calculateMD5(hash, 0, keyLengthInBytes);
  35984. }
  35985. }
  35986. const encryptionKey = hash.subarray(0, keyLengthInBytes);
  35987. let cipher, checkData;
  35988. if (revision >= 3) {
  35989. for (i = 0; i < 32; ++i) {
  35990. hashData[i] = CipherTransformFactory.#defaultPasswordBytes[i];
  35991. }
  35992. for (j = 0, n = fileId.length; j < n; ++j) {
  35993. hashData[i++] = fileId[j];
  35994. }
  35995. cipher = new ARCFourCipher(encryptionKey);
  35996. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  35997. n = encryptionKey.length;
  35998. const derivedKey = new Uint8Array(n);
  35999. for (j = 1; j <= 19; ++j) {
  36000. for (let k = 0; k < n; ++k) {
  36001. derivedKey[k] = encryptionKey[k] ^ j;
  36002. }
  36003. cipher = new ARCFourCipher(derivedKey);
  36004. checkData = cipher.encryptBlock(checkData);
  36005. }
  36006. for (j = 0, n = checkData.length; j < n; ++j) {
  36007. if (userPassword[j] !== checkData[j]) {
  36008. return null;
  36009. }
  36010. }
  36011. } else {
  36012. cipher = new ARCFourCipher(encryptionKey);
  36013. checkData = cipher.encryptBlock(CipherTransformFactory.#defaultPasswordBytes);
  36014. for (j = 0, n = checkData.length; j < n; ++j) {
  36015. if (userPassword[j] !== checkData[j]) {
  36016. return null;
  36017. }
  36018. }
  36019. }
  36020. return encryptionKey;
  36021. }
  36022. #decodeUserPassword(password, ownerPassword, revision, keyLength) {
  36023. const hashData = new Uint8Array(32);
  36024. let i = 0;
  36025. const n = Math.min(32, password.length);
  36026. for (; i < n; ++i) {
  36027. hashData[i] = password[i];
  36028. }
  36029. let j = 0;
  36030. while (i < 32) {
  36031. hashData[i++] = CipherTransformFactory.#defaultPasswordBytes[j++];
  36032. }
  36033. let hash = calculateMD5(hashData, 0, i);
  36034. const keyLengthInBytes = keyLength >> 3;
  36035. if (revision >= 3) {
  36036. for (j = 0; j < 50; ++j) {
  36037. hash = calculateMD5(hash, 0, hash.length);
  36038. }
  36039. }
  36040. let cipher, userPassword;
  36041. if (revision >= 3) {
  36042. userPassword = ownerPassword;
  36043. const derivedKey = new Uint8Array(keyLengthInBytes);
  36044. for (j = 19; j >= 0; j--) {
  36045. for (let k = 0; k < keyLengthInBytes; ++k) {
  36046. derivedKey[k] = hash[k] ^ j;
  36047. }
  36048. cipher = new ARCFourCipher(derivedKey);
  36049. userPassword = cipher.encryptBlock(userPassword);
  36050. }
  36051. } else {
  36052. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  36053. userPassword = cipher.encryptBlock(ownerPassword);
  36054. }
  36055. return userPassword;
  36056. }
  36057. #buildObjectKey(num, gen, encryptionKey, isAes = false) {
  36058. const key = new Uint8Array(encryptionKey.length + 9);
  36059. const n = encryptionKey.length;
  36060. let i;
  36061. for (i = 0; i < n; ++i) {
  36062. key[i] = encryptionKey[i];
  36063. }
  36064. key[i++] = num & 0xff;
  36065. key[i++] = num >> 8 & 0xff;
  36066. key[i++] = num >> 16 & 0xff;
  36067. key[i++] = gen & 0xff;
  36068. key[i++] = gen >> 8 & 0xff;
  36069. if (isAes) {
  36070. key[i++] = 0x73;
  36071. key[i++] = 0x41;
  36072. key[i++] = 0x6c;
  36073. key[i++] = 0x54;
  36074. }
  36075. const hash = calculateMD5(key, 0, i);
  36076. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  36077. }
  36078. #buildCipherConstructor(cf, name, num, gen, key) {
  36079. if (!(name instanceof Name)) {
  36080. throw new FormatError("Invalid crypt filter name.");
  36081. }
  36082. const self = this;
  36083. const cryptFilter = cf.get(name.name);
  36084. const cfm = cryptFilter?.get("CFM");
  36085. if (!cfm || cfm.name === "None") {
  36086. return function () {
  36087. return new NullCipher();
  36088. };
  36089. }
  36090. if (cfm.name === "V2") {
  36091. return function () {
  36092. return new ARCFourCipher(self.#buildObjectKey(num, gen, key, false));
  36093. };
  36094. }
  36095. if (cfm.name === "AESV2") {
  36096. return function () {
  36097. return new AES128Cipher(self.#buildObjectKey(num, gen, key, true));
  36098. };
  36099. }
  36100. if (cfm.name === "AESV3") {
  36101. return function () {
  36102. return new AES256Cipher(key);
  36103. };
  36104. }
  36105. throw new FormatError("Unknown crypto method");
  36106. }
  36107. constructor(dict, fileId, password) {
  36108. const filter = dict.get("Filter");
  36109. if (!isName(filter, "Standard")) {
  36110. throw new FormatError("unknown encryption method");
  36111. }
  36112. this.filterName = filter.name;
  36113. this.dict = dict;
  36114. const algorithm = dict.get("V");
  36115. if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  36116. throw new FormatError("unsupported encryption algorithm");
  36117. }
  36118. this.algorithm = algorithm;
  36119. let keyLength = dict.get("Length");
  36120. if (!keyLength) {
  36121. if (algorithm <= 3) {
  36122. keyLength = 40;
  36123. } else {
  36124. const cfDict = dict.get("CF");
  36125. const streamCryptoName = dict.get("StmF");
  36126. if (cfDict instanceof Dict && streamCryptoName instanceof Name) {
  36127. cfDict.suppressEncryption = true;
  36128. const handlerDict = cfDict.get(streamCryptoName.name);
  36129. keyLength = handlerDict?.get("Length") || 128;
  36130. if (keyLength < 40) {
  36131. keyLength <<= 3;
  36132. }
  36133. }
  36134. }
  36135. }
  36136. if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  36137. throw new FormatError("invalid key length");
  36138. }
  36139. const ownerBytes = stringToBytes(dict.get("O")),
  36140. userBytes = stringToBytes(dict.get("U"));
  36141. const ownerPassword = ownerBytes.subarray(0, 32);
  36142. const userPassword = userBytes.subarray(0, 32);
  36143. const flags = dict.get("P");
  36144. const revision = dict.get("R");
  36145. const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
  36146. this.encryptMetadata = encryptMetadata;
  36147. const fileIdBytes = stringToBytes(fileId);
  36148. let passwordBytes;
  36149. if (password) {
  36150. if (revision === 6) {
  36151. try {
  36152. password = utf8StringToString(password);
  36153. } catch {
  36154. warn("CipherTransformFactory: Unable to convert UTF8 encoded password.");
  36155. }
  36156. }
  36157. passwordBytes = stringToBytes(password);
  36158. }
  36159. let encryptionKey;
  36160. if (algorithm !== 5) {
  36161. encryptionKey = this.#prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  36162. } else {
  36163. const ownerValidationSalt = ownerBytes.subarray(32, 40);
  36164. const ownerKeySalt = ownerBytes.subarray(40, 48);
  36165. const uBytes = userBytes.subarray(0, 48);
  36166. const userValidationSalt = userBytes.subarray(32, 40);
  36167. const userKeySalt = userBytes.subarray(40, 48);
  36168. const ownerEncryption = stringToBytes(dict.get("OE"));
  36169. const userEncryption = stringToBytes(dict.get("UE"));
  36170. const perms = stringToBytes(dict.get("Perms"));
  36171. encryptionKey = this.#createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  36172. }
  36173. if (!encryptionKey && !password) {
  36174. throw new PasswordException("No password given", PasswordResponses.NEED_PASSWORD);
  36175. } else if (!encryptionKey && password) {
  36176. const decodedPassword = this.#decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  36177. encryptionKey = this.#prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  36178. }
  36179. if (!encryptionKey) {
  36180. throw new PasswordException("Incorrect Password", PasswordResponses.INCORRECT_PASSWORD);
  36181. }
  36182. this.encryptionKey = encryptionKey;
  36183. if (algorithm >= 4) {
  36184. const cf = dict.get("CF");
  36185. if (cf instanceof Dict) {
  36186. cf.suppressEncryption = true;
  36187. }
  36188. this.cf = cf;
  36189. this.stmf = dict.get("StmF") || Name.get("Identity");
  36190. this.strf = dict.get("StrF") || Name.get("Identity");
  36191. this.eff = dict.get("EFF") || this.stmf;
  36192. }
  36193. }
  36194. createCipherTransform(num, gen) {
  36195. if (this.algorithm === 4 || this.algorithm === 5) {
  36196. return new CipherTransform(this.#buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey), this.#buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey));
  36197. }
  36198. const key = this.#buildObjectKey(num, gen, this.encryptionKey, false);
  36199. const cipherConstructor = function () {
  36200. return new ARCFourCipher(key);
  36201. };
  36202. return new CipherTransform(cipherConstructor, cipherConstructor);
  36203. }
  36204. }
  36205. ;// ./src/core/writer.js
  36206. async function writeObject(ref, obj, buffer, {
  36207. encrypt = null
  36208. }) {
  36209. const transform = encrypt?.createCipherTransform(ref.num, ref.gen);
  36210. buffer.push(`${ref.num} ${ref.gen} obj\n`);
  36211. if (obj instanceof Dict) {
  36212. await writeDict(obj, buffer, transform);
  36213. } else if (obj instanceof BaseStream) {
  36214. await writeStream(obj, buffer, transform);
  36215. } else if (Array.isArray(obj) || ArrayBuffer.isView(obj)) {
  36216. await writeArray(obj, buffer, transform);
  36217. }
  36218. buffer.push("\nendobj\n");
  36219. }
  36220. async function writeDict(dict, buffer, transform) {
  36221. buffer.push("<<");
  36222. for (const key of dict.getKeys()) {
  36223. buffer.push(` /${escapePDFName(key)} `);
  36224. await writeValue(dict.getRaw(key), buffer, transform);
  36225. }
  36226. buffer.push(">>");
  36227. }
  36228. async function writeStream(stream, buffer, transform) {
  36229. let bytes = stream.getBytes();
  36230. const {
  36231. dict
  36232. } = stream;
  36233. const [filter, params] = await Promise.all([dict.getAsync("Filter"), dict.getAsync("DecodeParms")]);
  36234. const filterZero = Array.isArray(filter) ? await dict.xref.fetchIfRefAsync(filter[0]) : filter;
  36235. const isFilterZeroFlateDecode = isName(filterZero, "FlateDecode");
  36236. const MIN_LENGTH_FOR_COMPRESSING = 256;
  36237. if (bytes.length >= MIN_LENGTH_FOR_COMPRESSING || isFilterZeroFlateDecode) {
  36238. try {
  36239. const cs = new CompressionStream("deflate");
  36240. const writer = cs.writable.getWriter();
  36241. await writer.ready;
  36242. writer.write(bytes).then(async () => {
  36243. await writer.ready;
  36244. await writer.close();
  36245. }).catch(() => {});
  36246. const buf = await new Response(cs.readable).arrayBuffer();
  36247. bytes = new Uint8Array(buf);
  36248. let newFilter, newParams;
  36249. if (!filter) {
  36250. newFilter = Name.get("FlateDecode");
  36251. } else if (!isFilterZeroFlateDecode) {
  36252. newFilter = Array.isArray(filter) ? [Name.get("FlateDecode"), ...filter] : [Name.get("FlateDecode"), filter];
  36253. if (params) {
  36254. newParams = Array.isArray(params) ? [null, ...params] : [null, params];
  36255. }
  36256. }
  36257. if (newFilter) {
  36258. dict.set("Filter", newFilter);
  36259. }
  36260. if (newParams) {
  36261. dict.set("DecodeParms", newParams);
  36262. }
  36263. } catch (ex) {
  36264. info(`writeStream - cannot compress data: "${ex}".`);
  36265. }
  36266. }
  36267. let string = bytesToString(bytes);
  36268. if (transform) {
  36269. string = transform.encryptString(string);
  36270. }
  36271. dict.set("Length", string.length);
  36272. await writeDict(dict, buffer, transform);
  36273. buffer.push(" stream\n", string, "\nendstream");
  36274. }
  36275. async function writeArray(array, buffer, transform) {
  36276. buffer.push("[");
  36277. let first = true;
  36278. for (const val of array) {
  36279. if (!first) {
  36280. buffer.push(" ");
  36281. } else {
  36282. first = false;
  36283. }
  36284. await writeValue(val, buffer, transform);
  36285. }
  36286. buffer.push("]");
  36287. }
  36288. async function writeValue(value, buffer, transform) {
  36289. if (value instanceof Name) {
  36290. buffer.push(`/${escapePDFName(value.name)}`);
  36291. } else if (value instanceof Ref) {
  36292. buffer.push(`${value.num} ${value.gen} R`);
  36293. } else if (Array.isArray(value) || ArrayBuffer.isView(value)) {
  36294. await writeArray(value, buffer, transform);
  36295. } else if (typeof value === "string") {
  36296. if (transform) {
  36297. value = transform.encryptString(value);
  36298. }
  36299. buffer.push(`(${escapeString(value)})`);
  36300. } else if (typeof value === "number") {
  36301. buffer.push(numberToString(value));
  36302. } else if (typeof value === "boolean") {
  36303. buffer.push(value.toString());
  36304. } else if (value instanceof Dict) {
  36305. await writeDict(value, buffer, transform);
  36306. } else if (value instanceof BaseStream) {
  36307. await writeStream(value, buffer, transform);
  36308. } else if (value === null) {
  36309. buffer.push("null");
  36310. } else {
  36311. warn(`Unhandled value in writer: ${typeof value}, please file a bug.`);
  36312. }
  36313. }
  36314. function writeInt(number, size, offset, buffer) {
  36315. for (let i = size + offset - 1; i > offset - 1; i--) {
  36316. buffer[i] = number & 0xff;
  36317. number >>= 8;
  36318. }
  36319. return offset + size;
  36320. }
  36321. function writeString(string, offset, buffer) {
  36322. for (let i = 0, len = string.length; i < len; i++) {
  36323. buffer[offset + i] = string.charCodeAt(i) & 0xff;
  36324. }
  36325. }
  36326. function computeMD5(filesize, xrefInfo) {
  36327. const time = Math.floor(Date.now() / 1000);
  36328. const filename = xrefInfo.filename || "";
  36329. const md5Buffer = [time.toString(), filename, filesize.toString()];
  36330. let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0);
  36331. for (const value of Object.values(xrefInfo.info)) {
  36332. md5Buffer.push(value);
  36333. md5BufferLen += value.length;
  36334. }
  36335. const array = new Uint8Array(md5BufferLen);
  36336. let offset = 0;
  36337. for (const str of md5Buffer) {
  36338. writeString(str, offset, array);
  36339. offset += str.length;
  36340. }
  36341. return bytesToString(calculateMD5(array));
  36342. }
  36343. function writeXFADataForAcroform(str, newRefs) {
  36344. const xml = new SimpleXMLParser({
  36345. hasAttributes: true
  36346. }).parseFromString(str);
  36347. for (const {
  36348. xfa
  36349. } of newRefs) {
  36350. if (!xfa) {
  36351. continue;
  36352. }
  36353. const {
  36354. path,
  36355. value
  36356. } = xfa;
  36357. if (!path) {
  36358. continue;
  36359. }
  36360. const nodePath = parseXFAPath(path);
  36361. let node = xml.documentElement.searchNode(nodePath, 0);
  36362. if (!node && nodePath.length > 1) {
  36363. node = xml.documentElement.searchNode([nodePath.at(-1)], 0);
  36364. }
  36365. if (node) {
  36366. node.childNodes = Array.isArray(value) ? value.map(val => new SimpleDOMNode("value", val)) : [new SimpleDOMNode("#text", value)];
  36367. } else {
  36368. warn(`Node not found for path: ${path}`);
  36369. }
  36370. }
  36371. const buffer = [];
  36372. xml.documentElement.dump(buffer);
  36373. return buffer.join("");
  36374. }
  36375. async function updateAcroform({
  36376. xref,
  36377. acroForm,
  36378. acroFormRef,
  36379. hasXfa,
  36380. hasXfaDatasetsEntry,
  36381. xfaDatasetsRef,
  36382. needAppearances,
  36383. newRefs
  36384. }) {
  36385. if (hasXfa && !hasXfaDatasetsEntry && !xfaDatasetsRef) {
  36386. warn("XFA - Cannot save it");
  36387. }
  36388. if (!needAppearances && (!hasXfa || !xfaDatasetsRef || hasXfaDatasetsEntry)) {
  36389. return;
  36390. }
  36391. const dict = acroForm.clone();
  36392. if (hasXfa && !hasXfaDatasetsEntry) {
  36393. const newXfa = acroForm.get("XFA").slice();
  36394. newXfa.splice(2, 0, "datasets");
  36395. newXfa.splice(3, 0, xfaDatasetsRef);
  36396. dict.set("XFA", newXfa);
  36397. }
  36398. if (needAppearances) {
  36399. dict.set("NeedAppearances", true);
  36400. }
  36401. const buffer = [];
  36402. await writeObject(acroFormRef, dict, buffer, xref);
  36403. newRefs.push({
  36404. ref: acroFormRef,
  36405. data: buffer.join("")
  36406. });
  36407. }
  36408. function updateXFA({
  36409. xfaData,
  36410. xfaDatasetsRef,
  36411. newRefs,
  36412. xref
  36413. }) {
  36414. if (xfaData === null) {
  36415. const datasets = xref.fetchIfRef(xfaDatasetsRef);
  36416. xfaData = writeXFADataForAcroform(datasets.getString(), newRefs);
  36417. }
  36418. const encrypt = xref.encrypt;
  36419. if (encrypt) {
  36420. const transform = encrypt.createCipherTransform(xfaDatasetsRef.num, xfaDatasetsRef.gen);
  36421. xfaData = transform.encryptString(xfaData);
  36422. }
  36423. const data = `${xfaDatasetsRef.num} ${xfaDatasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n";
  36424. newRefs.push({
  36425. ref: xfaDatasetsRef,
  36426. data
  36427. });
  36428. }
  36429. async function getXRefTable(xrefInfo, baseOffset, newRefs, newXref, buffer) {
  36430. buffer.push("xref\n");
  36431. const indexes = getIndexes(newRefs);
  36432. let indexesPosition = 0;
  36433. for (const {
  36434. ref,
  36435. data
  36436. } of newRefs) {
  36437. if (ref.num === indexes[indexesPosition]) {
  36438. buffer.push(`${indexes[indexesPosition]} ${indexes[indexesPosition + 1]}\n`);
  36439. indexesPosition += 2;
  36440. }
  36441. if (data !== null) {
  36442. buffer.push(`${baseOffset.toString().padStart(10, "0")} ${Math.min(ref.gen, 0xffff).toString().padStart(5, "0")} n\r\n`);
  36443. baseOffset += data.length;
  36444. } else {
  36445. buffer.push(`0000000000 ${Math.min(ref.gen + 1, 0xffff).toString().padStart(5, "0")} f\r\n`);
  36446. }
  36447. }
  36448. computeIDs(baseOffset, xrefInfo, newXref);
  36449. buffer.push("trailer\n");
  36450. await writeDict(newXref, buffer);
  36451. buffer.push("\nstartxref\n", baseOffset.toString(), "\n%%EOF\n");
  36452. }
  36453. function getIndexes(newRefs) {
  36454. const indexes = [];
  36455. for (const {
  36456. ref
  36457. } of newRefs) {
  36458. if (ref.num === indexes.at(-2) + indexes.at(-1)) {
  36459. indexes[indexes.length - 1] += 1;
  36460. } else {
  36461. indexes.push(ref.num, 1);
  36462. }
  36463. }
  36464. return indexes;
  36465. }
  36466. async function getXRefStreamTable(xrefInfo, baseOffset, newRefs, newXref, buffer) {
  36467. const xrefTableData = [];
  36468. let maxOffset = 0;
  36469. let maxGen = 0;
  36470. for (const {
  36471. ref,
  36472. data
  36473. } of newRefs) {
  36474. let gen;
  36475. maxOffset = Math.max(maxOffset, baseOffset);
  36476. if (data !== null) {
  36477. gen = Math.min(ref.gen, 0xffff);
  36478. xrefTableData.push([1, baseOffset, gen]);
  36479. baseOffset += data.length;
  36480. } else {
  36481. gen = Math.min(ref.gen + 1, 0xffff);
  36482. xrefTableData.push([0, 0, gen]);
  36483. }
  36484. maxGen = Math.max(maxGen, gen);
  36485. }
  36486. newXref.set("Index", getIndexes(newRefs));
  36487. const offsetSize = getSizeInBytes(maxOffset);
  36488. const maxGenSize = getSizeInBytes(maxGen);
  36489. const sizes = [1, offsetSize, maxGenSize];
  36490. newXref.set("W", sizes);
  36491. computeIDs(baseOffset, xrefInfo, newXref);
  36492. const structSize = sizes.reduce((a, x) => a + x, 0);
  36493. const data = new Uint8Array(structSize * xrefTableData.length);
  36494. const stream = new Stream(data);
  36495. stream.dict = newXref;
  36496. let offset = 0;
  36497. for (const [type, objOffset, gen] of xrefTableData) {
  36498. offset = writeInt(type, sizes[0], offset, data);
  36499. offset = writeInt(objOffset, sizes[1], offset, data);
  36500. offset = writeInt(gen, sizes[2], offset, data);
  36501. }
  36502. await writeObject(xrefInfo.newRef, stream, buffer, {});
  36503. buffer.push("startxref\n", baseOffset.toString(), "\n%%EOF\n");
  36504. }
  36505. function computeIDs(baseOffset, xrefInfo, newXref) {
  36506. if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) {
  36507. const md5 = computeMD5(baseOffset, xrefInfo);
  36508. newXref.set("ID", [xrefInfo.fileIds[0], md5]);
  36509. }
  36510. }
  36511. function getTrailerDict(xrefInfo, newRefs, useXrefStream) {
  36512. const newXref = new Dict(null);
  36513. newXref.set("Prev", xrefInfo.startXRef);
  36514. const refForXrefTable = xrefInfo.newRef;
  36515. if (useXrefStream) {
  36516. newRefs.push({
  36517. ref: refForXrefTable,
  36518. data: ""
  36519. });
  36520. newXref.set("Size", refForXrefTable.num + 1);
  36521. newXref.set("Type", Name.get("XRef"));
  36522. } else {
  36523. newXref.set("Size", refForXrefTable.num);
  36524. }
  36525. if (xrefInfo.rootRef !== null) {
  36526. newXref.set("Root", xrefInfo.rootRef);
  36527. }
  36528. if (xrefInfo.infoRef !== null) {
  36529. newXref.set("Info", xrefInfo.infoRef);
  36530. }
  36531. if (xrefInfo.encryptRef !== null) {
  36532. newXref.set("Encrypt", xrefInfo.encryptRef);
  36533. }
  36534. return newXref;
  36535. }
  36536. async function incrementalUpdate({
  36537. originalData,
  36538. xrefInfo,
  36539. newRefs,
  36540. xref = null,
  36541. hasXfa = false,
  36542. xfaDatasetsRef = null,
  36543. hasXfaDatasetsEntry = false,
  36544. needAppearances,
  36545. acroFormRef = null,
  36546. acroForm = null,
  36547. xfaData = null,
  36548. useXrefStream = false
  36549. }) {
  36550. await updateAcroform({
  36551. xref,
  36552. acroForm,
  36553. acroFormRef,
  36554. hasXfa,
  36555. hasXfaDatasetsEntry,
  36556. xfaDatasetsRef,
  36557. needAppearances,
  36558. newRefs
  36559. });
  36560. if (hasXfa) {
  36561. updateXFA({
  36562. xfaData,
  36563. xfaDatasetsRef,
  36564. newRefs,
  36565. xref
  36566. });
  36567. }
  36568. const buffer = [];
  36569. let baseOffset = originalData.length;
  36570. const lastByte = originalData.at(-1);
  36571. if (lastByte !== 0x0a && lastByte !== 0x0d) {
  36572. buffer.push("\n");
  36573. baseOffset += 1;
  36574. }
  36575. const newXref = getTrailerDict(xrefInfo, newRefs, useXrefStream);
  36576. newRefs = newRefs.sort((a, b) => a.ref.num - b.ref.num);
  36577. for (const {
  36578. data
  36579. } of newRefs) {
  36580. if (data !== null) {
  36581. buffer.push(data);
  36582. }
  36583. }
  36584. await (useXrefStream ? getXRefStreamTable(xrefInfo, baseOffset, newRefs, newXref, buffer) : getXRefTable(xrefInfo, baseOffset, newRefs, newXref, buffer));
  36585. const totalLength = buffer.reduce((a, str) => a + str.length, originalData.length);
  36586. const array = new Uint8Array(totalLength);
  36587. array.set(originalData);
  36588. let offset = originalData.length;
  36589. for (const str of buffer) {
  36590. writeString(str, offset, array);
  36591. offset += str.length;
  36592. }
  36593. return array;
  36594. }
  36595. ;// ./src/core/struct_tree.js
  36596. const MAX_DEPTH = 40;
  36597. const StructElementType = {
  36598. PAGE_CONTENT: 1,
  36599. STREAM_CONTENT: 2,
  36600. OBJECT: 3,
  36601. ANNOTATION: 4,
  36602. ELEMENT: 5
  36603. };
  36604. class StructTreeRoot {
  36605. constructor(rootDict, rootRef) {
  36606. this.dict = rootDict;
  36607. this.ref = rootRef instanceof Ref ? rootRef : null;
  36608. this.roleMap = new Map();
  36609. this.structParentIds = null;
  36610. }
  36611. init() {
  36612. this.readRoleMap();
  36613. }
  36614. #addIdToPage(pageRef, id, type) {
  36615. if (!(pageRef instanceof Ref) || id < 0) {
  36616. return;
  36617. }
  36618. this.structParentIds ||= new RefSetCache();
  36619. let ids = this.structParentIds.get(pageRef);
  36620. if (!ids) {
  36621. ids = [];
  36622. this.structParentIds.put(pageRef, ids);
  36623. }
  36624. ids.push([id, type]);
  36625. }
  36626. addAnnotationIdToPage(pageRef, id) {
  36627. this.#addIdToPage(pageRef, id, StructElementType.ANNOTATION);
  36628. }
  36629. readRoleMap() {
  36630. const roleMapDict = this.dict.get("RoleMap");
  36631. if (!(roleMapDict instanceof Dict)) {
  36632. return;
  36633. }
  36634. roleMapDict.forEach((key, value) => {
  36635. if (!(value instanceof Name)) {
  36636. return;
  36637. }
  36638. this.roleMap.set(key, value.name);
  36639. });
  36640. }
  36641. static async canCreateStructureTree({
  36642. catalogRef,
  36643. pdfManager,
  36644. newAnnotationsByPage
  36645. }) {
  36646. if (!(catalogRef instanceof Ref)) {
  36647. warn("Cannot save the struct tree: no catalog reference.");
  36648. return false;
  36649. }
  36650. let nextKey = 0;
  36651. let hasNothingToUpdate = true;
  36652. for (const [pageIndex, elements] of newAnnotationsByPage) {
  36653. const {
  36654. ref: pageRef
  36655. } = await pdfManager.getPage(pageIndex);
  36656. if (!(pageRef instanceof Ref)) {
  36657. warn(`Cannot save the struct tree: page ${pageIndex} has no ref.`);
  36658. hasNothingToUpdate = true;
  36659. break;
  36660. }
  36661. for (const element of elements) {
  36662. if (element.accessibilityData?.type) {
  36663. element.parentTreeId = nextKey++;
  36664. hasNothingToUpdate = false;
  36665. }
  36666. }
  36667. }
  36668. if (hasNothingToUpdate) {
  36669. for (const elements of newAnnotationsByPage.values()) {
  36670. for (const element of elements) {
  36671. delete element.parentTreeId;
  36672. }
  36673. }
  36674. return false;
  36675. }
  36676. return true;
  36677. }
  36678. static async createStructureTree({
  36679. newAnnotationsByPage,
  36680. xref,
  36681. catalogRef,
  36682. pdfManager,
  36683. newRefs
  36684. }) {
  36685. const root = pdfManager.catalog.cloneDict();
  36686. const cache = new RefSetCache();
  36687. cache.put(catalogRef, root);
  36688. const structTreeRootRef = xref.getNewTemporaryRef();
  36689. root.set("StructTreeRoot", structTreeRootRef);
  36690. const structTreeRoot = new Dict(xref);
  36691. structTreeRoot.set("Type", Name.get("StructTreeRoot"));
  36692. const parentTreeRef = xref.getNewTemporaryRef();
  36693. structTreeRoot.set("ParentTree", parentTreeRef);
  36694. const kids = [];
  36695. structTreeRoot.set("K", kids);
  36696. cache.put(structTreeRootRef, structTreeRoot);
  36697. const parentTree = new Dict(xref);
  36698. const nums = [];
  36699. parentTree.set("Nums", nums);
  36700. const nextKey = await this.#writeKids({
  36701. newAnnotationsByPage,
  36702. structTreeRootRef,
  36703. structTreeRoot: null,
  36704. kids,
  36705. nums,
  36706. xref,
  36707. pdfManager,
  36708. newRefs,
  36709. cache
  36710. });
  36711. structTreeRoot.set("ParentTreeNextKey", nextKey);
  36712. cache.put(parentTreeRef, parentTree);
  36713. const buffer = [];
  36714. for (const [ref, obj] of cache.items()) {
  36715. buffer.length = 0;
  36716. await writeObject(ref, obj, buffer, xref);
  36717. newRefs.push({
  36718. ref,
  36719. data: buffer.join("")
  36720. });
  36721. }
  36722. }
  36723. async canUpdateStructTree({
  36724. pdfManager,
  36725. xref,
  36726. newAnnotationsByPage
  36727. }) {
  36728. if (!this.ref) {
  36729. warn("Cannot update the struct tree: no root reference.");
  36730. return false;
  36731. }
  36732. let nextKey = this.dict.get("ParentTreeNextKey");
  36733. if (!Number.isInteger(nextKey) || nextKey < 0) {
  36734. warn("Cannot update the struct tree: invalid next key.");
  36735. return false;
  36736. }
  36737. const parentTree = this.dict.get("ParentTree");
  36738. if (!(parentTree instanceof Dict)) {
  36739. warn("Cannot update the struct tree: ParentTree isn't a dict.");
  36740. return false;
  36741. }
  36742. const nums = parentTree.get("Nums");
  36743. if (!Array.isArray(nums)) {
  36744. warn("Cannot update the struct tree: nums isn't an array.");
  36745. return false;
  36746. }
  36747. const numberTree = new NumberTree(parentTree, xref);
  36748. for (const pageIndex of newAnnotationsByPage.keys()) {
  36749. const {
  36750. pageDict
  36751. } = await pdfManager.getPage(pageIndex);
  36752. if (!pageDict.has("StructParents")) {
  36753. continue;
  36754. }
  36755. const id = pageDict.get("StructParents");
  36756. if (!Number.isInteger(id) || !Array.isArray(numberTree.get(id))) {
  36757. warn(`Cannot save the struct tree: page ${pageIndex} has a wrong id.`);
  36758. return false;
  36759. }
  36760. }
  36761. let hasNothingToUpdate = true;
  36762. for (const [pageIndex, elements] of newAnnotationsByPage) {
  36763. const {
  36764. pageDict
  36765. } = await pdfManager.getPage(pageIndex);
  36766. StructTreeRoot.#collectParents({
  36767. elements,
  36768. xref: this.dict.xref,
  36769. pageDict,
  36770. numberTree
  36771. });
  36772. for (const element of elements) {
  36773. if (element.accessibilityData?.type) {
  36774. if (!(element.accessibilityData.structParent >= 0)) {
  36775. element.parentTreeId = nextKey++;
  36776. }
  36777. hasNothingToUpdate = false;
  36778. }
  36779. }
  36780. }
  36781. if (hasNothingToUpdate) {
  36782. for (const elements of newAnnotationsByPage.values()) {
  36783. for (const element of elements) {
  36784. delete element.parentTreeId;
  36785. delete element.structTreeParent;
  36786. }
  36787. }
  36788. return false;
  36789. }
  36790. return true;
  36791. }
  36792. async updateStructureTree({
  36793. newAnnotationsByPage,
  36794. pdfManager,
  36795. newRefs
  36796. }) {
  36797. const xref = this.dict.xref;
  36798. const structTreeRoot = this.dict.clone();
  36799. const structTreeRootRef = this.ref;
  36800. const cache = new RefSetCache();
  36801. cache.put(structTreeRootRef, structTreeRoot);
  36802. let parentTreeRef = structTreeRoot.getRaw("ParentTree");
  36803. let parentTree;
  36804. if (parentTreeRef instanceof Ref) {
  36805. parentTree = xref.fetch(parentTreeRef);
  36806. } else {
  36807. parentTree = parentTreeRef;
  36808. parentTreeRef = xref.getNewTemporaryRef();
  36809. structTreeRoot.set("ParentTree", parentTreeRef);
  36810. }
  36811. parentTree = parentTree.clone();
  36812. cache.put(parentTreeRef, parentTree);
  36813. let nums = parentTree.getRaw("Nums");
  36814. let numsRef = null;
  36815. if (nums instanceof Ref) {
  36816. numsRef = nums;
  36817. nums = xref.fetch(numsRef);
  36818. }
  36819. nums = nums.slice();
  36820. if (!numsRef) {
  36821. parentTree.set("Nums", nums);
  36822. }
  36823. const newNextKey = await StructTreeRoot.#writeKids({
  36824. newAnnotationsByPage,
  36825. structTreeRootRef,
  36826. structTreeRoot: this,
  36827. kids: null,
  36828. nums,
  36829. xref,
  36830. pdfManager,
  36831. newRefs,
  36832. cache
  36833. });
  36834. if (newNextKey === -1) {
  36835. return;
  36836. }
  36837. structTreeRoot.set("ParentTreeNextKey", newNextKey);
  36838. if (numsRef) {
  36839. cache.put(numsRef, nums);
  36840. }
  36841. const buffer = [];
  36842. for (const [ref, obj] of cache.items()) {
  36843. buffer.length = 0;
  36844. await writeObject(ref, obj, buffer, xref);
  36845. newRefs.push({
  36846. ref,
  36847. data: buffer.join("")
  36848. });
  36849. }
  36850. }
  36851. static async #writeKids({
  36852. newAnnotationsByPage,
  36853. structTreeRootRef,
  36854. structTreeRoot,
  36855. kids,
  36856. nums,
  36857. xref,
  36858. pdfManager,
  36859. newRefs,
  36860. cache
  36861. }) {
  36862. const objr = Name.get("OBJR");
  36863. let nextKey = -1;
  36864. let structTreePageObjs;
  36865. const buffer = [];
  36866. for (const [pageIndex, elements] of newAnnotationsByPage) {
  36867. const page = await pdfManager.getPage(pageIndex);
  36868. const {
  36869. ref: pageRef
  36870. } = page;
  36871. const isPageRef = pageRef instanceof Ref;
  36872. for (const {
  36873. accessibilityData,
  36874. ref,
  36875. parentTreeId,
  36876. structTreeParent
  36877. } of elements) {
  36878. if (!accessibilityData?.type) {
  36879. continue;
  36880. }
  36881. const {
  36882. structParent
  36883. } = accessibilityData;
  36884. if (structTreeRoot && Number.isInteger(structParent) && structParent >= 0) {
  36885. let objs = (structTreePageObjs ||= new Map()).get(pageIndex);
  36886. if (objs === undefined) {
  36887. const structTreePage = new StructTreePage(structTreeRoot, page.pageDict);
  36888. objs = structTreePage.collectObjects(pageRef);
  36889. structTreePageObjs.set(pageIndex, objs);
  36890. }
  36891. const objRef = objs?.get(structParent);
  36892. if (objRef) {
  36893. const tagDict = xref.fetch(objRef).clone();
  36894. StructTreeRoot.#writeProperties(tagDict, accessibilityData);
  36895. buffer.length = 0;
  36896. await writeObject(objRef, tagDict, buffer, xref);
  36897. newRefs.push({
  36898. ref: objRef,
  36899. data: buffer.join("")
  36900. });
  36901. continue;
  36902. }
  36903. }
  36904. nextKey = Math.max(nextKey, parentTreeId);
  36905. const tagRef = xref.getNewTemporaryRef();
  36906. const tagDict = new Dict(xref);
  36907. StructTreeRoot.#writeProperties(tagDict, accessibilityData);
  36908. await this.#updateParentTag({
  36909. structTreeParent,
  36910. tagDict,
  36911. newTagRef: tagRef,
  36912. structTreeRootRef,
  36913. fallbackKids: kids,
  36914. xref,
  36915. cache
  36916. });
  36917. const objDict = new Dict(xref);
  36918. tagDict.set("K", objDict);
  36919. objDict.set("Type", objr);
  36920. if (isPageRef) {
  36921. objDict.set("Pg", pageRef);
  36922. }
  36923. objDict.set("Obj", ref);
  36924. cache.put(tagRef, tagDict);
  36925. nums.push(parentTreeId, tagRef);
  36926. }
  36927. }
  36928. return nextKey + 1;
  36929. }
  36930. static #writeProperties(tagDict, {
  36931. type,
  36932. title,
  36933. lang,
  36934. alt,
  36935. expanded,
  36936. actualText
  36937. }) {
  36938. tagDict.set("S", Name.get(type));
  36939. if (title) {
  36940. tagDict.set("T", stringToAsciiOrUTF16BE(title));
  36941. }
  36942. if (lang) {
  36943. tagDict.set("Lang", stringToAsciiOrUTF16BE(lang));
  36944. }
  36945. if (alt) {
  36946. tagDict.set("Alt", stringToAsciiOrUTF16BE(alt));
  36947. }
  36948. if (expanded) {
  36949. tagDict.set("E", stringToAsciiOrUTF16BE(expanded));
  36950. }
  36951. if (actualText) {
  36952. tagDict.set("ActualText", stringToAsciiOrUTF16BE(actualText));
  36953. }
  36954. }
  36955. static #collectParents({
  36956. elements,
  36957. xref,
  36958. pageDict,
  36959. numberTree
  36960. }) {
  36961. const idToElements = new Map();
  36962. for (const element of elements) {
  36963. if (element.structTreeParentId) {
  36964. const id = parseInt(element.structTreeParentId.split("_mc")[1], 10);
  36965. let elems = idToElements.get(id);
  36966. if (!elems) {
  36967. elems = [];
  36968. idToElements.set(id, elems);
  36969. }
  36970. elems.push(element);
  36971. }
  36972. }
  36973. const id = pageDict.get("StructParents");
  36974. if (!Number.isInteger(id)) {
  36975. return;
  36976. }
  36977. const parentArray = numberTree.get(id);
  36978. const updateElement = (kid, pageKid, kidRef) => {
  36979. const elems = idToElements.get(kid);
  36980. if (elems) {
  36981. const parentRef = pageKid.getRaw("P");
  36982. const parentDict = xref.fetchIfRef(parentRef);
  36983. if (parentRef instanceof Ref && parentDict instanceof Dict) {
  36984. const params = {
  36985. ref: kidRef,
  36986. dict: pageKid
  36987. };
  36988. for (const element of elems) {
  36989. element.structTreeParent = params;
  36990. }
  36991. }
  36992. return true;
  36993. }
  36994. return false;
  36995. };
  36996. for (const kidRef of parentArray) {
  36997. if (!(kidRef instanceof Ref)) {
  36998. continue;
  36999. }
  37000. const pageKid = xref.fetch(kidRef);
  37001. const k = pageKid.get("K");
  37002. if (Number.isInteger(k)) {
  37003. updateElement(k, pageKid, kidRef);
  37004. continue;
  37005. }
  37006. if (!Array.isArray(k)) {
  37007. continue;
  37008. }
  37009. for (let kid of k) {
  37010. kid = xref.fetchIfRef(kid);
  37011. if (Number.isInteger(kid) && updateElement(kid, pageKid, kidRef)) {
  37012. break;
  37013. }
  37014. if (!(kid instanceof Dict)) {
  37015. continue;
  37016. }
  37017. if (!isName(kid.get("Type"), "MCR")) {
  37018. break;
  37019. }
  37020. const mcid = kid.get("MCID");
  37021. if (Number.isInteger(mcid) && updateElement(mcid, pageKid, kidRef)) {
  37022. break;
  37023. }
  37024. }
  37025. }
  37026. }
  37027. static async #updateParentTag({
  37028. structTreeParent,
  37029. tagDict,
  37030. newTagRef,
  37031. structTreeRootRef,
  37032. fallbackKids,
  37033. xref,
  37034. cache
  37035. }) {
  37036. let ref = null;
  37037. let parentRef;
  37038. if (structTreeParent) {
  37039. ({
  37040. ref
  37041. } = structTreeParent);
  37042. parentRef = structTreeParent.dict.getRaw("P") || structTreeRootRef;
  37043. } else {
  37044. parentRef = structTreeRootRef;
  37045. }
  37046. tagDict.set("P", parentRef);
  37047. const parentDict = xref.fetchIfRef(parentRef);
  37048. if (!parentDict) {
  37049. fallbackKids.push(newTagRef);
  37050. return;
  37051. }
  37052. let cachedParentDict = cache.get(parentRef);
  37053. if (!cachedParentDict) {
  37054. cachedParentDict = parentDict.clone();
  37055. cache.put(parentRef, cachedParentDict);
  37056. }
  37057. const parentKidsRaw = cachedParentDict.getRaw("K");
  37058. let cachedParentKids = parentKidsRaw instanceof Ref ? cache.get(parentKidsRaw) : null;
  37059. if (!cachedParentKids) {
  37060. cachedParentKids = xref.fetchIfRef(parentKidsRaw);
  37061. cachedParentKids = Array.isArray(cachedParentKids) ? cachedParentKids.slice() : [parentKidsRaw];
  37062. const parentKidsRef = xref.getNewTemporaryRef();
  37063. cachedParentDict.set("K", parentKidsRef);
  37064. cache.put(parentKidsRef, cachedParentKids);
  37065. }
  37066. const index = cachedParentKids.indexOf(ref);
  37067. cachedParentKids.splice(index >= 0 ? index + 1 : cachedParentKids.length, 0, newTagRef);
  37068. }
  37069. }
  37070. class StructElementNode {
  37071. constructor(tree, dict) {
  37072. this.tree = tree;
  37073. this.dict = dict;
  37074. this.kids = [];
  37075. this.parseKids();
  37076. }
  37077. get role() {
  37078. const nameObj = this.dict.get("S");
  37079. const name = nameObj instanceof Name ? nameObj.name : "";
  37080. const {
  37081. root
  37082. } = this.tree;
  37083. if (root.roleMap.has(name)) {
  37084. return root.roleMap.get(name);
  37085. }
  37086. return name;
  37087. }
  37088. parseKids() {
  37089. let pageObjId = null;
  37090. const objRef = this.dict.getRaw("Pg");
  37091. if (objRef instanceof Ref) {
  37092. pageObjId = objRef.toString();
  37093. }
  37094. const kids = this.dict.get("K");
  37095. if (Array.isArray(kids)) {
  37096. for (const kid of kids) {
  37097. const element = this.parseKid(pageObjId, kid);
  37098. if (element) {
  37099. this.kids.push(element);
  37100. }
  37101. }
  37102. } else {
  37103. const element = this.parseKid(pageObjId, kids);
  37104. if (element) {
  37105. this.kids.push(element);
  37106. }
  37107. }
  37108. }
  37109. parseKid(pageObjId, kid) {
  37110. if (Number.isInteger(kid)) {
  37111. if (this.tree.pageDict.objId !== pageObjId) {
  37112. return null;
  37113. }
  37114. return new StructElement({
  37115. type: StructElementType.PAGE_CONTENT,
  37116. mcid: kid,
  37117. pageObjId
  37118. });
  37119. }
  37120. let kidDict = null;
  37121. if (kid instanceof Ref) {
  37122. kidDict = this.dict.xref.fetch(kid);
  37123. } else if (kid instanceof Dict) {
  37124. kidDict = kid;
  37125. }
  37126. if (!kidDict) {
  37127. return null;
  37128. }
  37129. const pageRef = kidDict.getRaw("Pg");
  37130. if (pageRef instanceof Ref) {
  37131. pageObjId = pageRef.toString();
  37132. }
  37133. const type = kidDict.get("Type") instanceof Name ? kidDict.get("Type").name : null;
  37134. if (type === "MCR") {
  37135. if (this.tree.pageDict.objId !== pageObjId) {
  37136. return null;
  37137. }
  37138. const kidRef = kidDict.getRaw("Stm");
  37139. return new StructElement({
  37140. type: StructElementType.STREAM_CONTENT,
  37141. refObjId: kidRef instanceof Ref ? kidRef.toString() : null,
  37142. pageObjId,
  37143. mcid: kidDict.get("MCID")
  37144. });
  37145. }
  37146. if (type === "OBJR") {
  37147. if (this.tree.pageDict.objId !== pageObjId) {
  37148. return null;
  37149. }
  37150. const kidRef = kidDict.getRaw("Obj");
  37151. return new StructElement({
  37152. type: StructElementType.OBJECT,
  37153. refObjId: kidRef instanceof Ref ? kidRef.toString() : null,
  37154. pageObjId
  37155. });
  37156. }
  37157. return new StructElement({
  37158. type: StructElementType.ELEMENT,
  37159. dict: kidDict
  37160. });
  37161. }
  37162. }
  37163. class StructElement {
  37164. constructor({
  37165. type,
  37166. dict = null,
  37167. mcid = null,
  37168. pageObjId = null,
  37169. refObjId = null
  37170. }) {
  37171. this.type = type;
  37172. this.dict = dict;
  37173. this.mcid = mcid;
  37174. this.pageObjId = pageObjId;
  37175. this.refObjId = refObjId;
  37176. this.parentNode = null;
  37177. }
  37178. }
  37179. class StructTreePage {
  37180. constructor(structTreeRoot, pageDict) {
  37181. this.root = structTreeRoot;
  37182. this.rootDict = structTreeRoot ? structTreeRoot.dict : null;
  37183. this.pageDict = pageDict;
  37184. this.nodes = [];
  37185. }
  37186. collectObjects(pageRef) {
  37187. if (!this.root || !this.rootDict || !(pageRef instanceof Ref)) {
  37188. return null;
  37189. }
  37190. const parentTree = this.rootDict.get("ParentTree");
  37191. if (!parentTree) {
  37192. return null;
  37193. }
  37194. const ids = this.root.structParentIds?.get(pageRef);
  37195. if (!ids) {
  37196. return null;
  37197. }
  37198. const map = new Map();
  37199. const numberTree = new NumberTree(parentTree, this.rootDict.xref);
  37200. for (const [elemId] of ids) {
  37201. const obj = numberTree.getRaw(elemId);
  37202. if (obj instanceof Ref) {
  37203. map.set(elemId, obj);
  37204. }
  37205. }
  37206. return map;
  37207. }
  37208. parse(pageRef) {
  37209. if (!this.root || !this.rootDict || !(pageRef instanceof Ref)) {
  37210. return;
  37211. }
  37212. const parentTree = this.rootDict.get("ParentTree");
  37213. if (!parentTree) {
  37214. return;
  37215. }
  37216. const id = this.pageDict.get("StructParents");
  37217. const ids = this.root.structParentIds?.get(pageRef);
  37218. if (!Number.isInteger(id) && !ids) {
  37219. return;
  37220. }
  37221. const map = new Map();
  37222. const numberTree = new NumberTree(parentTree, this.rootDict.xref);
  37223. if (Number.isInteger(id)) {
  37224. const parentArray = numberTree.get(id);
  37225. if (Array.isArray(parentArray)) {
  37226. for (const ref of parentArray) {
  37227. if (ref instanceof Ref) {
  37228. this.addNode(this.rootDict.xref.fetch(ref), map);
  37229. }
  37230. }
  37231. }
  37232. }
  37233. if (!ids) {
  37234. return;
  37235. }
  37236. for (const [elemId, type] of ids) {
  37237. const obj = numberTree.get(elemId);
  37238. if (obj) {
  37239. const elem = this.addNode(this.rootDict.xref.fetchIfRef(obj), map);
  37240. if (elem?.kids?.length === 1 && elem.kids[0].type === StructElementType.OBJECT) {
  37241. elem.kids[0].type = type;
  37242. }
  37243. }
  37244. }
  37245. }
  37246. addNode(dict, map, level = 0) {
  37247. if (level > MAX_DEPTH) {
  37248. warn("StructTree MAX_DEPTH reached.");
  37249. return null;
  37250. }
  37251. if (!(dict instanceof Dict)) {
  37252. return null;
  37253. }
  37254. if (map.has(dict)) {
  37255. return map.get(dict);
  37256. }
  37257. const element = new StructElementNode(this, dict);
  37258. map.set(dict, element);
  37259. const parent = dict.get("P");
  37260. if (!parent || isName(parent.get("Type"), "StructTreeRoot")) {
  37261. if (!this.addTopLevelNode(dict, element)) {
  37262. map.delete(dict);
  37263. }
  37264. return element;
  37265. }
  37266. const parentNode = this.addNode(parent, map, level + 1);
  37267. if (!parentNode) {
  37268. return element;
  37269. }
  37270. let save = false;
  37271. for (const kid of parentNode.kids) {
  37272. if (kid.type === StructElementType.ELEMENT && kid.dict === dict) {
  37273. kid.parentNode = element;
  37274. save = true;
  37275. }
  37276. }
  37277. if (!save) {
  37278. map.delete(dict);
  37279. }
  37280. return element;
  37281. }
  37282. addTopLevelNode(dict, element) {
  37283. const obj = this.rootDict.get("K");
  37284. if (!obj) {
  37285. return false;
  37286. }
  37287. if (obj instanceof Dict) {
  37288. if (obj.objId !== dict.objId) {
  37289. return false;
  37290. }
  37291. this.nodes[0] = element;
  37292. return true;
  37293. }
  37294. if (!Array.isArray(obj)) {
  37295. return true;
  37296. }
  37297. let save = false;
  37298. for (let i = 0; i < obj.length; i++) {
  37299. const kidRef = obj[i];
  37300. if (kidRef?.toString() === dict.objId) {
  37301. this.nodes[i] = element;
  37302. save = true;
  37303. }
  37304. }
  37305. return save;
  37306. }
  37307. get serializable() {
  37308. function nodeToSerializable(node, parent, level = 0) {
  37309. if (level > MAX_DEPTH) {
  37310. warn("StructTree too deep to be fully serialized.");
  37311. return;
  37312. }
  37313. const obj = Object.create(null);
  37314. obj.role = node.role;
  37315. obj.children = [];
  37316. parent.children.push(obj);
  37317. let alt = node.dict.get("Alt");
  37318. if (typeof alt !== "string") {
  37319. alt = node.dict.get("ActualText");
  37320. }
  37321. if (typeof alt === "string") {
  37322. obj.alt = stringToPDFString(alt);
  37323. }
  37324. const a = node.dict.get("A");
  37325. if (a instanceof Dict) {
  37326. const bbox = lookupNormalRect(a.getArray("BBox"), null);
  37327. if (bbox) {
  37328. obj.bbox = bbox;
  37329. } else {
  37330. const width = a.get("Width");
  37331. const height = a.get("Height");
  37332. if (typeof width === "number" && width > 0 && typeof height === "number" && height > 0) {
  37333. obj.bbox = [0, 0, width, height];
  37334. }
  37335. }
  37336. }
  37337. const lang = node.dict.get("Lang");
  37338. if (typeof lang === "string") {
  37339. obj.lang = stringToPDFString(lang);
  37340. }
  37341. for (const kid of node.kids) {
  37342. const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null;
  37343. if (kidElement) {
  37344. nodeToSerializable(kidElement, obj, level + 1);
  37345. continue;
  37346. } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) {
  37347. obj.children.push({
  37348. type: "content",
  37349. id: `p${kid.pageObjId}_mc${kid.mcid}`
  37350. });
  37351. } else if (kid.type === StructElementType.OBJECT) {
  37352. obj.children.push({
  37353. type: "object",
  37354. id: kid.refObjId
  37355. });
  37356. } else if (kid.type === StructElementType.ANNOTATION) {
  37357. obj.children.push({
  37358. type: "annotation",
  37359. id: `${AnnotationPrefix}${kid.refObjId}`
  37360. });
  37361. }
  37362. }
  37363. }
  37364. const root = Object.create(null);
  37365. root.children = [];
  37366. root.role = "Root";
  37367. for (const child of this.nodes) {
  37368. if (!child) {
  37369. continue;
  37370. }
  37371. nodeToSerializable(child, root);
  37372. }
  37373. return root;
  37374. }
  37375. }
  37376. ;// ./src/core/catalog.js
  37377. function isValidExplicitDest(dest) {
  37378. if (!Array.isArray(dest) || dest.length < 2) {
  37379. return false;
  37380. }
  37381. const [page, zoom, ...args] = dest;
  37382. if (!(page instanceof Ref) && !Number.isInteger(page)) {
  37383. return false;
  37384. }
  37385. if (!(zoom instanceof Name)) {
  37386. return false;
  37387. }
  37388. const argsLen = args.length;
  37389. let allowNull = true;
  37390. switch (zoom.name) {
  37391. case "XYZ":
  37392. if (argsLen < 2 || argsLen > 3) {
  37393. return false;
  37394. }
  37395. break;
  37396. case "Fit":
  37397. case "FitB":
  37398. return argsLen === 0;
  37399. case "FitH":
  37400. case "FitBH":
  37401. case "FitV":
  37402. case "FitBV":
  37403. if (argsLen > 1) {
  37404. return false;
  37405. }
  37406. break;
  37407. case "FitR":
  37408. if (argsLen !== 4) {
  37409. return false;
  37410. }
  37411. allowNull = false;
  37412. break;
  37413. default:
  37414. return false;
  37415. }
  37416. for (const arg of args) {
  37417. if (!(typeof arg === "number" || allowNull && arg === null)) {
  37418. return false;
  37419. }
  37420. }
  37421. return true;
  37422. }
  37423. function fetchDest(dest) {
  37424. if (dest instanceof Dict) {
  37425. dest = dest.get("D");
  37426. }
  37427. return isValidExplicitDest(dest) ? dest : null;
  37428. }
  37429. function fetchRemoteDest(action) {
  37430. let dest = action.get("D");
  37431. if (dest) {
  37432. if (dest instanceof Name) {
  37433. dest = dest.name;
  37434. }
  37435. if (typeof dest === "string") {
  37436. return stringToPDFString(dest);
  37437. } else if (isValidExplicitDest(dest)) {
  37438. return JSON.stringify(dest);
  37439. }
  37440. }
  37441. return null;
  37442. }
  37443. class Catalog {
  37444. constructor(pdfManager, xref) {
  37445. this.pdfManager = pdfManager;
  37446. this.xref = xref;
  37447. this._catDict = xref.getCatalogObj();
  37448. if (!(this._catDict instanceof Dict)) {
  37449. throw new FormatError("Catalog object is not a dictionary.");
  37450. }
  37451. this.toplevelPagesDict;
  37452. this._actualNumPages = null;
  37453. this.fontCache = new RefSetCache();
  37454. this.builtInCMapCache = new Map();
  37455. this.standardFontDataCache = new Map();
  37456. this.globalImageCache = new GlobalImageCache();
  37457. this.pageKidsCountCache = new RefSetCache();
  37458. this.pageIndexCache = new RefSetCache();
  37459. this.pageDictCache = new RefSetCache();
  37460. this.nonBlendModesSet = new RefSet();
  37461. this.systemFontCache = new Map();
  37462. }
  37463. cloneDict() {
  37464. return this._catDict.clone();
  37465. }
  37466. get version() {
  37467. const version = this._catDict.get("Version");
  37468. if (version instanceof Name) {
  37469. if (PDF_VERSION_REGEXP.test(version.name)) {
  37470. return shadow(this, "version", version.name);
  37471. }
  37472. warn(`Invalid PDF catalog version: ${version.name}`);
  37473. }
  37474. return shadow(this, "version", null);
  37475. }
  37476. get lang() {
  37477. const lang = this._catDict.get("Lang");
  37478. return shadow(this, "lang", lang && typeof lang === "string" ? stringToPDFString(lang) : null);
  37479. }
  37480. get needsRendering() {
  37481. const needsRendering = this._catDict.get("NeedsRendering");
  37482. return shadow(this, "needsRendering", typeof needsRendering === "boolean" ? needsRendering : false);
  37483. }
  37484. get collection() {
  37485. let collection = null;
  37486. try {
  37487. const obj = this._catDict.get("Collection");
  37488. if (obj instanceof Dict && obj.size > 0) {
  37489. collection = obj;
  37490. }
  37491. } catch (ex) {
  37492. if (ex instanceof MissingDataException) {
  37493. throw ex;
  37494. }
  37495. info("Cannot fetch Collection entry; assuming no collection is present.");
  37496. }
  37497. return shadow(this, "collection", collection);
  37498. }
  37499. get acroForm() {
  37500. let acroForm = null;
  37501. try {
  37502. const obj = this._catDict.get("AcroForm");
  37503. if (obj instanceof Dict && obj.size > 0) {
  37504. acroForm = obj;
  37505. }
  37506. } catch (ex) {
  37507. if (ex instanceof MissingDataException) {
  37508. throw ex;
  37509. }
  37510. info("Cannot fetch AcroForm entry; assuming no forms are present.");
  37511. }
  37512. return shadow(this, "acroForm", acroForm);
  37513. }
  37514. get acroFormRef() {
  37515. const value = this._catDict.getRaw("AcroForm");
  37516. return shadow(this, "acroFormRef", value instanceof Ref ? value : null);
  37517. }
  37518. get metadata() {
  37519. const streamRef = this._catDict.getRaw("Metadata");
  37520. if (!(streamRef instanceof Ref)) {
  37521. return shadow(this, "metadata", null);
  37522. }
  37523. let metadata = null;
  37524. try {
  37525. const stream = this.xref.fetch(streamRef, !this.xref.encrypt?.encryptMetadata);
  37526. if (stream instanceof BaseStream && stream.dict instanceof Dict) {
  37527. const type = stream.dict.get("Type");
  37528. const subtype = stream.dict.get("Subtype");
  37529. if (isName(type, "Metadata") && isName(subtype, "XML")) {
  37530. const data = stringToUTF8String(stream.getString());
  37531. if (data) {
  37532. metadata = new MetadataParser(data).serializable;
  37533. }
  37534. }
  37535. }
  37536. } catch (ex) {
  37537. if (ex instanceof MissingDataException) {
  37538. throw ex;
  37539. }
  37540. info(`Skipping invalid Metadata: "${ex}".`);
  37541. }
  37542. return shadow(this, "metadata", metadata);
  37543. }
  37544. get markInfo() {
  37545. let markInfo = null;
  37546. try {
  37547. markInfo = this._readMarkInfo();
  37548. } catch (ex) {
  37549. if (ex instanceof MissingDataException) {
  37550. throw ex;
  37551. }
  37552. warn("Unable to read mark info.");
  37553. }
  37554. return shadow(this, "markInfo", markInfo);
  37555. }
  37556. _readMarkInfo() {
  37557. const obj = this._catDict.get("MarkInfo");
  37558. if (!(obj instanceof Dict)) {
  37559. return null;
  37560. }
  37561. const markInfo = {
  37562. Marked: false,
  37563. UserProperties: false,
  37564. Suspects: false
  37565. };
  37566. for (const key in markInfo) {
  37567. const value = obj.get(key);
  37568. if (typeof value === "boolean") {
  37569. markInfo[key] = value;
  37570. }
  37571. }
  37572. return markInfo;
  37573. }
  37574. get structTreeRoot() {
  37575. let structTree = null;
  37576. try {
  37577. structTree = this._readStructTreeRoot();
  37578. } catch (ex) {
  37579. if (ex instanceof MissingDataException) {
  37580. throw ex;
  37581. }
  37582. warn("Unable read to structTreeRoot info.");
  37583. }
  37584. return shadow(this, "structTreeRoot", structTree);
  37585. }
  37586. _readStructTreeRoot() {
  37587. const rawObj = this._catDict.getRaw("StructTreeRoot");
  37588. const obj = this.xref.fetchIfRef(rawObj);
  37589. if (!(obj instanceof Dict)) {
  37590. return null;
  37591. }
  37592. const root = new StructTreeRoot(obj, rawObj);
  37593. root.init();
  37594. return root;
  37595. }
  37596. get toplevelPagesDict() {
  37597. const pagesObj = this._catDict.get("Pages");
  37598. if (!(pagesObj instanceof Dict)) {
  37599. throw new FormatError("Invalid top-level pages dictionary.");
  37600. }
  37601. return shadow(this, "toplevelPagesDict", pagesObj);
  37602. }
  37603. get documentOutline() {
  37604. let obj = null;
  37605. try {
  37606. obj = this._readDocumentOutline();
  37607. } catch (ex) {
  37608. if (ex instanceof MissingDataException) {
  37609. throw ex;
  37610. }
  37611. warn("Unable to read document outline.");
  37612. }
  37613. return shadow(this, "documentOutline", obj);
  37614. }
  37615. _readDocumentOutline() {
  37616. let obj = this._catDict.get("Outlines");
  37617. if (!(obj instanceof Dict)) {
  37618. return null;
  37619. }
  37620. obj = obj.getRaw("First");
  37621. if (!(obj instanceof Ref)) {
  37622. return null;
  37623. }
  37624. const root = {
  37625. items: []
  37626. };
  37627. const queue = [{
  37628. obj,
  37629. parent: root
  37630. }];
  37631. const processed = new RefSet();
  37632. processed.put(obj);
  37633. const xref = this.xref,
  37634. blackColor = new Uint8ClampedArray(3);
  37635. while (queue.length > 0) {
  37636. const i = queue.shift();
  37637. const outlineDict = xref.fetchIfRef(i.obj);
  37638. if (outlineDict === null) {
  37639. continue;
  37640. }
  37641. if (!outlineDict.has("Title")) {
  37642. warn("Invalid outline item encountered.");
  37643. }
  37644. const data = {
  37645. url: null,
  37646. dest: null,
  37647. action: null
  37648. };
  37649. Catalog.parseDestDictionary({
  37650. destDict: outlineDict,
  37651. resultObj: data,
  37652. docBaseUrl: this.baseUrl,
  37653. docAttachments: this.attachments
  37654. });
  37655. const title = outlineDict.get("Title");
  37656. const flags = outlineDict.get("F") || 0;
  37657. const color = outlineDict.getArray("C");
  37658. const count = outlineDict.get("Count");
  37659. let rgbColor = blackColor;
  37660. if (isNumberArray(color, 3) && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  37661. rgbColor = ColorSpace.singletons.rgb.getRgb(color, 0);
  37662. }
  37663. const outlineItem = {
  37664. action: data.action,
  37665. attachment: data.attachment,
  37666. dest: data.dest,
  37667. url: data.url,
  37668. unsafeUrl: data.unsafeUrl,
  37669. newWindow: data.newWindow,
  37670. setOCGState: data.setOCGState,
  37671. title: typeof title === "string" ? stringToPDFString(title) : "",
  37672. color: rgbColor,
  37673. count: Number.isInteger(count) ? count : undefined,
  37674. bold: !!(flags & 2),
  37675. italic: !!(flags & 1),
  37676. items: []
  37677. };
  37678. i.parent.items.push(outlineItem);
  37679. obj = outlineDict.getRaw("First");
  37680. if (obj instanceof Ref && !processed.has(obj)) {
  37681. queue.push({
  37682. obj,
  37683. parent: outlineItem
  37684. });
  37685. processed.put(obj);
  37686. }
  37687. obj = outlineDict.getRaw("Next");
  37688. if (obj instanceof Ref && !processed.has(obj)) {
  37689. queue.push({
  37690. obj,
  37691. parent: i.parent
  37692. });
  37693. processed.put(obj);
  37694. }
  37695. }
  37696. return root.items.length > 0 ? root.items : null;
  37697. }
  37698. get permissions() {
  37699. let permissions = null;
  37700. try {
  37701. permissions = this._readPermissions();
  37702. } catch (ex) {
  37703. if (ex instanceof MissingDataException) {
  37704. throw ex;
  37705. }
  37706. warn("Unable to read permissions.");
  37707. }
  37708. return shadow(this, "permissions", permissions);
  37709. }
  37710. _readPermissions() {
  37711. const encrypt = this.xref.trailer.get("Encrypt");
  37712. if (!(encrypt instanceof Dict)) {
  37713. return null;
  37714. }
  37715. let flags = encrypt.get("P");
  37716. if (typeof flags !== "number") {
  37717. return null;
  37718. }
  37719. flags += 2 ** 32;
  37720. const permissions = [];
  37721. for (const key in PermissionFlag) {
  37722. const value = PermissionFlag[key];
  37723. if (flags & value) {
  37724. permissions.push(value);
  37725. }
  37726. }
  37727. return permissions;
  37728. }
  37729. get optionalContentConfig() {
  37730. let config = null;
  37731. try {
  37732. const properties = this._catDict.get("OCProperties");
  37733. if (!properties) {
  37734. return shadow(this, "optionalContentConfig", null);
  37735. }
  37736. const defaultConfig = properties.get("D");
  37737. if (!defaultConfig) {
  37738. return shadow(this, "optionalContentConfig", null);
  37739. }
  37740. const groupsData = properties.get("OCGs");
  37741. if (!Array.isArray(groupsData)) {
  37742. return shadow(this, "optionalContentConfig", null);
  37743. }
  37744. const groupRefCache = new RefSetCache();
  37745. for (const groupRef of groupsData) {
  37746. if (!(groupRef instanceof Ref) || groupRefCache.has(groupRef)) {
  37747. continue;
  37748. }
  37749. groupRefCache.put(groupRef, this.#readOptionalContentGroup(groupRef));
  37750. }
  37751. config = this.#readOptionalContentConfig(defaultConfig, groupRefCache);
  37752. } catch (ex) {
  37753. if (ex instanceof MissingDataException) {
  37754. throw ex;
  37755. }
  37756. warn(`Unable to read optional content config: ${ex}`);
  37757. }
  37758. return shadow(this, "optionalContentConfig", config);
  37759. }
  37760. #readOptionalContentGroup(groupRef) {
  37761. const group = this.xref.fetch(groupRef);
  37762. const obj = {
  37763. id: groupRef.toString(),
  37764. name: null,
  37765. intent: null,
  37766. usage: {
  37767. print: null,
  37768. view: null
  37769. },
  37770. rbGroups: []
  37771. };
  37772. const name = group.get("Name");
  37773. if (typeof name === "string") {
  37774. obj.name = stringToPDFString(name);
  37775. }
  37776. let intent = group.getArray("Intent");
  37777. if (!Array.isArray(intent)) {
  37778. intent = [intent];
  37779. }
  37780. if (intent.every(i => i instanceof Name)) {
  37781. obj.intent = intent.map(i => i.name);
  37782. }
  37783. const usage = group.get("Usage");
  37784. if (!(usage instanceof Dict)) {
  37785. return obj;
  37786. }
  37787. const usageObj = obj.usage;
  37788. const print = usage.get("Print");
  37789. if (print instanceof Dict) {
  37790. const printState = print.get("PrintState");
  37791. if (printState instanceof Name) {
  37792. switch (printState.name) {
  37793. case "ON":
  37794. case "OFF":
  37795. usageObj.print = {
  37796. printState: printState.name
  37797. };
  37798. }
  37799. }
  37800. }
  37801. const view = usage.get("View");
  37802. if (view instanceof Dict) {
  37803. const viewState = view.get("ViewState");
  37804. if (viewState instanceof Name) {
  37805. switch (viewState.name) {
  37806. case "ON":
  37807. case "OFF":
  37808. usageObj.view = {
  37809. viewState: viewState.name
  37810. };
  37811. }
  37812. }
  37813. }
  37814. return obj;
  37815. }
  37816. #readOptionalContentConfig(config, groupRefCache) {
  37817. function parseOnOff(refs) {
  37818. const onParsed = [];
  37819. if (Array.isArray(refs)) {
  37820. for (const value of refs) {
  37821. if (!(value instanceof Ref)) {
  37822. continue;
  37823. }
  37824. if (groupRefCache.has(value)) {
  37825. onParsed.push(value.toString());
  37826. }
  37827. }
  37828. }
  37829. return onParsed;
  37830. }
  37831. function parseOrder(refs, nestedLevels = 0) {
  37832. if (!Array.isArray(refs)) {
  37833. return null;
  37834. }
  37835. const order = [];
  37836. for (const value of refs) {
  37837. if (value instanceof Ref && groupRefCache.has(value)) {
  37838. parsedOrderRefs.put(value);
  37839. order.push(value.toString());
  37840. continue;
  37841. }
  37842. const nestedOrder = parseNestedOrder(value, nestedLevels);
  37843. if (nestedOrder) {
  37844. order.push(nestedOrder);
  37845. }
  37846. }
  37847. if (nestedLevels > 0) {
  37848. return order;
  37849. }
  37850. const hiddenGroups = [];
  37851. for (const [groupRef] of groupRefCache.items()) {
  37852. if (parsedOrderRefs.has(groupRef)) {
  37853. continue;
  37854. }
  37855. hiddenGroups.push(groupRef.toString());
  37856. }
  37857. if (hiddenGroups.length) {
  37858. order.push({
  37859. name: null,
  37860. order: hiddenGroups
  37861. });
  37862. }
  37863. return order;
  37864. }
  37865. function parseNestedOrder(ref, nestedLevels) {
  37866. if (++nestedLevels > MAX_NESTED_LEVELS) {
  37867. warn("parseNestedOrder - reached MAX_NESTED_LEVELS.");
  37868. return null;
  37869. }
  37870. const value = xref.fetchIfRef(ref);
  37871. if (!Array.isArray(value)) {
  37872. return null;
  37873. }
  37874. const nestedName = xref.fetchIfRef(value[0]);
  37875. if (typeof nestedName !== "string") {
  37876. return null;
  37877. }
  37878. const nestedOrder = parseOrder(value.slice(1), nestedLevels);
  37879. if (!nestedOrder || !nestedOrder.length) {
  37880. return null;
  37881. }
  37882. return {
  37883. name: stringToPDFString(nestedName),
  37884. order: nestedOrder
  37885. };
  37886. }
  37887. function parseRBGroups(rbGroups) {
  37888. if (!Array.isArray(rbGroups)) {
  37889. return;
  37890. }
  37891. for (const value of rbGroups) {
  37892. const rbGroup = xref.fetchIfRef(value);
  37893. if (!Array.isArray(rbGroup) || !rbGroup.length) {
  37894. continue;
  37895. }
  37896. const parsedRbGroup = new Set();
  37897. for (const ref of rbGroup) {
  37898. if (ref instanceof Ref && groupRefCache.has(ref) && !parsedRbGroup.has(ref.toString())) {
  37899. parsedRbGroup.add(ref.toString());
  37900. groupRefCache.get(ref).rbGroups.push(parsedRbGroup);
  37901. }
  37902. }
  37903. }
  37904. }
  37905. const xref = this.xref,
  37906. parsedOrderRefs = new RefSet(),
  37907. MAX_NESTED_LEVELS = 10;
  37908. parseRBGroups(config.get("RBGroups"));
  37909. return {
  37910. name: typeof config.get("Name") === "string" ? stringToPDFString(config.get("Name")) : null,
  37911. creator: typeof config.get("Creator") === "string" ? stringToPDFString(config.get("Creator")) : null,
  37912. baseState: config.get("BaseState") instanceof Name ? config.get("BaseState").name : null,
  37913. on: parseOnOff(config.get("ON")),
  37914. off: parseOnOff(config.get("OFF")),
  37915. order: parseOrder(config.get("Order")),
  37916. groups: [...groupRefCache]
  37917. };
  37918. }
  37919. setActualNumPages(num = null) {
  37920. this._actualNumPages = num;
  37921. }
  37922. get hasActualNumPages() {
  37923. return this._actualNumPages !== null;
  37924. }
  37925. get _pagesCount() {
  37926. const obj = this.toplevelPagesDict.get("Count");
  37927. if (!Number.isInteger(obj)) {
  37928. throw new FormatError("Page count in top-level pages dictionary is not an integer.");
  37929. }
  37930. return shadow(this, "_pagesCount", obj);
  37931. }
  37932. get numPages() {
  37933. return this.hasActualNumPages ? this._actualNumPages : this._pagesCount;
  37934. }
  37935. get destinations() {
  37936. const obj = this._readDests(),
  37937. dests = Object.create(null);
  37938. if (obj instanceof NameTree) {
  37939. for (const [key, value] of obj.getAll()) {
  37940. const dest = fetchDest(value);
  37941. if (dest) {
  37942. dests[stringToPDFString(key)] = dest;
  37943. }
  37944. }
  37945. } else if (obj instanceof Dict) {
  37946. obj.forEach(function (key, value) {
  37947. const dest = fetchDest(value);
  37948. if (dest) {
  37949. dests[key] = dest;
  37950. }
  37951. });
  37952. }
  37953. return shadow(this, "destinations", dests);
  37954. }
  37955. getDestination(id) {
  37956. const obj = this._readDests();
  37957. if (obj instanceof NameTree) {
  37958. const dest = fetchDest(obj.get(id));
  37959. if (dest) {
  37960. return dest;
  37961. }
  37962. const allDest = this.destinations[id];
  37963. if (allDest) {
  37964. warn(`Found "${id}" at an incorrect position in the NameTree.`);
  37965. return allDest;
  37966. }
  37967. } else if (obj instanceof Dict) {
  37968. const dest = fetchDest(obj.get(id));
  37969. if (dest) {
  37970. return dest;
  37971. }
  37972. }
  37973. return null;
  37974. }
  37975. _readDests() {
  37976. const obj = this._catDict.get("Names");
  37977. if (obj?.has("Dests")) {
  37978. return new NameTree(obj.getRaw("Dests"), this.xref);
  37979. } else if (this._catDict.has("Dests")) {
  37980. return this._catDict.get("Dests");
  37981. }
  37982. return undefined;
  37983. }
  37984. get pageLabels() {
  37985. let obj = null;
  37986. try {
  37987. obj = this._readPageLabels();
  37988. } catch (ex) {
  37989. if (ex instanceof MissingDataException) {
  37990. throw ex;
  37991. }
  37992. warn("Unable to read page labels.");
  37993. }
  37994. return shadow(this, "pageLabels", obj);
  37995. }
  37996. _readPageLabels() {
  37997. const obj = this._catDict.getRaw("PageLabels");
  37998. if (!obj) {
  37999. return null;
  38000. }
  38001. const pageLabels = new Array(this.numPages);
  38002. let style = null,
  38003. prefix = "";
  38004. const numberTree = new NumberTree(obj, this.xref);
  38005. const nums = numberTree.getAll();
  38006. let currentLabel = "",
  38007. currentIndex = 1;
  38008. for (let i = 0, ii = this.numPages; i < ii; i++) {
  38009. const labelDict = nums.get(i);
  38010. if (labelDict !== undefined) {
  38011. if (!(labelDict instanceof Dict)) {
  38012. throw new FormatError("PageLabel is not a dictionary.");
  38013. }
  38014. if (labelDict.has("Type") && !isName(labelDict.get("Type"), "PageLabel")) {
  38015. throw new FormatError("Invalid type in PageLabel dictionary.");
  38016. }
  38017. if (labelDict.has("S")) {
  38018. const s = labelDict.get("S");
  38019. if (!(s instanceof Name)) {
  38020. throw new FormatError("Invalid style in PageLabel dictionary.");
  38021. }
  38022. style = s.name;
  38023. } else {
  38024. style = null;
  38025. }
  38026. if (labelDict.has("P")) {
  38027. const p = labelDict.get("P");
  38028. if (typeof p !== "string") {
  38029. throw new FormatError("Invalid prefix in PageLabel dictionary.");
  38030. }
  38031. prefix = stringToPDFString(p);
  38032. } else {
  38033. prefix = "";
  38034. }
  38035. if (labelDict.has("St")) {
  38036. const st = labelDict.get("St");
  38037. if (!(Number.isInteger(st) && st >= 1)) {
  38038. throw new FormatError("Invalid start in PageLabel dictionary.");
  38039. }
  38040. currentIndex = st;
  38041. } else {
  38042. currentIndex = 1;
  38043. }
  38044. }
  38045. switch (style) {
  38046. case "D":
  38047. currentLabel = currentIndex;
  38048. break;
  38049. case "R":
  38050. case "r":
  38051. currentLabel = toRomanNumerals(currentIndex, style === "r");
  38052. break;
  38053. case "A":
  38054. case "a":
  38055. const LIMIT = 26;
  38056. const A_UPPER_CASE = 0x41,
  38057. A_LOWER_CASE = 0x61;
  38058. const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  38059. const letterIndex = currentIndex - 1;
  38060. const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  38061. currentLabel = character.repeat(Math.floor(letterIndex / LIMIT) + 1);
  38062. break;
  38063. default:
  38064. if (style) {
  38065. throw new FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
  38066. }
  38067. currentLabel = "";
  38068. }
  38069. pageLabels[i] = prefix + currentLabel;
  38070. currentIndex++;
  38071. }
  38072. return pageLabels;
  38073. }
  38074. get pageLayout() {
  38075. const obj = this._catDict.get("PageLayout");
  38076. let pageLayout = "";
  38077. if (obj instanceof Name) {
  38078. switch (obj.name) {
  38079. case "SinglePage":
  38080. case "OneColumn":
  38081. case "TwoColumnLeft":
  38082. case "TwoColumnRight":
  38083. case "TwoPageLeft":
  38084. case "TwoPageRight":
  38085. pageLayout = obj.name;
  38086. }
  38087. }
  38088. return shadow(this, "pageLayout", pageLayout);
  38089. }
  38090. get pageMode() {
  38091. const obj = this._catDict.get("PageMode");
  38092. let pageMode = "UseNone";
  38093. if (obj instanceof Name) {
  38094. switch (obj.name) {
  38095. case "UseNone":
  38096. case "UseOutlines":
  38097. case "UseThumbs":
  38098. case "FullScreen":
  38099. case "UseOC":
  38100. case "UseAttachments":
  38101. pageMode = obj.name;
  38102. }
  38103. }
  38104. return shadow(this, "pageMode", pageMode);
  38105. }
  38106. get viewerPreferences() {
  38107. const obj = this._catDict.get("ViewerPreferences");
  38108. if (!(obj instanceof Dict)) {
  38109. return shadow(this, "viewerPreferences", null);
  38110. }
  38111. let prefs = null;
  38112. for (const key of obj.getKeys()) {
  38113. const value = obj.get(key);
  38114. let prefValue;
  38115. switch (key) {
  38116. case "HideToolbar":
  38117. case "HideMenubar":
  38118. case "HideWindowUI":
  38119. case "FitWindow":
  38120. case "CenterWindow":
  38121. case "DisplayDocTitle":
  38122. case "PickTrayByPDFSize":
  38123. if (typeof value === "boolean") {
  38124. prefValue = value;
  38125. }
  38126. break;
  38127. case "NonFullScreenPageMode":
  38128. if (value instanceof Name) {
  38129. switch (value.name) {
  38130. case "UseNone":
  38131. case "UseOutlines":
  38132. case "UseThumbs":
  38133. case "UseOC":
  38134. prefValue = value.name;
  38135. break;
  38136. default:
  38137. prefValue = "UseNone";
  38138. }
  38139. }
  38140. break;
  38141. case "Direction":
  38142. if (value instanceof Name) {
  38143. switch (value.name) {
  38144. case "L2R":
  38145. case "R2L":
  38146. prefValue = value.name;
  38147. break;
  38148. default:
  38149. prefValue = "L2R";
  38150. }
  38151. }
  38152. break;
  38153. case "ViewArea":
  38154. case "ViewClip":
  38155. case "PrintArea":
  38156. case "PrintClip":
  38157. if (value instanceof Name) {
  38158. switch (value.name) {
  38159. case "MediaBox":
  38160. case "CropBox":
  38161. case "BleedBox":
  38162. case "TrimBox":
  38163. case "ArtBox":
  38164. prefValue = value.name;
  38165. break;
  38166. default:
  38167. prefValue = "CropBox";
  38168. }
  38169. }
  38170. break;
  38171. case "PrintScaling":
  38172. if (value instanceof Name) {
  38173. switch (value.name) {
  38174. case "None":
  38175. case "AppDefault":
  38176. prefValue = value.name;
  38177. break;
  38178. default:
  38179. prefValue = "AppDefault";
  38180. }
  38181. }
  38182. break;
  38183. case "Duplex":
  38184. if (value instanceof Name) {
  38185. switch (value.name) {
  38186. case "Simplex":
  38187. case "DuplexFlipShortEdge":
  38188. case "DuplexFlipLongEdge":
  38189. prefValue = value.name;
  38190. break;
  38191. default:
  38192. prefValue = "None";
  38193. }
  38194. }
  38195. break;
  38196. case "PrintPageRange":
  38197. if (Array.isArray(value) && value.length % 2 === 0) {
  38198. const isValid = value.every((page, i, arr) => Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages);
  38199. if (isValid) {
  38200. prefValue = value;
  38201. }
  38202. }
  38203. break;
  38204. case "NumCopies":
  38205. if (Number.isInteger(value) && value > 0) {
  38206. prefValue = value;
  38207. }
  38208. break;
  38209. default:
  38210. warn(`Ignoring non-standard key in ViewerPreferences: ${key}.`);
  38211. continue;
  38212. }
  38213. if (prefValue === undefined) {
  38214. warn(`Bad value, for key "${key}", in ViewerPreferences: ${value}.`);
  38215. continue;
  38216. }
  38217. if (!prefs) {
  38218. prefs = Object.create(null);
  38219. }
  38220. prefs[key] = prefValue;
  38221. }
  38222. return shadow(this, "viewerPreferences", prefs);
  38223. }
  38224. get openAction() {
  38225. const obj = this._catDict.get("OpenAction");
  38226. const openAction = Object.create(null);
  38227. if (obj instanceof Dict) {
  38228. const destDict = new Dict(this.xref);
  38229. destDict.set("A", obj);
  38230. const resultObj = {
  38231. url: null,
  38232. dest: null,
  38233. action: null
  38234. };
  38235. Catalog.parseDestDictionary({
  38236. destDict,
  38237. resultObj
  38238. });
  38239. if (Array.isArray(resultObj.dest)) {
  38240. openAction.dest = resultObj.dest;
  38241. } else if (resultObj.action) {
  38242. openAction.action = resultObj.action;
  38243. }
  38244. } else if (Array.isArray(obj)) {
  38245. openAction.dest = obj;
  38246. }
  38247. return shadow(this, "openAction", objectSize(openAction) > 0 ? openAction : null);
  38248. }
  38249. get attachments() {
  38250. const obj = this._catDict.get("Names");
  38251. let attachments = null;
  38252. if (obj instanceof Dict && obj.has("EmbeddedFiles")) {
  38253. const nameTree = new NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
  38254. for (const [key, value] of nameTree.getAll()) {
  38255. const fs = new FileSpec(value, this.xref);
  38256. if (!attachments) {
  38257. attachments = Object.create(null);
  38258. }
  38259. attachments[stringToPDFString(key)] = fs.serializable;
  38260. }
  38261. }
  38262. return shadow(this, "attachments", attachments);
  38263. }
  38264. get xfaImages() {
  38265. const obj = this._catDict.get("Names");
  38266. let xfaImages = null;
  38267. if (obj instanceof Dict && obj.has("XFAImages")) {
  38268. const nameTree = new NameTree(obj.getRaw("XFAImages"), this.xref);
  38269. for (const [key, value] of nameTree.getAll()) {
  38270. if (!xfaImages) {
  38271. xfaImages = new Dict(this.xref);
  38272. }
  38273. xfaImages.set(stringToPDFString(key), value);
  38274. }
  38275. }
  38276. return shadow(this, "xfaImages", xfaImages);
  38277. }
  38278. _collectJavaScript() {
  38279. const obj = this._catDict.get("Names");
  38280. let javaScript = null;
  38281. function appendIfJavaScriptDict(name, jsDict) {
  38282. if (!(jsDict instanceof Dict)) {
  38283. return;
  38284. }
  38285. if (!isName(jsDict.get("S"), "JavaScript")) {
  38286. return;
  38287. }
  38288. let js = jsDict.get("JS");
  38289. if (js instanceof BaseStream) {
  38290. js = js.getString();
  38291. } else if (typeof js !== "string") {
  38292. return;
  38293. }
  38294. js = stringToPDFString(js).replaceAll("\x00", "");
  38295. if (js) {
  38296. (javaScript ||= new Map()).set(name, js);
  38297. }
  38298. }
  38299. if (obj instanceof Dict && obj.has("JavaScript")) {
  38300. const nameTree = new NameTree(obj.getRaw("JavaScript"), this.xref);
  38301. for (const [key, value] of nameTree.getAll()) {
  38302. appendIfJavaScriptDict(stringToPDFString(key), value);
  38303. }
  38304. }
  38305. const openAction = this._catDict.get("OpenAction");
  38306. if (openAction) {
  38307. appendIfJavaScriptDict("OpenAction", openAction);
  38308. }
  38309. return javaScript;
  38310. }
  38311. get jsActions() {
  38312. const javaScript = this._collectJavaScript();
  38313. let actions = collectActions(this.xref, this._catDict, DocumentActionEventType);
  38314. if (javaScript) {
  38315. actions ||= Object.create(null);
  38316. for (const [key, val] of javaScript) {
  38317. if (key in actions) {
  38318. actions[key].push(val);
  38319. } else {
  38320. actions[key] = [val];
  38321. }
  38322. }
  38323. }
  38324. return shadow(this, "jsActions", actions);
  38325. }
  38326. async fontFallback(id, handler) {
  38327. const translatedFonts = await Promise.all(this.fontCache);
  38328. for (const translatedFont of translatedFonts) {
  38329. if (translatedFont.loadedName === id) {
  38330. translatedFont.fallback(handler);
  38331. return;
  38332. }
  38333. }
  38334. }
  38335. async cleanup(manuallyTriggered = false) {
  38336. clearGlobalCaches();
  38337. this.globalImageCache.clear(manuallyTriggered);
  38338. this.pageKidsCountCache.clear();
  38339. this.pageIndexCache.clear();
  38340. this.pageDictCache.clear();
  38341. this.nonBlendModesSet.clear();
  38342. const translatedFonts = await Promise.all(this.fontCache);
  38343. for (const {
  38344. dict
  38345. } of translatedFonts) {
  38346. delete dict.cacheKey;
  38347. }
  38348. this.fontCache.clear();
  38349. this.builtInCMapCache.clear();
  38350. this.standardFontDataCache.clear();
  38351. this.systemFontCache.clear();
  38352. }
  38353. async getPageDict(pageIndex) {
  38354. const nodesToVisit = [this.toplevelPagesDict];
  38355. const visitedNodes = new RefSet();
  38356. const pagesRef = this._catDict.getRaw("Pages");
  38357. if (pagesRef instanceof Ref) {
  38358. visitedNodes.put(pagesRef);
  38359. }
  38360. const xref = this.xref,
  38361. pageKidsCountCache = this.pageKidsCountCache,
  38362. pageIndexCache = this.pageIndexCache,
  38363. pageDictCache = this.pageDictCache;
  38364. let currentPageIndex = 0;
  38365. while (nodesToVisit.length) {
  38366. const currentNode = nodesToVisit.pop();
  38367. if (currentNode instanceof Ref) {
  38368. const count = pageKidsCountCache.get(currentNode);
  38369. if (count >= 0 && currentPageIndex + count <= pageIndex) {
  38370. currentPageIndex += count;
  38371. continue;
  38372. }
  38373. if (visitedNodes.has(currentNode)) {
  38374. throw new FormatError("Pages tree contains circular reference.");
  38375. }
  38376. visitedNodes.put(currentNode);
  38377. const obj = await (pageDictCache.get(currentNode) || xref.fetchAsync(currentNode));
  38378. if (obj instanceof Dict) {
  38379. let type = obj.getRaw("Type");
  38380. if (type instanceof Ref) {
  38381. type = await xref.fetchAsync(type);
  38382. }
  38383. if (isName(type, "Page") || !obj.has("Kids")) {
  38384. if (!pageKidsCountCache.has(currentNode)) {
  38385. pageKidsCountCache.put(currentNode, 1);
  38386. }
  38387. if (!pageIndexCache.has(currentNode)) {
  38388. pageIndexCache.put(currentNode, currentPageIndex);
  38389. }
  38390. if (currentPageIndex === pageIndex) {
  38391. return [obj, currentNode];
  38392. }
  38393. currentPageIndex++;
  38394. continue;
  38395. }
  38396. }
  38397. nodesToVisit.push(obj);
  38398. continue;
  38399. }
  38400. if (!(currentNode instanceof Dict)) {
  38401. throw new FormatError("Page dictionary kid reference points to wrong type of object.");
  38402. }
  38403. const {
  38404. objId
  38405. } = currentNode;
  38406. let count = currentNode.getRaw("Count");
  38407. if (count instanceof Ref) {
  38408. count = await xref.fetchAsync(count);
  38409. }
  38410. if (Number.isInteger(count) && count >= 0) {
  38411. if (objId && !pageKidsCountCache.has(objId)) {
  38412. pageKidsCountCache.put(objId, count);
  38413. }
  38414. if (currentPageIndex + count <= pageIndex) {
  38415. currentPageIndex += count;
  38416. continue;
  38417. }
  38418. }
  38419. let kids = currentNode.getRaw("Kids");
  38420. if (kids instanceof Ref) {
  38421. kids = await xref.fetchAsync(kids);
  38422. }
  38423. if (!Array.isArray(kids)) {
  38424. let type = currentNode.getRaw("Type");
  38425. if (type instanceof Ref) {
  38426. type = await xref.fetchAsync(type);
  38427. }
  38428. if (isName(type, "Page") || !currentNode.has("Kids")) {
  38429. if (currentPageIndex === pageIndex) {
  38430. return [currentNode, null];
  38431. }
  38432. currentPageIndex++;
  38433. continue;
  38434. }
  38435. throw new FormatError("Page dictionary kids object is not an array.");
  38436. }
  38437. for (let last = kids.length - 1; last >= 0; last--) {
  38438. const lastKid = kids[last];
  38439. nodesToVisit.push(lastKid);
  38440. if (currentNode === this.toplevelPagesDict && lastKid instanceof Ref && !pageDictCache.has(lastKid)) {
  38441. pageDictCache.put(lastKid, xref.fetchAsync(lastKid));
  38442. }
  38443. }
  38444. }
  38445. throw new Error(`Page index ${pageIndex} not found.`);
  38446. }
  38447. async getAllPageDicts(recoveryMode = false) {
  38448. const {
  38449. ignoreErrors
  38450. } = this.pdfManager.evaluatorOptions;
  38451. const queue = [{
  38452. currentNode: this.toplevelPagesDict,
  38453. posInKids: 0
  38454. }];
  38455. const visitedNodes = new RefSet();
  38456. const pagesRef = this._catDict.getRaw("Pages");
  38457. if (pagesRef instanceof Ref) {
  38458. visitedNodes.put(pagesRef);
  38459. }
  38460. const map = new Map(),
  38461. xref = this.xref,
  38462. pageIndexCache = this.pageIndexCache;
  38463. let pageIndex = 0;
  38464. function addPageDict(pageDict, pageRef) {
  38465. if (pageRef && !pageIndexCache.has(pageRef)) {
  38466. pageIndexCache.put(pageRef, pageIndex);
  38467. }
  38468. map.set(pageIndex++, [pageDict, pageRef]);
  38469. }
  38470. function addPageError(error) {
  38471. if (error instanceof XRefEntryException && !recoveryMode) {
  38472. throw error;
  38473. }
  38474. if (recoveryMode && ignoreErrors && pageIndex === 0) {
  38475. warn(`getAllPageDicts - Skipping invalid first page: "${error}".`);
  38476. error = Dict.empty;
  38477. }
  38478. map.set(pageIndex++, [error, null]);
  38479. }
  38480. while (queue.length > 0) {
  38481. const queueItem = queue.at(-1);
  38482. const {
  38483. currentNode,
  38484. posInKids
  38485. } = queueItem;
  38486. let kids = currentNode.getRaw("Kids");
  38487. if (kids instanceof Ref) {
  38488. try {
  38489. kids = await xref.fetchAsync(kids);
  38490. } catch (ex) {
  38491. addPageError(ex);
  38492. break;
  38493. }
  38494. }
  38495. if (!Array.isArray(kids)) {
  38496. addPageError(new FormatError("Page dictionary kids object is not an array."));
  38497. break;
  38498. }
  38499. if (posInKids >= kids.length) {
  38500. queue.pop();
  38501. continue;
  38502. }
  38503. const kidObj = kids[posInKids];
  38504. let obj;
  38505. if (kidObj instanceof Ref) {
  38506. if (visitedNodes.has(kidObj)) {
  38507. addPageError(new FormatError("Pages tree contains circular reference."));
  38508. break;
  38509. }
  38510. visitedNodes.put(kidObj);
  38511. try {
  38512. obj = await xref.fetchAsync(kidObj);
  38513. } catch (ex) {
  38514. addPageError(ex);
  38515. break;
  38516. }
  38517. } else {
  38518. obj = kidObj;
  38519. }
  38520. if (!(obj instanceof Dict)) {
  38521. addPageError(new FormatError("Page dictionary kid reference points to wrong type of object."));
  38522. break;
  38523. }
  38524. let type = obj.getRaw("Type");
  38525. if (type instanceof Ref) {
  38526. try {
  38527. type = await xref.fetchAsync(type);
  38528. } catch (ex) {
  38529. addPageError(ex);
  38530. break;
  38531. }
  38532. }
  38533. if (isName(type, "Page") || !obj.has("Kids")) {
  38534. addPageDict(obj, kidObj instanceof Ref ? kidObj : null);
  38535. } else {
  38536. queue.push({
  38537. currentNode: obj,
  38538. posInKids: 0
  38539. });
  38540. }
  38541. queueItem.posInKids++;
  38542. }
  38543. return map;
  38544. }
  38545. getPageIndex(pageRef) {
  38546. const cachedPageIndex = this.pageIndexCache.get(pageRef);
  38547. if (cachedPageIndex !== undefined) {
  38548. return Promise.resolve(cachedPageIndex);
  38549. }
  38550. const xref = this.xref;
  38551. function pagesBeforeRef(kidRef) {
  38552. let total = 0,
  38553. parentRef;
  38554. return xref.fetchAsync(kidRef).then(function (node) {
  38555. if (isRefsEqual(kidRef, pageRef) && !isDict(node, "Page") && !(node instanceof Dict && !node.has("Type") && node.has("Contents"))) {
  38556. throw new FormatError("The reference does not point to a /Page dictionary.");
  38557. }
  38558. if (!node) {
  38559. return null;
  38560. }
  38561. if (!(node instanceof Dict)) {
  38562. throw new FormatError("Node must be a dictionary.");
  38563. }
  38564. parentRef = node.getRaw("Parent");
  38565. return node.getAsync("Parent");
  38566. }).then(function (parent) {
  38567. if (!parent) {
  38568. return null;
  38569. }
  38570. if (!(parent instanceof Dict)) {
  38571. throw new FormatError("Parent must be a dictionary.");
  38572. }
  38573. return parent.getAsync("Kids");
  38574. }).then(function (kids) {
  38575. if (!kids) {
  38576. return null;
  38577. }
  38578. const kidPromises = [];
  38579. let found = false;
  38580. for (const kid of kids) {
  38581. if (!(kid instanceof Ref)) {
  38582. throw new FormatError("Kid must be a reference.");
  38583. }
  38584. if (isRefsEqual(kid, kidRef)) {
  38585. found = true;
  38586. break;
  38587. }
  38588. kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
  38589. if (!(obj instanceof Dict)) {
  38590. throw new FormatError("Kid node must be a dictionary.");
  38591. }
  38592. if (obj.has("Count")) {
  38593. total += obj.get("Count");
  38594. } else {
  38595. total++;
  38596. }
  38597. }));
  38598. }
  38599. if (!found) {
  38600. throw new FormatError("Kid reference not found in parent's kids.");
  38601. }
  38602. return Promise.all(kidPromises).then(function () {
  38603. return [total, parentRef];
  38604. });
  38605. });
  38606. }
  38607. let total = 0;
  38608. const next = ref => pagesBeforeRef(ref).then(args => {
  38609. if (!args) {
  38610. this.pageIndexCache.put(pageRef, total);
  38611. return total;
  38612. }
  38613. const [count, parentRef] = args;
  38614. total += count;
  38615. return next(parentRef);
  38616. });
  38617. return next(pageRef);
  38618. }
  38619. get baseUrl() {
  38620. const uri = this._catDict.get("URI");
  38621. if (uri instanceof Dict) {
  38622. const base = uri.get("Base");
  38623. if (typeof base === "string") {
  38624. const absoluteUrl = createValidAbsoluteUrl(base, null, {
  38625. tryConvertEncoding: true
  38626. });
  38627. if (absoluteUrl) {
  38628. return shadow(this, "baseUrl", absoluteUrl.href);
  38629. }
  38630. }
  38631. }
  38632. return shadow(this, "baseUrl", this.pdfManager.docBaseUrl);
  38633. }
  38634. static parseDestDictionary({
  38635. destDict,
  38636. resultObj,
  38637. docBaseUrl = null,
  38638. docAttachments = null
  38639. }) {
  38640. if (!(destDict instanceof Dict)) {
  38641. warn("parseDestDictionary: `destDict` must be a dictionary.");
  38642. return;
  38643. }
  38644. let action = destDict.get("A"),
  38645. url,
  38646. dest;
  38647. if (!(action instanceof Dict)) {
  38648. if (destDict.has("Dest")) {
  38649. action = destDict.get("Dest");
  38650. } else {
  38651. action = destDict.get("AA");
  38652. if (action instanceof Dict) {
  38653. if (action.has("D")) {
  38654. action = action.get("D");
  38655. } else if (action.has("U")) {
  38656. action = action.get("U");
  38657. }
  38658. }
  38659. }
  38660. }
  38661. if (action instanceof Dict) {
  38662. const actionType = action.get("S");
  38663. if (!(actionType instanceof Name)) {
  38664. warn("parseDestDictionary: Invalid type in Action dictionary.");
  38665. return;
  38666. }
  38667. const actionName = actionType.name;
  38668. switch (actionName) {
  38669. case "ResetForm":
  38670. const flags = action.get("Flags");
  38671. const include = ((typeof flags === "number" ? flags : 0) & 1) === 0;
  38672. const fields = [];
  38673. const refs = [];
  38674. for (const obj of action.get("Fields") || []) {
  38675. if (obj instanceof Ref) {
  38676. refs.push(obj.toString());
  38677. } else if (typeof obj === "string") {
  38678. fields.push(stringToPDFString(obj));
  38679. }
  38680. }
  38681. resultObj.resetForm = {
  38682. fields,
  38683. refs,
  38684. include
  38685. };
  38686. break;
  38687. case "URI":
  38688. url = action.get("URI");
  38689. if (url instanceof Name) {
  38690. url = "/" + url.name;
  38691. }
  38692. break;
  38693. case "GoTo":
  38694. dest = action.get("D");
  38695. break;
  38696. case "Launch":
  38697. case "GoToR":
  38698. const urlDict = action.get("F");
  38699. if (urlDict instanceof Dict) {
  38700. const fs = new FileSpec(urlDict, null, true);
  38701. const {
  38702. rawFilename
  38703. } = fs.serializable;
  38704. url = rawFilename;
  38705. } else if (typeof urlDict === "string") {
  38706. url = urlDict;
  38707. }
  38708. const remoteDest = fetchRemoteDest(action);
  38709. if (remoteDest && typeof url === "string") {
  38710. url = url.split("#", 1)[0] + "#" + remoteDest;
  38711. }
  38712. const newWindow = action.get("NewWindow");
  38713. if (typeof newWindow === "boolean") {
  38714. resultObj.newWindow = newWindow;
  38715. }
  38716. break;
  38717. case "GoToE":
  38718. const target = action.get("T");
  38719. let attachment;
  38720. if (docAttachments && target instanceof Dict) {
  38721. const relationship = target.get("R");
  38722. const name = target.get("N");
  38723. if (isName(relationship, "C") && typeof name === "string") {
  38724. attachment = docAttachments[stringToPDFString(name)];
  38725. }
  38726. }
  38727. if (attachment) {
  38728. resultObj.attachment = attachment;
  38729. const attachmentDest = fetchRemoteDest(action);
  38730. if (attachmentDest) {
  38731. resultObj.attachmentDest = attachmentDest;
  38732. }
  38733. } else {
  38734. warn(`parseDestDictionary - unimplemented "GoToE" action.`);
  38735. }
  38736. break;
  38737. case "Named":
  38738. const namedAction = action.get("N");
  38739. if (namedAction instanceof Name) {
  38740. resultObj.action = namedAction.name;
  38741. }
  38742. break;
  38743. case "SetOCGState":
  38744. const state = action.get("State");
  38745. const preserveRB = action.get("PreserveRB");
  38746. if (!Array.isArray(state) || state.length === 0) {
  38747. break;
  38748. }
  38749. const stateArr = [];
  38750. for (const elem of state) {
  38751. if (elem instanceof Name) {
  38752. switch (elem.name) {
  38753. case "ON":
  38754. case "OFF":
  38755. case "Toggle":
  38756. stateArr.push(elem.name);
  38757. break;
  38758. }
  38759. } else if (elem instanceof Ref) {
  38760. stateArr.push(elem.toString());
  38761. }
  38762. }
  38763. if (stateArr.length !== state.length) {
  38764. break;
  38765. }
  38766. resultObj.setOCGState = {
  38767. state: stateArr,
  38768. preserveRB: typeof preserveRB === "boolean" ? preserveRB : true
  38769. };
  38770. break;
  38771. case "JavaScript":
  38772. const jsAction = action.get("JS");
  38773. let js;
  38774. if (jsAction instanceof BaseStream) {
  38775. js = jsAction.getString();
  38776. } else if (typeof jsAction === "string") {
  38777. js = jsAction;
  38778. }
  38779. const jsURL = js && recoverJsURL(stringToPDFString(js));
  38780. if (jsURL) {
  38781. url = jsURL.url;
  38782. resultObj.newWindow = jsURL.newWindow;
  38783. break;
  38784. }
  38785. default:
  38786. if (actionName === "JavaScript" || actionName === "SubmitForm") {
  38787. break;
  38788. }
  38789. warn(`parseDestDictionary - unsupported action: "${actionName}".`);
  38790. break;
  38791. }
  38792. } else if (destDict.has("Dest")) {
  38793. dest = destDict.get("Dest");
  38794. }
  38795. if (typeof url === "string") {
  38796. const absoluteUrl = createValidAbsoluteUrl(url, docBaseUrl, {
  38797. addDefaultProtocol: true,
  38798. tryConvertEncoding: true
  38799. });
  38800. if (absoluteUrl) {
  38801. resultObj.url = absoluteUrl.href;
  38802. }
  38803. resultObj.unsafeUrl = url;
  38804. }
  38805. if (dest) {
  38806. if (dest instanceof Name) {
  38807. dest = dest.name;
  38808. }
  38809. if (typeof dest === "string") {
  38810. resultObj.dest = stringToPDFString(dest);
  38811. } else if (isValidExplicitDest(dest)) {
  38812. resultObj.dest = dest;
  38813. }
  38814. }
  38815. }
  38816. }
  38817. ;// ./src/core/object_loader.js
  38818. function mayHaveChildren(value) {
  38819. return value instanceof Ref || value instanceof Dict || value instanceof BaseStream || Array.isArray(value);
  38820. }
  38821. function addChildren(node, nodesToVisit) {
  38822. if (node instanceof Dict) {
  38823. node = node.getRawValues();
  38824. } else if (node instanceof BaseStream) {
  38825. node = node.dict.getRawValues();
  38826. } else if (!Array.isArray(node)) {
  38827. return;
  38828. }
  38829. for (const rawValue of node) {
  38830. if (mayHaveChildren(rawValue)) {
  38831. nodesToVisit.push(rawValue);
  38832. }
  38833. }
  38834. }
  38835. class ObjectLoader {
  38836. constructor(dict, keys, xref) {
  38837. this.dict = dict;
  38838. this.keys = keys;
  38839. this.xref = xref;
  38840. this.refSet = null;
  38841. }
  38842. async load() {
  38843. if (this.xref.stream.isDataLoaded) {
  38844. return undefined;
  38845. }
  38846. const {
  38847. keys,
  38848. dict
  38849. } = this;
  38850. this.refSet = new RefSet();
  38851. const nodesToVisit = [];
  38852. for (const key of keys) {
  38853. const rawValue = dict.getRaw(key);
  38854. if (rawValue !== undefined) {
  38855. nodesToVisit.push(rawValue);
  38856. }
  38857. }
  38858. return this._walk(nodesToVisit);
  38859. }
  38860. async _walk(nodesToVisit) {
  38861. const nodesToRevisit = [];
  38862. const pendingRequests = [];
  38863. while (nodesToVisit.length) {
  38864. let currentNode = nodesToVisit.pop();
  38865. if (currentNode instanceof Ref) {
  38866. if (this.refSet.has(currentNode)) {
  38867. continue;
  38868. }
  38869. try {
  38870. this.refSet.put(currentNode);
  38871. currentNode = this.xref.fetch(currentNode);
  38872. } catch (ex) {
  38873. if (!(ex instanceof MissingDataException)) {
  38874. warn(`ObjectLoader._walk - requesting all data: "${ex}".`);
  38875. this.refSet = null;
  38876. const {
  38877. manager
  38878. } = this.xref.stream;
  38879. return manager.requestAllChunks();
  38880. }
  38881. nodesToRevisit.push(currentNode);
  38882. pendingRequests.push({
  38883. begin: ex.begin,
  38884. end: ex.end
  38885. });
  38886. }
  38887. }
  38888. if (currentNode instanceof BaseStream) {
  38889. const baseStreams = currentNode.getBaseStreams();
  38890. if (baseStreams) {
  38891. let foundMissingData = false;
  38892. for (const stream of baseStreams) {
  38893. if (stream.isDataLoaded) {
  38894. continue;
  38895. }
  38896. foundMissingData = true;
  38897. pendingRequests.push({
  38898. begin: stream.start,
  38899. end: stream.end
  38900. });
  38901. }
  38902. if (foundMissingData) {
  38903. nodesToRevisit.push(currentNode);
  38904. }
  38905. }
  38906. }
  38907. addChildren(currentNode, nodesToVisit);
  38908. }
  38909. if (pendingRequests.length) {
  38910. await this.xref.stream.manager.requestRanges(pendingRequests);
  38911. for (const node of nodesToRevisit) {
  38912. if (node instanceof Ref) {
  38913. this.refSet.remove(node);
  38914. }
  38915. }
  38916. return this._walk(nodesToRevisit);
  38917. }
  38918. this.refSet = null;
  38919. return undefined;
  38920. }
  38921. }
  38922. ;// ./src/core/xfa/symbol_utils.js
  38923. const $acceptWhitespace = Symbol();
  38924. const $addHTML = Symbol();
  38925. const $appendChild = Symbol();
  38926. const $childrenToHTML = Symbol();
  38927. const $clean = Symbol();
  38928. const $cleanPage = Symbol();
  38929. const $cleanup = Symbol();
  38930. const $clone = Symbol();
  38931. const $consumed = Symbol();
  38932. const $content = Symbol("content");
  38933. const $data = Symbol("data");
  38934. const $dump = Symbol();
  38935. const $extra = Symbol("extra");
  38936. const $finalize = Symbol();
  38937. const $flushHTML = Symbol();
  38938. const $getAttributeIt = Symbol();
  38939. const $getAttributes = Symbol();
  38940. const $getAvailableSpace = Symbol();
  38941. const $getChildrenByClass = Symbol();
  38942. const $getChildrenByName = Symbol();
  38943. const $getChildrenByNameIt = Symbol();
  38944. const $getDataValue = Symbol();
  38945. const $getExtra = Symbol();
  38946. const $getRealChildrenByNameIt = Symbol();
  38947. const $getChildren = Symbol();
  38948. const $getContainedChildren = Symbol();
  38949. const $getNextPage = Symbol();
  38950. const $getSubformParent = Symbol();
  38951. const $getParent = Symbol();
  38952. const $getTemplateRoot = Symbol();
  38953. const $globalData = Symbol();
  38954. const $hasSettableValue = Symbol();
  38955. const $ids = Symbol();
  38956. const $indexOf = Symbol();
  38957. const $insertAt = Symbol();
  38958. const $isCDATAXml = Symbol();
  38959. const $isBindable = Symbol();
  38960. const $isDataValue = Symbol();
  38961. const $isDescendent = Symbol();
  38962. const $isNsAgnostic = Symbol();
  38963. const $isSplittable = Symbol();
  38964. const $isThereMoreWidth = Symbol();
  38965. const $isTransparent = Symbol();
  38966. const $isUsable = Symbol();
  38967. const $lastAttribute = Symbol();
  38968. const $namespaceId = Symbol("namespaceId");
  38969. const $nodeName = Symbol("nodeName");
  38970. const $nsAttributes = Symbol();
  38971. const $onChild = Symbol();
  38972. const $onChildCheck = Symbol();
  38973. const $onText = Symbol();
  38974. const $pushGlyphs = Symbol();
  38975. const $popPara = Symbol();
  38976. const $pushPara = Symbol();
  38977. const $removeChild = Symbol();
  38978. const $root = Symbol("root");
  38979. const $resolvePrototypes = Symbol();
  38980. const $searchNode = Symbol();
  38981. const $setId = Symbol();
  38982. const $setSetAttributes = Symbol();
  38983. const $setValue = Symbol();
  38984. const $tabIndex = Symbol();
  38985. const $text = Symbol();
  38986. const $toPages = Symbol();
  38987. const $toHTML = Symbol();
  38988. const $toString = Symbol();
  38989. const $toStyle = Symbol();
  38990. const $uid = Symbol("uid");
  38991. ;// ./src/core/xfa/namespaces.js
  38992. const $buildXFAObject = Symbol();
  38993. const NamespaceIds = {
  38994. config: {
  38995. id: 0,
  38996. check: ns => ns.startsWith("http://www.xfa.org/schema/xci/")
  38997. },
  38998. connectionSet: {
  38999. id: 1,
  39000. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/")
  39001. },
  39002. datasets: {
  39003. id: 2,
  39004. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/")
  39005. },
  39006. form: {
  39007. id: 3,
  39008. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/")
  39009. },
  39010. localeSet: {
  39011. id: 4,
  39012. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/")
  39013. },
  39014. pdf: {
  39015. id: 5,
  39016. check: ns => ns === "http://ns.adobe.com/xdp/pdf/"
  39017. },
  39018. signature: {
  39019. id: 6,
  39020. check: ns => ns === "http://www.w3.org/2000/09/xmldsig#"
  39021. },
  39022. sourceSet: {
  39023. id: 7,
  39024. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/")
  39025. },
  39026. stylesheet: {
  39027. id: 8,
  39028. check: ns => ns === "http://www.w3.org/1999/XSL/Transform"
  39029. },
  39030. template: {
  39031. id: 9,
  39032. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/")
  39033. },
  39034. xdc: {
  39035. id: 10,
  39036. check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/")
  39037. },
  39038. xdp: {
  39039. id: 11,
  39040. check: ns => ns === "http://ns.adobe.com/xdp/"
  39041. },
  39042. xfdf: {
  39043. id: 12,
  39044. check: ns => ns === "http://ns.adobe.com/xfdf/"
  39045. },
  39046. xhtml: {
  39047. id: 13,
  39048. check: ns => ns === "http://www.w3.org/1999/xhtml"
  39049. },
  39050. xmpmeta: {
  39051. id: 14,
  39052. check: ns => ns === "http://ns.adobe.com/xmpmeta/"
  39053. }
  39054. };
  39055. ;// ./src/core/xfa/utils.js
  39056. const dimConverters = {
  39057. pt: x => x,
  39058. cm: x => x / 2.54 * 72,
  39059. mm: x => x / (10 * 2.54) * 72,
  39060. in: x => x * 72,
  39061. px: x => x
  39062. };
  39063. const measurementPattern = /([+-]?\d+\.?\d*)(.*)/;
  39064. function stripQuotes(str) {
  39065. if (str.startsWith("'") || str.startsWith('"')) {
  39066. return str.slice(1, -1);
  39067. }
  39068. return str;
  39069. }
  39070. function getInteger({
  39071. data,
  39072. defaultValue,
  39073. validate
  39074. }) {
  39075. if (!data) {
  39076. return defaultValue;
  39077. }
  39078. data = data.trim();
  39079. const n = parseInt(data, 10);
  39080. if (!isNaN(n) && validate(n)) {
  39081. return n;
  39082. }
  39083. return defaultValue;
  39084. }
  39085. function getFloat({
  39086. data,
  39087. defaultValue,
  39088. validate
  39089. }) {
  39090. if (!data) {
  39091. return defaultValue;
  39092. }
  39093. data = data.trim();
  39094. const n = parseFloat(data);
  39095. if (!isNaN(n) && validate(n)) {
  39096. return n;
  39097. }
  39098. return defaultValue;
  39099. }
  39100. function getKeyword({
  39101. data,
  39102. defaultValue,
  39103. validate
  39104. }) {
  39105. if (!data) {
  39106. return defaultValue;
  39107. }
  39108. data = data.trim();
  39109. if (validate(data)) {
  39110. return data;
  39111. }
  39112. return defaultValue;
  39113. }
  39114. function getStringOption(data, options) {
  39115. return getKeyword({
  39116. data,
  39117. defaultValue: options[0],
  39118. validate: k => options.includes(k)
  39119. });
  39120. }
  39121. function getMeasurement(str, def = "0") {
  39122. def ||= "0";
  39123. if (!str) {
  39124. return getMeasurement(def);
  39125. }
  39126. const match = str.trim().match(measurementPattern);
  39127. if (!match) {
  39128. return getMeasurement(def);
  39129. }
  39130. const [, valueStr, unit] = match;
  39131. const value = parseFloat(valueStr);
  39132. if (isNaN(value)) {
  39133. return getMeasurement(def);
  39134. }
  39135. if (value === 0) {
  39136. return 0;
  39137. }
  39138. const conv = dimConverters[unit];
  39139. if (conv) {
  39140. return conv(value);
  39141. }
  39142. return value;
  39143. }
  39144. function getRatio(data) {
  39145. if (!data) {
  39146. return {
  39147. num: 1,
  39148. den: 1
  39149. };
  39150. }
  39151. const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x));
  39152. if (ratio.length === 1) {
  39153. ratio.push(1);
  39154. }
  39155. if (ratio.length === 0) {
  39156. return {
  39157. num: 1,
  39158. den: 1
  39159. };
  39160. }
  39161. const [num, den] = ratio;
  39162. return {
  39163. num,
  39164. den
  39165. };
  39166. }
  39167. function getRelevant(data) {
  39168. if (!data) {
  39169. return [];
  39170. }
  39171. return data.trim().split(/\s+/).map(e => ({
  39172. excluded: e[0] === "-",
  39173. viewname: e.substring(1)
  39174. }));
  39175. }
  39176. function getColor(data, def = [0, 0, 0]) {
  39177. let [r, g, b] = def;
  39178. if (!data) {
  39179. return {
  39180. r,
  39181. g,
  39182. b
  39183. };
  39184. }
  39185. const color = data.trim().split(/\s*,\s*/).map(c => Math.min(Math.max(0, parseInt(c.trim(), 10)), 255)).map(c => isNaN(c) ? 0 : c);
  39186. if (color.length < 3) {
  39187. return {
  39188. r,
  39189. g,
  39190. b
  39191. };
  39192. }
  39193. [r, g, b] = color;
  39194. return {
  39195. r,
  39196. g,
  39197. b
  39198. };
  39199. }
  39200. function getBBox(data) {
  39201. const def = -1;
  39202. if (!data) {
  39203. return {
  39204. x: def,
  39205. y: def,
  39206. width: def,
  39207. height: def
  39208. };
  39209. }
  39210. const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1"));
  39211. if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {
  39212. return {
  39213. x: def,
  39214. y: def,
  39215. width: def,
  39216. height: def
  39217. };
  39218. }
  39219. const [x, y, width, height] = bbox;
  39220. return {
  39221. x,
  39222. y,
  39223. width,
  39224. height
  39225. };
  39226. }
  39227. class HTMLResult {
  39228. static get FAILURE() {
  39229. return shadow(this, "FAILURE", new HTMLResult(false, null, null, null));
  39230. }
  39231. static get EMPTY() {
  39232. return shadow(this, "EMPTY", new HTMLResult(true, null, null, null));
  39233. }
  39234. constructor(success, html, bbox, breakNode) {
  39235. this.success = success;
  39236. this.html = html;
  39237. this.bbox = bbox;
  39238. this.breakNode = breakNode;
  39239. }
  39240. isBreak() {
  39241. return !!this.breakNode;
  39242. }
  39243. static breakNode(node) {
  39244. return new HTMLResult(false, null, null, node);
  39245. }
  39246. static success(html, bbox = null) {
  39247. return new HTMLResult(true, html, bbox, null);
  39248. }
  39249. }
  39250. ;// ./src/core/xfa/fonts.js
  39251. class FontFinder {
  39252. constructor(pdfFonts) {
  39253. this.fonts = new Map();
  39254. this.cache = new Map();
  39255. this.warned = new Set();
  39256. this.defaultFont = null;
  39257. this.add(pdfFonts);
  39258. }
  39259. add(pdfFonts, reallyMissingFonts = null) {
  39260. for (const pdfFont of pdfFonts) {
  39261. this.addPdfFont(pdfFont);
  39262. }
  39263. for (const pdfFont of this.fonts.values()) {
  39264. if (!pdfFont.regular) {
  39265. pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic;
  39266. }
  39267. }
  39268. if (!reallyMissingFonts || reallyMissingFonts.size === 0) {
  39269. return;
  39270. }
  39271. const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA");
  39272. for (const missing of reallyMissingFonts) {
  39273. this.fonts.set(missing, myriad);
  39274. }
  39275. }
  39276. addPdfFont(pdfFont) {
  39277. const cssFontInfo = pdfFont.cssFontInfo;
  39278. const name = cssFontInfo.fontFamily;
  39279. let font = this.fonts.get(name);
  39280. if (!font) {
  39281. font = Object.create(null);
  39282. this.fonts.set(name, font);
  39283. if (!this.defaultFont) {
  39284. this.defaultFont = font;
  39285. }
  39286. }
  39287. let property = "";
  39288. const fontWeight = parseFloat(cssFontInfo.fontWeight);
  39289. if (parseFloat(cssFontInfo.italicAngle) !== 0) {
  39290. property = fontWeight >= 700 ? "bolditalic" : "italic";
  39291. } else if (fontWeight >= 700) {
  39292. property = "bold";
  39293. }
  39294. if (!property) {
  39295. if (pdfFont.name.includes("Bold") || pdfFont.psName?.includes("Bold")) {
  39296. property = "bold";
  39297. }
  39298. if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName?.includes("Italic") || pdfFont.psName?.endsWith("It")) {
  39299. property += "italic";
  39300. }
  39301. }
  39302. if (!property) {
  39303. property = "regular";
  39304. }
  39305. font[property] = pdfFont;
  39306. }
  39307. getDefault() {
  39308. return this.defaultFont;
  39309. }
  39310. find(fontName, mustWarn = true) {
  39311. let font = this.fonts.get(fontName) || this.cache.get(fontName);
  39312. if (font) {
  39313. return font;
  39314. }
  39315. const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi;
  39316. let name = fontName.replaceAll(pattern, "");
  39317. font = this.fonts.get(name);
  39318. if (font) {
  39319. this.cache.set(fontName, font);
  39320. return font;
  39321. }
  39322. name = name.toLowerCase();
  39323. const maybe = [];
  39324. for (const [family, pdfFont] of this.fonts.entries()) {
  39325. if (family.replaceAll(pattern, "").toLowerCase().startsWith(name)) {
  39326. maybe.push(pdfFont);
  39327. }
  39328. }
  39329. if (maybe.length === 0) {
  39330. for (const [, pdfFont] of this.fonts.entries()) {
  39331. if (pdfFont.regular.name?.replaceAll(pattern, "").toLowerCase().startsWith(name)) {
  39332. maybe.push(pdfFont);
  39333. }
  39334. }
  39335. }
  39336. if (maybe.length === 0) {
  39337. name = name.replaceAll(/psmt|mt/gi, "");
  39338. for (const [family, pdfFont] of this.fonts.entries()) {
  39339. if (family.replaceAll(pattern, "").toLowerCase().startsWith(name)) {
  39340. maybe.push(pdfFont);
  39341. }
  39342. }
  39343. }
  39344. if (maybe.length === 0) {
  39345. for (const pdfFont of this.fonts.values()) {
  39346. if (pdfFont.regular.name?.replaceAll(pattern, "").toLowerCase().startsWith(name)) {
  39347. maybe.push(pdfFont);
  39348. }
  39349. }
  39350. }
  39351. if (maybe.length >= 1) {
  39352. if (maybe.length !== 1 && mustWarn) {
  39353. warn(`XFA - Too many choices to guess the correct font: ${fontName}`);
  39354. }
  39355. this.cache.set(fontName, maybe[0]);
  39356. return maybe[0];
  39357. }
  39358. if (mustWarn && !this.warned.has(fontName)) {
  39359. this.warned.add(fontName);
  39360. warn(`XFA - Cannot find the font: ${fontName}`);
  39361. }
  39362. return null;
  39363. }
  39364. }
  39365. function selectFont(xfaFont, typeface) {
  39366. if (xfaFont.posture === "italic") {
  39367. if (xfaFont.weight === "bold") {
  39368. return typeface.bolditalic;
  39369. }
  39370. return typeface.italic;
  39371. } else if (xfaFont.weight === "bold") {
  39372. return typeface.bold;
  39373. }
  39374. return typeface.regular;
  39375. }
  39376. function fonts_getMetrics(xfaFont, real = false) {
  39377. let pdfFont = null;
  39378. if (xfaFont) {
  39379. const name = stripQuotes(xfaFont.typeface);
  39380. const typeface = xfaFont[$globalData].fontFinder.find(name);
  39381. pdfFont = selectFont(xfaFont, typeface);
  39382. }
  39383. if (!pdfFont) {
  39384. return {
  39385. lineHeight: 12,
  39386. lineGap: 2,
  39387. lineNoGap: 10
  39388. };
  39389. }
  39390. const size = xfaFont.size || 10;
  39391. const lineHeight = pdfFont.lineHeight ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight) : 1.2;
  39392. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  39393. return {
  39394. lineHeight: lineHeight * size,
  39395. lineGap: lineGap * size,
  39396. lineNoGap: Math.max(1, lineHeight - lineGap) * size
  39397. };
  39398. }
  39399. ;// ./src/core/xfa/text.js
  39400. const WIDTH_FACTOR = 1.02;
  39401. class FontInfo {
  39402. constructor(xfaFont, margin, lineHeight, fontFinder) {
  39403. this.lineHeight = lineHeight;
  39404. this.paraMargin = margin || {
  39405. top: 0,
  39406. bottom: 0,
  39407. left: 0,
  39408. right: 0
  39409. };
  39410. if (!xfaFont) {
  39411. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  39412. return;
  39413. }
  39414. this.xfaFont = {
  39415. typeface: xfaFont.typeface,
  39416. posture: xfaFont.posture,
  39417. weight: xfaFont.weight,
  39418. size: xfaFont.size,
  39419. letterSpacing: xfaFont.letterSpacing
  39420. };
  39421. const typeface = fontFinder.find(xfaFont.typeface);
  39422. if (!typeface) {
  39423. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  39424. return;
  39425. }
  39426. this.pdfFont = selectFont(xfaFont, typeface);
  39427. if (!this.pdfFont) {
  39428. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  39429. }
  39430. }
  39431. defaultFont(fontFinder) {
  39432. const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault();
  39433. if (font?.regular) {
  39434. const pdfFont = font.regular;
  39435. const info = pdfFont.cssFontInfo;
  39436. const xfaFont = {
  39437. typeface: info.fontFamily,
  39438. posture: "normal",
  39439. weight: "normal",
  39440. size: 10,
  39441. letterSpacing: 0
  39442. };
  39443. return [pdfFont, xfaFont];
  39444. }
  39445. const xfaFont = {
  39446. typeface: "Courier",
  39447. posture: "normal",
  39448. weight: "normal",
  39449. size: 10,
  39450. letterSpacing: 0
  39451. };
  39452. return [null, xfaFont];
  39453. }
  39454. }
  39455. class FontSelector {
  39456. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) {
  39457. this.fontFinder = fontFinder;
  39458. this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)];
  39459. }
  39460. pushData(xfaFont, margin, lineHeight) {
  39461. const lastFont = this.stack.at(-1);
  39462. for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) {
  39463. if (!xfaFont[name]) {
  39464. xfaFont[name] = lastFont.xfaFont[name];
  39465. }
  39466. }
  39467. for (const name of ["top", "bottom", "left", "right"]) {
  39468. if (isNaN(margin[name])) {
  39469. margin[name] = lastFont.paraMargin[name];
  39470. }
  39471. }
  39472. const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder);
  39473. if (!fontInfo.pdfFont) {
  39474. fontInfo.pdfFont = lastFont.pdfFont;
  39475. }
  39476. this.stack.push(fontInfo);
  39477. }
  39478. popFont() {
  39479. this.stack.pop();
  39480. }
  39481. topFont() {
  39482. return this.stack.at(-1);
  39483. }
  39484. }
  39485. class TextMeasure {
  39486. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) {
  39487. this.glyphs = [];
  39488. this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts);
  39489. this.extraHeight = 0;
  39490. }
  39491. pushData(xfaFont, margin, lineHeight) {
  39492. this.fontSelector.pushData(xfaFont, margin, lineHeight);
  39493. }
  39494. popFont(xfaFont) {
  39495. return this.fontSelector.popFont();
  39496. }
  39497. addPara() {
  39498. const lastFont = this.fontSelector.topFont();
  39499. this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom;
  39500. }
  39501. addString(str) {
  39502. if (!str) {
  39503. return;
  39504. }
  39505. const lastFont = this.fontSelector.topFont();
  39506. const fontSize = lastFont.xfaFont.size;
  39507. if (lastFont.pdfFont) {
  39508. const letterSpacing = lastFont.xfaFont.letterSpacing;
  39509. const pdfFont = lastFont.pdfFont;
  39510. const fontLineHeight = pdfFont.lineHeight || 1.2;
  39511. const lineHeight = lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize;
  39512. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  39513. const noGap = fontLineHeight - lineGap;
  39514. const firstLineHeight = Math.max(1, noGap) * fontSize;
  39515. const scale = fontSize / 1000;
  39516. const fallbackWidth = pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width;
  39517. for (const line of str.split(/[\u2029\n]/)) {
  39518. const encodedLine = pdfFont.encodeString(line).join("");
  39519. const glyphs = pdfFont.charsToGlyphs(encodedLine);
  39520. for (const glyph of glyphs) {
  39521. const width = glyph.width || fallbackWidth;
  39522. this.glyphs.push([width * scale + letterSpacing, lineHeight, firstLineHeight, glyph.unicode, false]);
  39523. }
  39524. this.glyphs.push([0, 0, 0, "\n", true]);
  39525. }
  39526. this.glyphs.pop();
  39527. return;
  39528. }
  39529. for (const line of str.split(/[\u2029\n]/)) {
  39530. for (const char of line.split("")) {
  39531. this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]);
  39532. }
  39533. this.glyphs.push([0, 0, 0, "\n", true]);
  39534. }
  39535. this.glyphs.pop();
  39536. }
  39537. compute(maxWidth) {
  39538. let lastSpacePos = -1,
  39539. lastSpaceWidth = 0,
  39540. width = 0,
  39541. height = 0,
  39542. currentLineWidth = 0,
  39543. currentLineHeight = 0;
  39544. let isBroken = false;
  39545. let isFirstLine = true;
  39546. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  39547. const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] = this.glyphs[i];
  39548. const isSpace = char === " ";
  39549. const glyphHeight = isFirstLine ? firstLineHeight : lineHeight;
  39550. if (isEOL) {
  39551. width = Math.max(width, currentLineWidth);
  39552. currentLineWidth = 0;
  39553. height += currentLineHeight;
  39554. currentLineHeight = glyphHeight;
  39555. lastSpacePos = -1;
  39556. lastSpaceWidth = 0;
  39557. isFirstLine = false;
  39558. continue;
  39559. }
  39560. if (isSpace) {
  39561. if (currentLineWidth + glyphWidth > maxWidth) {
  39562. width = Math.max(width, currentLineWidth);
  39563. currentLineWidth = 0;
  39564. height += currentLineHeight;
  39565. currentLineHeight = glyphHeight;
  39566. lastSpacePos = -1;
  39567. lastSpaceWidth = 0;
  39568. isBroken = true;
  39569. isFirstLine = false;
  39570. } else {
  39571. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  39572. lastSpaceWidth = currentLineWidth;
  39573. currentLineWidth += glyphWidth;
  39574. lastSpacePos = i;
  39575. }
  39576. continue;
  39577. }
  39578. if (currentLineWidth + glyphWidth > maxWidth) {
  39579. height += currentLineHeight;
  39580. currentLineHeight = glyphHeight;
  39581. if (lastSpacePos !== -1) {
  39582. i = lastSpacePos;
  39583. width = Math.max(width, lastSpaceWidth);
  39584. currentLineWidth = 0;
  39585. lastSpacePos = -1;
  39586. lastSpaceWidth = 0;
  39587. } else {
  39588. width = Math.max(width, currentLineWidth);
  39589. currentLineWidth = glyphWidth;
  39590. }
  39591. isBroken = true;
  39592. isFirstLine = false;
  39593. continue;
  39594. }
  39595. currentLineWidth += glyphWidth;
  39596. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  39597. }
  39598. width = Math.max(width, currentLineWidth);
  39599. height += currentLineHeight + this.extraHeight;
  39600. return {
  39601. width: WIDTH_FACTOR * width,
  39602. height,
  39603. isBroken
  39604. };
  39605. }
  39606. }
  39607. ;// ./src/core/xfa/som.js
  39608. const namePattern = /^[^.[]+/;
  39609. const indexPattern = /^[^\]]+/;
  39610. const operators = {
  39611. dot: 0,
  39612. dotDot: 1,
  39613. dotHash: 2,
  39614. dotBracket: 3,
  39615. dotParen: 4
  39616. };
  39617. const shortcuts = new Map([["$data", (root, current) => root.datasets ? root.datasets.data : root], ["$record", (root, current) => (root.datasets ? root.datasets.data : root)[$getChildren]()[0]], ["$template", (root, current) => root.template], ["$connectionSet", (root, current) => root.connectionSet], ["$form", (root, current) => root.form], ["$layout", (root, current) => root.layout], ["$host", (root, current) => root.host], ["$dataWindow", (root, current) => root.dataWindow], ["$event", (root, current) => root.event], ["!", (root, current) => root.datasets], ["$xfa", (root, current) => root], ["xfa", (root, current) => root], ["$", (root, current) => current]]);
  39618. const somCache = new WeakMap();
  39619. function parseIndex(index) {
  39620. index = index.trim();
  39621. if (index === "*") {
  39622. return Infinity;
  39623. }
  39624. return parseInt(index, 10) || 0;
  39625. }
  39626. function parseExpression(expr, dotDotAllowed, noExpr = true) {
  39627. let match = expr.match(namePattern);
  39628. if (!match) {
  39629. return null;
  39630. }
  39631. let [name] = match;
  39632. const parsed = [{
  39633. name,
  39634. cacheName: "." + name,
  39635. index: 0,
  39636. js: null,
  39637. formCalc: null,
  39638. operator: operators.dot
  39639. }];
  39640. let pos = name.length;
  39641. while (pos < expr.length) {
  39642. const spos = pos;
  39643. const char = expr.charAt(pos++);
  39644. if (char === "[") {
  39645. match = expr.slice(pos).match(indexPattern);
  39646. if (!match) {
  39647. warn("XFA - Invalid index in SOM expression");
  39648. return null;
  39649. }
  39650. parsed.at(-1).index = parseIndex(match[0]);
  39651. pos += match[0].length + 1;
  39652. continue;
  39653. }
  39654. let operator;
  39655. switch (expr.charAt(pos)) {
  39656. case ".":
  39657. if (!dotDotAllowed) {
  39658. return null;
  39659. }
  39660. pos++;
  39661. operator = operators.dotDot;
  39662. break;
  39663. case "#":
  39664. pos++;
  39665. operator = operators.dotHash;
  39666. break;
  39667. case "[":
  39668. if (noExpr) {
  39669. warn("XFA - SOM expression contains a FormCalc subexpression which is not supported for now.");
  39670. return null;
  39671. }
  39672. operator = operators.dotBracket;
  39673. break;
  39674. case "(":
  39675. if (noExpr) {
  39676. warn("XFA - SOM expression contains a JavaScript subexpression which is not supported for now.");
  39677. return null;
  39678. }
  39679. operator = operators.dotParen;
  39680. break;
  39681. default:
  39682. operator = operators.dot;
  39683. break;
  39684. }
  39685. match = expr.slice(pos).match(namePattern);
  39686. if (!match) {
  39687. break;
  39688. }
  39689. [name] = match;
  39690. pos += name.length;
  39691. parsed.push({
  39692. name,
  39693. cacheName: expr.slice(spos, pos),
  39694. operator,
  39695. index: 0,
  39696. js: null,
  39697. formCalc: null
  39698. });
  39699. }
  39700. return parsed;
  39701. }
  39702. function searchNode(root, container, expr, dotDotAllowed = true, useCache = true) {
  39703. const parsed = parseExpression(expr, dotDotAllowed);
  39704. if (!parsed) {
  39705. return null;
  39706. }
  39707. const fn = shortcuts.get(parsed[0].name);
  39708. let i = 0;
  39709. let isQualified;
  39710. if (fn) {
  39711. isQualified = true;
  39712. root = [fn(root, container)];
  39713. i = 1;
  39714. } else {
  39715. isQualified = container === null;
  39716. root = [container || root];
  39717. }
  39718. for (let ii = parsed.length; i < ii; i++) {
  39719. const {
  39720. name,
  39721. cacheName,
  39722. operator,
  39723. index
  39724. } = parsed[i];
  39725. const nodes = [];
  39726. for (const node of root) {
  39727. if (!node.isXFAObject) {
  39728. continue;
  39729. }
  39730. let children, cached;
  39731. if (useCache) {
  39732. cached = somCache.get(node);
  39733. if (!cached) {
  39734. cached = new Map();
  39735. somCache.set(node, cached);
  39736. }
  39737. children = cached.get(cacheName);
  39738. }
  39739. if (!children) {
  39740. switch (operator) {
  39741. case operators.dot:
  39742. children = node[$getChildrenByName](name, false);
  39743. break;
  39744. case operators.dotDot:
  39745. children = node[$getChildrenByName](name, true);
  39746. break;
  39747. case operators.dotHash:
  39748. children = node[$getChildrenByClass](name);
  39749. children = children.isXFAObjectArray ? children.children : [children];
  39750. break;
  39751. default:
  39752. break;
  39753. }
  39754. if (useCache) {
  39755. cached.set(cacheName, children);
  39756. }
  39757. }
  39758. if (children.length > 0) {
  39759. nodes.push(children);
  39760. }
  39761. }
  39762. if (nodes.length === 0 && !isQualified && i === 0) {
  39763. const parent = container[$getParent]();
  39764. container = parent;
  39765. if (!container) {
  39766. return null;
  39767. }
  39768. i = -1;
  39769. root = [container];
  39770. continue;
  39771. }
  39772. root = isFinite(index) ? nodes.filter(node => index < node.length).map(node => node[index]) : nodes.flat();
  39773. }
  39774. if (root.length === 0) {
  39775. return null;
  39776. }
  39777. return root;
  39778. }
  39779. function createDataNode(root, container, expr) {
  39780. const parsed = parseExpression(expr);
  39781. if (!parsed) {
  39782. return null;
  39783. }
  39784. if (parsed.some(x => x.operator === operators.dotDot)) {
  39785. return null;
  39786. }
  39787. const fn = shortcuts.get(parsed[0].name);
  39788. let i = 0;
  39789. if (fn) {
  39790. root = fn(root, container);
  39791. i = 1;
  39792. } else {
  39793. root = container || root;
  39794. }
  39795. for (let ii = parsed.length; i < ii; i++) {
  39796. const {
  39797. name,
  39798. operator,
  39799. index
  39800. } = parsed[i];
  39801. if (!isFinite(index)) {
  39802. parsed[i].index = 0;
  39803. return root.createNodes(parsed.slice(i));
  39804. }
  39805. let children;
  39806. switch (operator) {
  39807. case operators.dot:
  39808. children = root[$getChildrenByName](name, false);
  39809. break;
  39810. case operators.dotDot:
  39811. children = root[$getChildrenByName](name, true);
  39812. break;
  39813. case operators.dotHash:
  39814. children = root[$getChildrenByClass](name);
  39815. children = children.isXFAObjectArray ? children.children : [children];
  39816. break;
  39817. default:
  39818. break;
  39819. }
  39820. if (children.length === 0) {
  39821. return root.createNodes(parsed.slice(i));
  39822. }
  39823. if (index < children.length) {
  39824. const child = children[index];
  39825. if (!child.isXFAObject) {
  39826. warn(`XFA - Cannot create a node.`);
  39827. return null;
  39828. }
  39829. root = child;
  39830. } else {
  39831. parsed[i].index = index - children.length;
  39832. return root.createNodes(parsed.slice(i));
  39833. }
  39834. }
  39835. return null;
  39836. }
  39837. ;// ./src/core/xfa/xfa_object.js
  39838. const _applyPrototype = Symbol();
  39839. const _attributes = Symbol();
  39840. const _attributeNames = Symbol();
  39841. const _children = Symbol("_children");
  39842. const _cloneAttribute = Symbol();
  39843. const _dataValue = Symbol();
  39844. const _defaultValue = Symbol();
  39845. const _filteredChildrenGenerator = Symbol();
  39846. const _getPrototype = Symbol();
  39847. const _getUnsetAttributes = Symbol();
  39848. const _hasChildren = Symbol();
  39849. const _max = Symbol();
  39850. const _options = Symbol();
  39851. const _parent = Symbol("parent");
  39852. const _resolvePrototypesHelper = Symbol();
  39853. const _setAttributes = Symbol();
  39854. const _validator = Symbol();
  39855. let uid = 0;
  39856. const NS_DATASETS = NamespaceIds.datasets.id;
  39857. class XFAObject {
  39858. constructor(nsId, name, hasChildren = false) {
  39859. this[$namespaceId] = nsId;
  39860. this[$nodeName] = name;
  39861. this[_hasChildren] = hasChildren;
  39862. this[_parent] = null;
  39863. this[_children] = [];
  39864. this[$uid] = `${name}${uid++}`;
  39865. this[$globalData] = null;
  39866. }
  39867. get isXFAObject() {
  39868. return true;
  39869. }
  39870. get isXFAObjectArray() {
  39871. return false;
  39872. }
  39873. createNodes(path) {
  39874. let root = this,
  39875. node = null;
  39876. for (const {
  39877. name,
  39878. index
  39879. } of path) {
  39880. for (let i = 0, ii = isFinite(index) ? index : 0; i <= ii; i++) {
  39881. const nsId = root[$namespaceId] === NS_DATASETS ? -1 : root[$namespaceId];
  39882. node = new XmlObject(nsId, name);
  39883. root[$appendChild](node);
  39884. }
  39885. root = node;
  39886. }
  39887. return node;
  39888. }
  39889. [$onChild](child) {
  39890. if (!this[_hasChildren] || !this[$onChildCheck](child)) {
  39891. return false;
  39892. }
  39893. const name = child[$nodeName];
  39894. const node = this[name];
  39895. if (node instanceof XFAObjectArray) {
  39896. if (node.push(child)) {
  39897. this[$appendChild](child);
  39898. return true;
  39899. }
  39900. } else {
  39901. if (node !== null) {
  39902. this[$removeChild](node);
  39903. }
  39904. this[name] = child;
  39905. this[$appendChild](child);
  39906. return true;
  39907. }
  39908. let id = "";
  39909. if (this.id) {
  39910. id = ` (id: ${this.id})`;
  39911. } else if (this.name) {
  39912. id = ` (name: ${this.name} ${this.h.value})`;
  39913. }
  39914. warn(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`);
  39915. return false;
  39916. }
  39917. [$onChildCheck](child) {
  39918. return this.hasOwnProperty(child[$nodeName]) && child[$namespaceId] === this[$namespaceId];
  39919. }
  39920. [$isNsAgnostic]() {
  39921. return false;
  39922. }
  39923. [$acceptWhitespace]() {
  39924. return false;
  39925. }
  39926. [$isCDATAXml]() {
  39927. return false;
  39928. }
  39929. [$isBindable]() {
  39930. return false;
  39931. }
  39932. [$popPara]() {
  39933. if (this.para) {
  39934. this[$getTemplateRoot]()[$extra].paraStack.pop();
  39935. }
  39936. }
  39937. [$pushPara]() {
  39938. this[$getTemplateRoot]()[$extra].paraStack.push(this.para);
  39939. }
  39940. [$setId](ids) {
  39941. if (this.id && this[$namespaceId] === NamespaceIds.template.id) {
  39942. ids.set(this.id, this);
  39943. }
  39944. }
  39945. [$getTemplateRoot]() {
  39946. return this[$globalData].template;
  39947. }
  39948. [$isSplittable]() {
  39949. return false;
  39950. }
  39951. [$isThereMoreWidth]() {
  39952. return false;
  39953. }
  39954. [$appendChild](child) {
  39955. child[_parent] = this;
  39956. this[_children].push(child);
  39957. if (!child[$globalData] && this[$globalData]) {
  39958. child[$globalData] = this[$globalData];
  39959. }
  39960. }
  39961. [$removeChild](child) {
  39962. const i = this[_children].indexOf(child);
  39963. this[_children].splice(i, 1);
  39964. }
  39965. [$hasSettableValue]() {
  39966. return this.hasOwnProperty("value");
  39967. }
  39968. [$setValue](_) {}
  39969. [$onText](_) {}
  39970. [$finalize]() {}
  39971. [$clean](builder) {
  39972. delete this[_hasChildren];
  39973. if (this[$cleanup]) {
  39974. builder.clean(this[$cleanup]);
  39975. delete this[$cleanup];
  39976. }
  39977. }
  39978. [$indexOf](child) {
  39979. return this[_children].indexOf(child);
  39980. }
  39981. [$insertAt](i, child) {
  39982. child[_parent] = this;
  39983. this[_children].splice(i, 0, child);
  39984. if (!child[$globalData] && this[$globalData]) {
  39985. child[$globalData] = this[$globalData];
  39986. }
  39987. }
  39988. [$isTransparent]() {
  39989. return !this.name;
  39990. }
  39991. [$lastAttribute]() {
  39992. return "";
  39993. }
  39994. [$text]() {
  39995. if (this[_children].length === 0) {
  39996. return this[$content];
  39997. }
  39998. return this[_children].map(c => c[$text]()).join("");
  39999. }
  40000. get [_attributeNames]() {
  40001. const proto = Object.getPrototypeOf(this);
  40002. if (!proto._attributes) {
  40003. const attributes = proto._attributes = new Set();
  40004. for (const name of Object.getOwnPropertyNames(this)) {
  40005. if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) {
  40006. break;
  40007. }
  40008. attributes.add(name);
  40009. }
  40010. }
  40011. return shadow(this, _attributeNames, proto._attributes);
  40012. }
  40013. [$isDescendent](parent) {
  40014. let node = this;
  40015. while (node) {
  40016. if (node === parent) {
  40017. return true;
  40018. }
  40019. node = node[$getParent]();
  40020. }
  40021. return false;
  40022. }
  40023. [$getParent]() {
  40024. return this[_parent];
  40025. }
  40026. [$getSubformParent]() {
  40027. return this[$getParent]();
  40028. }
  40029. [$getChildren](name = null) {
  40030. if (!name) {
  40031. return this[_children];
  40032. }
  40033. return this[name];
  40034. }
  40035. [$dump]() {
  40036. const dumped = Object.create(null);
  40037. if (this[$content]) {
  40038. dumped.$content = this[$content];
  40039. }
  40040. for (const name of Object.getOwnPropertyNames(this)) {
  40041. const value = this[name];
  40042. if (value === null) {
  40043. continue;
  40044. }
  40045. if (value instanceof XFAObject) {
  40046. dumped[name] = value[$dump]();
  40047. } else if (value instanceof XFAObjectArray) {
  40048. if (!value.isEmpty()) {
  40049. dumped[name] = value.dump();
  40050. }
  40051. } else {
  40052. dumped[name] = value;
  40053. }
  40054. }
  40055. return dumped;
  40056. }
  40057. [$toStyle]() {
  40058. return null;
  40059. }
  40060. [$toHTML]() {
  40061. return HTMLResult.EMPTY;
  40062. }
  40063. *[$getContainedChildren]() {
  40064. for (const node of this[$getChildren]()) {
  40065. yield node;
  40066. }
  40067. }
  40068. *[_filteredChildrenGenerator](filter, include) {
  40069. for (const node of this[$getContainedChildren]()) {
  40070. if (!filter || include === filter.has(node[$nodeName])) {
  40071. const availableSpace = this[$getAvailableSpace]();
  40072. const res = node[$toHTML](availableSpace);
  40073. if (!res.success) {
  40074. this[$extra].failingNode = node;
  40075. }
  40076. yield res;
  40077. }
  40078. }
  40079. }
  40080. [$flushHTML]() {
  40081. return null;
  40082. }
  40083. [$addHTML](html, bbox) {
  40084. this[$extra].children.push(html);
  40085. }
  40086. [$getAvailableSpace]() {}
  40087. [$childrenToHTML]({
  40088. filter = null,
  40089. include = true
  40090. }) {
  40091. if (!this[$extra].generator) {
  40092. this[$extra].generator = this[_filteredChildrenGenerator](filter, include);
  40093. } else {
  40094. const availableSpace = this[$getAvailableSpace]();
  40095. const res = this[$extra].failingNode[$toHTML](availableSpace);
  40096. if (!res.success) {
  40097. return res;
  40098. }
  40099. if (res.html) {
  40100. this[$addHTML](res.html, res.bbox);
  40101. }
  40102. delete this[$extra].failingNode;
  40103. }
  40104. while (true) {
  40105. const gen = this[$extra].generator.next();
  40106. if (gen.done) {
  40107. break;
  40108. }
  40109. const res = gen.value;
  40110. if (!res.success) {
  40111. return res;
  40112. }
  40113. if (res.html) {
  40114. this[$addHTML](res.html, res.bbox);
  40115. }
  40116. }
  40117. this[$extra].generator = null;
  40118. return HTMLResult.EMPTY;
  40119. }
  40120. [$setSetAttributes](attributes) {
  40121. this[_setAttributes] = new Set(Object.keys(attributes));
  40122. }
  40123. [_getUnsetAttributes](protoAttributes) {
  40124. const allAttr = this[_attributeNames];
  40125. const setAttr = this[_setAttributes];
  40126. return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x));
  40127. }
  40128. [$resolvePrototypes](ids, ancestors = new Set()) {
  40129. for (const child of this[_children]) {
  40130. child[_resolvePrototypesHelper](ids, ancestors);
  40131. }
  40132. }
  40133. [_resolvePrototypesHelper](ids, ancestors) {
  40134. const proto = this[_getPrototype](ids, ancestors);
  40135. if (proto) {
  40136. this[_applyPrototype](proto, ids, ancestors);
  40137. } else {
  40138. this[$resolvePrototypes](ids, ancestors);
  40139. }
  40140. }
  40141. [_getPrototype](ids, ancestors) {
  40142. const {
  40143. use,
  40144. usehref
  40145. } = this;
  40146. if (!use && !usehref) {
  40147. return null;
  40148. }
  40149. let proto = null;
  40150. let somExpression = null;
  40151. let id = null;
  40152. let ref = use;
  40153. if (usehref) {
  40154. ref = usehref;
  40155. if (usehref.startsWith("#som(") && usehref.endsWith(")")) {
  40156. somExpression = usehref.slice("#som(".length, -1);
  40157. } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) {
  40158. somExpression = usehref.slice(".#som(".length, -1);
  40159. } else if (usehref.startsWith("#")) {
  40160. id = usehref.slice(1);
  40161. } else if (usehref.startsWith(".#")) {
  40162. id = usehref.slice(2);
  40163. }
  40164. } else if (use.startsWith("#")) {
  40165. id = use.slice(1);
  40166. } else {
  40167. somExpression = use;
  40168. }
  40169. this.use = this.usehref = "";
  40170. if (id) {
  40171. proto = ids.get(id);
  40172. } else {
  40173. proto = searchNode(ids.get($root), this, somExpression, true, false);
  40174. if (proto) {
  40175. proto = proto[0];
  40176. }
  40177. }
  40178. if (!proto) {
  40179. warn(`XFA - Invalid prototype reference: ${ref}.`);
  40180. return null;
  40181. }
  40182. if (proto[$nodeName] !== this[$nodeName]) {
  40183. warn(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`);
  40184. return null;
  40185. }
  40186. if (ancestors.has(proto)) {
  40187. warn(`XFA - Cycle detected in prototypes use.`);
  40188. return null;
  40189. }
  40190. ancestors.add(proto);
  40191. const protoProto = proto[_getPrototype](ids, ancestors);
  40192. if (protoProto) {
  40193. proto[_applyPrototype](protoProto, ids, ancestors);
  40194. }
  40195. proto[$resolvePrototypes](ids, ancestors);
  40196. ancestors.delete(proto);
  40197. return proto;
  40198. }
  40199. [_applyPrototype](proto, ids, ancestors) {
  40200. if (ancestors.has(proto)) {
  40201. warn(`XFA - Cycle detected in prototypes use.`);
  40202. return;
  40203. }
  40204. if (!this[$content] && proto[$content]) {
  40205. this[$content] = proto[$content];
  40206. }
  40207. const newAncestors = new Set(ancestors);
  40208. newAncestors.add(proto);
  40209. for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) {
  40210. this[unsetAttrName] = proto[unsetAttrName];
  40211. if (this[_setAttributes]) {
  40212. this[_setAttributes].add(unsetAttrName);
  40213. }
  40214. }
  40215. for (const name of Object.getOwnPropertyNames(this)) {
  40216. if (this[_attributeNames].has(name)) {
  40217. continue;
  40218. }
  40219. const value = this[name];
  40220. const protoValue = proto[name];
  40221. if (value instanceof XFAObjectArray) {
  40222. for (const child of value[_children]) {
  40223. child[_resolvePrototypesHelper](ids, ancestors);
  40224. }
  40225. for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) {
  40226. const child = proto[_children][i][$clone]();
  40227. if (value.push(child)) {
  40228. child[_parent] = this;
  40229. this[_children].push(child);
  40230. child[_resolvePrototypesHelper](ids, ancestors);
  40231. } else {
  40232. break;
  40233. }
  40234. }
  40235. continue;
  40236. }
  40237. if (value !== null) {
  40238. value[$resolvePrototypes](ids, ancestors);
  40239. if (protoValue) {
  40240. value[_applyPrototype](protoValue, ids, ancestors);
  40241. }
  40242. continue;
  40243. }
  40244. if (protoValue !== null) {
  40245. const child = protoValue[$clone]();
  40246. child[_parent] = this;
  40247. this[name] = child;
  40248. this[_children].push(child);
  40249. child[_resolvePrototypesHelper](ids, ancestors);
  40250. }
  40251. }
  40252. }
  40253. static [_cloneAttribute](obj) {
  40254. if (Array.isArray(obj)) {
  40255. return obj.map(x => XFAObject[_cloneAttribute](x));
  40256. }
  40257. if (typeof obj === "object" && obj !== null) {
  40258. return Object.assign({}, obj);
  40259. }
  40260. return obj;
  40261. }
  40262. [$clone]() {
  40263. const clone = Object.create(Object.getPrototypeOf(this));
  40264. for (const $symbol of Object.getOwnPropertySymbols(this)) {
  40265. try {
  40266. clone[$symbol] = this[$symbol];
  40267. } catch {
  40268. shadow(clone, $symbol, this[$symbol]);
  40269. }
  40270. }
  40271. clone[$uid] = `${clone[$nodeName]}${uid++}`;
  40272. clone[_children] = [];
  40273. for (const name of Object.getOwnPropertyNames(this)) {
  40274. if (this[_attributeNames].has(name)) {
  40275. clone[name] = XFAObject[_cloneAttribute](this[name]);
  40276. continue;
  40277. }
  40278. const value = this[name];
  40279. clone[name] = value instanceof XFAObjectArray ? new XFAObjectArray(value[_max]) : null;
  40280. }
  40281. for (const child of this[_children]) {
  40282. const name = child[$nodeName];
  40283. const clonedChild = child[$clone]();
  40284. clone[_children].push(clonedChild);
  40285. clonedChild[_parent] = clone;
  40286. if (clone[name] === null) {
  40287. clone[name] = clonedChild;
  40288. } else {
  40289. clone[name][_children].push(clonedChild);
  40290. }
  40291. }
  40292. return clone;
  40293. }
  40294. [$getChildren](name = null) {
  40295. if (!name) {
  40296. return this[_children];
  40297. }
  40298. return this[_children].filter(c => c[$nodeName] === name);
  40299. }
  40300. [$getChildrenByClass](name) {
  40301. return this[name];
  40302. }
  40303. [$getChildrenByName](name, allTransparent, first = true) {
  40304. return Array.from(this[$getChildrenByNameIt](name, allTransparent, first));
  40305. }
  40306. *[$getChildrenByNameIt](name, allTransparent, first = true) {
  40307. if (name === "parent") {
  40308. yield this[_parent];
  40309. return;
  40310. }
  40311. for (const child of this[_children]) {
  40312. if (child[$nodeName] === name) {
  40313. yield child;
  40314. }
  40315. if (child.name === name) {
  40316. yield child;
  40317. }
  40318. if (allTransparent || child[$isTransparent]()) {
  40319. yield* child[$getChildrenByNameIt](name, allTransparent, false);
  40320. }
  40321. }
  40322. if (first && this[_attributeNames].has(name)) {
  40323. yield new XFAAttribute(this, name, this[name]);
  40324. }
  40325. }
  40326. }
  40327. class XFAObjectArray {
  40328. constructor(max = Infinity) {
  40329. this[_max] = max;
  40330. this[_children] = [];
  40331. }
  40332. get isXFAObject() {
  40333. return false;
  40334. }
  40335. get isXFAObjectArray() {
  40336. return true;
  40337. }
  40338. push(child) {
  40339. const len = this[_children].length;
  40340. if (len <= this[_max]) {
  40341. this[_children].push(child);
  40342. return true;
  40343. }
  40344. warn(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`);
  40345. return false;
  40346. }
  40347. isEmpty() {
  40348. return this[_children].length === 0;
  40349. }
  40350. dump() {
  40351. return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]());
  40352. }
  40353. [$clone]() {
  40354. const clone = new XFAObjectArray(this[_max]);
  40355. clone[_children] = this[_children].map(c => c[$clone]());
  40356. return clone;
  40357. }
  40358. get children() {
  40359. return this[_children];
  40360. }
  40361. clear() {
  40362. this[_children].length = 0;
  40363. }
  40364. }
  40365. class XFAAttribute {
  40366. constructor(node, name, value) {
  40367. this[_parent] = node;
  40368. this[$nodeName] = name;
  40369. this[$content] = value;
  40370. this[$consumed] = false;
  40371. this[$uid] = `attribute${uid++}`;
  40372. }
  40373. [$getParent]() {
  40374. return this[_parent];
  40375. }
  40376. [$isDataValue]() {
  40377. return true;
  40378. }
  40379. [$getDataValue]() {
  40380. return this[$content].trim();
  40381. }
  40382. [$setValue](value) {
  40383. value = value.value || "";
  40384. this[$content] = value.toString();
  40385. }
  40386. [$text]() {
  40387. return this[$content];
  40388. }
  40389. [$isDescendent](parent) {
  40390. return this[_parent] === parent || this[_parent][$isDescendent](parent);
  40391. }
  40392. }
  40393. class XmlObject extends XFAObject {
  40394. constructor(nsId, name, attributes = {}) {
  40395. super(nsId, name);
  40396. this[$content] = "";
  40397. this[_dataValue] = null;
  40398. if (name !== "#text") {
  40399. const map = new Map();
  40400. this[_attributes] = map;
  40401. for (const [attrName, value] of Object.entries(attributes)) {
  40402. map.set(attrName, new XFAAttribute(this, attrName, value));
  40403. }
  40404. if (attributes.hasOwnProperty($nsAttributes)) {
  40405. const dataNode = attributes[$nsAttributes].xfa.dataNode;
  40406. if (dataNode !== undefined) {
  40407. if (dataNode === "dataGroup") {
  40408. this[_dataValue] = false;
  40409. } else if (dataNode === "dataValue") {
  40410. this[_dataValue] = true;
  40411. }
  40412. }
  40413. }
  40414. }
  40415. this[$consumed] = false;
  40416. }
  40417. [$toString](buf) {
  40418. const tagName = this[$nodeName];
  40419. if (tagName === "#text") {
  40420. buf.push(encodeToXmlString(this[$content]));
  40421. return;
  40422. }
  40423. const utf8TagName = utf8StringToString(tagName);
  40424. const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : "";
  40425. buf.push(`<${prefix}${utf8TagName}`);
  40426. for (const [name, value] of this[_attributes].entries()) {
  40427. const utf8Name = utf8StringToString(name);
  40428. buf.push(` ${utf8Name}="${encodeToXmlString(value[$content])}"`);
  40429. }
  40430. if (this[_dataValue] !== null) {
  40431. if (this[_dataValue]) {
  40432. buf.push(` xfa:dataNode="dataValue"`);
  40433. } else {
  40434. buf.push(` xfa:dataNode="dataGroup"`);
  40435. }
  40436. }
  40437. if (!this[$content] && this[_children].length === 0) {
  40438. buf.push("/>");
  40439. return;
  40440. }
  40441. buf.push(">");
  40442. if (this[$content]) {
  40443. if (typeof this[$content] === "string") {
  40444. buf.push(encodeToXmlString(this[$content]));
  40445. } else {
  40446. this[$content][$toString](buf);
  40447. }
  40448. } else {
  40449. for (const child of this[_children]) {
  40450. child[$toString](buf);
  40451. }
  40452. }
  40453. buf.push(`</${prefix}${utf8TagName}>`);
  40454. }
  40455. [$onChild](child) {
  40456. if (this[$content]) {
  40457. const node = new XmlObject(this[$namespaceId], "#text");
  40458. this[$appendChild](node);
  40459. node[$content] = this[$content];
  40460. this[$content] = "";
  40461. }
  40462. this[$appendChild](child);
  40463. return true;
  40464. }
  40465. [$onText](str) {
  40466. this[$content] += str;
  40467. }
  40468. [$finalize]() {
  40469. if (this[$content] && this[_children].length > 0) {
  40470. const node = new XmlObject(this[$namespaceId], "#text");
  40471. this[$appendChild](node);
  40472. node[$content] = this[$content];
  40473. delete this[$content];
  40474. }
  40475. }
  40476. [$toHTML]() {
  40477. if (this[$nodeName] === "#text") {
  40478. return HTMLResult.success({
  40479. name: "#text",
  40480. value: this[$content]
  40481. });
  40482. }
  40483. return HTMLResult.EMPTY;
  40484. }
  40485. [$getChildren](name = null) {
  40486. if (!name) {
  40487. return this[_children];
  40488. }
  40489. return this[_children].filter(c => c[$nodeName] === name);
  40490. }
  40491. [$getAttributes]() {
  40492. return this[_attributes];
  40493. }
  40494. [$getChildrenByClass](name) {
  40495. const value = this[_attributes].get(name);
  40496. if (value !== undefined) {
  40497. return value;
  40498. }
  40499. return this[$getChildren](name);
  40500. }
  40501. *[$getChildrenByNameIt](name, allTransparent) {
  40502. const value = this[_attributes].get(name);
  40503. if (value) {
  40504. yield value;
  40505. }
  40506. for (const child of this[_children]) {
  40507. if (child[$nodeName] === name) {
  40508. yield child;
  40509. }
  40510. if (allTransparent) {
  40511. yield* child[$getChildrenByNameIt](name, allTransparent);
  40512. }
  40513. }
  40514. }
  40515. *[$getAttributeIt](name, skipConsumed) {
  40516. const value = this[_attributes].get(name);
  40517. if (value && (!skipConsumed || !value[$consumed])) {
  40518. yield value;
  40519. }
  40520. for (const child of this[_children]) {
  40521. yield* child[$getAttributeIt](name, skipConsumed);
  40522. }
  40523. }
  40524. *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {
  40525. for (const child of this[_children]) {
  40526. if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) {
  40527. yield child;
  40528. }
  40529. if (allTransparent) {
  40530. yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed);
  40531. }
  40532. }
  40533. }
  40534. [$isDataValue]() {
  40535. if (this[_dataValue] === null) {
  40536. return this[_children].length === 0 || this[_children][0][$namespaceId] === NamespaceIds.xhtml.id;
  40537. }
  40538. return this[_dataValue];
  40539. }
  40540. [$getDataValue]() {
  40541. if (this[_dataValue] === null) {
  40542. if (this[_children].length === 0) {
  40543. return this[$content].trim();
  40544. }
  40545. if (this[_children][0][$namespaceId] === NamespaceIds.xhtml.id) {
  40546. return this[_children][0][$text]().trim();
  40547. }
  40548. return null;
  40549. }
  40550. return this[$content].trim();
  40551. }
  40552. [$setValue](value) {
  40553. value = value.value || "";
  40554. this[$content] = value.toString();
  40555. }
  40556. [$dump](hasNS = false) {
  40557. const dumped = Object.create(null);
  40558. if (hasNS) {
  40559. dumped.$ns = this[$namespaceId];
  40560. }
  40561. if (this[$content]) {
  40562. dumped.$content = this[$content];
  40563. }
  40564. dumped.$name = this[$nodeName];
  40565. dumped.children = [];
  40566. for (const child of this[_children]) {
  40567. dumped.children.push(child[$dump](hasNS));
  40568. }
  40569. dumped.attributes = Object.create(null);
  40570. for (const [name, value] of this[_attributes]) {
  40571. dumped.attributes[name] = value[$content];
  40572. }
  40573. return dumped;
  40574. }
  40575. }
  40576. class ContentObject extends XFAObject {
  40577. constructor(nsId, name) {
  40578. super(nsId, name);
  40579. this[$content] = "";
  40580. }
  40581. [$onText](text) {
  40582. this[$content] += text;
  40583. }
  40584. [$finalize]() {}
  40585. }
  40586. class OptionObject extends ContentObject {
  40587. constructor(nsId, name, options) {
  40588. super(nsId, name);
  40589. this[_options] = options;
  40590. }
  40591. [$finalize]() {
  40592. this[$content] = getKeyword({
  40593. data: this[$content],
  40594. defaultValue: this[_options][0],
  40595. validate: k => this[_options].includes(k)
  40596. });
  40597. }
  40598. [$clean](builder) {
  40599. super[$clean](builder);
  40600. delete this[_options];
  40601. }
  40602. }
  40603. class StringObject extends ContentObject {
  40604. [$finalize]() {
  40605. this[$content] = this[$content].trim();
  40606. }
  40607. }
  40608. class IntegerObject extends ContentObject {
  40609. constructor(nsId, name, defaultValue, validator) {
  40610. super(nsId, name);
  40611. this[_defaultValue] = defaultValue;
  40612. this[_validator] = validator;
  40613. }
  40614. [$finalize]() {
  40615. this[$content] = getInteger({
  40616. data: this[$content],
  40617. defaultValue: this[_defaultValue],
  40618. validate: this[_validator]
  40619. });
  40620. }
  40621. [$clean](builder) {
  40622. super[$clean](builder);
  40623. delete this[_defaultValue];
  40624. delete this[_validator];
  40625. }
  40626. }
  40627. class Option01 extends IntegerObject {
  40628. constructor(nsId, name) {
  40629. super(nsId, name, 0, n => n === 1);
  40630. }
  40631. }
  40632. class Option10 extends IntegerObject {
  40633. constructor(nsId, name) {
  40634. super(nsId, name, 1, n => n === 0);
  40635. }
  40636. }
  40637. ;// ./src/core/xfa/html_utils.js
  40638. function measureToString(m) {
  40639. if (typeof m === "string") {
  40640. return "0px";
  40641. }
  40642. return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;
  40643. }
  40644. const converters = {
  40645. anchorType(node, style) {
  40646. const parent = node[$getSubformParent]();
  40647. if (!parent || parent.layout && parent.layout !== "position") {
  40648. return;
  40649. }
  40650. if (!("transform" in style)) {
  40651. style.transform = "";
  40652. }
  40653. switch (node.anchorType) {
  40654. case "bottomCenter":
  40655. style.transform += "translate(-50%, -100%)";
  40656. break;
  40657. case "bottomLeft":
  40658. style.transform += "translate(0,-100%)";
  40659. break;
  40660. case "bottomRight":
  40661. style.transform += "translate(-100%,-100%)";
  40662. break;
  40663. case "middleCenter":
  40664. style.transform += "translate(-50%,-50%)";
  40665. break;
  40666. case "middleLeft":
  40667. style.transform += "translate(0,-50%)";
  40668. break;
  40669. case "middleRight":
  40670. style.transform += "translate(-100%,-50%)";
  40671. break;
  40672. case "topCenter":
  40673. style.transform += "translate(-50%,0)";
  40674. break;
  40675. case "topRight":
  40676. style.transform += "translate(-100%,0)";
  40677. break;
  40678. }
  40679. },
  40680. dimensions(node, style) {
  40681. const parent = node[$getSubformParent]();
  40682. let width = node.w;
  40683. const height = node.h;
  40684. if (parent.layout?.includes("row")) {
  40685. const extra = parent[$extra];
  40686. const colSpan = node.colSpan;
  40687. let w;
  40688. if (colSpan === -1) {
  40689. w = extra.columnWidths.slice(extra.currentColumn).reduce((a, x) => a + x, 0);
  40690. extra.currentColumn = 0;
  40691. } else {
  40692. w = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, x) => a + x, 0);
  40693. extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length;
  40694. }
  40695. if (!isNaN(w)) {
  40696. width = node.w = w;
  40697. }
  40698. }
  40699. style.width = width !== "" ? measureToString(width) : "auto";
  40700. style.height = height !== "" ? measureToString(height) : "auto";
  40701. },
  40702. position(node, style) {
  40703. const parent = node[$getSubformParent]();
  40704. if (parent?.layout && parent.layout !== "position") {
  40705. return;
  40706. }
  40707. style.position = "absolute";
  40708. style.left = measureToString(node.x);
  40709. style.top = measureToString(node.y);
  40710. },
  40711. rotate(node, style) {
  40712. if (node.rotate) {
  40713. if (!("transform" in style)) {
  40714. style.transform = "";
  40715. }
  40716. style.transform += `rotate(-${node.rotate}deg)`;
  40717. style.transformOrigin = "top left";
  40718. }
  40719. },
  40720. presence(node, style) {
  40721. switch (node.presence) {
  40722. case "invisible":
  40723. style.visibility = "hidden";
  40724. break;
  40725. case "hidden":
  40726. case "inactive":
  40727. style.display = "none";
  40728. break;
  40729. }
  40730. },
  40731. hAlign(node, style) {
  40732. if (node[$nodeName] === "para") {
  40733. switch (node.hAlign) {
  40734. case "justifyAll":
  40735. style.textAlign = "justify-all";
  40736. break;
  40737. case "radix":
  40738. style.textAlign = "left";
  40739. break;
  40740. default:
  40741. style.textAlign = node.hAlign;
  40742. }
  40743. } else {
  40744. switch (node.hAlign) {
  40745. case "left":
  40746. style.alignSelf = "start";
  40747. break;
  40748. case "center":
  40749. style.alignSelf = "center";
  40750. break;
  40751. case "right":
  40752. style.alignSelf = "end";
  40753. break;
  40754. }
  40755. }
  40756. },
  40757. margin(node, style) {
  40758. if (node.margin) {
  40759. style.margin = node.margin[$toStyle]().margin;
  40760. }
  40761. }
  40762. };
  40763. function setMinMaxDimensions(node, style) {
  40764. const parent = node[$getSubformParent]();
  40765. if (parent.layout === "position") {
  40766. if (node.minW > 0) {
  40767. style.minWidth = measureToString(node.minW);
  40768. }
  40769. if (node.maxW > 0) {
  40770. style.maxWidth = measureToString(node.maxW);
  40771. }
  40772. if (node.minH > 0) {
  40773. style.minHeight = measureToString(node.minH);
  40774. }
  40775. if (node.maxH > 0) {
  40776. style.maxHeight = measureToString(node.maxH);
  40777. }
  40778. }
  40779. }
  40780. function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) {
  40781. const measure = new TextMeasure(xfaFont, margin, lineHeight, fontFinder);
  40782. if (typeof text === "string") {
  40783. measure.addString(text);
  40784. } else {
  40785. text[$pushGlyphs](measure);
  40786. }
  40787. return measure.compute(width);
  40788. }
  40789. function layoutNode(node, availableSpace) {
  40790. let height = null;
  40791. let width = null;
  40792. let isBroken = false;
  40793. if ((!node.w || !node.h) && node.value) {
  40794. let marginH = 0;
  40795. let marginV = 0;
  40796. if (node.margin) {
  40797. marginH = node.margin.leftInset + node.margin.rightInset;
  40798. marginV = node.margin.topInset + node.margin.bottomInset;
  40799. }
  40800. let lineHeight = null;
  40801. let margin = null;
  40802. if (node.para) {
  40803. margin = Object.create(null);
  40804. lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight;
  40805. margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove;
  40806. margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow;
  40807. margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft;
  40808. margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight;
  40809. }
  40810. let font = node.font;
  40811. if (!font) {
  40812. const root = node[$getTemplateRoot]();
  40813. let parent = node[$getParent]();
  40814. while (parent && parent !== root) {
  40815. if (parent.font) {
  40816. font = parent.font;
  40817. break;
  40818. }
  40819. parent = parent[$getParent]();
  40820. }
  40821. }
  40822. const maxWidth = (node.w || availableSpace.width) - marginH;
  40823. const fontFinder = node[$globalData].fontFinder;
  40824. if (node.value.exData && node.value.exData[$content] && node.value.exData.contentType === "text/html") {
  40825. const res = layoutText(node.value.exData[$content], font, margin, lineHeight, fontFinder, maxWidth);
  40826. width = res.width;
  40827. height = res.height;
  40828. isBroken = res.isBroken;
  40829. } else {
  40830. const text = node.value[$text]();
  40831. if (text) {
  40832. const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth);
  40833. width = res.width;
  40834. height = res.height;
  40835. isBroken = res.isBroken;
  40836. }
  40837. }
  40838. if (width !== null && !node.w) {
  40839. width += marginH;
  40840. }
  40841. if (height !== null && !node.h) {
  40842. height += marginV;
  40843. }
  40844. }
  40845. return {
  40846. w: width,
  40847. h: height,
  40848. isBroken
  40849. };
  40850. }
  40851. function computeBbox(node, html, availableSpace) {
  40852. let bbox;
  40853. if (node.w !== "" && node.h !== "") {
  40854. bbox = [node.x, node.y, node.w, node.h];
  40855. } else {
  40856. if (!availableSpace) {
  40857. return null;
  40858. }
  40859. let width = node.w;
  40860. if (width === "") {
  40861. if (node.maxW === 0) {
  40862. const parent = node[$getSubformParent]();
  40863. width = parent.layout === "position" && parent.w !== "" ? 0 : node.minW;
  40864. } else {
  40865. width = Math.min(node.maxW, availableSpace.width);
  40866. }
  40867. html.attributes.style.width = measureToString(width);
  40868. }
  40869. let height = node.h;
  40870. if (height === "") {
  40871. if (node.maxH === 0) {
  40872. const parent = node[$getSubformParent]();
  40873. height = parent.layout === "position" && parent.h !== "" ? 0 : node.minH;
  40874. } else {
  40875. height = Math.min(node.maxH, availableSpace.height);
  40876. }
  40877. html.attributes.style.height = measureToString(height);
  40878. }
  40879. bbox = [node.x, node.y, width, height];
  40880. }
  40881. return bbox;
  40882. }
  40883. function fixDimensions(node) {
  40884. const parent = node[$getSubformParent]();
  40885. if (parent.layout?.includes("row")) {
  40886. const extra = parent[$extra];
  40887. const colSpan = node.colSpan;
  40888. let width;
  40889. if (colSpan === -1) {
  40890. width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0);
  40891. } else {
  40892. width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0);
  40893. }
  40894. if (!isNaN(width)) {
  40895. node.w = width;
  40896. }
  40897. }
  40898. if (parent.layout && parent.layout !== "position") {
  40899. node.x = node.y = 0;
  40900. }
  40901. if (node.layout === "table") {
  40902. if (node.w === "" && Array.isArray(node.columnWidths)) {
  40903. node.w = node.columnWidths.reduce((a, x) => a + x, 0);
  40904. }
  40905. }
  40906. }
  40907. function layoutClass(node) {
  40908. switch (node.layout) {
  40909. case "position":
  40910. return "xfaPosition";
  40911. case "lr-tb":
  40912. return "xfaLrTb";
  40913. case "rl-row":
  40914. return "xfaRlRow";
  40915. case "rl-tb":
  40916. return "xfaRlTb";
  40917. case "row":
  40918. return "xfaRow";
  40919. case "table":
  40920. return "xfaTable";
  40921. case "tb":
  40922. return "xfaTb";
  40923. default:
  40924. return "xfaPosition";
  40925. }
  40926. }
  40927. function toStyle(node, ...names) {
  40928. const style = Object.create(null);
  40929. for (const name of names) {
  40930. const value = node[name];
  40931. if (value === null) {
  40932. continue;
  40933. }
  40934. if (converters.hasOwnProperty(name)) {
  40935. converters[name](node, style);
  40936. continue;
  40937. }
  40938. if (value instanceof XFAObject) {
  40939. const newStyle = value[$toStyle]();
  40940. if (newStyle) {
  40941. Object.assign(style, newStyle);
  40942. } else {
  40943. warn(`(DEBUG) - XFA - style for ${name} not implemented yet`);
  40944. }
  40945. }
  40946. }
  40947. return style;
  40948. }
  40949. function createWrapper(node, html) {
  40950. const {
  40951. attributes
  40952. } = html;
  40953. const {
  40954. style
  40955. } = attributes;
  40956. const wrapper = {
  40957. name: "div",
  40958. attributes: {
  40959. class: ["xfaWrapper"],
  40960. style: Object.create(null)
  40961. },
  40962. children: []
  40963. };
  40964. attributes.class.push("xfaWrapped");
  40965. if (node.border) {
  40966. const {
  40967. widths,
  40968. insets
  40969. } = node.border[$extra];
  40970. let width, height;
  40971. let top = insets[0];
  40972. let left = insets[3];
  40973. const insetsH = insets[0] + insets[2];
  40974. const insetsW = insets[1] + insets[3];
  40975. switch (node.border.hand) {
  40976. case "even":
  40977. top -= widths[0] / 2;
  40978. left -= widths[3] / 2;
  40979. width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
  40980. height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;
  40981. break;
  40982. case "left":
  40983. top -= widths[0];
  40984. left -= widths[3];
  40985. width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
  40986. height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
  40987. break;
  40988. case "right":
  40989. width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
  40990. height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
  40991. break;
  40992. }
  40993. const classNames = ["xfaBorder"];
  40994. if (isPrintOnly(node.border)) {
  40995. classNames.push("xfaPrintOnly");
  40996. }
  40997. const border = {
  40998. name: "div",
  40999. attributes: {
  41000. class: classNames,
  41001. style: {
  41002. top: `${top}px`,
  41003. left: `${left}px`,
  41004. width,
  41005. height
  41006. }
  41007. },
  41008. children: []
  41009. };
  41010. for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) {
  41011. if (style[key] !== undefined) {
  41012. border.attributes.style[key] = style[key];
  41013. delete style[key];
  41014. }
  41015. }
  41016. wrapper.children.push(border, html);
  41017. } else {
  41018. wrapper.children.push(html);
  41019. }
  41020. for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) {
  41021. if (style[key] !== undefined) {
  41022. wrapper.attributes.style[key] = style[key];
  41023. delete style[key];
  41024. }
  41025. }
  41026. wrapper.attributes.style.position = style.position === "absolute" ? "absolute" : "relative";
  41027. delete style.position;
  41028. if (style.alignSelf) {
  41029. wrapper.attributes.style.alignSelf = style.alignSelf;
  41030. delete style.alignSelf;
  41031. }
  41032. return wrapper;
  41033. }
  41034. function fixTextIndent(styles) {
  41035. const indent = getMeasurement(styles.textIndent, "0px");
  41036. if (indent >= 0) {
  41037. return;
  41038. }
  41039. const align = styles.textAlign === "right" ? "right" : "left";
  41040. const name = "padding" + (align === "left" ? "Left" : "Right");
  41041. const padding = getMeasurement(styles[name], "0px");
  41042. styles[name] = `${padding - indent}px`;
  41043. }
  41044. function setAccess(node, classNames) {
  41045. switch (node.access) {
  41046. case "nonInteractive":
  41047. classNames.push("xfaNonInteractive");
  41048. break;
  41049. case "readOnly":
  41050. classNames.push("xfaReadOnly");
  41051. break;
  41052. case "protected":
  41053. classNames.push("xfaDisabled");
  41054. break;
  41055. }
  41056. }
  41057. function isPrintOnly(node) {
  41058. return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print";
  41059. }
  41060. function getCurrentPara(node) {
  41061. const stack = node[$getTemplateRoot]()[$extra].paraStack;
  41062. return stack.length ? stack.at(-1) : null;
  41063. }
  41064. function setPara(node, nodeStyle, value) {
  41065. if (value.attributes.class?.includes("xfaRich")) {
  41066. if (nodeStyle) {
  41067. if (node.h === "") {
  41068. nodeStyle.height = "auto";
  41069. }
  41070. if (node.w === "") {
  41071. nodeStyle.width = "auto";
  41072. }
  41073. }
  41074. const para = getCurrentPara(node);
  41075. if (para) {
  41076. const valueStyle = value.attributes.style;
  41077. valueStyle.display = "flex";
  41078. valueStyle.flexDirection = "column";
  41079. switch (para.vAlign) {
  41080. case "top":
  41081. valueStyle.justifyContent = "start";
  41082. break;
  41083. case "bottom":
  41084. valueStyle.justifyContent = "end";
  41085. break;
  41086. case "middle":
  41087. valueStyle.justifyContent = "center";
  41088. break;
  41089. }
  41090. const paraStyle = para[$toStyle]();
  41091. for (const [key, val] of Object.entries(paraStyle)) {
  41092. if (!(key in valueStyle)) {
  41093. valueStyle[key] = val;
  41094. }
  41095. }
  41096. }
  41097. }
  41098. }
  41099. function setFontFamily(xfaFont, node, fontFinder, style) {
  41100. if (!fontFinder) {
  41101. delete style.fontFamily;
  41102. return;
  41103. }
  41104. const name = stripQuotes(xfaFont.typeface);
  41105. style.fontFamily = `"${name}"`;
  41106. const typeface = fontFinder.find(name);
  41107. if (typeface) {
  41108. const {
  41109. fontFamily
  41110. } = typeface.regular.cssFontInfo;
  41111. if (fontFamily !== name) {
  41112. style.fontFamily = `"${fontFamily}"`;
  41113. }
  41114. const para = getCurrentPara(node);
  41115. if (para && para.lineHeight !== "") {
  41116. return;
  41117. }
  41118. if (style.lineHeight) {
  41119. return;
  41120. }
  41121. const pdfFont = selectFont(xfaFont, typeface);
  41122. if (pdfFont) {
  41123. style.lineHeight = Math.max(1.2, pdfFont.lineHeight);
  41124. }
  41125. }
  41126. }
  41127. function fixURL(str) {
  41128. const absoluteUrl = createValidAbsoluteUrl(str, null, {
  41129. addDefaultProtocol: true,
  41130. tryConvertEncoding: true
  41131. });
  41132. return absoluteUrl ? absoluteUrl.href : null;
  41133. }
  41134. ;// ./src/core/xfa/layout.js
  41135. function createLine(node, children) {
  41136. return {
  41137. name: "div",
  41138. attributes: {
  41139. class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"]
  41140. },
  41141. children
  41142. };
  41143. }
  41144. function flushHTML(node) {
  41145. if (!node[$extra]) {
  41146. return null;
  41147. }
  41148. const attributes = node[$extra].attributes;
  41149. const html = {
  41150. name: "div",
  41151. attributes,
  41152. children: node[$extra].children
  41153. };
  41154. if (node[$extra].failingNode) {
  41155. const htmlFromFailing = node[$extra].failingNode[$flushHTML]();
  41156. if (htmlFromFailing) {
  41157. if (node.layout.endsWith("-tb")) {
  41158. html.children.push(createLine(node, [htmlFromFailing]));
  41159. } else {
  41160. html.children.push(htmlFromFailing);
  41161. }
  41162. }
  41163. }
  41164. if (html.children.length === 0) {
  41165. return null;
  41166. }
  41167. return html;
  41168. }
  41169. function addHTML(node, html, bbox) {
  41170. const extra = node[$extra];
  41171. const availableSpace = extra.availableSpace;
  41172. const [x, y, w, h] = bbox;
  41173. switch (node.layout) {
  41174. case "position":
  41175. {
  41176. extra.width = Math.max(extra.width, x + w);
  41177. extra.height = Math.max(extra.height, y + h);
  41178. extra.children.push(html);
  41179. break;
  41180. }
  41181. case "lr-tb":
  41182. case "rl-tb":
  41183. if (!extra.line || extra.attempt === 1) {
  41184. extra.line = createLine(node, []);
  41185. extra.children.push(extra.line);
  41186. extra.numberInLine = 0;
  41187. }
  41188. extra.numberInLine += 1;
  41189. extra.line.children.push(html);
  41190. if (extra.attempt === 0) {
  41191. extra.currentWidth += w;
  41192. extra.height = Math.max(extra.height, extra.prevHeight + h);
  41193. } else {
  41194. extra.currentWidth = w;
  41195. extra.prevHeight = extra.height;
  41196. extra.height += h;
  41197. extra.attempt = 0;
  41198. }
  41199. extra.width = Math.max(extra.width, extra.currentWidth);
  41200. break;
  41201. case "rl-row":
  41202. case "row":
  41203. {
  41204. extra.children.push(html);
  41205. extra.width += w;
  41206. extra.height = Math.max(extra.height, h);
  41207. const height = measureToString(extra.height);
  41208. for (const child of extra.children) {
  41209. child.attributes.style.height = height;
  41210. }
  41211. break;
  41212. }
  41213. case "table":
  41214. {
  41215. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  41216. extra.height += h;
  41217. extra.children.push(html);
  41218. break;
  41219. }
  41220. case "tb":
  41221. {
  41222. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  41223. extra.height += h;
  41224. extra.children.push(html);
  41225. break;
  41226. }
  41227. }
  41228. }
  41229. function getAvailableSpace(node) {
  41230. const availableSpace = node[$extra].availableSpace;
  41231. const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0;
  41232. const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0;
  41233. switch (node.layout) {
  41234. case "lr-tb":
  41235. case "rl-tb":
  41236. if (node[$extra].attempt === 0) {
  41237. return {
  41238. width: availableSpace.width - marginH - node[$extra].currentWidth,
  41239. height: availableSpace.height - marginV - node[$extra].prevHeight
  41240. };
  41241. }
  41242. return {
  41243. width: availableSpace.width - marginH,
  41244. height: availableSpace.height - marginV - node[$extra].height
  41245. };
  41246. case "rl-row":
  41247. case "row":
  41248. const width = node[$extra].columnWidths.slice(node[$extra].currentColumn).reduce((a, x) => a + x);
  41249. return {
  41250. width,
  41251. height: availableSpace.height - marginH
  41252. };
  41253. case "table":
  41254. case "tb":
  41255. return {
  41256. width: availableSpace.width - marginH,
  41257. height: availableSpace.height - marginV - node[$extra].height
  41258. };
  41259. case "position":
  41260. default:
  41261. return availableSpace;
  41262. }
  41263. }
  41264. function getTransformedBBox(node) {
  41265. let w = node.w === "" ? NaN : node.w;
  41266. let h = node.h === "" ? NaN : node.h;
  41267. let [centerX, centerY] = [0, 0];
  41268. switch (node.anchorType || "") {
  41269. case "bottomCenter":
  41270. [centerX, centerY] = [w / 2, h];
  41271. break;
  41272. case "bottomLeft":
  41273. [centerX, centerY] = [0, h];
  41274. break;
  41275. case "bottomRight":
  41276. [centerX, centerY] = [w, h];
  41277. break;
  41278. case "middleCenter":
  41279. [centerX, centerY] = [w / 2, h / 2];
  41280. break;
  41281. case "middleLeft":
  41282. [centerX, centerY] = [0, h / 2];
  41283. break;
  41284. case "middleRight":
  41285. [centerX, centerY] = [w, h / 2];
  41286. break;
  41287. case "topCenter":
  41288. [centerX, centerY] = [w / 2, 0];
  41289. break;
  41290. case "topRight":
  41291. [centerX, centerY] = [w, 0];
  41292. break;
  41293. }
  41294. let x, y;
  41295. switch (node.rotate || 0) {
  41296. case 0:
  41297. [x, y] = [-centerX, -centerY];
  41298. break;
  41299. case 90:
  41300. [x, y] = [-centerY, centerX];
  41301. [w, h] = [h, -w];
  41302. break;
  41303. case 180:
  41304. [x, y] = [centerX, centerY];
  41305. [w, h] = [-w, -h];
  41306. break;
  41307. case 270:
  41308. [x, y] = [centerY, -centerX];
  41309. [w, h] = [-h, w];
  41310. break;
  41311. }
  41312. return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)];
  41313. }
  41314. function checkDimensions(node, space) {
  41315. if (node[$getTemplateRoot]()[$extra].firstUnsplittable === null) {
  41316. return true;
  41317. }
  41318. if (node.w === 0 || node.h === 0) {
  41319. return true;
  41320. }
  41321. const ERROR = 2;
  41322. const parent = node[$getSubformParent]();
  41323. const attempt = parent[$extra]?.attempt || 0;
  41324. const [, y, w, h] = getTransformedBBox(node);
  41325. switch (parent.layout) {
  41326. case "lr-tb":
  41327. case "rl-tb":
  41328. if (attempt === 0) {
  41329. if (!node[$getTemplateRoot]()[$extra].noLayoutFailure) {
  41330. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  41331. return false;
  41332. }
  41333. if (node.w !== "") {
  41334. if (Math.round(w - space.width) <= ERROR) {
  41335. return true;
  41336. }
  41337. if (parent[$extra].numberInLine === 0) {
  41338. return space.height > ERROR;
  41339. }
  41340. return false;
  41341. }
  41342. return space.width > ERROR;
  41343. }
  41344. if (node.w !== "") {
  41345. return Math.round(w - space.width) <= ERROR;
  41346. }
  41347. return space.width > ERROR;
  41348. }
  41349. if (node[$getTemplateRoot]()[$extra].noLayoutFailure) {
  41350. return true;
  41351. }
  41352. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  41353. return false;
  41354. }
  41355. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  41356. return space.height > ERROR;
  41357. }
  41358. if (parent[$isThereMoreWidth]()) {
  41359. return false;
  41360. }
  41361. return space.height > ERROR;
  41362. case "table":
  41363. case "tb":
  41364. if (node[$getTemplateRoot]()[$extra].noLayoutFailure) {
  41365. return true;
  41366. }
  41367. if (node.h !== "" && !node[$isSplittable]()) {
  41368. return Math.round(h - space.height) <= ERROR;
  41369. }
  41370. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  41371. return space.height > ERROR;
  41372. }
  41373. if (parent[$isThereMoreWidth]()) {
  41374. return false;
  41375. }
  41376. return space.height > ERROR;
  41377. case "position":
  41378. if (node[$getTemplateRoot]()[$extra].noLayoutFailure) {
  41379. return true;
  41380. }
  41381. if (node.h === "" || Math.round(h + y - space.height) <= ERROR) {
  41382. return true;
  41383. }
  41384. const area = node[$getTemplateRoot]()[$extra].currentContentArea;
  41385. return h + y > area.h;
  41386. case "rl-row":
  41387. case "row":
  41388. if (node[$getTemplateRoot]()[$extra].noLayoutFailure) {
  41389. return true;
  41390. }
  41391. if (node.h !== "") {
  41392. return Math.round(h - space.height) <= ERROR;
  41393. }
  41394. return true;
  41395. default:
  41396. return true;
  41397. }
  41398. }
  41399. ;// ./src/core/xfa/template.js
  41400. const TEMPLATE_NS_ID = NamespaceIds.template.id;
  41401. const SVG_NS = "http://www.w3.org/2000/svg";
  41402. const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2;
  41403. const MAX_EMPTY_PAGES = 3;
  41404. const DEFAULT_TAB_INDEX = 5000;
  41405. const HEADING_PATTERN = /^H(\d+)$/;
  41406. const MIMES = new Set(["image/gif", "image/jpeg", "image/jpg", "image/pjpeg", "image/png", "image/apng", "image/x-png", "image/bmp", "image/x-ms-bmp", "image/tiff", "image/tif", "application/octet-stream"]);
  41407. const IMAGES_HEADERS = [[[0x42, 0x4d], "image/bmp"], [[0xff, 0xd8, 0xff], "image/jpeg"], [[0x49, 0x49, 0x2a, 0x00], "image/tiff"], [[0x4d, 0x4d, 0x00, 0x2a], "image/tiff"], [[0x47, 0x49, 0x46, 0x38, 0x39, 0x61], "image/gif"], [[0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a], "image/png"]];
  41408. function getBorderDims(node) {
  41409. if (!node || !node.border) {
  41410. return {
  41411. w: 0,
  41412. h: 0
  41413. };
  41414. }
  41415. const borderExtra = node.border[$getExtra]();
  41416. if (!borderExtra) {
  41417. return {
  41418. w: 0,
  41419. h: 0
  41420. };
  41421. }
  41422. return {
  41423. w: borderExtra.widths[0] + borderExtra.widths[2] + borderExtra.insets[0] + borderExtra.insets[2],
  41424. h: borderExtra.widths[1] + borderExtra.widths[3] + borderExtra.insets[1] + borderExtra.insets[3]
  41425. };
  41426. }
  41427. function hasMargin(node) {
  41428. return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset);
  41429. }
  41430. function _setValue(templateNode, value) {
  41431. if (!templateNode.value) {
  41432. const nodeValue = new Value({});
  41433. templateNode[$appendChild](nodeValue);
  41434. templateNode.value = nodeValue;
  41435. }
  41436. templateNode.value[$setValue](value);
  41437. }
  41438. function* getContainedChildren(node) {
  41439. for (const child of node[$getChildren]()) {
  41440. if (child instanceof SubformSet) {
  41441. yield* child[$getContainedChildren]();
  41442. continue;
  41443. }
  41444. yield child;
  41445. }
  41446. }
  41447. function isRequired(node) {
  41448. return node.validate?.nullTest === "error";
  41449. }
  41450. function setTabIndex(node) {
  41451. while (node) {
  41452. if (!node.traversal) {
  41453. node[$tabIndex] = node[$getParent]()[$tabIndex];
  41454. return;
  41455. }
  41456. if (node[$tabIndex]) {
  41457. return;
  41458. }
  41459. let next = null;
  41460. for (const child of node.traversal[$getChildren]()) {
  41461. if (child.operation === "next") {
  41462. next = child;
  41463. break;
  41464. }
  41465. }
  41466. if (!next || !next.ref) {
  41467. node[$tabIndex] = node[$getParent]()[$tabIndex];
  41468. return;
  41469. }
  41470. const root = node[$getTemplateRoot]();
  41471. node[$tabIndex] = ++root[$tabIndex];
  41472. const ref = root[$searchNode](next.ref, node);
  41473. if (!ref) {
  41474. return;
  41475. }
  41476. node = ref[0];
  41477. }
  41478. }
  41479. function applyAssist(obj, attributes) {
  41480. const assist = obj.assist;
  41481. if (assist) {
  41482. const assistTitle = assist[$toHTML]();
  41483. if (assistTitle) {
  41484. attributes.title = assistTitle;
  41485. }
  41486. const role = assist.role;
  41487. const match = role.match(HEADING_PATTERN);
  41488. if (match) {
  41489. const ariaRole = "heading";
  41490. const ariaLevel = match[1];
  41491. attributes.role = ariaRole;
  41492. attributes["aria-level"] = ariaLevel;
  41493. }
  41494. }
  41495. if (obj.layout === "table") {
  41496. attributes.role = "table";
  41497. } else if (obj.layout === "row") {
  41498. attributes.role = "row";
  41499. } else {
  41500. const parent = obj[$getParent]();
  41501. if (parent.layout === "row") {
  41502. attributes.role = parent.assist?.role === "TH" ? "columnheader" : "cell";
  41503. }
  41504. }
  41505. }
  41506. function ariaLabel(obj) {
  41507. if (!obj.assist) {
  41508. return null;
  41509. }
  41510. const assist = obj.assist;
  41511. if (assist.speak && assist.speak[$content] !== "") {
  41512. return assist.speak[$content];
  41513. }
  41514. if (assist.toolTip) {
  41515. return assist.toolTip[$content];
  41516. }
  41517. return null;
  41518. }
  41519. function valueToHtml(value) {
  41520. return HTMLResult.success({
  41521. name: "div",
  41522. attributes: {
  41523. class: ["xfaRich"],
  41524. style: Object.create(null)
  41525. },
  41526. children: [{
  41527. name: "span",
  41528. attributes: {
  41529. style: Object.create(null)
  41530. },
  41531. value
  41532. }]
  41533. });
  41534. }
  41535. function setFirstUnsplittable(node) {
  41536. const root = node[$getTemplateRoot]();
  41537. if (root[$extra].firstUnsplittable === null) {
  41538. root[$extra].firstUnsplittable = node;
  41539. root[$extra].noLayoutFailure = true;
  41540. }
  41541. }
  41542. function unsetFirstUnsplittable(node) {
  41543. const root = node[$getTemplateRoot]();
  41544. if (root[$extra].firstUnsplittable === node) {
  41545. root[$extra].noLayoutFailure = false;
  41546. }
  41547. }
  41548. function handleBreak(node) {
  41549. if (node[$extra]) {
  41550. return false;
  41551. }
  41552. node[$extra] = Object.create(null);
  41553. if (node.targetType === "auto") {
  41554. return false;
  41555. }
  41556. const root = node[$getTemplateRoot]();
  41557. let target = null;
  41558. if (node.target) {
  41559. target = root[$searchNode](node.target, node[$getParent]());
  41560. if (!target) {
  41561. return false;
  41562. }
  41563. target = target[0];
  41564. }
  41565. const {
  41566. currentPageArea,
  41567. currentContentArea
  41568. } = root[$extra];
  41569. if (node.targetType === "pageArea") {
  41570. if (!(target instanceof PageArea)) {
  41571. target = null;
  41572. }
  41573. if (node.startNew) {
  41574. node[$extra].target = target || currentPageArea;
  41575. return true;
  41576. } else if (target && target !== currentPageArea) {
  41577. node[$extra].target = target;
  41578. return true;
  41579. }
  41580. return false;
  41581. }
  41582. if (!(target instanceof ContentArea)) {
  41583. target = null;
  41584. }
  41585. const pageArea = target && target[$getParent]();
  41586. let index;
  41587. let nextPageArea = pageArea;
  41588. if (node.startNew) {
  41589. if (target) {
  41590. const contentAreas = pageArea.contentArea.children;
  41591. const indexForCurrent = contentAreas.indexOf(currentContentArea);
  41592. const indexForTarget = contentAreas.indexOf(target);
  41593. if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) {
  41594. nextPageArea = null;
  41595. }
  41596. index = indexForTarget - 1;
  41597. } else {
  41598. index = currentPageArea.contentArea.children.indexOf(currentContentArea);
  41599. }
  41600. } else if (target && target !== currentContentArea) {
  41601. const contentAreas = pageArea.contentArea.children;
  41602. index = contentAreas.indexOf(target) - 1;
  41603. nextPageArea = pageArea === currentPageArea ? null : pageArea;
  41604. } else {
  41605. return false;
  41606. }
  41607. node[$extra].target = nextPageArea;
  41608. node[$extra].index = index;
  41609. return true;
  41610. }
  41611. function handleOverflow(node, extraNode, space) {
  41612. const root = node[$getTemplateRoot]();
  41613. const saved = root[$extra].noLayoutFailure;
  41614. const savedMethod = extraNode[$getSubformParent];
  41615. extraNode[$getSubformParent] = () => node;
  41616. root[$extra].noLayoutFailure = true;
  41617. const res = extraNode[$toHTML](space);
  41618. node[$addHTML](res.html, res.bbox);
  41619. root[$extra].noLayoutFailure = saved;
  41620. extraNode[$getSubformParent] = savedMethod;
  41621. }
  41622. class AppearanceFilter extends StringObject {
  41623. constructor(attributes) {
  41624. super(TEMPLATE_NS_ID, "appearanceFilter");
  41625. this.id = attributes.id || "";
  41626. this.type = getStringOption(attributes.type, ["optional", "required"]);
  41627. this.use = attributes.use || "";
  41628. this.usehref = attributes.usehref || "";
  41629. }
  41630. }
  41631. class Arc extends XFAObject {
  41632. constructor(attributes) {
  41633. super(TEMPLATE_NS_ID, "arc", true);
  41634. this.circular = getInteger({
  41635. data: attributes.circular,
  41636. defaultValue: 0,
  41637. validate: x => x === 1
  41638. });
  41639. this.hand = getStringOption(attributes.hand, ["even", "left", "right"]);
  41640. this.id = attributes.id || "";
  41641. this.startAngle = getFloat({
  41642. data: attributes.startAngle,
  41643. defaultValue: 0,
  41644. validate: x => true
  41645. });
  41646. this.sweepAngle = getFloat({
  41647. data: attributes.sweepAngle,
  41648. defaultValue: 360,
  41649. validate: x => true
  41650. });
  41651. this.use = attributes.use || "";
  41652. this.usehref = attributes.usehref || "";
  41653. this.edge = null;
  41654. this.fill = null;
  41655. }
  41656. [$toHTML]() {
  41657. const edge = this.edge || new Edge({});
  41658. const edgeStyle = edge[$toStyle]();
  41659. const style = Object.create(null);
  41660. if (this.fill?.presence === "visible") {
  41661. Object.assign(style, this.fill[$toStyle]());
  41662. } else {
  41663. style.fill = "transparent";
  41664. }
  41665. style.strokeWidth = measureToString(edge.presence === "visible" ? edge.thickness : 0);
  41666. style.stroke = edgeStyle.color;
  41667. let arc;
  41668. const attributes = {
  41669. xmlns: SVG_NS,
  41670. style: {
  41671. width: "100%",
  41672. height: "100%",
  41673. overflow: "visible"
  41674. }
  41675. };
  41676. if (this.sweepAngle === 360) {
  41677. arc = {
  41678. name: "ellipse",
  41679. attributes: {
  41680. xmlns: SVG_NS,
  41681. cx: "50%",
  41682. cy: "50%",
  41683. rx: "50%",
  41684. ry: "50%",
  41685. style
  41686. }
  41687. };
  41688. } else {
  41689. const startAngle = this.startAngle * Math.PI / 180;
  41690. const sweepAngle = this.sweepAngle * Math.PI / 180;
  41691. const largeArc = this.sweepAngle > 180 ? 1 : 0;
  41692. const [x1, y1, x2, y2] = [50 * (1 + Math.cos(startAngle)), 50 * (1 - Math.sin(startAngle)), 50 * (1 + Math.cos(startAngle + sweepAngle)), 50 * (1 - Math.sin(startAngle + sweepAngle))];
  41693. arc = {
  41694. name: "path",
  41695. attributes: {
  41696. xmlns: SVG_NS,
  41697. d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`,
  41698. vectorEffect: "non-scaling-stroke",
  41699. style
  41700. }
  41701. };
  41702. Object.assign(attributes, {
  41703. viewBox: "0 0 100 100",
  41704. preserveAspectRatio: "none"
  41705. });
  41706. }
  41707. const svg = {
  41708. name: "svg",
  41709. children: [arc],
  41710. attributes
  41711. };
  41712. const parent = this[$getParent]()[$getParent]();
  41713. if (hasMargin(parent)) {
  41714. return HTMLResult.success({
  41715. name: "div",
  41716. attributes: {
  41717. style: {
  41718. display: "inline",
  41719. width: "100%",
  41720. height: "100%"
  41721. }
  41722. },
  41723. children: [svg]
  41724. });
  41725. }
  41726. svg.attributes.style.position = "absolute";
  41727. return HTMLResult.success(svg);
  41728. }
  41729. }
  41730. class Area extends XFAObject {
  41731. constructor(attributes) {
  41732. super(TEMPLATE_NS_ID, "area", true);
  41733. this.colSpan = getInteger({
  41734. data: attributes.colSpan,
  41735. defaultValue: 1,
  41736. validate: n => n >= 1 || n === -1
  41737. });
  41738. this.id = attributes.id || "";
  41739. this.name = attributes.name || "";
  41740. this.relevant = getRelevant(attributes.relevant);
  41741. this.use = attributes.use || "";
  41742. this.usehref = attributes.usehref || "";
  41743. this.x = getMeasurement(attributes.x, "0pt");
  41744. this.y = getMeasurement(attributes.y, "0pt");
  41745. this.desc = null;
  41746. this.extras = null;
  41747. this.area = new XFAObjectArray();
  41748. this.draw = new XFAObjectArray();
  41749. this.exObject = new XFAObjectArray();
  41750. this.exclGroup = new XFAObjectArray();
  41751. this.field = new XFAObjectArray();
  41752. this.subform = new XFAObjectArray();
  41753. this.subformSet = new XFAObjectArray();
  41754. }
  41755. *[$getContainedChildren]() {
  41756. yield* getContainedChildren(this);
  41757. }
  41758. [$isTransparent]() {
  41759. return true;
  41760. }
  41761. [$isBindable]() {
  41762. return true;
  41763. }
  41764. [$addHTML](html, bbox) {
  41765. const [x, y, w, h] = bbox;
  41766. this[$extra].width = Math.max(this[$extra].width, x + w);
  41767. this[$extra].height = Math.max(this[$extra].height, y + h);
  41768. this[$extra].children.push(html);
  41769. }
  41770. [$getAvailableSpace]() {
  41771. return this[$extra].availableSpace;
  41772. }
  41773. [$toHTML](availableSpace) {
  41774. const style = toStyle(this, "position");
  41775. const attributes = {
  41776. style,
  41777. id: this[$uid],
  41778. class: ["xfaArea"]
  41779. };
  41780. if (isPrintOnly(this)) {
  41781. attributes.class.push("xfaPrintOnly");
  41782. }
  41783. if (this.name) {
  41784. attributes.xfaName = this.name;
  41785. }
  41786. const children = [];
  41787. this[$extra] = {
  41788. children,
  41789. width: 0,
  41790. height: 0,
  41791. availableSpace
  41792. };
  41793. const result = this[$childrenToHTML]({
  41794. filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]),
  41795. include: true
  41796. });
  41797. if (!result.success) {
  41798. if (result.isBreak()) {
  41799. return result;
  41800. }
  41801. delete this[$extra];
  41802. return HTMLResult.FAILURE;
  41803. }
  41804. style.width = measureToString(this[$extra].width);
  41805. style.height = measureToString(this[$extra].height);
  41806. const html = {
  41807. name: "div",
  41808. attributes,
  41809. children
  41810. };
  41811. const bbox = [this.x, this.y, this[$extra].width, this[$extra].height];
  41812. delete this[$extra];
  41813. return HTMLResult.success(html, bbox);
  41814. }
  41815. }
  41816. class Assist extends XFAObject {
  41817. constructor(attributes) {
  41818. super(TEMPLATE_NS_ID, "assist", true);
  41819. this.id = attributes.id || "";
  41820. this.role = attributes.role || "";
  41821. this.use = attributes.use || "";
  41822. this.usehref = attributes.usehref || "";
  41823. this.speak = null;
  41824. this.toolTip = null;
  41825. }
  41826. [$toHTML]() {
  41827. return this.toolTip?.[$content] || null;
  41828. }
  41829. }
  41830. class Barcode extends XFAObject {
  41831. constructor(attributes) {
  41832. super(TEMPLATE_NS_ID, "barcode", true);
  41833. this.charEncoding = getKeyword({
  41834. data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "",
  41835. defaultValue: "",
  41836. validate: k => ["utf-8", "big-five", "fontspecific", "gbk", "gb-18030", "gb-2312", "ksc-5601", "none", "shift-jis", "ucs-2", "utf-16"].includes(k) || k.match(/iso-8859-\d{2}/)
  41837. });
  41838. this.checksum = getStringOption(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]);
  41839. this.dataColumnCount = getInteger({
  41840. data: attributes.dataColumnCount,
  41841. defaultValue: -1,
  41842. validate: x => x >= 0
  41843. });
  41844. this.dataLength = getInteger({
  41845. data: attributes.dataLength,
  41846. defaultValue: -1,
  41847. validate: x => x >= 0
  41848. });
  41849. this.dataPrep = getStringOption(attributes.dataPrep, ["none", "flateCompress"]);
  41850. this.dataRowCount = getInteger({
  41851. data: attributes.dataRowCount,
  41852. defaultValue: -1,
  41853. validate: x => x >= 0
  41854. });
  41855. this.endChar = attributes.endChar || "";
  41856. this.errorCorrectionLevel = getInteger({
  41857. data: attributes.errorCorrectionLevel,
  41858. defaultValue: -1,
  41859. validate: x => x >= 0 && x <= 8
  41860. });
  41861. this.id = attributes.id || "";
  41862. this.moduleHeight = getMeasurement(attributes.moduleHeight, "5mm");
  41863. this.moduleWidth = getMeasurement(attributes.moduleWidth, "0.25mm");
  41864. this.printCheckDigit = getInteger({
  41865. data: attributes.printCheckDigit,
  41866. defaultValue: 0,
  41867. validate: x => x === 1
  41868. });
  41869. this.rowColumnRatio = getRatio(attributes.rowColumnRatio);
  41870. this.startChar = attributes.startChar || "";
  41871. this.textLocation = getStringOption(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]);
  41872. this.truncate = getInteger({
  41873. data: attributes.truncate,
  41874. defaultValue: 0,
  41875. validate: x => x === 1
  41876. });
  41877. this.type = getStringOption(attributes.type ? attributes.type.toLowerCase() : "", ["aztec", "codabar", "code2of5industrial", "code2of5interleaved", "code2of5matrix", "code2of5standard", "code3of9", "code3of9extended", "code11", "code49", "code93", "code128", "code128a", "code128b", "code128c", "code128sscc", "datamatrix", "ean8", "ean8add2", "ean8add5", "ean13", "ean13add2", "ean13add5", "ean13pwcd", "fim", "logmars", "maxicode", "msi", "pdf417", "pdf417macro", "plessey", "postauscust2", "postauscust3", "postausreplypaid", "postausstandard", "postukrm4scc", "postusdpbc", "postusimb", "postusstandard", "postus5zip", "qrcode", "rfid", "rss14", "rss14expanded", "rss14limited", "rss14stacked", "rss14stackedomni", "rss14truncated", "telepen", "ucc128", "ucc128random", "ucc128sscc", "upca", "upcaadd2", "upcaadd5", "upcapwcd", "upce", "upceadd2", "upceadd5", "upcean2", "upcean5", "upsmaxicode"]);
  41878. this.upsMode = getStringOption(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]);
  41879. this.use = attributes.use || "";
  41880. this.usehref = attributes.usehref || "";
  41881. this.wideNarrowRatio = getRatio(attributes.wideNarrowRatio);
  41882. this.encrypt = null;
  41883. this.extras = null;
  41884. }
  41885. }
  41886. class Bind extends XFAObject {
  41887. constructor(attributes) {
  41888. super(TEMPLATE_NS_ID, "bind", true);
  41889. this.match = getStringOption(attributes.match, ["once", "dataRef", "global", "none"]);
  41890. this.ref = attributes.ref || "";
  41891. this.picture = null;
  41892. }
  41893. }
  41894. class BindItems extends XFAObject {
  41895. constructor(attributes) {
  41896. super(TEMPLATE_NS_ID, "bindItems");
  41897. this.connection = attributes.connection || "";
  41898. this.labelRef = attributes.labelRef || "";
  41899. this.ref = attributes.ref || "";
  41900. this.valueRef = attributes.valueRef || "";
  41901. }
  41902. }
  41903. class Bookend extends XFAObject {
  41904. constructor(attributes) {
  41905. super(TEMPLATE_NS_ID, "bookend");
  41906. this.id = attributes.id || "";
  41907. this.leader = attributes.leader || "";
  41908. this.trailer = attributes.trailer || "";
  41909. this.use = attributes.use || "";
  41910. this.usehref = attributes.usehref || "";
  41911. }
  41912. }
  41913. class BooleanElement extends Option01 {
  41914. constructor(attributes) {
  41915. super(TEMPLATE_NS_ID, "boolean");
  41916. this.id = attributes.id || "";
  41917. this.name = attributes.name || "";
  41918. this.use = attributes.use || "";
  41919. this.usehref = attributes.usehref || "";
  41920. }
  41921. [$toHTML](availableSpace) {
  41922. return valueToHtml(this[$content] === 1 ? "1" : "0");
  41923. }
  41924. }
  41925. class Border extends XFAObject {
  41926. constructor(attributes) {
  41927. super(TEMPLATE_NS_ID, "border", true);
  41928. this.break = getStringOption(attributes.break, ["close", "open"]);
  41929. this.hand = getStringOption(attributes.hand, ["even", "left", "right"]);
  41930. this.id = attributes.id || "";
  41931. this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  41932. this.relevant = getRelevant(attributes.relevant);
  41933. this.use = attributes.use || "";
  41934. this.usehref = attributes.usehref || "";
  41935. this.corner = new XFAObjectArray(4);
  41936. this.edge = new XFAObjectArray(4);
  41937. this.extras = null;
  41938. this.fill = null;
  41939. this.margin = null;
  41940. }
  41941. [$getExtra]() {
  41942. if (!this[$extra]) {
  41943. const edges = this.edge.children.slice();
  41944. if (edges.length < 4) {
  41945. const defaultEdge = edges.at(-1) || new Edge({});
  41946. for (let i = edges.length; i < 4; i++) {
  41947. edges.push(defaultEdge);
  41948. }
  41949. }
  41950. const widths = edges.map(edge => edge.thickness);
  41951. const insets = [0, 0, 0, 0];
  41952. if (this.margin) {
  41953. insets[0] = this.margin.topInset;
  41954. insets[1] = this.margin.rightInset;
  41955. insets[2] = this.margin.bottomInset;
  41956. insets[3] = this.margin.leftInset;
  41957. }
  41958. this[$extra] = {
  41959. widths,
  41960. insets,
  41961. edges
  41962. };
  41963. }
  41964. return this[$extra];
  41965. }
  41966. [$toStyle]() {
  41967. const {
  41968. edges
  41969. } = this[$getExtra]();
  41970. const edgeStyles = edges.map(node => {
  41971. const style = node[$toStyle]();
  41972. style.color ||= "#000000";
  41973. return style;
  41974. });
  41975. const style = Object.create(null);
  41976. if (this.margin) {
  41977. Object.assign(style, this.margin[$toStyle]());
  41978. }
  41979. if (this.fill?.presence === "visible") {
  41980. Object.assign(style, this.fill[$toStyle]());
  41981. }
  41982. if (this.corner.children.some(node => node.radius !== 0)) {
  41983. const cornerStyles = this.corner.children.map(node => node[$toStyle]());
  41984. if (cornerStyles.length === 2 || cornerStyles.length === 3) {
  41985. const last = cornerStyles.at(-1);
  41986. for (let i = cornerStyles.length; i < 4; i++) {
  41987. cornerStyles.push(last);
  41988. }
  41989. }
  41990. style.borderRadius = cornerStyles.map(s => s.radius).join(" ");
  41991. }
  41992. switch (this.presence) {
  41993. case "invisible":
  41994. case "hidden":
  41995. style.borderStyle = "";
  41996. break;
  41997. case "inactive":
  41998. style.borderStyle = "none";
  41999. break;
  42000. default:
  42001. style.borderStyle = edgeStyles.map(s => s.style).join(" ");
  42002. break;
  42003. }
  42004. style.borderWidth = edgeStyles.map(s => s.width).join(" ");
  42005. style.borderColor = edgeStyles.map(s => s.color).join(" ");
  42006. return style;
  42007. }
  42008. }
  42009. class Break extends XFAObject {
  42010. constructor(attributes) {
  42011. super(TEMPLATE_NS_ID, "break", true);
  42012. this.after = getStringOption(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  42013. this.afterTarget = attributes.afterTarget || "";
  42014. this.before = getStringOption(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  42015. this.beforeTarget = attributes.beforeTarget || "";
  42016. this.bookendLeader = attributes.bookendLeader || "";
  42017. this.bookendTrailer = attributes.bookendTrailer || "";
  42018. this.id = attributes.id || "";
  42019. this.overflowLeader = attributes.overflowLeader || "";
  42020. this.overflowTarget = attributes.overflowTarget || "";
  42021. this.overflowTrailer = attributes.overflowTrailer || "";
  42022. this.startNew = getInteger({
  42023. data: attributes.startNew,
  42024. defaultValue: 0,
  42025. validate: x => x === 1
  42026. });
  42027. this.use = attributes.use || "";
  42028. this.usehref = attributes.usehref || "";
  42029. this.extras = null;
  42030. }
  42031. }
  42032. class BreakAfter extends XFAObject {
  42033. constructor(attributes) {
  42034. super(TEMPLATE_NS_ID, "breakAfter", true);
  42035. this.id = attributes.id || "";
  42036. this.leader = attributes.leader || "";
  42037. this.startNew = getInteger({
  42038. data: attributes.startNew,
  42039. defaultValue: 0,
  42040. validate: x => x === 1
  42041. });
  42042. this.target = attributes.target || "";
  42043. this.targetType = getStringOption(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  42044. this.trailer = attributes.trailer || "";
  42045. this.use = attributes.use || "";
  42046. this.usehref = attributes.usehref || "";
  42047. this.script = null;
  42048. }
  42049. }
  42050. class BreakBefore extends XFAObject {
  42051. constructor(attributes) {
  42052. super(TEMPLATE_NS_ID, "breakBefore", true);
  42053. this.id = attributes.id || "";
  42054. this.leader = attributes.leader || "";
  42055. this.startNew = getInteger({
  42056. data: attributes.startNew,
  42057. defaultValue: 0,
  42058. validate: x => x === 1
  42059. });
  42060. this.target = attributes.target || "";
  42061. this.targetType = getStringOption(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  42062. this.trailer = attributes.trailer || "";
  42063. this.use = attributes.use || "";
  42064. this.usehref = attributes.usehref || "";
  42065. this.script = null;
  42066. }
  42067. [$toHTML](availableSpace) {
  42068. this[$extra] = {};
  42069. return HTMLResult.FAILURE;
  42070. }
  42071. }
  42072. class Button extends XFAObject {
  42073. constructor(attributes) {
  42074. super(TEMPLATE_NS_ID, "button", true);
  42075. this.highlight = getStringOption(attributes.highlight, ["inverted", "none", "outline", "push"]);
  42076. this.id = attributes.id || "";
  42077. this.use = attributes.use || "";
  42078. this.usehref = attributes.usehref || "";
  42079. this.extras = null;
  42080. }
  42081. [$toHTML](availableSpace) {
  42082. const parent = this[$getParent]();
  42083. const grandpa = parent[$getParent]();
  42084. const htmlButton = {
  42085. name: "button",
  42086. attributes: {
  42087. id: this[$uid],
  42088. class: ["xfaButton"],
  42089. style: {}
  42090. },
  42091. children: []
  42092. };
  42093. for (const event of grandpa.event.children) {
  42094. if (event.activity !== "click" || !event.script) {
  42095. continue;
  42096. }
  42097. const jsURL = recoverJsURL(event.script[$content]);
  42098. if (!jsURL) {
  42099. continue;
  42100. }
  42101. const href = fixURL(jsURL.url);
  42102. if (!href) {
  42103. continue;
  42104. }
  42105. htmlButton.children.push({
  42106. name: "a",
  42107. attributes: {
  42108. id: "link" + this[$uid],
  42109. href,
  42110. newWindow: jsURL.newWindow,
  42111. class: ["xfaLink"],
  42112. style: {}
  42113. },
  42114. children: []
  42115. });
  42116. }
  42117. return HTMLResult.success(htmlButton);
  42118. }
  42119. }
  42120. class Calculate extends XFAObject {
  42121. constructor(attributes) {
  42122. super(TEMPLATE_NS_ID, "calculate", true);
  42123. this.id = attributes.id || "";
  42124. this.override = getStringOption(attributes.override, ["disabled", "error", "ignore", "warning"]);
  42125. this.use = attributes.use || "";
  42126. this.usehref = attributes.usehref || "";
  42127. this.extras = null;
  42128. this.message = null;
  42129. this.script = null;
  42130. }
  42131. }
  42132. class Caption extends XFAObject {
  42133. constructor(attributes) {
  42134. super(TEMPLATE_NS_ID, "caption", true);
  42135. this.id = attributes.id || "";
  42136. this.placement = getStringOption(attributes.placement, ["left", "bottom", "inline", "right", "top"]);
  42137. this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  42138. this.reserve = Math.ceil(getMeasurement(attributes.reserve));
  42139. this.use = attributes.use || "";
  42140. this.usehref = attributes.usehref || "";
  42141. this.extras = null;
  42142. this.font = null;
  42143. this.margin = null;
  42144. this.para = null;
  42145. this.value = null;
  42146. }
  42147. [$setValue](value) {
  42148. _setValue(this, value);
  42149. }
  42150. [$getExtra](availableSpace) {
  42151. if (!this[$extra]) {
  42152. let {
  42153. width,
  42154. height
  42155. } = availableSpace;
  42156. switch (this.placement) {
  42157. case "left":
  42158. case "right":
  42159. case "inline":
  42160. width = this.reserve <= 0 ? width : this.reserve;
  42161. break;
  42162. case "top":
  42163. case "bottom":
  42164. height = this.reserve <= 0 ? height : this.reserve;
  42165. break;
  42166. }
  42167. this[$extra] = layoutNode(this, {
  42168. width,
  42169. height
  42170. });
  42171. }
  42172. return this[$extra];
  42173. }
  42174. [$toHTML](availableSpace) {
  42175. if (!this.value) {
  42176. return HTMLResult.EMPTY;
  42177. }
  42178. this[$pushPara]();
  42179. const value = this.value[$toHTML](availableSpace).html;
  42180. if (!value) {
  42181. this[$popPara]();
  42182. return HTMLResult.EMPTY;
  42183. }
  42184. const savedReserve = this.reserve;
  42185. if (this.reserve <= 0) {
  42186. const {
  42187. w,
  42188. h
  42189. } = this[$getExtra](availableSpace);
  42190. switch (this.placement) {
  42191. case "left":
  42192. case "right":
  42193. case "inline":
  42194. this.reserve = w;
  42195. break;
  42196. case "top":
  42197. case "bottom":
  42198. this.reserve = h;
  42199. break;
  42200. }
  42201. }
  42202. const children = [];
  42203. if (typeof value === "string") {
  42204. children.push({
  42205. name: "#text",
  42206. value
  42207. });
  42208. } else {
  42209. children.push(value);
  42210. }
  42211. const style = toStyle(this, "font", "margin", "visibility");
  42212. switch (this.placement) {
  42213. case "left":
  42214. case "right":
  42215. if (this.reserve > 0) {
  42216. style.width = measureToString(this.reserve);
  42217. }
  42218. break;
  42219. case "top":
  42220. case "bottom":
  42221. if (this.reserve > 0) {
  42222. style.height = measureToString(this.reserve);
  42223. }
  42224. break;
  42225. }
  42226. setPara(this, null, value);
  42227. this[$popPara]();
  42228. this.reserve = savedReserve;
  42229. return HTMLResult.success({
  42230. name: "div",
  42231. attributes: {
  42232. style,
  42233. class: ["xfaCaption"]
  42234. },
  42235. children
  42236. });
  42237. }
  42238. }
  42239. class Certificate extends StringObject {
  42240. constructor(attributes) {
  42241. super(TEMPLATE_NS_ID, "certificate");
  42242. this.id = attributes.id || "";
  42243. this.name = attributes.name || "";
  42244. this.use = attributes.use || "";
  42245. this.usehref = attributes.usehref || "";
  42246. }
  42247. }
  42248. class Certificates extends XFAObject {
  42249. constructor(attributes) {
  42250. super(TEMPLATE_NS_ID, "certificates", true);
  42251. this.credentialServerPolicy = getStringOption(attributes.credentialServerPolicy, ["optional", "required"]);
  42252. this.id = attributes.id || "";
  42253. this.url = attributes.url || "";
  42254. this.urlPolicy = attributes.urlPolicy || "";
  42255. this.use = attributes.use || "";
  42256. this.usehref = attributes.usehref || "";
  42257. this.encryption = null;
  42258. this.issuers = null;
  42259. this.keyUsage = null;
  42260. this.oids = null;
  42261. this.signing = null;
  42262. this.subjectDNs = null;
  42263. }
  42264. }
  42265. class CheckButton extends XFAObject {
  42266. constructor(attributes) {
  42267. super(TEMPLATE_NS_ID, "checkButton", true);
  42268. this.id = attributes.id || "";
  42269. this.mark = getStringOption(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]);
  42270. this.shape = getStringOption(attributes.shape, ["square", "round"]);
  42271. this.size = getMeasurement(attributes.size, "10pt");
  42272. this.use = attributes.use || "";
  42273. this.usehref = attributes.usehref || "";
  42274. this.border = null;
  42275. this.extras = null;
  42276. this.margin = null;
  42277. }
  42278. [$toHTML](availableSpace) {
  42279. const style = toStyle("margin");
  42280. const size = measureToString(this.size);
  42281. style.width = style.height = size;
  42282. let type;
  42283. let className;
  42284. let groupId;
  42285. const field = this[$getParent]()[$getParent]();
  42286. const items = field.items.children.length && field.items.children[0][$toHTML]().html || [];
  42287. const exportedValue = {
  42288. on: (items[0] !== undefined ? items[0] : "on").toString(),
  42289. off: (items[1] !== undefined ? items[1] : "off").toString()
  42290. };
  42291. const value = field.value?.[$text]() || "off";
  42292. const checked = value === exportedValue.on || undefined;
  42293. const container = field[$getSubformParent]();
  42294. const fieldId = field[$uid];
  42295. let dataId;
  42296. if (container instanceof ExclGroup) {
  42297. groupId = container[$uid];
  42298. type = "radio";
  42299. className = "xfaRadio";
  42300. dataId = container[$data]?.[$uid] || container[$uid];
  42301. } else {
  42302. type = "checkbox";
  42303. className = "xfaCheckbox";
  42304. dataId = field[$data]?.[$uid] || field[$uid];
  42305. }
  42306. const input = {
  42307. name: "input",
  42308. attributes: {
  42309. class: [className],
  42310. style,
  42311. fieldId,
  42312. dataId,
  42313. type,
  42314. checked,
  42315. xfaOn: exportedValue.on,
  42316. xfaOff: exportedValue.off,
  42317. "aria-label": ariaLabel(field),
  42318. "aria-required": false
  42319. }
  42320. };
  42321. if (groupId) {
  42322. input.attributes.name = groupId;
  42323. }
  42324. if (isRequired(field)) {
  42325. input.attributes["aria-required"] = true;
  42326. input.attributes.required = true;
  42327. }
  42328. return HTMLResult.success({
  42329. name: "label",
  42330. attributes: {
  42331. class: ["xfaLabel"]
  42332. },
  42333. children: [input]
  42334. });
  42335. }
  42336. }
  42337. class ChoiceList extends XFAObject {
  42338. constructor(attributes) {
  42339. super(TEMPLATE_NS_ID, "choiceList", true);
  42340. this.commitOn = getStringOption(attributes.commitOn, ["select", "exit"]);
  42341. this.id = attributes.id || "";
  42342. this.open = getStringOption(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]);
  42343. this.textEntry = getInteger({
  42344. data: attributes.textEntry,
  42345. defaultValue: 0,
  42346. validate: x => x === 1
  42347. });
  42348. this.use = attributes.use || "";
  42349. this.usehref = attributes.usehref || "";
  42350. this.border = null;
  42351. this.extras = null;
  42352. this.margin = null;
  42353. }
  42354. [$toHTML](availableSpace) {
  42355. const style = toStyle(this, "border", "margin");
  42356. const ui = this[$getParent]();
  42357. const field = ui[$getParent]();
  42358. const fontSize = field.font?.size || 10;
  42359. const optionStyle = {
  42360. fontSize: `calc(${fontSize}px * var(--scale-factor))`
  42361. };
  42362. const children = [];
  42363. if (field.items.children.length > 0) {
  42364. const items = field.items;
  42365. let displayedIndex = 0;
  42366. let saveIndex = 0;
  42367. if (items.children.length === 2) {
  42368. displayedIndex = items.children[0].save;
  42369. saveIndex = 1 - displayedIndex;
  42370. }
  42371. const displayed = items.children[displayedIndex][$toHTML]().html;
  42372. const values = items.children[saveIndex][$toHTML]().html;
  42373. let selected = false;
  42374. const value = field.value?.[$text]() || "";
  42375. for (let i = 0, ii = displayed.length; i < ii; i++) {
  42376. const option = {
  42377. name: "option",
  42378. attributes: {
  42379. value: values[i] || displayed[i],
  42380. style: optionStyle
  42381. },
  42382. value: displayed[i]
  42383. };
  42384. if (values[i] === value) {
  42385. option.attributes.selected = selected = true;
  42386. }
  42387. children.push(option);
  42388. }
  42389. if (!selected) {
  42390. children.splice(0, 0, {
  42391. name: "option",
  42392. attributes: {
  42393. hidden: true,
  42394. selected: true
  42395. },
  42396. value: " "
  42397. });
  42398. }
  42399. }
  42400. const selectAttributes = {
  42401. class: ["xfaSelect"],
  42402. fieldId: field[$uid],
  42403. dataId: field[$data]?.[$uid] || field[$uid],
  42404. style,
  42405. "aria-label": ariaLabel(field),
  42406. "aria-required": false
  42407. };
  42408. if (isRequired(field)) {
  42409. selectAttributes["aria-required"] = true;
  42410. selectAttributes.required = true;
  42411. }
  42412. if (this.open === "multiSelect") {
  42413. selectAttributes.multiple = true;
  42414. }
  42415. return HTMLResult.success({
  42416. name: "label",
  42417. attributes: {
  42418. class: ["xfaLabel"]
  42419. },
  42420. children: [{
  42421. name: "select",
  42422. children,
  42423. attributes: selectAttributes
  42424. }]
  42425. });
  42426. }
  42427. }
  42428. class Color extends XFAObject {
  42429. constructor(attributes) {
  42430. super(TEMPLATE_NS_ID, "color", true);
  42431. this.cSpace = getStringOption(attributes.cSpace, ["SRGB"]);
  42432. this.id = attributes.id || "";
  42433. this.use = attributes.use || "";
  42434. this.usehref = attributes.usehref || "";
  42435. this.value = attributes.value ? getColor(attributes.value) : "";
  42436. this.extras = null;
  42437. }
  42438. [$hasSettableValue]() {
  42439. return false;
  42440. }
  42441. [$toStyle]() {
  42442. return this.value ? Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null;
  42443. }
  42444. }
  42445. class Comb extends XFAObject {
  42446. constructor(attributes) {
  42447. super(TEMPLATE_NS_ID, "comb");
  42448. this.id = attributes.id || "";
  42449. this.numberOfCells = getInteger({
  42450. data: attributes.numberOfCells,
  42451. defaultValue: 0,
  42452. validate: x => x >= 0
  42453. });
  42454. this.use = attributes.use || "";
  42455. this.usehref = attributes.usehref || "";
  42456. }
  42457. }
  42458. class Connect extends XFAObject {
  42459. constructor(attributes) {
  42460. super(TEMPLATE_NS_ID, "connect", true);
  42461. this.connection = attributes.connection || "";
  42462. this.id = attributes.id || "";
  42463. this.ref = attributes.ref || "";
  42464. this.usage = getStringOption(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]);
  42465. this.use = attributes.use || "";
  42466. this.usehref = attributes.usehref || "";
  42467. this.picture = null;
  42468. }
  42469. }
  42470. class ContentArea extends XFAObject {
  42471. constructor(attributes) {
  42472. super(TEMPLATE_NS_ID, "contentArea", true);
  42473. this.h = getMeasurement(attributes.h);
  42474. this.id = attributes.id || "";
  42475. this.name = attributes.name || "";
  42476. this.relevant = getRelevant(attributes.relevant);
  42477. this.use = attributes.use || "";
  42478. this.usehref = attributes.usehref || "";
  42479. this.w = getMeasurement(attributes.w);
  42480. this.x = getMeasurement(attributes.x, "0pt");
  42481. this.y = getMeasurement(attributes.y, "0pt");
  42482. this.desc = null;
  42483. this.extras = null;
  42484. }
  42485. [$toHTML](availableSpace) {
  42486. const left = measureToString(this.x);
  42487. const top = measureToString(this.y);
  42488. const style = {
  42489. left,
  42490. top,
  42491. width: measureToString(this.w),
  42492. height: measureToString(this.h)
  42493. };
  42494. const classNames = ["xfaContentarea"];
  42495. if (isPrintOnly(this)) {
  42496. classNames.push("xfaPrintOnly");
  42497. }
  42498. return HTMLResult.success({
  42499. name: "div",
  42500. children: [],
  42501. attributes: {
  42502. style,
  42503. class: classNames,
  42504. id: this[$uid]
  42505. }
  42506. });
  42507. }
  42508. }
  42509. class Corner extends XFAObject {
  42510. constructor(attributes) {
  42511. super(TEMPLATE_NS_ID, "corner", true);
  42512. this.id = attributes.id || "";
  42513. this.inverted = getInteger({
  42514. data: attributes.inverted,
  42515. defaultValue: 0,
  42516. validate: x => x === 1
  42517. });
  42518. this.join = getStringOption(attributes.join, ["square", "round"]);
  42519. this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  42520. this.radius = getMeasurement(attributes.radius);
  42521. this.stroke = getStringOption(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  42522. this.thickness = getMeasurement(attributes.thickness, "0.5pt");
  42523. this.use = attributes.use || "";
  42524. this.usehref = attributes.usehref || "";
  42525. this.color = null;
  42526. this.extras = null;
  42527. }
  42528. [$toStyle]() {
  42529. const style = toStyle(this, "visibility");
  42530. style.radius = measureToString(this.join === "square" ? 0 : this.radius);
  42531. return style;
  42532. }
  42533. }
  42534. class DateElement extends ContentObject {
  42535. constructor(attributes) {
  42536. super(TEMPLATE_NS_ID, "date");
  42537. this.id = attributes.id || "";
  42538. this.name = attributes.name || "";
  42539. this.use = attributes.use || "";
  42540. this.usehref = attributes.usehref || "";
  42541. }
  42542. [$finalize]() {
  42543. const date = this[$content].trim();
  42544. this[$content] = date ? new Date(date) : null;
  42545. }
  42546. [$toHTML](availableSpace) {
  42547. return valueToHtml(this[$content] ? this[$content].toString() : "");
  42548. }
  42549. }
  42550. class DateTime extends ContentObject {
  42551. constructor(attributes) {
  42552. super(TEMPLATE_NS_ID, "dateTime");
  42553. this.id = attributes.id || "";
  42554. this.name = attributes.name || "";
  42555. this.use = attributes.use || "";
  42556. this.usehref = attributes.usehref || "";
  42557. }
  42558. [$finalize]() {
  42559. const date = this[$content].trim();
  42560. this[$content] = date ? new Date(date) : null;
  42561. }
  42562. [$toHTML](availableSpace) {
  42563. return valueToHtml(this[$content] ? this[$content].toString() : "");
  42564. }
  42565. }
  42566. class DateTimeEdit extends XFAObject {
  42567. constructor(attributes) {
  42568. super(TEMPLATE_NS_ID, "dateTimeEdit", true);
  42569. this.hScrollPolicy = getStringOption(attributes.hScrollPolicy, ["auto", "off", "on"]);
  42570. this.id = attributes.id || "";
  42571. this.picker = getStringOption(attributes.picker, ["host", "none"]);
  42572. this.use = attributes.use || "";
  42573. this.usehref = attributes.usehref || "";
  42574. this.border = null;
  42575. this.comb = null;
  42576. this.extras = null;
  42577. this.margin = null;
  42578. }
  42579. [$toHTML](availableSpace) {
  42580. const style = toStyle(this, "border", "font", "margin");
  42581. const field = this[$getParent]()[$getParent]();
  42582. const html = {
  42583. name: "input",
  42584. attributes: {
  42585. type: "text",
  42586. fieldId: field[$uid],
  42587. dataId: field[$data]?.[$uid] || field[$uid],
  42588. class: ["xfaTextfield"],
  42589. style,
  42590. "aria-label": ariaLabel(field),
  42591. "aria-required": false
  42592. }
  42593. };
  42594. if (isRequired(field)) {
  42595. html.attributes["aria-required"] = true;
  42596. html.attributes.required = true;
  42597. }
  42598. return HTMLResult.success({
  42599. name: "label",
  42600. attributes: {
  42601. class: ["xfaLabel"]
  42602. },
  42603. children: [html]
  42604. });
  42605. }
  42606. }
  42607. class Decimal extends ContentObject {
  42608. constructor(attributes) {
  42609. super(TEMPLATE_NS_ID, "decimal");
  42610. this.fracDigits = getInteger({
  42611. data: attributes.fracDigits,
  42612. defaultValue: 2,
  42613. validate: x => true
  42614. });
  42615. this.id = attributes.id || "";
  42616. this.leadDigits = getInteger({
  42617. data: attributes.leadDigits,
  42618. defaultValue: -1,
  42619. validate: x => true
  42620. });
  42621. this.name = attributes.name || "";
  42622. this.use = attributes.use || "";
  42623. this.usehref = attributes.usehref || "";
  42624. }
  42625. [$finalize]() {
  42626. const number = parseFloat(this[$content].trim());
  42627. this[$content] = isNaN(number) ? null : number;
  42628. }
  42629. [$toHTML](availableSpace) {
  42630. return valueToHtml(this[$content] !== null ? this[$content].toString() : "");
  42631. }
  42632. }
  42633. class DefaultUi extends XFAObject {
  42634. constructor(attributes) {
  42635. super(TEMPLATE_NS_ID, "defaultUi", true);
  42636. this.id = attributes.id || "";
  42637. this.use = attributes.use || "";
  42638. this.usehref = attributes.usehref || "";
  42639. this.extras = null;
  42640. }
  42641. }
  42642. class Desc extends XFAObject {
  42643. constructor(attributes) {
  42644. super(TEMPLATE_NS_ID, "desc", true);
  42645. this.id = attributes.id || "";
  42646. this.use = attributes.use || "";
  42647. this.usehref = attributes.usehref || "";
  42648. this.boolean = new XFAObjectArray();
  42649. this.date = new XFAObjectArray();
  42650. this.dateTime = new XFAObjectArray();
  42651. this.decimal = new XFAObjectArray();
  42652. this.exData = new XFAObjectArray();
  42653. this.float = new XFAObjectArray();
  42654. this.image = new XFAObjectArray();
  42655. this.integer = new XFAObjectArray();
  42656. this.text = new XFAObjectArray();
  42657. this.time = new XFAObjectArray();
  42658. }
  42659. }
  42660. class DigestMethod extends OptionObject {
  42661. constructor(attributes) {
  42662. super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]);
  42663. this.id = attributes.id || "";
  42664. this.use = attributes.use || "";
  42665. this.usehref = attributes.usehref || "";
  42666. }
  42667. }
  42668. class DigestMethods extends XFAObject {
  42669. constructor(attributes) {
  42670. super(TEMPLATE_NS_ID, "digestMethods", true);
  42671. this.id = attributes.id || "";
  42672. this.type = getStringOption(attributes.type, ["optional", "required"]);
  42673. this.use = attributes.use || "";
  42674. this.usehref = attributes.usehref || "";
  42675. this.digestMethod = new XFAObjectArray();
  42676. }
  42677. }
  42678. class Draw extends XFAObject {
  42679. constructor(attributes) {
  42680. super(TEMPLATE_NS_ID, "draw", true);
  42681. this.anchorType = getStringOption(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  42682. this.colSpan = getInteger({
  42683. data: attributes.colSpan,
  42684. defaultValue: 1,
  42685. validate: n => n >= 1 || n === -1
  42686. });
  42687. this.h = attributes.h ? getMeasurement(attributes.h) : "";
  42688. this.hAlign = getStringOption(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  42689. this.id = attributes.id || "";
  42690. this.locale = attributes.locale || "";
  42691. this.maxH = getMeasurement(attributes.maxH, "0pt");
  42692. this.maxW = getMeasurement(attributes.maxW, "0pt");
  42693. this.minH = getMeasurement(attributes.minH, "0pt");
  42694. this.minW = getMeasurement(attributes.minW, "0pt");
  42695. this.name = attributes.name || "";
  42696. this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  42697. this.relevant = getRelevant(attributes.relevant);
  42698. this.rotate = getInteger({
  42699. data: attributes.rotate,
  42700. defaultValue: 0,
  42701. validate: x => x % 90 === 0
  42702. });
  42703. this.use = attributes.use || "";
  42704. this.usehref = attributes.usehref || "";
  42705. this.w = attributes.w ? getMeasurement(attributes.w) : "";
  42706. this.x = getMeasurement(attributes.x, "0pt");
  42707. this.y = getMeasurement(attributes.y, "0pt");
  42708. this.assist = null;
  42709. this.border = null;
  42710. this.caption = null;
  42711. this.desc = null;
  42712. this.extras = null;
  42713. this.font = null;
  42714. this.keep = null;
  42715. this.margin = null;
  42716. this.para = null;
  42717. this.traversal = null;
  42718. this.ui = null;
  42719. this.value = null;
  42720. this.setProperty = new XFAObjectArray();
  42721. }
  42722. [$setValue](value) {
  42723. _setValue(this, value);
  42724. }
  42725. [$toHTML](availableSpace) {
  42726. setTabIndex(this);
  42727. if (this.presence === "hidden" || this.presence === "inactive") {
  42728. return HTMLResult.EMPTY;
  42729. }
  42730. fixDimensions(this);
  42731. this[$pushPara]();
  42732. const savedW = this.w;
  42733. const savedH = this.h;
  42734. const {
  42735. w,
  42736. h,
  42737. isBroken
  42738. } = layoutNode(this, availableSpace);
  42739. if (w && this.w === "") {
  42740. if (isBroken && this[$getSubformParent]()[$isThereMoreWidth]()) {
  42741. this[$popPara]();
  42742. return HTMLResult.FAILURE;
  42743. }
  42744. this.w = w;
  42745. }
  42746. if (h && this.h === "") {
  42747. this.h = h;
  42748. }
  42749. setFirstUnsplittable(this);
  42750. if (!checkDimensions(this, availableSpace)) {
  42751. this.w = savedW;
  42752. this.h = savedH;
  42753. this[$popPara]();
  42754. return HTMLResult.FAILURE;
  42755. }
  42756. unsetFirstUnsplittable(this);
  42757. const style = toStyle(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin");
  42758. setMinMaxDimensions(this, style);
  42759. if (style.margin) {
  42760. style.padding = style.margin;
  42761. delete style.margin;
  42762. }
  42763. const classNames = ["xfaDraw"];
  42764. if (this.font) {
  42765. classNames.push("xfaFont");
  42766. }
  42767. if (isPrintOnly(this)) {
  42768. classNames.push("xfaPrintOnly");
  42769. }
  42770. const attributes = {
  42771. style,
  42772. id: this[$uid],
  42773. class: classNames
  42774. };
  42775. if (this.name) {
  42776. attributes.xfaName = this.name;
  42777. }
  42778. const html = {
  42779. name: "div",
  42780. attributes,
  42781. children: []
  42782. };
  42783. applyAssist(this, attributes);
  42784. const bbox = computeBbox(this, html, availableSpace);
  42785. const value = this.value ? this.value[$toHTML](availableSpace).html : null;
  42786. if (value === null) {
  42787. this.w = savedW;
  42788. this.h = savedH;
  42789. this[$popPara]();
  42790. return HTMLResult.success(createWrapper(this, html), bbox);
  42791. }
  42792. html.children.push(value);
  42793. setPara(this, style, value);
  42794. this.w = savedW;
  42795. this.h = savedH;
  42796. this[$popPara]();
  42797. return HTMLResult.success(createWrapper(this, html), bbox);
  42798. }
  42799. }
  42800. class Edge extends XFAObject {
  42801. constructor(attributes) {
  42802. super(TEMPLATE_NS_ID, "edge", true);
  42803. this.cap = getStringOption(attributes.cap, ["square", "butt", "round"]);
  42804. this.id = attributes.id || "";
  42805. this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  42806. this.stroke = getStringOption(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  42807. this.thickness = getMeasurement(attributes.thickness, "0.5pt");
  42808. this.use = attributes.use || "";
  42809. this.usehref = attributes.usehref || "";
  42810. this.color = null;
  42811. this.extras = null;
  42812. }
  42813. [$toStyle]() {
  42814. const style = toStyle(this, "visibility");
  42815. Object.assign(style, {
  42816. linecap: this.cap,
  42817. width: measureToString(this.thickness),
  42818. color: this.color ? this.color[$toStyle]() : "#000000",
  42819. style: ""
  42820. });
  42821. if (this.presence !== "visible") {
  42822. style.style = "none";
  42823. } else {
  42824. switch (this.stroke) {
  42825. case "solid":
  42826. style.style = "solid";
  42827. break;
  42828. case "dashDot":
  42829. style.style = "dashed";
  42830. break;
  42831. case "dashDotDot":
  42832. style.style = "dashed";
  42833. break;
  42834. case "dashed":
  42835. style.style = "dashed";
  42836. break;
  42837. case "dotted":
  42838. style.style = "dotted";
  42839. break;
  42840. case "embossed":
  42841. style.style = "ridge";
  42842. break;
  42843. case "etched":
  42844. style.style = "groove";
  42845. break;
  42846. case "lowered":
  42847. style.style = "inset";
  42848. break;
  42849. case "raised":
  42850. style.style = "outset";
  42851. break;
  42852. }
  42853. }
  42854. return style;
  42855. }
  42856. }
  42857. class Encoding extends OptionObject {
  42858. constructor(attributes) {
  42859. super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]);
  42860. this.id = attributes.id || "";
  42861. this.use = attributes.use || "";
  42862. this.usehref = attributes.usehref || "";
  42863. }
  42864. }
  42865. class Encodings extends XFAObject {
  42866. constructor(attributes) {
  42867. super(TEMPLATE_NS_ID, "encodings", true);
  42868. this.id = attributes.id || "";
  42869. this.type = getStringOption(attributes.type, ["optional", "required"]);
  42870. this.use = attributes.use || "";
  42871. this.usehref = attributes.usehref || "";
  42872. this.encoding = new XFAObjectArray();
  42873. }
  42874. }
  42875. class Encrypt extends XFAObject {
  42876. constructor(attributes) {
  42877. super(TEMPLATE_NS_ID, "encrypt", true);
  42878. this.id = attributes.id || "";
  42879. this.use = attributes.use || "";
  42880. this.usehref = attributes.usehref || "";
  42881. this.certificate = null;
  42882. }
  42883. }
  42884. class EncryptData extends XFAObject {
  42885. constructor(attributes) {
  42886. super(TEMPLATE_NS_ID, "encryptData", true);
  42887. this.id = attributes.id || "";
  42888. this.operation = getStringOption(attributes.operation, ["encrypt", "decrypt"]);
  42889. this.target = attributes.target || "";
  42890. this.use = attributes.use || "";
  42891. this.usehref = attributes.usehref || "";
  42892. this.filter = null;
  42893. this.manifest = null;
  42894. }
  42895. }
  42896. class Encryption extends XFAObject {
  42897. constructor(attributes) {
  42898. super(TEMPLATE_NS_ID, "encryption", true);
  42899. this.id = attributes.id || "";
  42900. this.type = getStringOption(attributes.type, ["optional", "required"]);
  42901. this.use = attributes.use || "";
  42902. this.usehref = attributes.usehref || "";
  42903. this.certificate = new XFAObjectArray();
  42904. }
  42905. }
  42906. class EncryptionMethod extends OptionObject {
  42907. constructor(attributes) {
  42908. super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]);
  42909. this.id = attributes.id || "";
  42910. this.use = attributes.use || "";
  42911. this.usehref = attributes.usehref || "";
  42912. }
  42913. }
  42914. class EncryptionMethods extends XFAObject {
  42915. constructor(attributes) {
  42916. super(TEMPLATE_NS_ID, "encryptionMethods", true);
  42917. this.id = attributes.id || "";
  42918. this.type = getStringOption(attributes.type, ["optional", "required"]);
  42919. this.use = attributes.use || "";
  42920. this.usehref = attributes.usehref || "";
  42921. this.encryptionMethod = new XFAObjectArray();
  42922. }
  42923. }
  42924. class Event extends XFAObject {
  42925. constructor(attributes) {
  42926. super(TEMPLATE_NS_ID, "event", true);
  42927. this.activity = getStringOption(attributes.activity, ["click", "change", "docClose", "docReady", "enter", "exit", "full", "indexChange", "initialize", "mouseDown", "mouseEnter", "mouseExit", "mouseUp", "postExecute", "postOpen", "postPrint", "postSave", "postSign", "postSubmit", "preExecute", "preOpen", "prePrint", "preSave", "preSign", "preSubmit", "ready", "validationState"]);
  42928. this.id = attributes.id || "";
  42929. this.listen = getStringOption(attributes.listen, ["refOnly", "refAndDescendents"]);
  42930. this.name = attributes.name || "";
  42931. this.ref = attributes.ref || "";
  42932. this.use = attributes.use || "";
  42933. this.usehref = attributes.usehref || "";
  42934. this.extras = null;
  42935. this.encryptData = null;
  42936. this.execute = null;
  42937. this.script = null;
  42938. this.signData = null;
  42939. this.submit = null;
  42940. }
  42941. }
  42942. class ExData extends ContentObject {
  42943. constructor(attributes) {
  42944. super(TEMPLATE_NS_ID, "exData");
  42945. this.contentType = attributes.contentType || "";
  42946. this.href = attributes.href || "";
  42947. this.id = attributes.id || "";
  42948. this.maxLength = getInteger({
  42949. data: attributes.maxLength,
  42950. defaultValue: -1,
  42951. validate: x => x >= -1
  42952. });
  42953. this.name = attributes.name || "";
  42954. this.rid = attributes.rid || "";
  42955. this.transferEncoding = getStringOption(attributes.transferEncoding, ["none", "base64", "package"]);
  42956. this.use = attributes.use || "";
  42957. this.usehref = attributes.usehref || "";
  42958. }
  42959. [$isCDATAXml]() {
  42960. return this.contentType === "text/html";
  42961. }
  42962. [$onChild](child) {
  42963. if (this.contentType === "text/html" && child[$namespaceId] === NamespaceIds.xhtml.id) {
  42964. this[$content] = child;
  42965. return true;
  42966. }
  42967. if (this.contentType === "text/xml") {
  42968. this[$content] = child;
  42969. return true;
  42970. }
  42971. return false;
  42972. }
  42973. [$toHTML](availableSpace) {
  42974. if (this.contentType !== "text/html" || !this[$content]) {
  42975. return HTMLResult.EMPTY;
  42976. }
  42977. return this[$content][$toHTML](availableSpace);
  42978. }
  42979. }
  42980. class ExObject extends XFAObject {
  42981. constructor(attributes) {
  42982. super(TEMPLATE_NS_ID, "exObject", true);
  42983. this.archive = attributes.archive || "";
  42984. this.classId = attributes.classId || "";
  42985. this.codeBase = attributes.codeBase || "";
  42986. this.codeType = attributes.codeType || "";
  42987. this.id = attributes.id || "";
  42988. this.name = attributes.name || "";
  42989. this.use = attributes.use || "";
  42990. this.usehref = attributes.usehref || "";
  42991. this.extras = null;
  42992. this.boolean = new XFAObjectArray();
  42993. this.date = new XFAObjectArray();
  42994. this.dateTime = new XFAObjectArray();
  42995. this.decimal = new XFAObjectArray();
  42996. this.exData = new XFAObjectArray();
  42997. this.exObject = new XFAObjectArray();
  42998. this.float = new XFAObjectArray();
  42999. this.image = new XFAObjectArray();
  43000. this.integer = new XFAObjectArray();
  43001. this.text = new XFAObjectArray();
  43002. this.time = new XFAObjectArray();
  43003. }
  43004. }
  43005. class ExclGroup extends XFAObject {
  43006. constructor(attributes) {
  43007. super(TEMPLATE_NS_ID, "exclGroup", true);
  43008. this.access = getStringOption(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  43009. this.accessKey = attributes.accessKey || "";
  43010. this.anchorType = getStringOption(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  43011. this.colSpan = getInteger({
  43012. data: attributes.colSpan,
  43013. defaultValue: 1,
  43014. validate: n => n >= 1 || n === -1
  43015. });
  43016. this.h = attributes.h ? getMeasurement(attributes.h) : "";
  43017. this.hAlign = getStringOption(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  43018. this.id = attributes.id || "";
  43019. this.layout = getStringOption(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  43020. this.maxH = getMeasurement(attributes.maxH, "0pt");
  43021. this.maxW = getMeasurement(attributes.maxW, "0pt");
  43022. this.minH = getMeasurement(attributes.minH, "0pt");
  43023. this.minW = getMeasurement(attributes.minW, "0pt");
  43024. this.name = attributes.name || "";
  43025. this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  43026. this.relevant = getRelevant(attributes.relevant);
  43027. this.use = attributes.use || "";
  43028. this.usehref = attributes.usehref || "";
  43029. this.w = attributes.w ? getMeasurement(attributes.w) : "";
  43030. this.x = getMeasurement(attributes.x, "0pt");
  43031. this.y = getMeasurement(attributes.y, "0pt");
  43032. this.assist = null;
  43033. this.bind = null;
  43034. this.border = null;
  43035. this.calculate = null;
  43036. this.caption = null;
  43037. this.desc = null;
  43038. this.extras = null;
  43039. this.margin = null;
  43040. this.para = null;
  43041. this.traversal = null;
  43042. this.validate = null;
  43043. this.connect = new XFAObjectArray();
  43044. this.event = new XFAObjectArray();
  43045. this.field = new XFAObjectArray();
  43046. this.setProperty = new XFAObjectArray();
  43047. }
  43048. [$isBindable]() {
  43049. return true;
  43050. }
  43051. [$hasSettableValue]() {
  43052. return true;
  43053. }
  43054. [$setValue](value) {
  43055. for (const field of this.field.children) {
  43056. if (!field.value) {
  43057. const nodeValue = new Value({});
  43058. field[$appendChild](nodeValue);
  43059. field.value = nodeValue;
  43060. }
  43061. field.value[$setValue](value);
  43062. }
  43063. }
  43064. [$isThereMoreWidth]() {
  43065. return this.layout.endsWith("-tb") && this[$extra].attempt === 0 && this[$extra].numberInLine > 0 || this[$getParent]()[$isThereMoreWidth]();
  43066. }
  43067. [$isSplittable]() {
  43068. const parent = this[$getSubformParent]();
  43069. if (!parent[$isSplittable]()) {
  43070. return false;
  43071. }
  43072. if (this[$extra]._isSplittable !== undefined) {
  43073. return this[$extra]._isSplittable;
  43074. }
  43075. if (this.layout === "position" || this.layout.includes("row")) {
  43076. this[$extra]._isSplittable = false;
  43077. return false;
  43078. }
  43079. if (parent.layout?.endsWith("-tb") && parent[$extra].numberInLine !== 0) {
  43080. return false;
  43081. }
  43082. this[$extra]._isSplittable = true;
  43083. return true;
  43084. }
  43085. [$flushHTML]() {
  43086. return flushHTML(this);
  43087. }
  43088. [$addHTML](html, bbox) {
  43089. addHTML(this, html, bbox);
  43090. }
  43091. [$getAvailableSpace]() {
  43092. return getAvailableSpace(this);
  43093. }
  43094. [$toHTML](availableSpace) {
  43095. setTabIndex(this);
  43096. if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  43097. return HTMLResult.EMPTY;
  43098. }
  43099. fixDimensions(this);
  43100. const children = [];
  43101. const attributes = {
  43102. id: this[$uid],
  43103. class: []
  43104. };
  43105. setAccess(this, attributes.class);
  43106. if (!this[$extra]) {
  43107. this[$extra] = Object.create(null);
  43108. }
  43109. Object.assign(this[$extra], {
  43110. children,
  43111. attributes,
  43112. attempt: 0,
  43113. line: null,
  43114. numberInLine: 0,
  43115. availableSpace: {
  43116. width: Math.min(this.w || Infinity, availableSpace.width),
  43117. height: Math.min(this.h || Infinity, availableSpace.height)
  43118. },
  43119. width: 0,
  43120. height: 0,
  43121. prevHeight: 0,
  43122. currentWidth: 0
  43123. });
  43124. const isSplittable = this[$isSplittable]();
  43125. if (!isSplittable) {
  43126. setFirstUnsplittable(this);
  43127. }
  43128. if (!checkDimensions(this, availableSpace)) {
  43129. return HTMLResult.FAILURE;
  43130. }
  43131. const filter = new Set(["field"]);
  43132. if (this.layout.includes("row")) {
  43133. const columnWidths = this[$getSubformParent]().columnWidths;
  43134. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  43135. this[$extra].columnWidths = columnWidths;
  43136. this[$extra].currentColumn = 0;
  43137. }
  43138. }
  43139. const style = toStyle(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  43140. const classNames = ["xfaExclgroup"];
  43141. const cl = layoutClass(this);
  43142. if (cl) {
  43143. classNames.push(cl);
  43144. }
  43145. if (isPrintOnly(this)) {
  43146. classNames.push("xfaPrintOnly");
  43147. }
  43148. attributes.style = style;
  43149. attributes.class = classNames;
  43150. if (this.name) {
  43151. attributes.xfaName = this.name;
  43152. }
  43153. this[$pushPara]();
  43154. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  43155. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  43156. for (; this[$extra].attempt < maxRun; this[$extra].attempt++) {
  43157. if (isLrTb && this[$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  43158. this[$extra].numberInLine = 0;
  43159. }
  43160. const result = this[$childrenToHTML]({
  43161. filter,
  43162. include: true
  43163. });
  43164. if (result.success) {
  43165. break;
  43166. }
  43167. if (result.isBreak()) {
  43168. this[$popPara]();
  43169. return result;
  43170. }
  43171. if (isLrTb && this[$extra].attempt === 0 && this[$extra].numberInLine === 0 && !this[$getTemplateRoot]()[$extra].noLayoutFailure) {
  43172. this[$extra].attempt = maxRun;
  43173. break;
  43174. }
  43175. }
  43176. this[$popPara]();
  43177. if (!isSplittable) {
  43178. unsetFirstUnsplittable(this);
  43179. }
  43180. if (this[$extra].attempt === maxRun) {
  43181. if (!isSplittable) {
  43182. delete this[$extra];
  43183. }
  43184. return HTMLResult.FAILURE;
  43185. }
  43186. let marginH = 0;
  43187. let marginV = 0;
  43188. if (this.margin) {
  43189. marginH = this.margin.leftInset + this.margin.rightInset;
  43190. marginV = this.margin.topInset + this.margin.bottomInset;
  43191. }
  43192. const width = Math.max(this[$extra].width + marginH, this.w || 0);
  43193. const height = Math.max(this[$extra].height + marginV, this.h || 0);
  43194. const bbox = [this.x, this.y, width, height];
  43195. if (this.w === "") {
  43196. style.width = measureToString(width);
  43197. }
  43198. if (this.h === "") {
  43199. style.height = measureToString(height);
  43200. }
  43201. const html = {
  43202. name: "div",
  43203. attributes,
  43204. children
  43205. };
  43206. applyAssist(this, attributes);
  43207. delete this[$extra];
  43208. return HTMLResult.success(createWrapper(this, html), bbox);
  43209. }
  43210. }
  43211. class Execute extends XFAObject {
  43212. constructor(attributes) {
  43213. super(TEMPLATE_NS_ID, "execute");
  43214. this.connection = attributes.connection || "";
  43215. this.executeType = getStringOption(attributes.executeType, ["import", "remerge"]);
  43216. this.id = attributes.id || "";
  43217. this.runAt = getStringOption(attributes.runAt, ["client", "both", "server"]);
  43218. this.use = attributes.use || "";
  43219. this.usehref = attributes.usehref || "";
  43220. }
  43221. }
  43222. class Extras extends XFAObject {
  43223. constructor(attributes) {
  43224. super(TEMPLATE_NS_ID, "extras", true);
  43225. this.id = attributes.id || "";
  43226. this.name = attributes.name || "";
  43227. this.use = attributes.use || "";
  43228. this.usehref = attributes.usehref || "";
  43229. this.boolean = new XFAObjectArray();
  43230. this.date = new XFAObjectArray();
  43231. this.dateTime = new XFAObjectArray();
  43232. this.decimal = new XFAObjectArray();
  43233. this.exData = new XFAObjectArray();
  43234. this.extras = new XFAObjectArray();
  43235. this.float = new XFAObjectArray();
  43236. this.image = new XFAObjectArray();
  43237. this.integer = new XFAObjectArray();
  43238. this.text = new XFAObjectArray();
  43239. this.time = new XFAObjectArray();
  43240. }
  43241. }
  43242. class Field extends XFAObject {
  43243. constructor(attributes) {
  43244. super(TEMPLATE_NS_ID, "field", true);
  43245. this.access = getStringOption(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  43246. this.accessKey = attributes.accessKey || "";
  43247. this.anchorType = getStringOption(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  43248. this.colSpan = getInteger({
  43249. data: attributes.colSpan,
  43250. defaultValue: 1,
  43251. validate: n => n >= 1 || n === -1
  43252. });
  43253. this.h = attributes.h ? getMeasurement(attributes.h) : "";
  43254. this.hAlign = getStringOption(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  43255. this.id = attributes.id || "";
  43256. this.locale = attributes.locale || "";
  43257. this.maxH = getMeasurement(attributes.maxH, "0pt");
  43258. this.maxW = getMeasurement(attributes.maxW, "0pt");
  43259. this.minH = getMeasurement(attributes.minH, "0pt");
  43260. this.minW = getMeasurement(attributes.minW, "0pt");
  43261. this.name = attributes.name || "";
  43262. this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  43263. this.relevant = getRelevant(attributes.relevant);
  43264. this.rotate = getInteger({
  43265. data: attributes.rotate,
  43266. defaultValue: 0,
  43267. validate: x => x % 90 === 0
  43268. });
  43269. this.use = attributes.use || "";
  43270. this.usehref = attributes.usehref || "";
  43271. this.w = attributes.w ? getMeasurement(attributes.w) : "";
  43272. this.x = getMeasurement(attributes.x, "0pt");
  43273. this.y = getMeasurement(attributes.y, "0pt");
  43274. this.assist = null;
  43275. this.bind = null;
  43276. this.border = null;
  43277. this.calculate = null;
  43278. this.caption = null;
  43279. this.desc = null;
  43280. this.extras = null;
  43281. this.font = null;
  43282. this.format = null;
  43283. this.items = new XFAObjectArray(2);
  43284. this.keep = null;
  43285. this.margin = null;
  43286. this.para = null;
  43287. this.traversal = null;
  43288. this.ui = null;
  43289. this.validate = null;
  43290. this.value = null;
  43291. this.bindItems = new XFAObjectArray();
  43292. this.connect = new XFAObjectArray();
  43293. this.event = new XFAObjectArray();
  43294. this.setProperty = new XFAObjectArray();
  43295. }
  43296. [$isBindable]() {
  43297. return true;
  43298. }
  43299. [$setValue](value) {
  43300. _setValue(this, value);
  43301. }
  43302. [$toHTML](availableSpace) {
  43303. setTabIndex(this);
  43304. if (!this.ui) {
  43305. this.ui = new Ui({});
  43306. this.ui[$globalData] = this[$globalData];
  43307. this[$appendChild](this.ui);
  43308. let node;
  43309. switch (this.items.children.length) {
  43310. case 0:
  43311. node = new TextEdit({});
  43312. this.ui.textEdit = node;
  43313. break;
  43314. case 1:
  43315. node = new CheckButton({});
  43316. this.ui.checkButton = node;
  43317. break;
  43318. case 2:
  43319. node = new ChoiceList({});
  43320. this.ui.choiceList = node;
  43321. break;
  43322. }
  43323. this.ui[$appendChild](node);
  43324. }
  43325. if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  43326. return HTMLResult.EMPTY;
  43327. }
  43328. if (this.caption) {
  43329. delete this.caption[$extra];
  43330. }
  43331. this[$pushPara]();
  43332. const caption = this.caption ? this.caption[$toHTML](availableSpace).html : null;
  43333. const savedW = this.w;
  43334. const savedH = this.h;
  43335. let marginH = 0;
  43336. let marginV = 0;
  43337. if (this.margin) {
  43338. marginH = this.margin.leftInset + this.margin.rightInset;
  43339. marginV = this.margin.topInset + this.margin.bottomInset;
  43340. }
  43341. let borderDims = null;
  43342. if (this.w === "" || this.h === "") {
  43343. let width = null;
  43344. let height = null;
  43345. let uiW = 0;
  43346. let uiH = 0;
  43347. if (this.ui.checkButton) {
  43348. uiW = uiH = this.ui.checkButton.size;
  43349. } else {
  43350. const {
  43351. w,
  43352. h
  43353. } = layoutNode(this, availableSpace);
  43354. if (w !== null) {
  43355. uiW = w;
  43356. uiH = h;
  43357. } else {
  43358. uiH = fonts_getMetrics(this.font, true).lineNoGap;
  43359. }
  43360. }
  43361. borderDims = getBorderDims(this.ui[$getExtra]());
  43362. uiW += borderDims.w;
  43363. uiH += borderDims.h;
  43364. if (this.caption) {
  43365. const {
  43366. w,
  43367. h,
  43368. isBroken
  43369. } = this.caption[$getExtra](availableSpace);
  43370. if (isBroken && this[$getSubformParent]()[$isThereMoreWidth]()) {
  43371. this[$popPara]();
  43372. return HTMLResult.FAILURE;
  43373. }
  43374. width = w;
  43375. height = h;
  43376. switch (this.caption.placement) {
  43377. case "left":
  43378. case "right":
  43379. case "inline":
  43380. width += uiW;
  43381. break;
  43382. case "top":
  43383. case "bottom":
  43384. height += uiH;
  43385. break;
  43386. }
  43387. } else {
  43388. width = uiW;
  43389. height = uiH;
  43390. }
  43391. if (width && this.w === "") {
  43392. width += marginH;
  43393. this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW);
  43394. }
  43395. if (height && this.h === "") {
  43396. height += marginV;
  43397. this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH);
  43398. }
  43399. }
  43400. this[$popPara]();
  43401. fixDimensions(this);
  43402. setFirstUnsplittable(this);
  43403. if (!checkDimensions(this, availableSpace)) {
  43404. this.w = savedW;
  43405. this.h = savedH;
  43406. this[$popPara]();
  43407. return HTMLResult.FAILURE;
  43408. }
  43409. unsetFirstUnsplittable(this);
  43410. const style = toStyle(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign");
  43411. setMinMaxDimensions(this, style);
  43412. const classNames = ["xfaField"];
  43413. if (this.font) {
  43414. classNames.push("xfaFont");
  43415. }
  43416. if (isPrintOnly(this)) {
  43417. classNames.push("xfaPrintOnly");
  43418. }
  43419. const attributes = {
  43420. style,
  43421. id: this[$uid],
  43422. class: classNames
  43423. };
  43424. if (style.margin) {
  43425. style.padding = style.margin;
  43426. delete style.margin;
  43427. }
  43428. setAccess(this, classNames);
  43429. if (this.name) {
  43430. attributes.xfaName = this.name;
  43431. }
  43432. const children = [];
  43433. const html = {
  43434. name: "div",
  43435. attributes,
  43436. children
  43437. };
  43438. applyAssist(this, attributes);
  43439. const borderStyle = this.border ? this.border[$toStyle]() : null;
  43440. const bbox = computeBbox(this, html, availableSpace);
  43441. const ui = this.ui[$toHTML]().html;
  43442. if (!ui) {
  43443. Object.assign(style, borderStyle);
  43444. return HTMLResult.success(createWrapper(this, html), bbox);
  43445. }
  43446. if (this[$tabIndex]) {
  43447. if (ui.children?.[0]) {
  43448. ui.children[0].attributes.tabindex = this[$tabIndex];
  43449. } else {
  43450. ui.attributes.tabindex = this[$tabIndex];
  43451. }
  43452. }
  43453. if (!ui.attributes.style) {
  43454. ui.attributes.style = Object.create(null);
  43455. }
  43456. let aElement = null;
  43457. if (this.ui.button) {
  43458. if (ui.children.length === 1) {
  43459. [aElement] = ui.children.splice(0, 1);
  43460. }
  43461. Object.assign(ui.attributes.style, borderStyle);
  43462. } else {
  43463. Object.assign(style, borderStyle);
  43464. }
  43465. children.push(ui);
  43466. if (this.value) {
  43467. if (this.ui.imageEdit) {
  43468. ui.children.push(this.value[$toHTML]().html);
  43469. } else if (!this.ui.button) {
  43470. let value = "";
  43471. if (this.value.exData) {
  43472. value = this.value.exData[$text]();
  43473. } else if (this.value.text) {
  43474. value = this.value.text[$getExtra]();
  43475. } else {
  43476. const htmlValue = this.value[$toHTML]().html;
  43477. if (htmlValue !== null) {
  43478. value = htmlValue.children[0].value;
  43479. }
  43480. }
  43481. if (this.ui.textEdit && this.value.text?.maxChars) {
  43482. ui.children[0].attributes.maxLength = this.value.text.maxChars;
  43483. }
  43484. if (value) {
  43485. if (this.ui.numericEdit) {
  43486. value = parseFloat(value);
  43487. value = isNaN(value) ? "" : value.toString();
  43488. }
  43489. if (ui.children[0].name === "textarea") {
  43490. ui.children[0].attributes.textContent = value;
  43491. } else {
  43492. ui.children[0].attributes.value = value;
  43493. }
  43494. }
  43495. }
  43496. }
  43497. if (!this.ui.imageEdit && ui.children?.[0] && this.h) {
  43498. borderDims = borderDims || getBorderDims(this.ui[$getExtra]());
  43499. let captionHeight = 0;
  43500. if (this.caption && ["top", "bottom"].includes(this.caption.placement)) {
  43501. captionHeight = this.caption.reserve;
  43502. if (captionHeight <= 0) {
  43503. captionHeight = this.caption[$getExtra](availableSpace).h;
  43504. }
  43505. const inputHeight = this.h - captionHeight - marginV - borderDims.h;
  43506. ui.children[0].attributes.style.height = measureToString(inputHeight);
  43507. } else {
  43508. ui.children[0].attributes.style.height = "100%";
  43509. }
  43510. }
  43511. if (aElement) {
  43512. ui.children.push(aElement);
  43513. }
  43514. if (!caption) {
  43515. if (ui.attributes.class) {
  43516. ui.attributes.class.push("xfaLeft");
  43517. }
  43518. this.w = savedW;
  43519. this.h = savedH;
  43520. return HTMLResult.success(createWrapper(this, html), bbox);
  43521. }
  43522. if (this.ui.button) {
  43523. if (style.padding) {
  43524. delete style.padding;
  43525. }
  43526. if (caption.name === "div") {
  43527. caption.name = "span";
  43528. }
  43529. ui.children.push(caption);
  43530. return HTMLResult.success(html, bbox);
  43531. } else if (this.ui.checkButton) {
  43532. caption.attributes.class[0] = "xfaCaptionForCheckButton";
  43533. }
  43534. if (!ui.attributes.class) {
  43535. ui.attributes.class = [];
  43536. }
  43537. ui.children.splice(0, 0, caption);
  43538. switch (this.caption.placement) {
  43539. case "left":
  43540. ui.attributes.class.push("xfaLeft");
  43541. break;
  43542. case "right":
  43543. ui.attributes.class.push("xfaRight");
  43544. break;
  43545. case "top":
  43546. ui.attributes.class.push("xfaTop");
  43547. break;
  43548. case "bottom":
  43549. ui.attributes.class.push("xfaBottom");
  43550. break;
  43551. case "inline":
  43552. ui.attributes.class.push("xfaLeft");
  43553. break;
  43554. }
  43555. this.w = savedW;
  43556. this.h = savedH;
  43557. return HTMLResult.success(createWrapper(this, html), bbox);
  43558. }
  43559. }
  43560. class Fill extends XFAObject {
  43561. constructor(attributes) {
  43562. super(TEMPLATE_NS_ID, "fill", true);
  43563. this.id = attributes.id || "";
  43564. this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  43565. this.use = attributes.use || "";
  43566. this.usehref = attributes.usehref || "";
  43567. this.color = null;
  43568. this.extras = null;
  43569. this.linear = null;
  43570. this.pattern = null;
  43571. this.radial = null;
  43572. this.solid = null;
  43573. this.stipple = null;
  43574. }
  43575. [$toStyle]() {
  43576. const parent = this[$getParent]();
  43577. const grandpa = parent[$getParent]();
  43578. const ggrandpa = grandpa[$getParent]();
  43579. const style = Object.create(null);
  43580. let propName = "color";
  43581. let altPropName = propName;
  43582. if (parent instanceof Border) {
  43583. propName = "background-color";
  43584. altPropName = "background";
  43585. if (ggrandpa instanceof Ui) {
  43586. style.backgroundColor = "white";
  43587. }
  43588. }
  43589. if (parent instanceof Rectangle || parent instanceof Arc) {
  43590. propName = altPropName = "fill";
  43591. style.fill = "white";
  43592. }
  43593. for (const name of Object.getOwnPropertyNames(this)) {
  43594. if (name === "extras" || name === "color") {
  43595. continue;
  43596. }
  43597. const obj = this[name];
  43598. if (!(obj instanceof XFAObject)) {
  43599. continue;
  43600. }
  43601. const color = obj[$toStyle](this.color);
  43602. if (color) {
  43603. style[color.startsWith("#") ? propName : altPropName] = color;
  43604. }
  43605. return style;
  43606. }
  43607. if (this.color?.value) {
  43608. const color = this.color[$toStyle]();
  43609. style[color.startsWith("#") ? propName : altPropName] = color;
  43610. }
  43611. return style;
  43612. }
  43613. }
  43614. class Filter extends XFAObject {
  43615. constructor(attributes) {
  43616. super(TEMPLATE_NS_ID, "filter", true);
  43617. this.addRevocationInfo = getStringOption(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
  43618. this.id = attributes.id || "";
  43619. this.name = attributes.name || "";
  43620. this.use = attributes.use || "";
  43621. this.usehref = attributes.usehref || "";
  43622. this.version = getInteger({
  43623. data: this.version,
  43624. defaultValue: 5,
  43625. validate: x => x >= 1 && x <= 5
  43626. });
  43627. this.appearanceFilter = null;
  43628. this.certificates = null;
  43629. this.digestMethods = null;
  43630. this.encodings = null;
  43631. this.encryptionMethods = null;
  43632. this.handler = null;
  43633. this.lockDocument = null;
  43634. this.mdp = null;
  43635. this.reasons = null;
  43636. this.timeStamp = null;
  43637. }
  43638. }
  43639. class Float extends ContentObject {
  43640. constructor(attributes) {
  43641. super(TEMPLATE_NS_ID, "float");
  43642. this.id = attributes.id || "";
  43643. this.name = attributes.name || "";
  43644. this.use = attributes.use || "";
  43645. this.usehref = attributes.usehref || "";
  43646. }
  43647. [$finalize]() {
  43648. const number = parseFloat(this[$content].trim());
  43649. this[$content] = isNaN(number) ? null : number;
  43650. }
  43651. [$toHTML](availableSpace) {
  43652. return valueToHtml(this[$content] !== null ? this[$content].toString() : "");
  43653. }
  43654. }
  43655. class template_Font extends XFAObject {
  43656. constructor(attributes) {
  43657. super(TEMPLATE_NS_ID, "font", true);
  43658. this.baselineShift = getMeasurement(attributes.baselineShift);
  43659. this.fontHorizontalScale = getFloat({
  43660. data: attributes.fontHorizontalScale,
  43661. defaultValue: 100,
  43662. validate: x => x >= 0
  43663. });
  43664. this.fontVerticalScale = getFloat({
  43665. data: attributes.fontVerticalScale,
  43666. defaultValue: 100,
  43667. validate: x => x >= 0
  43668. });
  43669. this.id = attributes.id || "";
  43670. this.kerningMode = getStringOption(attributes.kerningMode, ["none", "pair"]);
  43671. this.letterSpacing = getMeasurement(attributes.letterSpacing, "0");
  43672. this.lineThrough = getInteger({
  43673. data: attributes.lineThrough,
  43674. defaultValue: 0,
  43675. validate: x => x === 1 || x === 2
  43676. });
  43677. this.lineThroughPeriod = getStringOption(attributes.lineThroughPeriod, ["all", "word"]);
  43678. this.overline = getInteger({
  43679. data: attributes.overline,
  43680. defaultValue: 0,
  43681. validate: x => x === 1 || x === 2
  43682. });
  43683. this.overlinePeriod = getStringOption(attributes.overlinePeriod, ["all", "word"]);
  43684. this.posture = getStringOption(attributes.posture, ["normal", "italic"]);
  43685. this.size = getMeasurement(attributes.size, "10pt");
  43686. this.typeface = attributes.typeface || "Courier";
  43687. this.underline = getInteger({
  43688. data: attributes.underline,
  43689. defaultValue: 0,
  43690. validate: x => x === 1 || x === 2
  43691. });
  43692. this.underlinePeriod = getStringOption(attributes.underlinePeriod, ["all", "word"]);
  43693. this.use = attributes.use || "";
  43694. this.usehref = attributes.usehref || "";
  43695. this.weight = getStringOption(attributes.weight, ["normal", "bold"]);
  43696. this.extras = null;
  43697. this.fill = null;
  43698. }
  43699. [$clean](builder) {
  43700. super[$clean](builder);
  43701. this[$globalData].usedTypefaces.add(this.typeface);
  43702. }
  43703. [$toStyle]() {
  43704. const style = toStyle(this, "fill");
  43705. const color = style.color;
  43706. if (color) {
  43707. if (color === "#000000") {
  43708. delete style.color;
  43709. } else if (!color.startsWith("#")) {
  43710. style.background = color;
  43711. style.backgroundClip = "text";
  43712. style.color = "transparent";
  43713. }
  43714. }
  43715. if (this.baselineShift) {
  43716. style.verticalAlign = measureToString(this.baselineShift);
  43717. }
  43718. style.fontKerning = this.kerningMode === "none" ? "none" : "normal";
  43719. style.letterSpacing = measureToString(this.letterSpacing);
  43720. if (this.lineThrough !== 0) {
  43721. style.textDecoration = "line-through";
  43722. if (this.lineThrough === 2) {
  43723. style.textDecorationStyle = "double";
  43724. }
  43725. }
  43726. if (this.overline !== 0) {
  43727. style.textDecoration = "overline";
  43728. if (this.overline === 2) {
  43729. style.textDecorationStyle = "double";
  43730. }
  43731. }
  43732. style.fontStyle = this.posture;
  43733. style.fontSize = measureToString(0.99 * this.size);
  43734. setFontFamily(this, this, this[$globalData].fontFinder, style);
  43735. if (this.underline !== 0) {
  43736. style.textDecoration = "underline";
  43737. if (this.underline === 2) {
  43738. style.textDecorationStyle = "double";
  43739. }
  43740. }
  43741. style.fontWeight = this.weight;
  43742. return style;
  43743. }
  43744. }
  43745. class Format extends XFAObject {
  43746. constructor(attributes) {
  43747. super(TEMPLATE_NS_ID, "format", true);
  43748. this.id = attributes.id || "";
  43749. this.use = attributes.use || "";
  43750. this.usehref = attributes.usehref || "";
  43751. this.extras = null;
  43752. this.picture = null;
  43753. }
  43754. }
  43755. class Handler extends StringObject {
  43756. constructor(attributes) {
  43757. super(TEMPLATE_NS_ID, "handler");
  43758. this.id = attributes.id || "";
  43759. this.type = getStringOption(attributes.type, ["optional", "required"]);
  43760. this.use = attributes.use || "";
  43761. this.usehref = attributes.usehref || "";
  43762. }
  43763. }
  43764. class Hyphenation extends XFAObject {
  43765. constructor(attributes) {
  43766. super(TEMPLATE_NS_ID, "hyphenation");
  43767. this.excludeAllCaps = getInteger({
  43768. data: attributes.excludeAllCaps,
  43769. defaultValue: 0,
  43770. validate: x => x === 1
  43771. });
  43772. this.excludeInitialCap = getInteger({
  43773. data: attributes.excludeInitialCap,
  43774. defaultValue: 0,
  43775. validate: x => x === 1
  43776. });
  43777. this.hyphenate = getInteger({
  43778. data: attributes.hyphenate,
  43779. defaultValue: 0,
  43780. validate: x => x === 1
  43781. });
  43782. this.id = attributes.id || "";
  43783. this.pushCharacterCount = getInteger({
  43784. data: attributes.pushCharacterCount,
  43785. defaultValue: 3,
  43786. validate: x => x >= 0
  43787. });
  43788. this.remainCharacterCount = getInteger({
  43789. data: attributes.remainCharacterCount,
  43790. defaultValue: 3,
  43791. validate: x => x >= 0
  43792. });
  43793. this.use = attributes.use || "";
  43794. this.usehref = attributes.usehref || "";
  43795. this.wordCharacterCount = getInteger({
  43796. data: attributes.wordCharacterCount,
  43797. defaultValue: 7,
  43798. validate: x => x >= 0
  43799. });
  43800. }
  43801. }
  43802. class Image extends StringObject {
  43803. constructor(attributes) {
  43804. super(TEMPLATE_NS_ID, "image");
  43805. this.aspect = getStringOption(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
  43806. this.contentType = attributes.contentType || "";
  43807. this.href = attributes.href || "";
  43808. this.id = attributes.id || "";
  43809. this.name = attributes.name || "";
  43810. this.transferEncoding = getStringOption(attributes.transferEncoding, ["base64", "none", "package"]);
  43811. this.use = attributes.use || "";
  43812. this.usehref = attributes.usehref || "";
  43813. }
  43814. [$toHTML]() {
  43815. if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) {
  43816. return HTMLResult.EMPTY;
  43817. }
  43818. let buffer = this[$globalData].images && this[$globalData].images.get(this.href);
  43819. if (!buffer && (this.href || !this[$content])) {
  43820. return HTMLResult.EMPTY;
  43821. }
  43822. if (!buffer && this.transferEncoding === "base64") {
  43823. buffer = fromBase64Util(this[$content]);
  43824. }
  43825. if (!buffer) {
  43826. return HTMLResult.EMPTY;
  43827. }
  43828. if (!this.contentType) {
  43829. for (const [header, type] of IMAGES_HEADERS) {
  43830. if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) {
  43831. this.contentType = type;
  43832. break;
  43833. }
  43834. }
  43835. if (!this.contentType) {
  43836. return HTMLResult.EMPTY;
  43837. }
  43838. }
  43839. const blob = new Blob([buffer], {
  43840. type: this.contentType
  43841. });
  43842. let style;
  43843. switch (this.aspect) {
  43844. case "fit":
  43845. case "actual":
  43846. break;
  43847. case "height":
  43848. style = {
  43849. height: "100%",
  43850. objectFit: "fill"
  43851. };
  43852. break;
  43853. case "none":
  43854. style = {
  43855. width: "100%",
  43856. height: "100%",
  43857. objectFit: "fill"
  43858. };
  43859. break;
  43860. case "width":
  43861. style = {
  43862. width: "100%",
  43863. objectFit: "fill"
  43864. };
  43865. break;
  43866. }
  43867. const parent = this[$getParent]();
  43868. return HTMLResult.success({
  43869. name: "img",
  43870. attributes: {
  43871. class: ["xfaImage"],
  43872. style,
  43873. src: URL.createObjectURL(blob),
  43874. alt: parent ? ariaLabel(parent[$getParent]()) : null
  43875. }
  43876. });
  43877. }
  43878. }
  43879. class ImageEdit extends XFAObject {
  43880. constructor(attributes) {
  43881. super(TEMPLATE_NS_ID, "imageEdit", true);
  43882. this.data = getStringOption(attributes.data, ["link", "embed"]);
  43883. this.id = attributes.id || "";
  43884. this.use = attributes.use || "";
  43885. this.usehref = attributes.usehref || "";
  43886. this.border = null;
  43887. this.extras = null;
  43888. this.margin = null;
  43889. }
  43890. [$toHTML](availableSpace) {
  43891. if (this.data === "embed") {
  43892. return HTMLResult.success({
  43893. name: "div",
  43894. children: [],
  43895. attributes: {}
  43896. });
  43897. }
  43898. return HTMLResult.EMPTY;
  43899. }
  43900. }
  43901. class Integer extends ContentObject {
  43902. constructor(attributes) {
  43903. super(TEMPLATE_NS_ID, "integer");
  43904. this.id = attributes.id || "";
  43905. this.name = attributes.name || "";
  43906. this.use = attributes.use || "";
  43907. this.usehref = attributes.usehref || "";
  43908. }
  43909. [$finalize]() {
  43910. const number = parseInt(this[$content].trim(), 10);
  43911. this[$content] = isNaN(number) ? null : number;
  43912. }
  43913. [$toHTML](availableSpace) {
  43914. return valueToHtml(this[$content] !== null ? this[$content].toString() : "");
  43915. }
  43916. }
  43917. class Issuers extends XFAObject {
  43918. constructor(attributes) {
  43919. super(TEMPLATE_NS_ID, "issuers", true);
  43920. this.id = attributes.id || "";
  43921. this.type = getStringOption(attributes.type, ["optional", "required"]);
  43922. this.use = attributes.use || "";
  43923. this.usehref = attributes.usehref || "";
  43924. this.certificate = new XFAObjectArray();
  43925. }
  43926. }
  43927. class Items extends XFAObject {
  43928. constructor(attributes) {
  43929. super(TEMPLATE_NS_ID, "items", true);
  43930. this.id = attributes.id || "";
  43931. this.name = attributes.name || "";
  43932. this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  43933. this.ref = attributes.ref || "";
  43934. this.save = getInteger({
  43935. data: attributes.save,
  43936. defaultValue: 0,
  43937. validate: x => x === 1
  43938. });
  43939. this.use = attributes.use || "";
  43940. this.usehref = attributes.usehref || "";
  43941. this.boolean = new XFAObjectArray();
  43942. this.date = new XFAObjectArray();
  43943. this.dateTime = new XFAObjectArray();
  43944. this.decimal = new XFAObjectArray();
  43945. this.exData = new XFAObjectArray();
  43946. this.float = new XFAObjectArray();
  43947. this.image = new XFAObjectArray();
  43948. this.integer = new XFAObjectArray();
  43949. this.text = new XFAObjectArray();
  43950. this.time = new XFAObjectArray();
  43951. }
  43952. [$toHTML]() {
  43953. const output = [];
  43954. for (const child of this[$getChildren]()) {
  43955. output.push(child[$text]());
  43956. }
  43957. return HTMLResult.success(output);
  43958. }
  43959. }
  43960. class Keep extends XFAObject {
  43961. constructor(attributes) {
  43962. super(TEMPLATE_NS_ID, "keep", true);
  43963. this.id = attributes.id || "";
  43964. const options = ["none", "contentArea", "pageArea"];
  43965. this.intact = getStringOption(attributes.intact, options);
  43966. this.next = getStringOption(attributes.next, options);
  43967. this.previous = getStringOption(attributes.previous, options);
  43968. this.use = attributes.use || "";
  43969. this.usehref = attributes.usehref || "";
  43970. this.extras = null;
  43971. }
  43972. }
  43973. class KeyUsage extends XFAObject {
  43974. constructor(attributes) {
  43975. super(TEMPLATE_NS_ID, "keyUsage");
  43976. const options = ["", "yes", "no"];
  43977. this.crlSign = getStringOption(attributes.crlSign, options);
  43978. this.dataEncipherment = getStringOption(attributes.dataEncipherment, options);
  43979. this.decipherOnly = getStringOption(attributes.decipherOnly, options);
  43980. this.digitalSignature = getStringOption(attributes.digitalSignature, options);
  43981. this.encipherOnly = getStringOption(attributes.encipherOnly, options);
  43982. this.id = attributes.id || "";
  43983. this.keyAgreement = getStringOption(attributes.keyAgreement, options);
  43984. this.keyCertSign = getStringOption(attributes.keyCertSign, options);
  43985. this.keyEncipherment = getStringOption(attributes.keyEncipherment, options);
  43986. this.nonRepudiation = getStringOption(attributes.nonRepudiation, options);
  43987. this.type = getStringOption(attributes.type, ["optional", "required"]);
  43988. this.use = attributes.use || "";
  43989. this.usehref = attributes.usehref || "";
  43990. }
  43991. }
  43992. class Line extends XFAObject {
  43993. constructor(attributes) {
  43994. super(TEMPLATE_NS_ID, "line", true);
  43995. this.hand = getStringOption(attributes.hand, ["even", "left", "right"]);
  43996. this.id = attributes.id || "";
  43997. this.slope = getStringOption(attributes.slope, ["\\", "/"]);
  43998. this.use = attributes.use || "";
  43999. this.usehref = attributes.usehref || "";
  44000. this.edge = null;
  44001. }
  44002. [$toHTML]() {
  44003. const parent = this[$getParent]()[$getParent]();
  44004. const edge = this.edge || new Edge({});
  44005. const edgeStyle = edge[$toStyle]();
  44006. const style = Object.create(null);
  44007. const thickness = edge.presence === "visible" ? edge.thickness : 0;
  44008. style.strokeWidth = measureToString(thickness);
  44009. style.stroke = edgeStyle.color;
  44010. let x1, y1, x2, y2;
  44011. let width = "100%";
  44012. let height = "100%";
  44013. if (parent.w <= thickness) {
  44014. [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"];
  44015. width = style.strokeWidth;
  44016. } else if (parent.h <= thickness) {
  44017. [x1, y1, x2, y2] = [0, "50%", "100%", "50%"];
  44018. height = style.strokeWidth;
  44019. } else if (this.slope === "\\") {
  44020. [x1, y1, x2, y2] = [0, 0, "100%", "100%"];
  44021. } else {
  44022. [x1, y1, x2, y2] = [0, "100%", "100%", 0];
  44023. }
  44024. const line = {
  44025. name: "line",
  44026. attributes: {
  44027. xmlns: SVG_NS,
  44028. x1,
  44029. y1,
  44030. x2,
  44031. y2,
  44032. style
  44033. }
  44034. };
  44035. const svg = {
  44036. name: "svg",
  44037. children: [line],
  44038. attributes: {
  44039. xmlns: SVG_NS,
  44040. width,
  44041. height,
  44042. style: {
  44043. overflow: "visible"
  44044. }
  44045. }
  44046. };
  44047. if (hasMargin(parent)) {
  44048. return HTMLResult.success({
  44049. name: "div",
  44050. attributes: {
  44051. style: {
  44052. display: "inline",
  44053. width: "100%",
  44054. height: "100%"
  44055. }
  44056. },
  44057. children: [svg]
  44058. });
  44059. }
  44060. svg.attributes.style.position = "absolute";
  44061. return HTMLResult.success(svg);
  44062. }
  44063. }
  44064. class Linear extends XFAObject {
  44065. constructor(attributes) {
  44066. super(TEMPLATE_NS_ID, "linear", true);
  44067. this.id = attributes.id || "";
  44068. this.type = getStringOption(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]);
  44069. this.use = attributes.use || "";
  44070. this.usehref = attributes.usehref || "";
  44071. this.color = null;
  44072. this.extras = null;
  44073. }
  44074. [$toStyle](startColor) {
  44075. startColor = startColor ? startColor[$toStyle]() : "#FFFFFF";
  44076. const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
  44077. const endColor = this.color ? this.color[$toStyle]() : "#000000";
  44078. return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
  44079. }
  44080. }
  44081. class LockDocument extends ContentObject {
  44082. constructor(attributes) {
  44083. super(TEMPLATE_NS_ID, "lockDocument");
  44084. this.id = attributes.id || "";
  44085. this.type = getStringOption(attributes.type, ["optional", "required"]);
  44086. this.use = attributes.use || "";
  44087. this.usehref = attributes.usehref || "";
  44088. }
  44089. [$finalize]() {
  44090. this[$content] = getStringOption(this[$content], ["auto", "0", "1"]);
  44091. }
  44092. }
  44093. class Manifest extends XFAObject {
  44094. constructor(attributes) {
  44095. super(TEMPLATE_NS_ID, "manifest", true);
  44096. this.action = getStringOption(attributes.action, ["include", "all", "exclude"]);
  44097. this.id = attributes.id || "";
  44098. this.name = attributes.name || "";
  44099. this.use = attributes.use || "";
  44100. this.usehref = attributes.usehref || "";
  44101. this.extras = null;
  44102. this.ref = new XFAObjectArray();
  44103. }
  44104. }
  44105. class Margin extends XFAObject {
  44106. constructor(attributes) {
  44107. super(TEMPLATE_NS_ID, "margin", true);
  44108. this.bottomInset = getMeasurement(attributes.bottomInset, "0");
  44109. this.id = attributes.id || "";
  44110. this.leftInset = getMeasurement(attributes.leftInset, "0");
  44111. this.rightInset = getMeasurement(attributes.rightInset, "0");
  44112. this.topInset = getMeasurement(attributes.topInset, "0");
  44113. this.use = attributes.use || "";
  44114. this.usehref = attributes.usehref || "";
  44115. this.extras = null;
  44116. }
  44117. [$toStyle]() {
  44118. return {
  44119. margin: measureToString(this.topInset) + " " + measureToString(this.rightInset) + " " + measureToString(this.bottomInset) + " " + measureToString(this.leftInset)
  44120. };
  44121. }
  44122. }
  44123. class Mdp extends XFAObject {
  44124. constructor(attributes) {
  44125. super(TEMPLATE_NS_ID, "mdp");
  44126. this.id = attributes.id || "";
  44127. this.permissions = getInteger({
  44128. data: attributes.permissions,
  44129. defaultValue: 2,
  44130. validate: x => x === 1 || x === 3
  44131. });
  44132. this.signatureType = getStringOption(attributes.signatureType, ["filler", "author"]);
  44133. this.use = attributes.use || "";
  44134. this.usehref = attributes.usehref || "";
  44135. }
  44136. }
  44137. class Medium extends XFAObject {
  44138. constructor(attributes) {
  44139. super(TEMPLATE_NS_ID, "medium");
  44140. this.id = attributes.id || "";
  44141. this.imagingBBox = getBBox(attributes.imagingBBox);
  44142. this.long = getMeasurement(attributes.long);
  44143. this.orientation = getStringOption(attributes.orientation, ["portrait", "landscape"]);
  44144. this.short = getMeasurement(attributes.short);
  44145. this.stock = attributes.stock || "";
  44146. this.trayIn = getStringOption(attributes.trayIn, ["auto", "delegate", "pageFront"]);
  44147. this.trayOut = getStringOption(attributes.trayOut, ["auto", "delegate"]);
  44148. this.use = attributes.use || "";
  44149. this.usehref = attributes.usehref || "";
  44150. }
  44151. }
  44152. class Message extends XFAObject {
  44153. constructor(attributes) {
  44154. super(TEMPLATE_NS_ID, "message", true);
  44155. this.id = attributes.id || "";
  44156. this.use = attributes.use || "";
  44157. this.usehref = attributes.usehref || "";
  44158. this.text = new XFAObjectArray();
  44159. }
  44160. }
  44161. class NumericEdit extends XFAObject {
  44162. constructor(attributes) {
  44163. super(TEMPLATE_NS_ID, "numericEdit", true);
  44164. this.hScrollPolicy = getStringOption(attributes.hScrollPolicy, ["auto", "off", "on"]);
  44165. this.id = attributes.id || "";
  44166. this.use = attributes.use || "";
  44167. this.usehref = attributes.usehref || "";
  44168. this.border = null;
  44169. this.comb = null;
  44170. this.extras = null;
  44171. this.margin = null;
  44172. }
  44173. [$toHTML](availableSpace) {
  44174. const style = toStyle(this, "border", "font", "margin");
  44175. const field = this[$getParent]()[$getParent]();
  44176. const html = {
  44177. name: "input",
  44178. attributes: {
  44179. type: "text",
  44180. fieldId: field[$uid],
  44181. dataId: field[$data]?.[$uid] || field[$uid],
  44182. class: ["xfaTextfield"],
  44183. style,
  44184. "aria-label": ariaLabel(field),
  44185. "aria-required": false
  44186. }
  44187. };
  44188. if (isRequired(field)) {
  44189. html.attributes["aria-required"] = true;
  44190. html.attributes.required = true;
  44191. }
  44192. return HTMLResult.success({
  44193. name: "label",
  44194. attributes: {
  44195. class: ["xfaLabel"]
  44196. },
  44197. children: [html]
  44198. });
  44199. }
  44200. }
  44201. class Occur extends XFAObject {
  44202. constructor(attributes) {
  44203. super(TEMPLATE_NS_ID, "occur", true);
  44204. this.id = attributes.id || "";
  44205. this.initial = attributes.initial !== "" ? getInteger({
  44206. data: attributes.initial,
  44207. defaultValue: "",
  44208. validate: x => true
  44209. }) : "";
  44210. this.max = attributes.max !== "" ? getInteger({
  44211. data: attributes.max,
  44212. defaultValue: 1,
  44213. validate: x => true
  44214. }) : "";
  44215. this.min = attributes.min !== "" ? getInteger({
  44216. data: attributes.min,
  44217. defaultValue: 1,
  44218. validate: x => true
  44219. }) : "";
  44220. this.use = attributes.use || "";
  44221. this.usehref = attributes.usehref || "";
  44222. this.extras = null;
  44223. }
  44224. [$clean]() {
  44225. const parent = this[$getParent]();
  44226. const originalMin = this.min;
  44227. if (this.min === "") {
  44228. this.min = parent instanceof PageArea || parent instanceof PageSet ? 0 : 1;
  44229. }
  44230. if (this.max === "") {
  44231. if (originalMin === "") {
  44232. this.max = parent instanceof PageArea || parent instanceof PageSet ? -1 : 1;
  44233. } else {
  44234. this.max = this.min;
  44235. }
  44236. }
  44237. if (this.max !== -1 && this.max < this.min) {
  44238. this.max = this.min;
  44239. }
  44240. if (this.initial === "") {
  44241. this.initial = parent instanceof Template ? 1 : this.min;
  44242. }
  44243. }
  44244. }
  44245. class Oid extends StringObject {
  44246. constructor(attributes) {
  44247. super(TEMPLATE_NS_ID, "oid");
  44248. this.id = attributes.id || "";
  44249. this.name = attributes.name || "";
  44250. this.use = attributes.use || "";
  44251. this.usehref = attributes.usehref || "";
  44252. }
  44253. }
  44254. class Oids extends XFAObject {
  44255. constructor(attributes) {
  44256. super(TEMPLATE_NS_ID, "oids", true);
  44257. this.id = attributes.id || "";
  44258. this.type = getStringOption(attributes.type, ["optional", "required"]);
  44259. this.use = attributes.use || "";
  44260. this.usehref = attributes.usehref || "";
  44261. this.oid = new XFAObjectArray();
  44262. }
  44263. }
  44264. class Overflow extends XFAObject {
  44265. constructor(attributes) {
  44266. super(TEMPLATE_NS_ID, "overflow");
  44267. this.id = attributes.id || "";
  44268. this.leader = attributes.leader || "";
  44269. this.target = attributes.target || "";
  44270. this.trailer = attributes.trailer || "";
  44271. this.use = attributes.use || "";
  44272. this.usehref = attributes.usehref || "";
  44273. }
  44274. [$getExtra]() {
  44275. if (!this[$extra]) {
  44276. const parent = this[$getParent]();
  44277. const root = this[$getTemplateRoot]();
  44278. const target = root[$searchNode](this.target, parent);
  44279. const leader = root[$searchNode](this.leader, parent);
  44280. const trailer = root[$searchNode](this.trailer, parent);
  44281. this[$extra] = {
  44282. target: target?.[0] || null,
  44283. leader: leader?.[0] || null,
  44284. trailer: trailer?.[0] || null,
  44285. addLeader: false,
  44286. addTrailer: false
  44287. };
  44288. }
  44289. return this[$extra];
  44290. }
  44291. }
  44292. class PageArea extends XFAObject {
  44293. constructor(attributes) {
  44294. super(TEMPLATE_NS_ID, "pageArea", true);
  44295. this.blankOrNotBlank = getStringOption(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]);
  44296. this.id = attributes.id || "";
  44297. this.initialNumber = getInteger({
  44298. data: attributes.initialNumber,
  44299. defaultValue: 1,
  44300. validate: x => true
  44301. });
  44302. this.name = attributes.name || "";
  44303. this.numbered = getInteger({
  44304. data: attributes.numbered,
  44305. defaultValue: 1,
  44306. validate: x => true
  44307. });
  44308. this.oddOrEven = getStringOption(attributes.oddOrEven, ["any", "even", "odd"]);
  44309. this.pagePosition = getStringOption(attributes.pagePosition, ["any", "first", "last", "only", "rest"]);
  44310. this.relevant = getRelevant(attributes.relevant);
  44311. this.use = attributes.use || "";
  44312. this.usehref = attributes.usehref || "";
  44313. this.desc = null;
  44314. this.extras = null;
  44315. this.medium = null;
  44316. this.occur = null;
  44317. this.area = new XFAObjectArray();
  44318. this.contentArea = new XFAObjectArray();
  44319. this.draw = new XFAObjectArray();
  44320. this.exclGroup = new XFAObjectArray();
  44321. this.field = new XFAObjectArray();
  44322. this.subform = new XFAObjectArray();
  44323. }
  44324. [$isUsable]() {
  44325. if (!this[$extra]) {
  44326. this[$extra] = {
  44327. numberOfUse: 0
  44328. };
  44329. return true;
  44330. }
  44331. return !this.occur || this.occur.max === -1 || this[$extra].numberOfUse < this.occur.max;
  44332. }
  44333. [$cleanPage]() {
  44334. delete this[$extra];
  44335. }
  44336. [$getNextPage]() {
  44337. if (!this[$extra]) {
  44338. this[$extra] = {
  44339. numberOfUse: 0
  44340. };
  44341. }
  44342. const parent = this[$getParent]();
  44343. if (parent.relation === "orderedOccurrence") {
  44344. if (this[$isUsable]()) {
  44345. this[$extra].numberOfUse += 1;
  44346. return this;
  44347. }
  44348. }
  44349. return parent[$getNextPage]();
  44350. }
  44351. [$getAvailableSpace]() {
  44352. return this[$extra].space || {
  44353. width: 0,
  44354. height: 0
  44355. };
  44356. }
  44357. [$toHTML]() {
  44358. if (!this[$extra]) {
  44359. this[$extra] = {
  44360. numberOfUse: 1
  44361. };
  44362. }
  44363. const children = [];
  44364. this[$extra].children = children;
  44365. const style = Object.create(null);
  44366. if (this.medium && this.medium.short && this.medium.long) {
  44367. style.width = measureToString(this.medium.short);
  44368. style.height = measureToString(this.medium.long);
  44369. this[$extra].space = {
  44370. width: this.medium.short,
  44371. height: this.medium.long
  44372. };
  44373. if (this.medium.orientation === "landscape") {
  44374. const x = style.width;
  44375. style.width = style.height;
  44376. style.height = x;
  44377. this[$extra].space = {
  44378. width: this.medium.long,
  44379. height: this.medium.short
  44380. };
  44381. }
  44382. } else {
  44383. warn("XFA - No medium specified in pageArea: please file a bug.");
  44384. }
  44385. this[$childrenToHTML]({
  44386. filter: new Set(["area", "draw", "field", "subform"]),
  44387. include: true
  44388. });
  44389. this[$childrenToHTML]({
  44390. filter: new Set(["contentArea"]),
  44391. include: true
  44392. });
  44393. return HTMLResult.success({
  44394. name: "div",
  44395. children,
  44396. attributes: {
  44397. class: ["xfaPage"],
  44398. id: this[$uid],
  44399. style,
  44400. xfaName: this.name
  44401. }
  44402. });
  44403. }
  44404. }
  44405. class PageSet extends XFAObject {
  44406. constructor(attributes) {
  44407. super(TEMPLATE_NS_ID, "pageSet", true);
  44408. this.duplexImposition = getStringOption(attributes.duplexImposition, ["longEdge", "shortEdge"]);
  44409. this.id = attributes.id || "";
  44410. this.name = attributes.name || "";
  44411. this.relation = getStringOption(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
  44412. this.relevant = getRelevant(attributes.relevant);
  44413. this.use = attributes.use || "";
  44414. this.usehref = attributes.usehref || "";
  44415. this.extras = null;
  44416. this.occur = null;
  44417. this.pageArea = new XFAObjectArray();
  44418. this.pageSet = new XFAObjectArray();
  44419. }
  44420. [$cleanPage]() {
  44421. for (const page of this.pageArea.children) {
  44422. page[$cleanPage]();
  44423. }
  44424. for (const page of this.pageSet.children) {
  44425. page[$cleanPage]();
  44426. }
  44427. }
  44428. [$isUsable]() {
  44429. return !this.occur || this.occur.max === -1 || this[$extra].numberOfUse < this.occur.max;
  44430. }
  44431. [$getNextPage]() {
  44432. if (!this[$extra]) {
  44433. this[$extra] = {
  44434. numberOfUse: 1,
  44435. pageIndex: -1,
  44436. pageSetIndex: -1
  44437. };
  44438. }
  44439. if (this.relation === "orderedOccurrence") {
  44440. if (this[$extra].pageIndex + 1 < this.pageArea.children.length) {
  44441. this[$extra].pageIndex += 1;
  44442. const pageArea = this.pageArea.children[this[$extra].pageIndex];
  44443. return pageArea[$getNextPage]();
  44444. }
  44445. if (this[$extra].pageSetIndex + 1 < this.pageSet.children.length) {
  44446. this[$extra].pageSetIndex += 1;
  44447. return this.pageSet.children[this[$extra].pageSetIndex][$getNextPage]();
  44448. }
  44449. if (this[$isUsable]()) {
  44450. this[$extra].numberOfUse += 1;
  44451. this[$extra].pageIndex = -1;
  44452. this[$extra].pageSetIndex = -1;
  44453. return this[$getNextPage]();
  44454. }
  44455. const parent = this[$getParent]();
  44456. if (parent instanceof PageSet) {
  44457. return parent[$getNextPage]();
  44458. }
  44459. this[$cleanPage]();
  44460. return this[$getNextPage]();
  44461. }
  44462. const pageNumber = this[$getTemplateRoot]()[$extra].pageNumber;
  44463. const parity = pageNumber % 2 === 0 ? "even" : "odd";
  44464. const position = pageNumber === 0 ? "first" : "rest";
  44465. let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position);
  44466. if (page) {
  44467. return page;
  44468. }
  44469. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position);
  44470. if (page) {
  44471. return page;
  44472. }
  44473. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any");
  44474. if (page) {
  44475. return page;
  44476. }
  44477. return this.pageArea.children[0];
  44478. }
  44479. }
  44480. class Para extends XFAObject {
  44481. constructor(attributes) {
  44482. super(TEMPLATE_NS_ID, "para", true);
  44483. this.hAlign = getStringOption(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  44484. this.id = attributes.id || "";
  44485. this.lineHeight = attributes.lineHeight ? getMeasurement(attributes.lineHeight, "0pt") : "";
  44486. this.marginLeft = attributes.marginLeft ? getMeasurement(attributes.marginLeft, "0pt") : "";
  44487. this.marginRight = attributes.marginRight ? getMeasurement(attributes.marginRight, "0pt") : "";
  44488. this.orphans = getInteger({
  44489. data: attributes.orphans,
  44490. defaultValue: 0,
  44491. validate: x => x >= 0
  44492. });
  44493. this.preserve = attributes.preserve || "";
  44494. this.radixOffset = attributes.radixOffset ? getMeasurement(attributes.radixOffset, "0pt") : "";
  44495. this.spaceAbove = attributes.spaceAbove ? getMeasurement(attributes.spaceAbove, "0pt") : "";
  44496. this.spaceBelow = attributes.spaceBelow ? getMeasurement(attributes.spaceBelow, "0pt") : "";
  44497. this.tabDefault = attributes.tabDefault ? getMeasurement(this.tabDefault) : "";
  44498. this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? getMeasurement(x) : x);
  44499. this.textIndent = attributes.textIndent ? getMeasurement(attributes.textIndent, "0pt") : "";
  44500. this.use = attributes.use || "";
  44501. this.usehref = attributes.usehref || "";
  44502. this.vAlign = getStringOption(attributes.vAlign, ["top", "bottom", "middle"]);
  44503. this.widows = getInteger({
  44504. data: attributes.widows,
  44505. defaultValue: 0,
  44506. validate: x => x >= 0
  44507. });
  44508. this.hyphenation = null;
  44509. }
  44510. [$toStyle]() {
  44511. const style = toStyle(this, "hAlign");
  44512. if (this.marginLeft !== "") {
  44513. style.paddingLeft = measureToString(this.marginLeft);
  44514. }
  44515. if (this.marginRight !== "") {
  44516. style.paddingight = measureToString(this.marginRight);
  44517. }
  44518. if (this.spaceAbove !== "") {
  44519. style.paddingTop = measureToString(this.spaceAbove);
  44520. }
  44521. if (this.spaceBelow !== "") {
  44522. style.paddingBottom = measureToString(this.spaceBelow);
  44523. }
  44524. if (this.textIndent !== "") {
  44525. style.textIndent = measureToString(this.textIndent);
  44526. fixTextIndent(style);
  44527. }
  44528. if (this.lineHeight > 0) {
  44529. style.lineHeight = measureToString(this.lineHeight);
  44530. }
  44531. if (this.tabDefault !== "") {
  44532. style.tabSize = measureToString(this.tabDefault);
  44533. }
  44534. if (this.tabStops.length > 0) {}
  44535. if (this.hyphenatation) {
  44536. Object.assign(style, this.hyphenatation[$toStyle]());
  44537. }
  44538. return style;
  44539. }
  44540. }
  44541. class PasswordEdit extends XFAObject {
  44542. constructor(attributes) {
  44543. super(TEMPLATE_NS_ID, "passwordEdit", true);
  44544. this.hScrollPolicy = getStringOption(attributes.hScrollPolicy, ["auto", "off", "on"]);
  44545. this.id = attributes.id || "";
  44546. this.passwordChar = attributes.passwordChar || "*";
  44547. this.use = attributes.use || "";
  44548. this.usehref = attributes.usehref || "";
  44549. this.border = null;
  44550. this.extras = null;
  44551. this.margin = null;
  44552. }
  44553. }
  44554. class template_Pattern extends XFAObject {
  44555. constructor(attributes) {
  44556. super(TEMPLATE_NS_ID, "pattern", true);
  44557. this.id = attributes.id || "";
  44558. this.type = getStringOption(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
  44559. this.use = attributes.use || "";
  44560. this.usehref = attributes.usehref || "";
  44561. this.color = null;
  44562. this.extras = null;
  44563. }
  44564. [$toStyle](startColor) {
  44565. startColor = startColor ? startColor[$toStyle]() : "#FFFFFF";
  44566. const endColor = this.color ? this.color[$toStyle]() : "#000000";
  44567. const width = 5;
  44568. const cmd = "repeating-linear-gradient";
  44569. const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
  44570. switch (this.type) {
  44571. case "crossHatch":
  44572. return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
  44573. case "crossDiagonal":
  44574. return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
  44575. case "diagonalLeft":
  44576. return `${cmd}(45deg,${colors})`;
  44577. case "diagonalRight":
  44578. return `${cmd}(-45deg,${colors})`;
  44579. case "horizontal":
  44580. return `${cmd}(to top,${colors})`;
  44581. case "vertical":
  44582. return `${cmd}(to right,${colors})`;
  44583. }
  44584. return "";
  44585. }
  44586. }
  44587. class Picture extends StringObject {
  44588. constructor(attributes) {
  44589. super(TEMPLATE_NS_ID, "picture");
  44590. this.id = attributes.id || "";
  44591. this.use = attributes.use || "";
  44592. this.usehref = attributes.usehref || "";
  44593. }
  44594. }
  44595. class Proto extends XFAObject {
  44596. constructor(attributes) {
  44597. super(TEMPLATE_NS_ID, "proto", true);
  44598. this.appearanceFilter = new XFAObjectArray();
  44599. this.arc = new XFAObjectArray();
  44600. this.area = new XFAObjectArray();
  44601. this.assist = new XFAObjectArray();
  44602. this.barcode = new XFAObjectArray();
  44603. this.bindItems = new XFAObjectArray();
  44604. this.bookend = new XFAObjectArray();
  44605. this.boolean = new XFAObjectArray();
  44606. this.border = new XFAObjectArray();
  44607. this.break = new XFAObjectArray();
  44608. this.breakAfter = new XFAObjectArray();
  44609. this.breakBefore = new XFAObjectArray();
  44610. this.button = new XFAObjectArray();
  44611. this.calculate = new XFAObjectArray();
  44612. this.caption = new XFAObjectArray();
  44613. this.certificate = new XFAObjectArray();
  44614. this.certificates = new XFAObjectArray();
  44615. this.checkButton = new XFAObjectArray();
  44616. this.choiceList = new XFAObjectArray();
  44617. this.color = new XFAObjectArray();
  44618. this.comb = new XFAObjectArray();
  44619. this.connect = new XFAObjectArray();
  44620. this.contentArea = new XFAObjectArray();
  44621. this.corner = new XFAObjectArray();
  44622. this.date = new XFAObjectArray();
  44623. this.dateTime = new XFAObjectArray();
  44624. this.dateTimeEdit = new XFAObjectArray();
  44625. this.decimal = new XFAObjectArray();
  44626. this.defaultUi = new XFAObjectArray();
  44627. this.desc = new XFAObjectArray();
  44628. this.digestMethod = new XFAObjectArray();
  44629. this.digestMethods = new XFAObjectArray();
  44630. this.draw = new XFAObjectArray();
  44631. this.edge = new XFAObjectArray();
  44632. this.encoding = new XFAObjectArray();
  44633. this.encodings = new XFAObjectArray();
  44634. this.encrypt = new XFAObjectArray();
  44635. this.encryptData = new XFAObjectArray();
  44636. this.encryption = new XFAObjectArray();
  44637. this.encryptionMethod = new XFAObjectArray();
  44638. this.encryptionMethods = new XFAObjectArray();
  44639. this.event = new XFAObjectArray();
  44640. this.exData = new XFAObjectArray();
  44641. this.exObject = new XFAObjectArray();
  44642. this.exclGroup = new XFAObjectArray();
  44643. this.execute = new XFAObjectArray();
  44644. this.extras = new XFAObjectArray();
  44645. this.field = new XFAObjectArray();
  44646. this.fill = new XFAObjectArray();
  44647. this.filter = new XFAObjectArray();
  44648. this.float = new XFAObjectArray();
  44649. this.font = new XFAObjectArray();
  44650. this.format = new XFAObjectArray();
  44651. this.handler = new XFAObjectArray();
  44652. this.hyphenation = new XFAObjectArray();
  44653. this.image = new XFAObjectArray();
  44654. this.imageEdit = new XFAObjectArray();
  44655. this.integer = new XFAObjectArray();
  44656. this.issuers = new XFAObjectArray();
  44657. this.items = new XFAObjectArray();
  44658. this.keep = new XFAObjectArray();
  44659. this.keyUsage = new XFAObjectArray();
  44660. this.line = new XFAObjectArray();
  44661. this.linear = new XFAObjectArray();
  44662. this.lockDocument = new XFAObjectArray();
  44663. this.manifest = new XFAObjectArray();
  44664. this.margin = new XFAObjectArray();
  44665. this.mdp = new XFAObjectArray();
  44666. this.medium = new XFAObjectArray();
  44667. this.message = new XFAObjectArray();
  44668. this.numericEdit = new XFAObjectArray();
  44669. this.occur = new XFAObjectArray();
  44670. this.oid = new XFAObjectArray();
  44671. this.oids = new XFAObjectArray();
  44672. this.overflow = new XFAObjectArray();
  44673. this.pageArea = new XFAObjectArray();
  44674. this.pageSet = new XFAObjectArray();
  44675. this.para = new XFAObjectArray();
  44676. this.passwordEdit = new XFAObjectArray();
  44677. this.pattern = new XFAObjectArray();
  44678. this.picture = new XFAObjectArray();
  44679. this.radial = new XFAObjectArray();
  44680. this.reason = new XFAObjectArray();
  44681. this.reasons = new XFAObjectArray();
  44682. this.rectangle = new XFAObjectArray();
  44683. this.ref = new XFAObjectArray();
  44684. this.script = new XFAObjectArray();
  44685. this.setProperty = new XFAObjectArray();
  44686. this.signData = new XFAObjectArray();
  44687. this.signature = new XFAObjectArray();
  44688. this.signing = new XFAObjectArray();
  44689. this.solid = new XFAObjectArray();
  44690. this.speak = new XFAObjectArray();
  44691. this.stipple = new XFAObjectArray();
  44692. this.subform = new XFAObjectArray();
  44693. this.subformSet = new XFAObjectArray();
  44694. this.subjectDN = new XFAObjectArray();
  44695. this.subjectDNs = new XFAObjectArray();
  44696. this.submit = new XFAObjectArray();
  44697. this.text = new XFAObjectArray();
  44698. this.textEdit = new XFAObjectArray();
  44699. this.time = new XFAObjectArray();
  44700. this.timeStamp = new XFAObjectArray();
  44701. this.toolTip = new XFAObjectArray();
  44702. this.traversal = new XFAObjectArray();
  44703. this.traverse = new XFAObjectArray();
  44704. this.ui = new XFAObjectArray();
  44705. this.validate = new XFAObjectArray();
  44706. this.value = new XFAObjectArray();
  44707. this.variables = new XFAObjectArray();
  44708. }
  44709. }
  44710. class Radial extends XFAObject {
  44711. constructor(attributes) {
  44712. super(TEMPLATE_NS_ID, "radial", true);
  44713. this.id = attributes.id || "";
  44714. this.type = getStringOption(attributes.type, ["toEdge", "toCenter"]);
  44715. this.use = attributes.use || "";
  44716. this.usehref = attributes.usehref || "";
  44717. this.color = null;
  44718. this.extras = null;
  44719. }
  44720. [$toStyle](startColor) {
  44721. startColor = startColor ? startColor[$toStyle]() : "#FFFFFF";
  44722. const endColor = this.color ? this.color[$toStyle]() : "#000000";
  44723. const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
  44724. return `radial-gradient(circle at center, ${colors})`;
  44725. }
  44726. }
  44727. class Reason extends StringObject {
  44728. constructor(attributes) {
  44729. super(TEMPLATE_NS_ID, "reason");
  44730. this.id = attributes.id || "";
  44731. this.name = attributes.name || "";
  44732. this.use = attributes.use || "";
  44733. this.usehref = attributes.usehref || "";
  44734. }
  44735. }
  44736. class Reasons extends XFAObject {
  44737. constructor(attributes) {
  44738. super(TEMPLATE_NS_ID, "reasons", true);
  44739. this.id = attributes.id || "";
  44740. this.type = getStringOption(attributes.type, ["optional", "required"]);
  44741. this.use = attributes.use || "";
  44742. this.usehref = attributes.usehref || "";
  44743. this.reason = new XFAObjectArray();
  44744. }
  44745. }
  44746. class Rectangle extends XFAObject {
  44747. constructor(attributes) {
  44748. super(TEMPLATE_NS_ID, "rectangle", true);
  44749. this.hand = getStringOption(attributes.hand, ["even", "left", "right"]);
  44750. this.id = attributes.id || "";
  44751. this.use = attributes.use || "";
  44752. this.usehref = attributes.usehref || "";
  44753. this.corner = new XFAObjectArray(4);
  44754. this.edge = new XFAObjectArray(4);
  44755. this.fill = null;
  44756. }
  44757. [$toHTML]() {
  44758. const edge = this.edge.children.length ? this.edge.children[0] : new Edge({});
  44759. const edgeStyle = edge[$toStyle]();
  44760. const style = Object.create(null);
  44761. if (this.fill?.presence === "visible") {
  44762. Object.assign(style, this.fill[$toStyle]());
  44763. } else {
  44764. style.fill = "transparent";
  44765. }
  44766. style.strokeWidth = measureToString(edge.presence === "visible" ? edge.thickness : 0);
  44767. style.stroke = edgeStyle.color;
  44768. const corner = this.corner.children.length ? this.corner.children[0] : new Corner({});
  44769. const cornerStyle = corner[$toStyle]();
  44770. const rect = {
  44771. name: "rect",
  44772. attributes: {
  44773. xmlns: SVG_NS,
  44774. width: "100%",
  44775. height: "100%",
  44776. x: 0,
  44777. y: 0,
  44778. rx: cornerStyle.radius,
  44779. ry: cornerStyle.radius,
  44780. style
  44781. }
  44782. };
  44783. const svg = {
  44784. name: "svg",
  44785. children: [rect],
  44786. attributes: {
  44787. xmlns: SVG_NS,
  44788. style: {
  44789. overflow: "visible"
  44790. },
  44791. width: "100%",
  44792. height: "100%"
  44793. }
  44794. };
  44795. const parent = this[$getParent]()[$getParent]();
  44796. if (hasMargin(parent)) {
  44797. return HTMLResult.success({
  44798. name: "div",
  44799. attributes: {
  44800. style: {
  44801. display: "inline",
  44802. width: "100%",
  44803. height: "100%"
  44804. }
  44805. },
  44806. children: [svg]
  44807. });
  44808. }
  44809. svg.attributes.style.position = "absolute";
  44810. return HTMLResult.success(svg);
  44811. }
  44812. }
  44813. class RefElement extends StringObject {
  44814. constructor(attributes) {
  44815. super(TEMPLATE_NS_ID, "ref");
  44816. this.id = attributes.id || "";
  44817. this.use = attributes.use || "";
  44818. this.usehref = attributes.usehref || "";
  44819. }
  44820. }
  44821. class Script extends StringObject {
  44822. constructor(attributes) {
  44823. super(TEMPLATE_NS_ID, "script");
  44824. this.binding = attributes.binding || "";
  44825. this.contentType = attributes.contentType || "";
  44826. this.id = attributes.id || "";
  44827. this.name = attributes.name || "";
  44828. this.runAt = getStringOption(attributes.runAt, ["client", "both", "server"]);
  44829. this.use = attributes.use || "";
  44830. this.usehref = attributes.usehref || "";
  44831. }
  44832. }
  44833. class SetProperty extends XFAObject {
  44834. constructor(attributes) {
  44835. super(TEMPLATE_NS_ID, "setProperty");
  44836. this.connection = attributes.connection || "";
  44837. this.ref = attributes.ref || "";
  44838. this.target = attributes.target || "";
  44839. }
  44840. }
  44841. class SignData extends XFAObject {
  44842. constructor(attributes) {
  44843. super(TEMPLATE_NS_ID, "signData", true);
  44844. this.id = attributes.id || "";
  44845. this.operation = getStringOption(attributes.operation, ["sign", "clear", "verify"]);
  44846. this.ref = attributes.ref || "";
  44847. this.target = attributes.target || "";
  44848. this.use = attributes.use || "";
  44849. this.usehref = attributes.usehref || "";
  44850. this.filter = null;
  44851. this.manifest = null;
  44852. }
  44853. }
  44854. class Signature extends XFAObject {
  44855. constructor(attributes) {
  44856. super(TEMPLATE_NS_ID, "signature", true);
  44857. this.id = attributes.id || "";
  44858. this.type = getStringOption(attributes.type, ["PDF1.3", "PDF1.6"]);
  44859. this.use = attributes.use || "";
  44860. this.usehref = attributes.usehref || "";
  44861. this.border = null;
  44862. this.extras = null;
  44863. this.filter = null;
  44864. this.manifest = null;
  44865. this.margin = null;
  44866. }
  44867. }
  44868. class Signing extends XFAObject {
  44869. constructor(attributes) {
  44870. super(TEMPLATE_NS_ID, "signing", true);
  44871. this.id = attributes.id || "";
  44872. this.type = getStringOption(attributes.type, ["optional", "required"]);
  44873. this.use = attributes.use || "";
  44874. this.usehref = attributes.usehref || "";
  44875. this.certificate = new XFAObjectArray();
  44876. }
  44877. }
  44878. class Solid extends XFAObject {
  44879. constructor(attributes) {
  44880. super(TEMPLATE_NS_ID, "solid", true);
  44881. this.id = attributes.id || "";
  44882. this.use = attributes.use || "";
  44883. this.usehref = attributes.usehref || "";
  44884. this.extras = null;
  44885. }
  44886. [$toStyle](startColor) {
  44887. return startColor ? startColor[$toStyle]() : "#FFFFFF";
  44888. }
  44889. }
  44890. class Speak extends StringObject {
  44891. constructor(attributes) {
  44892. super(TEMPLATE_NS_ID, "speak");
  44893. this.disable = getInteger({
  44894. data: attributes.disable,
  44895. defaultValue: 0,
  44896. validate: x => x === 1
  44897. });
  44898. this.id = attributes.id || "";
  44899. this.priority = getStringOption(attributes.priority, ["custom", "caption", "name", "toolTip"]);
  44900. this.rid = attributes.rid || "";
  44901. this.use = attributes.use || "";
  44902. this.usehref = attributes.usehref || "";
  44903. }
  44904. }
  44905. class Stipple extends XFAObject {
  44906. constructor(attributes) {
  44907. super(TEMPLATE_NS_ID, "stipple", true);
  44908. this.id = attributes.id || "";
  44909. this.rate = getInteger({
  44910. data: attributes.rate,
  44911. defaultValue: 50,
  44912. validate: x => x >= 0 && x <= 100
  44913. });
  44914. this.use = attributes.use || "";
  44915. this.usehref = attributes.usehref || "";
  44916. this.color = null;
  44917. this.extras = null;
  44918. }
  44919. [$toStyle](bgColor) {
  44920. const alpha = this.rate / 100;
  44921. return Util.makeHexColor(Math.round(bgColor.value.r * (1 - alpha) + this.value.r * alpha), Math.round(bgColor.value.g * (1 - alpha) + this.value.g * alpha), Math.round(bgColor.value.b * (1 - alpha) + this.value.b * alpha));
  44922. }
  44923. }
  44924. class Subform extends XFAObject {
  44925. constructor(attributes) {
  44926. super(TEMPLATE_NS_ID, "subform", true);
  44927. this.access = getStringOption(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  44928. this.allowMacro = getInteger({
  44929. data: attributes.allowMacro,
  44930. defaultValue: 0,
  44931. validate: x => x === 1
  44932. });
  44933. this.anchorType = getStringOption(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  44934. this.colSpan = getInteger({
  44935. data: attributes.colSpan,
  44936. defaultValue: 1,
  44937. validate: n => n >= 1 || n === -1
  44938. });
  44939. this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : getMeasurement(x));
  44940. this.h = attributes.h ? getMeasurement(attributes.h) : "";
  44941. this.hAlign = getStringOption(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  44942. this.id = attributes.id || "";
  44943. this.layout = getStringOption(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  44944. this.locale = attributes.locale || "";
  44945. this.maxH = getMeasurement(attributes.maxH, "0pt");
  44946. this.maxW = getMeasurement(attributes.maxW, "0pt");
  44947. this.mergeMode = getStringOption(attributes.mergeMode, ["consumeData", "matchTemplate"]);
  44948. this.minH = getMeasurement(attributes.minH, "0pt");
  44949. this.minW = getMeasurement(attributes.minW, "0pt");
  44950. this.name = attributes.name || "";
  44951. this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  44952. this.relevant = getRelevant(attributes.relevant);
  44953. this.restoreState = getStringOption(attributes.restoreState, ["manual", "auto"]);
  44954. this.scope = getStringOption(attributes.scope, ["name", "none"]);
  44955. this.use = attributes.use || "";
  44956. this.usehref = attributes.usehref || "";
  44957. this.w = attributes.w ? getMeasurement(attributes.w) : "";
  44958. this.x = getMeasurement(attributes.x, "0pt");
  44959. this.y = getMeasurement(attributes.y, "0pt");
  44960. this.assist = null;
  44961. this.bind = null;
  44962. this.bookend = null;
  44963. this.border = null;
  44964. this.break = null;
  44965. this.calculate = null;
  44966. this.desc = null;
  44967. this.extras = null;
  44968. this.keep = null;
  44969. this.margin = null;
  44970. this.occur = null;
  44971. this.overflow = null;
  44972. this.pageSet = null;
  44973. this.para = null;
  44974. this.traversal = null;
  44975. this.validate = null;
  44976. this.variables = null;
  44977. this.area = new XFAObjectArray();
  44978. this.breakAfter = new XFAObjectArray();
  44979. this.breakBefore = new XFAObjectArray();
  44980. this.connect = new XFAObjectArray();
  44981. this.draw = new XFAObjectArray();
  44982. this.event = new XFAObjectArray();
  44983. this.exObject = new XFAObjectArray();
  44984. this.exclGroup = new XFAObjectArray();
  44985. this.field = new XFAObjectArray();
  44986. this.proto = new XFAObjectArray();
  44987. this.setProperty = new XFAObjectArray();
  44988. this.subform = new XFAObjectArray();
  44989. this.subformSet = new XFAObjectArray();
  44990. }
  44991. [$getSubformParent]() {
  44992. const parent = this[$getParent]();
  44993. if (parent instanceof SubformSet) {
  44994. return parent[$getSubformParent]();
  44995. }
  44996. return parent;
  44997. }
  44998. [$isBindable]() {
  44999. return true;
  45000. }
  45001. [$isThereMoreWidth]() {
  45002. return this.layout.endsWith("-tb") && this[$extra].attempt === 0 && this[$extra].numberInLine > 0 || this[$getParent]()[$isThereMoreWidth]();
  45003. }
  45004. *[$getContainedChildren]() {
  45005. yield* getContainedChildren(this);
  45006. }
  45007. [$flushHTML]() {
  45008. return flushHTML(this);
  45009. }
  45010. [$addHTML](html, bbox) {
  45011. addHTML(this, html, bbox);
  45012. }
  45013. [$getAvailableSpace]() {
  45014. return getAvailableSpace(this);
  45015. }
  45016. [$isSplittable]() {
  45017. const parent = this[$getSubformParent]();
  45018. if (!parent[$isSplittable]()) {
  45019. return false;
  45020. }
  45021. if (this[$extra]._isSplittable !== undefined) {
  45022. return this[$extra]._isSplittable;
  45023. }
  45024. if (this.layout === "position" || this.layout.includes("row")) {
  45025. this[$extra]._isSplittable = false;
  45026. return false;
  45027. }
  45028. if (this.keep && this.keep.intact !== "none") {
  45029. this[$extra]._isSplittable = false;
  45030. return false;
  45031. }
  45032. if (parent.layout?.endsWith("-tb") && parent[$extra].numberInLine !== 0) {
  45033. return false;
  45034. }
  45035. this[$extra]._isSplittable = true;
  45036. return true;
  45037. }
  45038. [$toHTML](availableSpace) {
  45039. setTabIndex(this);
  45040. if (this.break) {
  45041. if (this.break.after !== "auto" || this.break.afterTarget !== "") {
  45042. const node = new BreakAfter({
  45043. targetType: this.break.after,
  45044. target: this.break.afterTarget,
  45045. startNew: this.break.startNew.toString()
  45046. });
  45047. node[$globalData] = this[$globalData];
  45048. this[$appendChild](node);
  45049. this.breakAfter.push(node);
  45050. }
  45051. if (this.break.before !== "auto" || this.break.beforeTarget !== "") {
  45052. const node = new BreakBefore({
  45053. targetType: this.break.before,
  45054. target: this.break.beforeTarget,
  45055. startNew: this.break.startNew.toString()
  45056. });
  45057. node[$globalData] = this[$globalData];
  45058. this[$appendChild](node);
  45059. this.breakBefore.push(node);
  45060. }
  45061. if (this.break.overflowTarget !== "") {
  45062. const node = new Overflow({
  45063. target: this.break.overflowTarget,
  45064. leader: this.break.overflowLeader,
  45065. trailer: this.break.overflowTrailer
  45066. });
  45067. node[$globalData] = this[$globalData];
  45068. this[$appendChild](node);
  45069. this.overflow.push(node);
  45070. }
  45071. this[$removeChild](this.break);
  45072. this.break = null;
  45073. }
  45074. if (this.presence === "hidden" || this.presence === "inactive") {
  45075. return HTMLResult.EMPTY;
  45076. }
  45077. if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) {
  45078. warn("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");
  45079. }
  45080. if (this.breakBefore.children.length >= 1) {
  45081. const breakBefore = this.breakBefore.children[0];
  45082. if (handleBreak(breakBefore)) {
  45083. return HTMLResult.breakNode(breakBefore);
  45084. }
  45085. }
  45086. if (this[$extra]?.afterBreakAfter) {
  45087. return HTMLResult.EMPTY;
  45088. }
  45089. fixDimensions(this);
  45090. const children = [];
  45091. const attributes = {
  45092. id: this[$uid],
  45093. class: []
  45094. };
  45095. setAccess(this, attributes.class);
  45096. if (!this[$extra]) {
  45097. this[$extra] = Object.create(null);
  45098. }
  45099. Object.assign(this[$extra], {
  45100. children,
  45101. line: null,
  45102. attributes,
  45103. attempt: 0,
  45104. numberInLine: 0,
  45105. availableSpace: {
  45106. width: Math.min(this.w || Infinity, availableSpace.width),
  45107. height: Math.min(this.h || Infinity, availableSpace.height)
  45108. },
  45109. width: 0,
  45110. height: 0,
  45111. prevHeight: 0,
  45112. currentWidth: 0
  45113. });
  45114. const root = this[$getTemplateRoot]();
  45115. const savedNoLayoutFailure = root[$extra].noLayoutFailure;
  45116. const isSplittable = this[$isSplittable]();
  45117. if (!isSplittable) {
  45118. setFirstUnsplittable(this);
  45119. }
  45120. if (!checkDimensions(this, availableSpace)) {
  45121. return HTMLResult.FAILURE;
  45122. }
  45123. const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]);
  45124. if (this.layout.includes("row")) {
  45125. const columnWidths = this[$getSubformParent]().columnWidths;
  45126. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  45127. this[$extra].columnWidths = columnWidths;
  45128. this[$extra].currentColumn = 0;
  45129. }
  45130. }
  45131. const style = toStyle(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  45132. const classNames = ["xfaSubform"];
  45133. const cl = layoutClass(this);
  45134. if (cl) {
  45135. classNames.push(cl);
  45136. }
  45137. attributes.style = style;
  45138. attributes.class = classNames;
  45139. if (this.name) {
  45140. attributes.xfaName = this.name;
  45141. }
  45142. if (this.overflow) {
  45143. const overflowExtra = this.overflow[$getExtra]();
  45144. if (overflowExtra.addLeader) {
  45145. overflowExtra.addLeader = false;
  45146. handleOverflow(this, overflowExtra.leader, availableSpace);
  45147. }
  45148. }
  45149. this[$pushPara]();
  45150. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  45151. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  45152. for (; this[$extra].attempt < maxRun; this[$extra].attempt++) {
  45153. if (isLrTb && this[$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  45154. this[$extra].numberInLine = 0;
  45155. }
  45156. const result = this[$childrenToHTML]({
  45157. filter,
  45158. include: true
  45159. });
  45160. if (result.success) {
  45161. break;
  45162. }
  45163. if (result.isBreak()) {
  45164. this[$popPara]();
  45165. return result;
  45166. }
  45167. if (isLrTb && this[$extra].attempt === 0 && this[$extra].numberInLine === 0 && !root[$extra].noLayoutFailure) {
  45168. this[$extra].attempt = maxRun;
  45169. break;
  45170. }
  45171. }
  45172. this[$popPara]();
  45173. if (!isSplittable) {
  45174. unsetFirstUnsplittable(this);
  45175. }
  45176. root[$extra].noLayoutFailure = savedNoLayoutFailure;
  45177. if (this[$extra].attempt === maxRun) {
  45178. if (this.overflow) {
  45179. this[$getTemplateRoot]()[$extra].overflowNode = this.overflow;
  45180. }
  45181. if (!isSplittable) {
  45182. delete this[$extra];
  45183. }
  45184. return HTMLResult.FAILURE;
  45185. }
  45186. if (this.overflow) {
  45187. const overflowExtra = this.overflow[$getExtra]();
  45188. if (overflowExtra.addTrailer) {
  45189. overflowExtra.addTrailer = false;
  45190. handleOverflow(this, overflowExtra.trailer, availableSpace);
  45191. }
  45192. }
  45193. let marginH = 0;
  45194. let marginV = 0;
  45195. if (this.margin) {
  45196. marginH = this.margin.leftInset + this.margin.rightInset;
  45197. marginV = this.margin.topInset + this.margin.bottomInset;
  45198. }
  45199. const width = Math.max(this[$extra].width + marginH, this.w || 0);
  45200. const height = Math.max(this[$extra].height + marginV, this.h || 0);
  45201. const bbox = [this.x, this.y, width, height];
  45202. if (this.w === "") {
  45203. style.width = measureToString(width);
  45204. }
  45205. if (this.h === "") {
  45206. style.height = measureToString(height);
  45207. }
  45208. if ((style.width === "0px" || style.height === "0px") && children.length === 0) {
  45209. return HTMLResult.EMPTY;
  45210. }
  45211. const html = {
  45212. name: "div",
  45213. attributes,
  45214. children
  45215. };
  45216. applyAssist(this, attributes);
  45217. const result = HTMLResult.success(createWrapper(this, html), bbox);
  45218. if (this.breakAfter.children.length >= 1) {
  45219. const breakAfter = this.breakAfter.children[0];
  45220. if (handleBreak(breakAfter)) {
  45221. this[$extra].afterBreakAfter = result;
  45222. return HTMLResult.breakNode(breakAfter);
  45223. }
  45224. }
  45225. delete this[$extra];
  45226. return result;
  45227. }
  45228. }
  45229. class SubformSet extends XFAObject {
  45230. constructor(attributes) {
  45231. super(TEMPLATE_NS_ID, "subformSet", true);
  45232. this.id = attributes.id || "";
  45233. this.name = attributes.name || "";
  45234. this.relation = getStringOption(attributes.relation, ["ordered", "choice", "unordered"]);
  45235. this.relevant = getRelevant(attributes.relevant);
  45236. this.use = attributes.use || "";
  45237. this.usehref = attributes.usehref || "";
  45238. this.bookend = null;
  45239. this.break = null;
  45240. this.desc = null;
  45241. this.extras = null;
  45242. this.occur = null;
  45243. this.overflow = null;
  45244. this.breakAfter = new XFAObjectArray();
  45245. this.breakBefore = new XFAObjectArray();
  45246. this.subform = new XFAObjectArray();
  45247. this.subformSet = new XFAObjectArray();
  45248. }
  45249. *[$getContainedChildren]() {
  45250. yield* getContainedChildren(this);
  45251. }
  45252. [$getSubformParent]() {
  45253. let parent = this[$getParent]();
  45254. while (!(parent instanceof Subform)) {
  45255. parent = parent[$getParent]();
  45256. }
  45257. return parent;
  45258. }
  45259. [$isBindable]() {
  45260. return true;
  45261. }
  45262. }
  45263. class SubjectDN extends ContentObject {
  45264. constructor(attributes) {
  45265. super(TEMPLATE_NS_ID, "subjectDN");
  45266. this.delimiter = attributes.delimiter || ",";
  45267. this.id = attributes.id || "";
  45268. this.name = attributes.name || "";
  45269. this.use = attributes.use || "";
  45270. this.usehref = attributes.usehref || "";
  45271. }
  45272. [$finalize]() {
  45273. this[$content] = new Map(this[$content].split(this.delimiter).map(kv => {
  45274. kv = kv.split("=", 2);
  45275. kv[0] = kv[0].trim();
  45276. return kv;
  45277. }));
  45278. }
  45279. }
  45280. class SubjectDNs extends XFAObject {
  45281. constructor(attributes) {
  45282. super(TEMPLATE_NS_ID, "subjectDNs", true);
  45283. this.id = attributes.id || "";
  45284. this.type = getStringOption(attributes.type, ["optional", "required"]);
  45285. this.use = attributes.use || "";
  45286. this.usehref = attributes.usehref || "";
  45287. this.subjectDN = new XFAObjectArray();
  45288. }
  45289. }
  45290. class Submit extends XFAObject {
  45291. constructor(attributes) {
  45292. super(TEMPLATE_NS_ID, "submit", true);
  45293. this.embedPDF = getInteger({
  45294. data: attributes.embedPDF,
  45295. defaultValue: 0,
  45296. validate: x => x === 1
  45297. });
  45298. this.format = getStringOption(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]);
  45299. this.id = attributes.id || "";
  45300. this.target = attributes.target || "";
  45301. this.textEncoding = getKeyword({
  45302. data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "",
  45303. defaultValue: "",
  45304. validate: k => ["utf-8", "big-five", "fontspecific", "gbk", "gb-18030", "gb-2312", "ksc-5601", "none", "shift-jis", "ucs-2", "utf-16"].includes(k) || k.match(/iso-8859-\d{2}/)
  45305. });
  45306. this.use = attributes.use || "";
  45307. this.usehref = attributes.usehref || "";
  45308. this.xdpContent = attributes.xdpContent || "";
  45309. this.encrypt = null;
  45310. this.encryptData = new XFAObjectArray();
  45311. this.signData = new XFAObjectArray();
  45312. }
  45313. }
  45314. class Template extends XFAObject {
  45315. constructor(attributes) {
  45316. super(TEMPLATE_NS_ID, "template", true);
  45317. this.baseProfile = getStringOption(attributes.baseProfile, ["full", "interactiveForms"]);
  45318. this.extras = null;
  45319. this.subform = new XFAObjectArray();
  45320. }
  45321. [$finalize]() {
  45322. if (this.subform.children.length === 0) {
  45323. warn("XFA - No subforms in template node.");
  45324. }
  45325. if (this.subform.children.length >= 2) {
  45326. warn("XFA - Several subforms in template node: please file a bug.");
  45327. }
  45328. this[$tabIndex] = DEFAULT_TAB_INDEX;
  45329. }
  45330. [$isSplittable]() {
  45331. return true;
  45332. }
  45333. [$searchNode](expr, container) {
  45334. if (expr.startsWith("#")) {
  45335. return [this[$ids].get(expr.slice(1))];
  45336. }
  45337. return searchNode(this, container, expr, true, true);
  45338. }
  45339. *[$toPages]() {
  45340. if (!this.subform.children.length) {
  45341. return HTMLResult.success({
  45342. name: "div",
  45343. children: []
  45344. });
  45345. }
  45346. this[$extra] = {
  45347. overflowNode: null,
  45348. firstUnsplittable: null,
  45349. currentContentArea: null,
  45350. currentPageArea: null,
  45351. noLayoutFailure: false,
  45352. pageNumber: 1,
  45353. pagePosition: "first",
  45354. oddOrEven: "odd",
  45355. blankOrNotBlank: "nonBlank",
  45356. paraStack: []
  45357. };
  45358. const root = this.subform.children[0];
  45359. root.pageSet[$cleanPage]();
  45360. const pageAreas = root.pageSet.pageArea.children;
  45361. const mainHtml = {
  45362. name: "div",
  45363. children: []
  45364. };
  45365. let pageArea = null;
  45366. let breakBefore = null;
  45367. let breakBeforeTarget = null;
  45368. if (root.breakBefore.children.length >= 1) {
  45369. breakBefore = root.breakBefore.children[0];
  45370. breakBeforeTarget = breakBefore.target;
  45371. } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) {
  45372. breakBefore = root.subform.children[0].breakBefore.children[0];
  45373. breakBeforeTarget = breakBefore.target;
  45374. } else if (root.break?.beforeTarget) {
  45375. breakBefore = root.break;
  45376. breakBeforeTarget = breakBefore.beforeTarget;
  45377. } else if (root.subform.children.length >= 1 && root.subform.children[0].break?.beforeTarget) {
  45378. breakBefore = root.subform.children[0].break;
  45379. breakBeforeTarget = breakBefore.beforeTarget;
  45380. }
  45381. if (breakBefore) {
  45382. const target = this[$searchNode](breakBeforeTarget, breakBefore[$getParent]());
  45383. if (target instanceof PageArea) {
  45384. pageArea = target;
  45385. breakBefore[$extra] = {};
  45386. }
  45387. }
  45388. if (!pageArea) {
  45389. pageArea = pageAreas[0];
  45390. }
  45391. pageArea[$extra] = {
  45392. numberOfUse: 1
  45393. };
  45394. const pageAreaParent = pageArea[$getParent]();
  45395. pageAreaParent[$extra] = {
  45396. numberOfUse: 1,
  45397. pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea),
  45398. pageSetIndex: 0
  45399. };
  45400. let targetPageArea;
  45401. let leader = null;
  45402. let trailer = null;
  45403. let hasSomething = true;
  45404. let hasSomethingCounter = 0;
  45405. let startIndex = 0;
  45406. while (true) {
  45407. if (!hasSomething) {
  45408. mainHtml.children.pop();
  45409. if (++hasSomethingCounter === MAX_EMPTY_PAGES) {
  45410. warn("XFA - Something goes wrong: please file a bug.");
  45411. return mainHtml;
  45412. }
  45413. } else {
  45414. hasSomethingCounter = 0;
  45415. }
  45416. targetPageArea = null;
  45417. this[$extra].currentPageArea = pageArea;
  45418. const page = pageArea[$toHTML]().html;
  45419. mainHtml.children.push(page);
  45420. if (leader) {
  45421. this[$extra].noLayoutFailure = true;
  45422. page.children.push(leader[$toHTML](pageArea[$extra].space).html);
  45423. leader = null;
  45424. }
  45425. if (trailer) {
  45426. this[$extra].noLayoutFailure = true;
  45427. page.children.push(trailer[$toHTML](pageArea[$extra].space).html);
  45428. trailer = null;
  45429. }
  45430. const contentAreas = pageArea.contentArea.children;
  45431. const htmlContentAreas = page.children.filter(node => node.attributes.class.includes("xfaContentarea"));
  45432. hasSomething = false;
  45433. this[$extra].firstUnsplittable = null;
  45434. this[$extra].noLayoutFailure = false;
  45435. const flush = index => {
  45436. const html = root[$flushHTML]();
  45437. if (html) {
  45438. hasSomething ||= html.children?.length > 0;
  45439. htmlContentAreas[index].children.push(html);
  45440. }
  45441. };
  45442. for (let i = startIndex, ii = contentAreas.length; i < ii; i++) {
  45443. const contentArea = this[$extra].currentContentArea = contentAreas[i];
  45444. const space = {
  45445. width: contentArea.w,
  45446. height: contentArea.h
  45447. };
  45448. startIndex = 0;
  45449. if (leader) {
  45450. htmlContentAreas[i].children.push(leader[$toHTML](space).html);
  45451. leader = null;
  45452. }
  45453. if (trailer) {
  45454. htmlContentAreas[i].children.push(trailer[$toHTML](space).html);
  45455. trailer = null;
  45456. }
  45457. const html = root[$toHTML](space);
  45458. if (html.success) {
  45459. if (html.html) {
  45460. hasSomething ||= html.html.children?.length > 0;
  45461. htmlContentAreas[i].children.push(html.html);
  45462. } else if (!hasSomething && mainHtml.children.length > 1) {
  45463. mainHtml.children.pop();
  45464. }
  45465. return mainHtml;
  45466. }
  45467. if (html.isBreak()) {
  45468. const node = html.breakNode;
  45469. flush(i);
  45470. if (node.targetType === "auto") {
  45471. continue;
  45472. }
  45473. if (node.leader) {
  45474. leader = this[$searchNode](node.leader, node[$getParent]());
  45475. leader = leader ? leader[0] : null;
  45476. }
  45477. if (node.trailer) {
  45478. trailer = this[$searchNode](node.trailer, node[$getParent]());
  45479. trailer = trailer ? trailer[0] : null;
  45480. }
  45481. if (node.targetType === "pageArea") {
  45482. targetPageArea = node[$extra].target;
  45483. i = Infinity;
  45484. } else if (!node[$extra].target) {
  45485. i = node[$extra].index;
  45486. } else {
  45487. targetPageArea = node[$extra].target;
  45488. startIndex = node[$extra].index + 1;
  45489. i = Infinity;
  45490. }
  45491. continue;
  45492. }
  45493. if (this[$extra].overflowNode) {
  45494. const node = this[$extra].overflowNode;
  45495. this[$extra].overflowNode = null;
  45496. const overflowExtra = node[$getExtra]();
  45497. const target = overflowExtra.target;
  45498. overflowExtra.addLeader = overflowExtra.leader !== null;
  45499. overflowExtra.addTrailer = overflowExtra.trailer !== null;
  45500. flush(i);
  45501. const currentIndex = i;
  45502. i = Infinity;
  45503. if (target instanceof PageArea) {
  45504. targetPageArea = target;
  45505. } else if (target instanceof ContentArea) {
  45506. const index = contentAreas.indexOf(target);
  45507. if (index !== -1) {
  45508. if (index > currentIndex) {
  45509. i = index - 1;
  45510. } else {
  45511. startIndex = index;
  45512. }
  45513. } else {
  45514. targetPageArea = target[$getParent]();
  45515. startIndex = targetPageArea.contentArea.children.indexOf(target);
  45516. }
  45517. }
  45518. continue;
  45519. }
  45520. flush(i);
  45521. }
  45522. this[$extra].pageNumber += 1;
  45523. if (targetPageArea) {
  45524. if (targetPageArea[$isUsable]()) {
  45525. targetPageArea[$extra].numberOfUse += 1;
  45526. } else {
  45527. targetPageArea = null;
  45528. }
  45529. }
  45530. pageArea = targetPageArea || pageArea[$getNextPage]();
  45531. yield null;
  45532. }
  45533. }
  45534. }
  45535. class Text extends ContentObject {
  45536. constructor(attributes) {
  45537. super(TEMPLATE_NS_ID, "text");
  45538. this.id = attributes.id || "";
  45539. this.maxChars = getInteger({
  45540. data: attributes.maxChars,
  45541. defaultValue: 0,
  45542. validate: x => x >= 0
  45543. });
  45544. this.name = attributes.name || "";
  45545. this.rid = attributes.rid || "";
  45546. this.use = attributes.use || "";
  45547. this.usehref = attributes.usehref || "";
  45548. }
  45549. [$acceptWhitespace]() {
  45550. return true;
  45551. }
  45552. [$onChild](child) {
  45553. if (child[$namespaceId] === NamespaceIds.xhtml.id) {
  45554. this[$content] = child;
  45555. return true;
  45556. }
  45557. warn(`XFA - Invalid content in Text: ${child[$nodeName]}.`);
  45558. return false;
  45559. }
  45560. [$onText](str) {
  45561. if (this[$content] instanceof XFAObject) {
  45562. return;
  45563. }
  45564. super[$onText](str);
  45565. }
  45566. [$finalize]() {
  45567. if (typeof this[$content] === "string") {
  45568. this[$content] = this[$content].replaceAll("\r\n", "\n");
  45569. }
  45570. }
  45571. [$getExtra]() {
  45572. if (typeof this[$content] === "string") {
  45573. return this[$content].split(/[\u2029\u2028\n]/).reduce((acc, line) => {
  45574. if (line) {
  45575. acc.push(line);
  45576. }
  45577. return acc;
  45578. }, []).join("\n");
  45579. }
  45580. return this[$content][$text]();
  45581. }
  45582. [$toHTML](availableSpace) {
  45583. if (typeof this[$content] === "string") {
  45584. const html = valueToHtml(this[$content]).html;
  45585. if (this[$content].includes("\u2029")) {
  45586. html.name = "div";
  45587. html.children = [];
  45588. this[$content].split("\u2029").map(para => para.split(/[\u2028\n]/).reduce((acc, line) => {
  45589. acc.push({
  45590. name: "span",
  45591. value: line
  45592. }, {
  45593. name: "br"
  45594. });
  45595. return acc;
  45596. }, [])).forEach(lines => {
  45597. html.children.push({
  45598. name: "p",
  45599. children: lines
  45600. });
  45601. });
  45602. } else if (/[\u2028\n]/.test(this[$content])) {
  45603. html.name = "div";
  45604. html.children = [];
  45605. this[$content].split(/[\u2028\n]/).forEach(line => {
  45606. html.children.push({
  45607. name: "span",
  45608. value: line
  45609. }, {
  45610. name: "br"
  45611. });
  45612. });
  45613. }
  45614. return HTMLResult.success(html);
  45615. }
  45616. return this[$content][$toHTML](availableSpace);
  45617. }
  45618. }
  45619. class TextEdit extends XFAObject {
  45620. constructor(attributes) {
  45621. super(TEMPLATE_NS_ID, "textEdit", true);
  45622. this.allowRichText = getInteger({
  45623. data: attributes.allowRichText,
  45624. defaultValue: 0,
  45625. validate: x => x === 1
  45626. });
  45627. this.hScrollPolicy = getStringOption(attributes.hScrollPolicy, ["auto", "off", "on"]);
  45628. this.id = attributes.id || "";
  45629. this.multiLine = getInteger({
  45630. data: attributes.multiLine,
  45631. defaultValue: "",
  45632. validate: x => x === 0 || x === 1
  45633. });
  45634. this.use = attributes.use || "";
  45635. this.usehref = attributes.usehref || "";
  45636. this.vScrollPolicy = getStringOption(attributes.vScrollPolicy, ["auto", "off", "on"]);
  45637. this.border = null;
  45638. this.comb = null;
  45639. this.extras = null;
  45640. this.margin = null;
  45641. }
  45642. [$toHTML](availableSpace) {
  45643. const style = toStyle(this, "border", "font", "margin");
  45644. let html;
  45645. const field = this[$getParent]()[$getParent]();
  45646. if (this.multiLine === "") {
  45647. this.multiLine = field instanceof Draw ? 1 : 0;
  45648. }
  45649. if (this.multiLine === 1) {
  45650. html = {
  45651. name: "textarea",
  45652. attributes: {
  45653. dataId: field[$data]?.[$uid] || field[$uid],
  45654. fieldId: field[$uid],
  45655. class: ["xfaTextfield"],
  45656. style,
  45657. "aria-label": ariaLabel(field),
  45658. "aria-required": false
  45659. }
  45660. };
  45661. } else {
  45662. html = {
  45663. name: "input",
  45664. attributes: {
  45665. type: "text",
  45666. dataId: field[$data]?.[$uid] || field[$uid],
  45667. fieldId: field[$uid],
  45668. class: ["xfaTextfield"],
  45669. style,
  45670. "aria-label": ariaLabel(field),
  45671. "aria-required": false
  45672. }
  45673. };
  45674. }
  45675. if (isRequired(field)) {
  45676. html.attributes["aria-required"] = true;
  45677. html.attributes.required = true;
  45678. }
  45679. return HTMLResult.success({
  45680. name: "label",
  45681. attributes: {
  45682. class: ["xfaLabel"]
  45683. },
  45684. children: [html]
  45685. });
  45686. }
  45687. }
  45688. class Time extends StringObject {
  45689. constructor(attributes) {
  45690. super(TEMPLATE_NS_ID, "time");
  45691. this.id = attributes.id || "";
  45692. this.name = attributes.name || "";
  45693. this.use = attributes.use || "";
  45694. this.usehref = attributes.usehref || "";
  45695. }
  45696. [$finalize]() {
  45697. const date = this[$content].trim();
  45698. this[$content] = date ? new Date(date) : null;
  45699. }
  45700. [$toHTML](availableSpace) {
  45701. return valueToHtml(this[$content] ? this[$content].toString() : "");
  45702. }
  45703. }
  45704. class TimeStamp extends XFAObject {
  45705. constructor(attributes) {
  45706. super(TEMPLATE_NS_ID, "timeStamp");
  45707. this.id = attributes.id || "";
  45708. this.server = attributes.server || "";
  45709. this.type = getStringOption(attributes.type, ["optional", "required"]);
  45710. this.use = attributes.use || "";
  45711. this.usehref = attributes.usehref || "";
  45712. }
  45713. }
  45714. class ToolTip extends StringObject {
  45715. constructor(attributes) {
  45716. super(TEMPLATE_NS_ID, "toolTip");
  45717. this.id = attributes.id || "";
  45718. this.rid = attributes.rid || "";
  45719. this.use = attributes.use || "";
  45720. this.usehref = attributes.usehref || "";
  45721. }
  45722. }
  45723. class Traversal extends XFAObject {
  45724. constructor(attributes) {
  45725. super(TEMPLATE_NS_ID, "traversal", true);
  45726. this.id = attributes.id || "";
  45727. this.use = attributes.use || "";
  45728. this.usehref = attributes.usehref || "";
  45729. this.extras = null;
  45730. this.traverse = new XFAObjectArray();
  45731. }
  45732. }
  45733. class Traverse extends XFAObject {
  45734. constructor(attributes) {
  45735. super(TEMPLATE_NS_ID, "traverse", true);
  45736. this.id = attributes.id || "";
  45737. this.operation = getStringOption(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]);
  45738. this.ref = attributes.ref || "";
  45739. this.use = attributes.use || "";
  45740. this.usehref = attributes.usehref || "";
  45741. this.extras = null;
  45742. this.script = null;
  45743. }
  45744. get name() {
  45745. return this.operation;
  45746. }
  45747. [$isTransparent]() {
  45748. return false;
  45749. }
  45750. }
  45751. class Ui extends XFAObject {
  45752. constructor(attributes) {
  45753. super(TEMPLATE_NS_ID, "ui", true);
  45754. this.id = attributes.id || "";
  45755. this.use = attributes.use || "";
  45756. this.usehref = attributes.usehref || "";
  45757. this.extras = null;
  45758. this.picture = null;
  45759. this.barcode = null;
  45760. this.button = null;
  45761. this.checkButton = null;
  45762. this.choiceList = null;
  45763. this.dateTimeEdit = null;
  45764. this.defaultUi = null;
  45765. this.imageEdit = null;
  45766. this.numericEdit = null;
  45767. this.passwordEdit = null;
  45768. this.signature = null;
  45769. this.textEdit = null;
  45770. }
  45771. [$getExtra]() {
  45772. if (this[$extra] === undefined) {
  45773. for (const name of Object.getOwnPropertyNames(this)) {
  45774. if (name === "extras" || name === "picture") {
  45775. continue;
  45776. }
  45777. const obj = this[name];
  45778. if (!(obj instanceof XFAObject)) {
  45779. continue;
  45780. }
  45781. this[$extra] = obj;
  45782. return obj;
  45783. }
  45784. this[$extra] = null;
  45785. }
  45786. return this[$extra];
  45787. }
  45788. [$toHTML](availableSpace) {
  45789. const obj = this[$getExtra]();
  45790. if (obj) {
  45791. return obj[$toHTML](availableSpace);
  45792. }
  45793. return HTMLResult.EMPTY;
  45794. }
  45795. }
  45796. class Validate extends XFAObject {
  45797. constructor(attributes) {
  45798. super(TEMPLATE_NS_ID, "validate", true);
  45799. this.formatTest = getStringOption(attributes.formatTest, ["warning", "disabled", "error"]);
  45800. this.id = attributes.id || "";
  45801. this.nullTest = getStringOption(attributes.nullTest, ["disabled", "error", "warning"]);
  45802. this.scriptTest = getStringOption(attributes.scriptTest, ["error", "disabled", "warning"]);
  45803. this.use = attributes.use || "";
  45804. this.usehref = attributes.usehref || "";
  45805. this.extras = null;
  45806. this.message = null;
  45807. this.picture = null;
  45808. this.script = null;
  45809. }
  45810. }
  45811. class Value extends XFAObject {
  45812. constructor(attributes) {
  45813. super(TEMPLATE_NS_ID, "value", true);
  45814. this.id = attributes.id || "";
  45815. this.override = getInteger({
  45816. data: attributes.override,
  45817. defaultValue: 0,
  45818. validate: x => x === 1
  45819. });
  45820. this.relevant = getRelevant(attributes.relevant);
  45821. this.use = attributes.use || "";
  45822. this.usehref = attributes.usehref || "";
  45823. this.arc = null;
  45824. this.boolean = null;
  45825. this.date = null;
  45826. this.dateTime = null;
  45827. this.decimal = null;
  45828. this.exData = null;
  45829. this.float = null;
  45830. this.image = null;
  45831. this.integer = null;
  45832. this.line = null;
  45833. this.rectangle = null;
  45834. this.text = null;
  45835. this.time = null;
  45836. }
  45837. [$setValue](value) {
  45838. const parent = this[$getParent]();
  45839. if (parent instanceof Field) {
  45840. if (parent.ui?.imageEdit) {
  45841. if (!this.image) {
  45842. this.image = new Image({});
  45843. this[$appendChild](this.image);
  45844. }
  45845. this.image[$content] = value[$content];
  45846. return;
  45847. }
  45848. }
  45849. const valueName = value[$nodeName];
  45850. if (this[valueName] !== null) {
  45851. this[valueName][$content] = value[$content];
  45852. return;
  45853. }
  45854. for (const name of Object.getOwnPropertyNames(this)) {
  45855. const obj = this[name];
  45856. if (obj instanceof XFAObject) {
  45857. this[name] = null;
  45858. this[$removeChild](obj);
  45859. }
  45860. }
  45861. this[value[$nodeName]] = value;
  45862. this[$appendChild](value);
  45863. }
  45864. [$text]() {
  45865. if (this.exData) {
  45866. if (typeof this.exData[$content] === "string") {
  45867. return this.exData[$content].trim();
  45868. }
  45869. return this.exData[$content][$text]().trim();
  45870. }
  45871. for (const name of Object.getOwnPropertyNames(this)) {
  45872. if (name === "image") {
  45873. continue;
  45874. }
  45875. const obj = this[name];
  45876. if (obj instanceof XFAObject) {
  45877. return (obj[$content] || "").toString().trim();
  45878. }
  45879. }
  45880. return null;
  45881. }
  45882. [$toHTML](availableSpace) {
  45883. for (const name of Object.getOwnPropertyNames(this)) {
  45884. const obj = this[name];
  45885. if (!(obj instanceof XFAObject)) {
  45886. continue;
  45887. }
  45888. return obj[$toHTML](availableSpace);
  45889. }
  45890. return HTMLResult.EMPTY;
  45891. }
  45892. }
  45893. class Variables extends XFAObject {
  45894. constructor(attributes) {
  45895. super(TEMPLATE_NS_ID, "variables", true);
  45896. this.id = attributes.id || "";
  45897. this.use = attributes.use || "";
  45898. this.usehref = attributes.usehref || "";
  45899. this.boolean = new XFAObjectArray();
  45900. this.date = new XFAObjectArray();
  45901. this.dateTime = new XFAObjectArray();
  45902. this.decimal = new XFAObjectArray();
  45903. this.exData = new XFAObjectArray();
  45904. this.float = new XFAObjectArray();
  45905. this.image = new XFAObjectArray();
  45906. this.integer = new XFAObjectArray();
  45907. this.manifest = new XFAObjectArray();
  45908. this.script = new XFAObjectArray();
  45909. this.text = new XFAObjectArray();
  45910. this.time = new XFAObjectArray();
  45911. }
  45912. [$isTransparent]() {
  45913. return true;
  45914. }
  45915. }
  45916. class TemplateNamespace {
  45917. static [$buildXFAObject](name, attributes) {
  45918. if (TemplateNamespace.hasOwnProperty(name)) {
  45919. const node = TemplateNamespace[name](attributes);
  45920. node[$setSetAttributes](attributes);
  45921. return node;
  45922. }
  45923. return undefined;
  45924. }
  45925. static appearanceFilter(attrs) {
  45926. return new AppearanceFilter(attrs);
  45927. }
  45928. static arc(attrs) {
  45929. return new Arc(attrs);
  45930. }
  45931. static area(attrs) {
  45932. return new Area(attrs);
  45933. }
  45934. static assist(attrs) {
  45935. return new Assist(attrs);
  45936. }
  45937. static barcode(attrs) {
  45938. return new Barcode(attrs);
  45939. }
  45940. static bind(attrs) {
  45941. return new Bind(attrs);
  45942. }
  45943. static bindItems(attrs) {
  45944. return new BindItems(attrs);
  45945. }
  45946. static bookend(attrs) {
  45947. return new Bookend(attrs);
  45948. }
  45949. static boolean(attrs) {
  45950. return new BooleanElement(attrs);
  45951. }
  45952. static border(attrs) {
  45953. return new Border(attrs);
  45954. }
  45955. static break(attrs) {
  45956. return new Break(attrs);
  45957. }
  45958. static breakAfter(attrs) {
  45959. return new BreakAfter(attrs);
  45960. }
  45961. static breakBefore(attrs) {
  45962. return new BreakBefore(attrs);
  45963. }
  45964. static button(attrs) {
  45965. return new Button(attrs);
  45966. }
  45967. static calculate(attrs) {
  45968. return new Calculate(attrs);
  45969. }
  45970. static caption(attrs) {
  45971. return new Caption(attrs);
  45972. }
  45973. static certificate(attrs) {
  45974. return new Certificate(attrs);
  45975. }
  45976. static certificates(attrs) {
  45977. return new Certificates(attrs);
  45978. }
  45979. static checkButton(attrs) {
  45980. return new CheckButton(attrs);
  45981. }
  45982. static choiceList(attrs) {
  45983. return new ChoiceList(attrs);
  45984. }
  45985. static color(attrs) {
  45986. return new Color(attrs);
  45987. }
  45988. static comb(attrs) {
  45989. return new Comb(attrs);
  45990. }
  45991. static connect(attrs) {
  45992. return new Connect(attrs);
  45993. }
  45994. static contentArea(attrs) {
  45995. return new ContentArea(attrs);
  45996. }
  45997. static corner(attrs) {
  45998. return new Corner(attrs);
  45999. }
  46000. static date(attrs) {
  46001. return new DateElement(attrs);
  46002. }
  46003. static dateTime(attrs) {
  46004. return new DateTime(attrs);
  46005. }
  46006. static dateTimeEdit(attrs) {
  46007. return new DateTimeEdit(attrs);
  46008. }
  46009. static decimal(attrs) {
  46010. return new Decimal(attrs);
  46011. }
  46012. static defaultUi(attrs) {
  46013. return new DefaultUi(attrs);
  46014. }
  46015. static desc(attrs) {
  46016. return new Desc(attrs);
  46017. }
  46018. static digestMethod(attrs) {
  46019. return new DigestMethod(attrs);
  46020. }
  46021. static digestMethods(attrs) {
  46022. return new DigestMethods(attrs);
  46023. }
  46024. static draw(attrs) {
  46025. return new Draw(attrs);
  46026. }
  46027. static edge(attrs) {
  46028. return new Edge(attrs);
  46029. }
  46030. static encoding(attrs) {
  46031. return new Encoding(attrs);
  46032. }
  46033. static encodings(attrs) {
  46034. return new Encodings(attrs);
  46035. }
  46036. static encrypt(attrs) {
  46037. return new Encrypt(attrs);
  46038. }
  46039. static encryptData(attrs) {
  46040. return new EncryptData(attrs);
  46041. }
  46042. static encryption(attrs) {
  46043. return new Encryption(attrs);
  46044. }
  46045. static encryptionMethod(attrs) {
  46046. return new EncryptionMethod(attrs);
  46047. }
  46048. static encryptionMethods(attrs) {
  46049. return new EncryptionMethods(attrs);
  46050. }
  46051. static event(attrs) {
  46052. return new Event(attrs);
  46053. }
  46054. static exData(attrs) {
  46055. return new ExData(attrs);
  46056. }
  46057. static exObject(attrs) {
  46058. return new ExObject(attrs);
  46059. }
  46060. static exclGroup(attrs) {
  46061. return new ExclGroup(attrs);
  46062. }
  46063. static execute(attrs) {
  46064. return new Execute(attrs);
  46065. }
  46066. static extras(attrs) {
  46067. return new Extras(attrs);
  46068. }
  46069. static field(attrs) {
  46070. return new Field(attrs);
  46071. }
  46072. static fill(attrs) {
  46073. return new Fill(attrs);
  46074. }
  46075. static filter(attrs) {
  46076. return new Filter(attrs);
  46077. }
  46078. static float(attrs) {
  46079. return new Float(attrs);
  46080. }
  46081. static font(attrs) {
  46082. return new template_Font(attrs);
  46083. }
  46084. static format(attrs) {
  46085. return new Format(attrs);
  46086. }
  46087. static handler(attrs) {
  46088. return new Handler(attrs);
  46089. }
  46090. static hyphenation(attrs) {
  46091. return new Hyphenation(attrs);
  46092. }
  46093. static image(attrs) {
  46094. return new Image(attrs);
  46095. }
  46096. static imageEdit(attrs) {
  46097. return new ImageEdit(attrs);
  46098. }
  46099. static integer(attrs) {
  46100. return new Integer(attrs);
  46101. }
  46102. static issuers(attrs) {
  46103. return new Issuers(attrs);
  46104. }
  46105. static items(attrs) {
  46106. return new Items(attrs);
  46107. }
  46108. static keep(attrs) {
  46109. return new Keep(attrs);
  46110. }
  46111. static keyUsage(attrs) {
  46112. return new KeyUsage(attrs);
  46113. }
  46114. static line(attrs) {
  46115. return new Line(attrs);
  46116. }
  46117. static linear(attrs) {
  46118. return new Linear(attrs);
  46119. }
  46120. static lockDocument(attrs) {
  46121. return new LockDocument(attrs);
  46122. }
  46123. static manifest(attrs) {
  46124. return new Manifest(attrs);
  46125. }
  46126. static margin(attrs) {
  46127. return new Margin(attrs);
  46128. }
  46129. static mdp(attrs) {
  46130. return new Mdp(attrs);
  46131. }
  46132. static medium(attrs) {
  46133. return new Medium(attrs);
  46134. }
  46135. static message(attrs) {
  46136. return new Message(attrs);
  46137. }
  46138. static numericEdit(attrs) {
  46139. return new NumericEdit(attrs);
  46140. }
  46141. static occur(attrs) {
  46142. return new Occur(attrs);
  46143. }
  46144. static oid(attrs) {
  46145. return new Oid(attrs);
  46146. }
  46147. static oids(attrs) {
  46148. return new Oids(attrs);
  46149. }
  46150. static overflow(attrs) {
  46151. return new Overflow(attrs);
  46152. }
  46153. static pageArea(attrs) {
  46154. return new PageArea(attrs);
  46155. }
  46156. static pageSet(attrs) {
  46157. return new PageSet(attrs);
  46158. }
  46159. static para(attrs) {
  46160. return new Para(attrs);
  46161. }
  46162. static passwordEdit(attrs) {
  46163. return new PasswordEdit(attrs);
  46164. }
  46165. static pattern(attrs) {
  46166. return new template_Pattern(attrs);
  46167. }
  46168. static picture(attrs) {
  46169. return new Picture(attrs);
  46170. }
  46171. static proto(attrs) {
  46172. return new Proto(attrs);
  46173. }
  46174. static radial(attrs) {
  46175. return new Radial(attrs);
  46176. }
  46177. static reason(attrs) {
  46178. return new Reason(attrs);
  46179. }
  46180. static reasons(attrs) {
  46181. return new Reasons(attrs);
  46182. }
  46183. static rectangle(attrs) {
  46184. return new Rectangle(attrs);
  46185. }
  46186. static ref(attrs) {
  46187. return new RefElement(attrs);
  46188. }
  46189. static script(attrs) {
  46190. return new Script(attrs);
  46191. }
  46192. static setProperty(attrs) {
  46193. return new SetProperty(attrs);
  46194. }
  46195. static signData(attrs) {
  46196. return new SignData(attrs);
  46197. }
  46198. static signature(attrs) {
  46199. return new Signature(attrs);
  46200. }
  46201. static signing(attrs) {
  46202. return new Signing(attrs);
  46203. }
  46204. static solid(attrs) {
  46205. return new Solid(attrs);
  46206. }
  46207. static speak(attrs) {
  46208. return new Speak(attrs);
  46209. }
  46210. static stipple(attrs) {
  46211. return new Stipple(attrs);
  46212. }
  46213. static subform(attrs) {
  46214. return new Subform(attrs);
  46215. }
  46216. static subformSet(attrs) {
  46217. return new SubformSet(attrs);
  46218. }
  46219. static subjectDN(attrs) {
  46220. return new SubjectDN(attrs);
  46221. }
  46222. static subjectDNs(attrs) {
  46223. return new SubjectDNs(attrs);
  46224. }
  46225. static submit(attrs) {
  46226. return new Submit(attrs);
  46227. }
  46228. static template(attrs) {
  46229. return new Template(attrs);
  46230. }
  46231. static text(attrs) {
  46232. return new Text(attrs);
  46233. }
  46234. static textEdit(attrs) {
  46235. return new TextEdit(attrs);
  46236. }
  46237. static time(attrs) {
  46238. return new Time(attrs);
  46239. }
  46240. static timeStamp(attrs) {
  46241. return new TimeStamp(attrs);
  46242. }
  46243. static toolTip(attrs) {
  46244. return new ToolTip(attrs);
  46245. }
  46246. static traversal(attrs) {
  46247. return new Traversal(attrs);
  46248. }
  46249. static traverse(attrs) {
  46250. return new Traverse(attrs);
  46251. }
  46252. static ui(attrs) {
  46253. return new Ui(attrs);
  46254. }
  46255. static validate(attrs) {
  46256. return new Validate(attrs);
  46257. }
  46258. static value(attrs) {
  46259. return new Value(attrs);
  46260. }
  46261. static variables(attrs) {
  46262. return new Variables(attrs);
  46263. }
  46264. }
  46265. ;// ./src/core/xfa/bind.js
  46266. const bind_NS_DATASETS = NamespaceIds.datasets.id;
  46267. function createText(content) {
  46268. const node = new Text({});
  46269. node[$content] = content;
  46270. return node;
  46271. }
  46272. class Binder {
  46273. constructor(root) {
  46274. this.root = root;
  46275. this.datasets = root.datasets;
  46276. this.data = root.datasets?.data || new XmlObject(NamespaceIds.datasets.id, "data");
  46277. this.emptyMerge = this.data[$getChildren]().length === 0;
  46278. this.root.form = this.form = root.template[$clone]();
  46279. }
  46280. _isConsumeData() {
  46281. return !this.emptyMerge && this._mergeMode;
  46282. }
  46283. _isMatchTemplate() {
  46284. return !this._isConsumeData();
  46285. }
  46286. bind() {
  46287. this._bindElement(this.form, this.data);
  46288. return this.form;
  46289. }
  46290. getData() {
  46291. return this.data;
  46292. }
  46293. _bindValue(formNode, data, picture) {
  46294. formNode[$data] = data;
  46295. if (formNode[$hasSettableValue]()) {
  46296. if (data[$isDataValue]()) {
  46297. const value = data[$getDataValue]();
  46298. formNode[$setValue](createText(value));
  46299. } else if (formNode instanceof Field && formNode.ui?.choiceList?.open === "multiSelect") {
  46300. const value = data[$getChildren]().map(child => child[$content].trim()).join("\n");
  46301. formNode[$setValue](createText(value));
  46302. } else if (this._isConsumeData()) {
  46303. warn(`XFA - Nodes haven't the same type.`);
  46304. }
  46305. } else if (!data[$isDataValue]() || this._isMatchTemplate()) {
  46306. this._bindElement(formNode, data);
  46307. } else {
  46308. warn(`XFA - Nodes haven't the same type.`);
  46309. }
  46310. }
  46311. _findDataByNameToConsume(name, isValue, dataNode, global) {
  46312. if (!name) {
  46313. return null;
  46314. }
  46315. let generator, match;
  46316. for (let i = 0; i < 3; i++) {
  46317. generator = dataNode[$getRealChildrenByNameIt](name, false, true);
  46318. while (true) {
  46319. match = generator.next().value;
  46320. if (!match) {
  46321. break;
  46322. }
  46323. if (isValue === match[$isDataValue]()) {
  46324. return match;
  46325. }
  46326. }
  46327. if (dataNode[$namespaceId] === NamespaceIds.datasets.id && dataNode[$nodeName] === "data") {
  46328. break;
  46329. }
  46330. dataNode = dataNode[$getParent]();
  46331. }
  46332. if (!global) {
  46333. return null;
  46334. }
  46335. generator = this.data[$getRealChildrenByNameIt](name, true, false);
  46336. match = generator.next().value;
  46337. if (match) {
  46338. return match;
  46339. }
  46340. generator = this.data[$getAttributeIt](name, true);
  46341. match = generator.next().value;
  46342. if (match?.[$isDataValue]()) {
  46343. return match;
  46344. }
  46345. return null;
  46346. }
  46347. _setProperties(formNode, dataNode) {
  46348. if (!formNode.hasOwnProperty("setProperty")) {
  46349. return;
  46350. }
  46351. for (const {
  46352. ref,
  46353. target,
  46354. connection
  46355. } of formNode.setProperty.children) {
  46356. if (connection) {
  46357. continue;
  46358. }
  46359. if (!ref) {
  46360. continue;
  46361. }
  46362. const nodes = searchNode(this.root, dataNode, ref, false, false);
  46363. if (!nodes) {
  46364. warn(`XFA - Invalid reference: ${ref}.`);
  46365. continue;
  46366. }
  46367. const [node] = nodes;
  46368. if (!node[$isDescendent](this.data)) {
  46369. warn(`XFA - Invalid node: must be a data node.`);
  46370. continue;
  46371. }
  46372. const targetNodes = searchNode(this.root, formNode, target, false, false);
  46373. if (!targetNodes) {
  46374. warn(`XFA - Invalid target: ${target}.`);
  46375. continue;
  46376. }
  46377. const [targetNode] = targetNodes;
  46378. if (!targetNode[$isDescendent](formNode)) {
  46379. warn(`XFA - Invalid target: must be a property or subproperty.`);
  46380. continue;
  46381. }
  46382. const targetParent = targetNode[$getParent]();
  46383. if (targetNode instanceof SetProperty || targetParent instanceof SetProperty) {
  46384. warn(`XFA - Invalid target: cannot be a setProperty or one of its properties.`);
  46385. continue;
  46386. }
  46387. if (targetNode instanceof BindItems || targetParent instanceof BindItems) {
  46388. warn(`XFA - Invalid target: cannot be a bindItems or one of its properties.`);
  46389. continue;
  46390. }
  46391. const content = node[$text]();
  46392. const name = targetNode[$nodeName];
  46393. if (targetNode instanceof XFAAttribute) {
  46394. const attrs = Object.create(null);
  46395. attrs[name] = content;
  46396. const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]);
  46397. targetParent[name] = obj[name];
  46398. continue;
  46399. }
  46400. if (!targetNode.hasOwnProperty($content)) {
  46401. warn(`XFA - Invalid node to use in setProperty`);
  46402. continue;
  46403. }
  46404. targetNode[$data] = node;
  46405. targetNode[$content] = content;
  46406. targetNode[$finalize]();
  46407. }
  46408. }
  46409. _bindItems(formNode, dataNode) {
  46410. if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) {
  46411. return;
  46412. }
  46413. for (const item of formNode.items.children) {
  46414. formNode[$removeChild](item);
  46415. }
  46416. formNode.items.clear();
  46417. const labels = new Items({});
  46418. const values = new Items({});
  46419. formNode[$appendChild](labels);
  46420. formNode.items.push(labels);
  46421. formNode[$appendChild](values);
  46422. formNode.items.push(values);
  46423. for (const {
  46424. ref,
  46425. labelRef,
  46426. valueRef,
  46427. connection
  46428. } of formNode.bindItems.children) {
  46429. if (connection) {
  46430. continue;
  46431. }
  46432. if (!ref) {
  46433. continue;
  46434. }
  46435. const nodes = searchNode(this.root, dataNode, ref, false, false);
  46436. if (!nodes) {
  46437. warn(`XFA - Invalid reference: ${ref}.`);
  46438. continue;
  46439. }
  46440. for (const node of nodes) {
  46441. if (!node[$isDescendent](this.datasets)) {
  46442. warn(`XFA - Invalid ref (${ref}): must be a datasets child.`);
  46443. continue;
  46444. }
  46445. const labelNodes = searchNode(this.root, node, labelRef, true, false);
  46446. if (!labelNodes) {
  46447. warn(`XFA - Invalid label: ${labelRef}.`);
  46448. continue;
  46449. }
  46450. const [labelNode] = labelNodes;
  46451. if (!labelNode[$isDescendent](this.datasets)) {
  46452. warn(`XFA - Invalid label: must be a datasets child.`);
  46453. continue;
  46454. }
  46455. const valueNodes = searchNode(this.root, node, valueRef, true, false);
  46456. if (!valueNodes) {
  46457. warn(`XFA - Invalid value: ${valueRef}.`);
  46458. continue;
  46459. }
  46460. const [valueNode] = valueNodes;
  46461. if (!valueNode[$isDescendent](this.datasets)) {
  46462. warn(`XFA - Invalid value: must be a datasets child.`);
  46463. continue;
  46464. }
  46465. const label = createText(labelNode[$text]());
  46466. const value = createText(valueNode[$text]());
  46467. labels[$appendChild](label);
  46468. labels.text.push(label);
  46469. values[$appendChild](value);
  46470. values.text.push(value);
  46471. }
  46472. }
  46473. }
  46474. _bindOccurrences(formNode, matches, picture) {
  46475. let baseClone;
  46476. if (matches.length > 1) {
  46477. baseClone = formNode[$clone]();
  46478. baseClone[$removeChild](baseClone.occur);
  46479. baseClone.occur = null;
  46480. }
  46481. this._bindValue(formNode, matches[0], picture);
  46482. this._setProperties(formNode, matches[0]);
  46483. this._bindItems(formNode, matches[0]);
  46484. if (matches.length === 1) {
  46485. return;
  46486. }
  46487. const parent = formNode[$getParent]();
  46488. const name = formNode[$nodeName];
  46489. const pos = parent[$indexOf](formNode);
  46490. for (let i = 1, ii = matches.length; i < ii; i++) {
  46491. const match = matches[i];
  46492. const clone = baseClone[$clone]();
  46493. parent[name].push(clone);
  46494. parent[$insertAt](pos + i, clone);
  46495. this._bindValue(clone, match, picture);
  46496. this._setProperties(clone, match);
  46497. this._bindItems(clone, match);
  46498. }
  46499. }
  46500. _createOccurrences(formNode) {
  46501. if (!this.emptyMerge) {
  46502. return;
  46503. }
  46504. const {
  46505. occur
  46506. } = formNode;
  46507. if (!occur || occur.initial <= 1) {
  46508. return;
  46509. }
  46510. const parent = formNode[$getParent]();
  46511. const name = formNode[$nodeName];
  46512. if (!(parent[name] instanceof XFAObjectArray)) {
  46513. return;
  46514. }
  46515. let currentNumber;
  46516. if (formNode.name) {
  46517. currentNumber = parent[name].children.filter(e => e.name === formNode.name).length;
  46518. } else {
  46519. currentNumber = parent[name].children.length;
  46520. }
  46521. const pos = parent[$indexOf](formNode) + 1;
  46522. const ii = occur.initial - currentNumber;
  46523. if (ii) {
  46524. const nodeClone = formNode[$clone]();
  46525. nodeClone[$removeChild](nodeClone.occur);
  46526. nodeClone.occur = null;
  46527. parent[name].push(nodeClone);
  46528. parent[$insertAt](pos, nodeClone);
  46529. for (let i = 1; i < ii; i++) {
  46530. const clone = nodeClone[$clone]();
  46531. parent[name].push(clone);
  46532. parent[$insertAt](pos + i, clone);
  46533. }
  46534. }
  46535. }
  46536. _getOccurInfo(formNode) {
  46537. const {
  46538. name,
  46539. occur
  46540. } = formNode;
  46541. if (!occur || !name) {
  46542. return [1, 1];
  46543. }
  46544. const max = occur.max === -1 ? Infinity : occur.max;
  46545. return [occur.min, max];
  46546. }
  46547. _setAndBind(formNode, dataNode) {
  46548. this._setProperties(formNode, dataNode);
  46549. this._bindItems(formNode, dataNode);
  46550. this._bindElement(formNode, dataNode);
  46551. }
  46552. _bindElement(formNode, dataNode) {
  46553. const uselessNodes = [];
  46554. this._createOccurrences(formNode);
  46555. for (const child of formNode[$getChildren]()) {
  46556. if (child[$data]) {
  46557. continue;
  46558. }
  46559. if (this._mergeMode === undefined && child[$nodeName] === "subform") {
  46560. this._mergeMode = child.mergeMode === "consumeData";
  46561. const dataChildren = dataNode[$getChildren]();
  46562. if (dataChildren.length > 0) {
  46563. this._bindOccurrences(child, [dataChildren[0]], null);
  46564. } else if (this.emptyMerge) {
  46565. const nsId = dataNode[$namespaceId] === bind_NS_DATASETS ? -1 : dataNode[$namespaceId];
  46566. const dataChild = child[$data] = new XmlObject(nsId, child.name || "root");
  46567. dataNode[$appendChild](dataChild);
  46568. this._bindElement(child, dataChild);
  46569. }
  46570. continue;
  46571. }
  46572. if (!child[$isBindable]()) {
  46573. continue;
  46574. }
  46575. let global = false;
  46576. let picture = null;
  46577. let ref = null;
  46578. let match = null;
  46579. if (child.bind) {
  46580. switch (child.bind.match) {
  46581. case "none":
  46582. this._setAndBind(child, dataNode);
  46583. continue;
  46584. case "global":
  46585. global = true;
  46586. break;
  46587. case "dataRef":
  46588. if (!child.bind.ref) {
  46589. warn(`XFA - ref is empty in node ${child[$nodeName]}.`);
  46590. this._setAndBind(child, dataNode);
  46591. continue;
  46592. }
  46593. ref = child.bind.ref;
  46594. break;
  46595. default:
  46596. break;
  46597. }
  46598. if (child.bind.picture) {
  46599. picture = child.bind.picture[$content];
  46600. }
  46601. }
  46602. const [min, max] = this._getOccurInfo(child);
  46603. if (ref) {
  46604. match = searchNode(this.root, dataNode, ref, true, false);
  46605. if (match === null) {
  46606. match = createDataNode(this.data, dataNode, ref);
  46607. if (!match) {
  46608. continue;
  46609. }
  46610. if (this._isConsumeData()) {
  46611. match[$consumed] = true;
  46612. }
  46613. this._setAndBind(child, match);
  46614. continue;
  46615. } else {
  46616. if (this._isConsumeData()) {
  46617. match = match.filter(node => !node[$consumed]);
  46618. }
  46619. if (match.length > max) {
  46620. match = match.slice(0, max);
  46621. } else if (match.length === 0) {
  46622. match = null;
  46623. }
  46624. if (match && this._isConsumeData()) {
  46625. match.forEach(node => {
  46626. node[$consumed] = true;
  46627. });
  46628. }
  46629. }
  46630. } else {
  46631. if (!child.name) {
  46632. this._setAndBind(child, dataNode);
  46633. continue;
  46634. }
  46635. if (this._isConsumeData()) {
  46636. const matches = [];
  46637. while (matches.length < max) {
  46638. const found = this._findDataByNameToConsume(child.name, child[$hasSettableValue](), dataNode, global);
  46639. if (!found) {
  46640. break;
  46641. }
  46642. found[$consumed] = true;
  46643. matches.push(found);
  46644. }
  46645. match = matches.length > 0 ? matches : null;
  46646. } else {
  46647. match = dataNode[$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value;
  46648. if (!match) {
  46649. if (min === 0) {
  46650. uselessNodes.push(child);
  46651. continue;
  46652. }
  46653. const nsId = dataNode[$namespaceId] === bind_NS_DATASETS ? -1 : dataNode[$namespaceId];
  46654. match = child[$data] = new XmlObject(nsId, child.name);
  46655. if (this.emptyMerge) {
  46656. match[$consumed] = true;
  46657. }
  46658. dataNode[$appendChild](match);
  46659. this._setAndBind(child, match);
  46660. continue;
  46661. }
  46662. if (this.emptyMerge) {
  46663. match[$consumed] = true;
  46664. }
  46665. match = [match];
  46666. }
  46667. }
  46668. if (match) {
  46669. this._bindOccurrences(child, match, picture);
  46670. } else if (min > 0) {
  46671. this._setAndBind(child, dataNode);
  46672. } else {
  46673. uselessNodes.push(child);
  46674. }
  46675. }
  46676. uselessNodes.forEach(node => node[$getParent]()[$removeChild](node));
  46677. }
  46678. }
  46679. ;// ./src/core/xfa/data.js
  46680. class DataHandler {
  46681. constructor(root, data) {
  46682. this.data = data;
  46683. this.dataset = root.datasets || null;
  46684. }
  46685. serialize(storage) {
  46686. const stack = [[-1, this.data[$getChildren]()]];
  46687. while (stack.length > 0) {
  46688. const last = stack.at(-1);
  46689. const [i, children] = last;
  46690. if (i + 1 === children.length) {
  46691. stack.pop();
  46692. continue;
  46693. }
  46694. const child = children[++last[0]];
  46695. const storageEntry = storage.get(child[$uid]);
  46696. if (storageEntry) {
  46697. child[$setValue](storageEntry);
  46698. } else {
  46699. const attributes = child[$getAttributes]();
  46700. for (const value of attributes.values()) {
  46701. const entry = storage.get(value[$uid]);
  46702. if (entry) {
  46703. value[$setValue](entry);
  46704. break;
  46705. }
  46706. }
  46707. }
  46708. const nodes = child[$getChildren]();
  46709. if (nodes.length > 0) {
  46710. stack.push([-1, nodes]);
  46711. }
  46712. }
  46713. const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`];
  46714. if (this.dataset) {
  46715. for (const child of this.dataset[$getChildren]()) {
  46716. if (child[$nodeName] !== "data") {
  46717. child[$toString](buf);
  46718. }
  46719. }
  46720. }
  46721. this.data[$toString](buf);
  46722. buf.push("</xfa:datasets>");
  46723. return buf.join("");
  46724. }
  46725. }
  46726. ;// ./src/core/xfa/config.js
  46727. const CONFIG_NS_ID = NamespaceIds.config.id;
  46728. class Acrobat extends XFAObject {
  46729. constructor(attributes) {
  46730. super(CONFIG_NS_ID, "acrobat", true);
  46731. this.acrobat7 = null;
  46732. this.autoSave = null;
  46733. this.common = null;
  46734. this.validate = null;
  46735. this.validateApprovalSignatures = null;
  46736. this.submitUrl = new XFAObjectArray();
  46737. }
  46738. }
  46739. class Acrobat7 extends XFAObject {
  46740. constructor(attributes) {
  46741. super(CONFIG_NS_ID, "acrobat7", true);
  46742. this.dynamicRender = null;
  46743. }
  46744. }
  46745. class ADBE_JSConsole extends OptionObject {
  46746. constructor(attributes) {
  46747. super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]);
  46748. }
  46749. }
  46750. class ADBE_JSDebugger extends OptionObject {
  46751. constructor(attributes) {
  46752. super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]);
  46753. }
  46754. }
  46755. class AddSilentPrint extends Option01 {
  46756. constructor(attributes) {
  46757. super(CONFIG_NS_ID, "addSilentPrint");
  46758. }
  46759. }
  46760. class AddViewerPreferences extends Option01 {
  46761. constructor(attributes) {
  46762. super(CONFIG_NS_ID, "addViewerPreferences");
  46763. }
  46764. }
  46765. class AdjustData extends Option10 {
  46766. constructor(attributes) {
  46767. super(CONFIG_NS_ID, "adjustData");
  46768. }
  46769. }
  46770. class AdobeExtensionLevel extends IntegerObject {
  46771. constructor(attributes) {
  46772. super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8);
  46773. }
  46774. }
  46775. class Agent extends XFAObject {
  46776. constructor(attributes) {
  46777. super(CONFIG_NS_ID, "agent", true);
  46778. this.name = attributes.name ? attributes.name.trim() : "";
  46779. this.common = new XFAObjectArray();
  46780. }
  46781. }
  46782. class AlwaysEmbed extends ContentObject {
  46783. constructor(attributes) {
  46784. super(CONFIG_NS_ID, "alwaysEmbed");
  46785. }
  46786. }
  46787. class Amd extends StringObject {
  46788. constructor(attributes) {
  46789. super(CONFIG_NS_ID, "amd");
  46790. }
  46791. }
  46792. class config_Area extends XFAObject {
  46793. constructor(attributes) {
  46794. super(CONFIG_NS_ID, "area");
  46795. this.level = getInteger({
  46796. data: attributes.level,
  46797. defaultValue: 0,
  46798. validate: n => n >= 1 && n <= 3
  46799. });
  46800. this.name = getStringOption(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]);
  46801. }
  46802. }
  46803. class Attributes extends OptionObject {
  46804. constructor(attributes) {
  46805. super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]);
  46806. }
  46807. }
  46808. class AutoSave extends OptionObject {
  46809. constructor(attributes) {
  46810. super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]);
  46811. }
  46812. }
  46813. class Base extends StringObject {
  46814. constructor(attributes) {
  46815. super(CONFIG_NS_ID, "base");
  46816. }
  46817. }
  46818. class BatchOutput extends XFAObject {
  46819. constructor(attributes) {
  46820. super(CONFIG_NS_ID, "batchOutput");
  46821. this.format = getStringOption(attributes.format, ["none", "concat", "zip", "zipCompress"]);
  46822. }
  46823. }
  46824. class BehaviorOverride extends ContentObject {
  46825. constructor(attributes) {
  46826. super(CONFIG_NS_ID, "behaviorOverride");
  46827. }
  46828. [$finalize]() {
  46829. this[$content] = new Map(this[$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2)));
  46830. }
  46831. }
  46832. class Cache extends XFAObject {
  46833. constructor(attributes) {
  46834. super(CONFIG_NS_ID, "cache", true);
  46835. this.templateCache = null;
  46836. }
  46837. }
  46838. class Change extends Option01 {
  46839. constructor(attributes) {
  46840. super(CONFIG_NS_ID, "change");
  46841. }
  46842. }
  46843. class Common extends XFAObject {
  46844. constructor(attributes) {
  46845. super(CONFIG_NS_ID, "common", true);
  46846. this.data = null;
  46847. this.locale = null;
  46848. this.localeSet = null;
  46849. this.messaging = null;
  46850. this.suppressBanner = null;
  46851. this.template = null;
  46852. this.validationMessaging = null;
  46853. this.versionControl = null;
  46854. this.log = new XFAObjectArray();
  46855. }
  46856. }
  46857. class Compress extends XFAObject {
  46858. constructor(attributes) {
  46859. super(CONFIG_NS_ID, "compress");
  46860. this.scope = getStringOption(attributes.scope, ["imageOnly", "document"]);
  46861. }
  46862. }
  46863. class CompressLogicalStructure extends Option01 {
  46864. constructor(attributes) {
  46865. super(CONFIG_NS_ID, "compressLogicalStructure");
  46866. }
  46867. }
  46868. class CompressObjectStream extends Option10 {
  46869. constructor(attributes) {
  46870. super(CONFIG_NS_ID, "compressObjectStream");
  46871. }
  46872. }
  46873. class Compression extends XFAObject {
  46874. constructor(attributes) {
  46875. super(CONFIG_NS_ID, "compression", true);
  46876. this.compressLogicalStructure = null;
  46877. this.compressObjectStream = null;
  46878. this.level = null;
  46879. this.type = null;
  46880. }
  46881. }
  46882. class Config extends XFAObject {
  46883. constructor(attributes) {
  46884. super(CONFIG_NS_ID, "config", true);
  46885. this.acrobat = null;
  46886. this.present = null;
  46887. this.trace = null;
  46888. this.agent = new XFAObjectArray();
  46889. }
  46890. }
  46891. class Conformance extends OptionObject {
  46892. constructor(attributes) {
  46893. super(CONFIG_NS_ID, "conformance", ["A", "B"]);
  46894. }
  46895. }
  46896. class ContentCopy extends Option01 {
  46897. constructor(attributes) {
  46898. super(CONFIG_NS_ID, "contentCopy");
  46899. }
  46900. }
  46901. class Copies extends IntegerObject {
  46902. constructor(attributes) {
  46903. super(CONFIG_NS_ID, "copies", 1, n => n >= 1);
  46904. }
  46905. }
  46906. class Creator extends StringObject {
  46907. constructor(attributes) {
  46908. super(CONFIG_NS_ID, "creator");
  46909. }
  46910. }
  46911. class CurrentPage extends IntegerObject {
  46912. constructor(attributes) {
  46913. super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0);
  46914. }
  46915. }
  46916. class Data extends XFAObject {
  46917. constructor(attributes) {
  46918. super(CONFIG_NS_ID, "data", true);
  46919. this.adjustData = null;
  46920. this.attributes = null;
  46921. this.incrementalLoad = null;
  46922. this.outputXSL = null;
  46923. this.range = null;
  46924. this.record = null;
  46925. this.startNode = null;
  46926. this.uri = null;
  46927. this.window = null;
  46928. this.xsl = null;
  46929. this.excludeNS = new XFAObjectArray();
  46930. this.transform = new XFAObjectArray();
  46931. }
  46932. }
  46933. class Debug extends XFAObject {
  46934. constructor(attributes) {
  46935. super(CONFIG_NS_ID, "debug", true);
  46936. this.uri = null;
  46937. }
  46938. }
  46939. class DefaultTypeface extends ContentObject {
  46940. constructor(attributes) {
  46941. super(CONFIG_NS_ID, "defaultTypeface");
  46942. this.writingScript = getStringOption(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]);
  46943. }
  46944. }
  46945. class Destination extends OptionObject {
  46946. constructor(attributes) {
  46947. super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]);
  46948. }
  46949. }
  46950. class DocumentAssembly extends Option01 {
  46951. constructor(attributes) {
  46952. super(CONFIG_NS_ID, "documentAssembly");
  46953. }
  46954. }
  46955. class Driver extends XFAObject {
  46956. constructor(attributes) {
  46957. super(CONFIG_NS_ID, "driver", true);
  46958. this.name = attributes.name ? attributes.name.trim() : "";
  46959. this.fontInfo = null;
  46960. this.xdc = null;
  46961. }
  46962. }
  46963. class DuplexOption extends OptionObject {
  46964. constructor(attributes) {
  46965. super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]);
  46966. }
  46967. }
  46968. class DynamicRender extends OptionObject {
  46969. constructor(attributes) {
  46970. super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]);
  46971. }
  46972. }
  46973. class Embed extends Option01 {
  46974. constructor(attributes) {
  46975. super(CONFIG_NS_ID, "embed");
  46976. }
  46977. }
  46978. class config_Encrypt extends Option01 {
  46979. constructor(attributes) {
  46980. super(CONFIG_NS_ID, "encrypt");
  46981. }
  46982. }
  46983. class config_Encryption extends XFAObject {
  46984. constructor(attributes) {
  46985. super(CONFIG_NS_ID, "encryption", true);
  46986. this.encrypt = null;
  46987. this.encryptionLevel = null;
  46988. this.permissions = null;
  46989. }
  46990. }
  46991. class EncryptionLevel extends OptionObject {
  46992. constructor(attributes) {
  46993. super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]);
  46994. }
  46995. }
  46996. class Enforce extends StringObject {
  46997. constructor(attributes) {
  46998. super(CONFIG_NS_ID, "enforce");
  46999. }
  47000. }
  47001. class Equate extends XFAObject {
  47002. constructor(attributes) {
  47003. super(CONFIG_NS_ID, "equate");
  47004. this.force = getInteger({
  47005. data: attributes.force,
  47006. defaultValue: 1,
  47007. validate: n => n === 0
  47008. });
  47009. this.from = attributes.from || "";
  47010. this.to = attributes.to || "";
  47011. }
  47012. }
  47013. class EquateRange extends XFAObject {
  47014. constructor(attributes) {
  47015. super(CONFIG_NS_ID, "equateRange");
  47016. this.from = attributes.from || "";
  47017. this.to = attributes.to || "";
  47018. this._unicodeRange = attributes.unicodeRange || "";
  47019. }
  47020. get unicodeRange() {
  47021. const ranges = [];
  47022. const unicodeRegex = /U\+([0-9a-fA-F]+)/;
  47023. const unicodeRange = this._unicodeRange;
  47024. for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) {
  47025. range = range.split("-", 2).map(x => {
  47026. const found = x.match(unicodeRegex);
  47027. if (!found) {
  47028. return 0;
  47029. }
  47030. return parseInt(found[1], 16);
  47031. });
  47032. if (range.length === 1) {
  47033. range.push(range[0]);
  47034. }
  47035. ranges.push(range);
  47036. }
  47037. return shadow(this, "unicodeRange", ranges);
  47038. }
  47039. }
  47040. class Exclude extends ContentObject {
  47041. constructor(attributes) {
  47042. super(CONFIG_NS_ID, "exclude");
  47043. }
  47044. [$finalize]() {
  47045. this[$content] = this[$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x));
  47046. }
  47047. }
  47048. class ExcludeNS extends StringObject {
  47049. constructor(attributes) {
  47050. super(CONFIG_NS_ID, "excludeNS");
  47051. }
  47052. }
  47053. class FlipLabel extends OptionObject {
  47054. constructor(attributes) {
  47055. super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]);
  47056. }
  47057. }
  47058. class config_FontInfo extends XFAObject {
  47059. constructor(attributes) {
  47060. super(CONFIG_NS_ID, "fontInfo", true);
  47061. this.embed = null;
  47062. this.map = null;
  47063. this.subsetBelow = null;
  47064. this.alwaysEmbed = new XFAObjectArray();
  47065. this.defaultTypeface = new XFAObjectArray();
  47066. this.neverEmbed = new XFAObjectArray();
  47067. }
  47068. }
  47069. class FormFieldFilling extends Option01 {
  47070. constructor(attributes) {
  47071. super(CONFIG_NS_ID, "formFieldFilling");
  47072. }
  47073. }
  47074. class GroupParent extends StringObject {
  47075. constructor(attributes) {
  47076. super(CONFIG_NS_ID, "groupParent");
  47077. }
  47078. }
  47079. class IfEmpty extends OptionObject {
  47080. constructor(attributes) {
  47081. super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]);
  47082. }
  47083. }
  47084. class IncludeXDPContent extends StringObject {
  47085. constructor(attributes) {
  47086. super(CONFIG_NS_ID, "includeXDPContent");
  47087. }
  47088. }
  47089. class IncrementalLoad extends OptionObject {
  47090. constructor(attributes) {
  47091. super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]);
  47092. }
  47093. }
  47094. class IncrementalMerge extends Option01 {
  47095. constructor(attributes) {
  47096. super(CONFIG_NS_ID, "incrementalMerge");
  47097. }
  47098. }
  47099. class Interactive extends Option01 {
  47100. constructor(attributes) {
  47101. super(CONFIG_NS_ID, "interactive");
  47102. }
  47103. }
  47104. class Jog extends OptionObject {
  47105. constructor(attributes) {
  47106. super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]);
  47107. }
  47108. }
  47109. class LabelPrinter extends XFAObject {
  47110. constructor(attributes) {
  47111. super(CONFIG_NS_ID, "labelPrinter", true);
  47112. this.name = getStringOption(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]);
  47113. this.batchOutput = null;
  47114. this.flipLabel = null;
  47115. this.fontInfo = null;
  47116. this.xdc = null;
  47117. }
  47118. }
  47119. class Layout extends OptionObject {
  47120. constructor(attributes) {
  47121. super(CONFIG_NS_ID, "layout", ["paginate", "panel"]);
  47122. }
  47123. }
  47124. class Level extends IntegerObject {
  47125. constructor(attributes) {
  47126. super(CONFIG_NS_ID, "level", 0, n => n > 0);
  47127. }
  47128. }
  47129. class Linearized extends Option01 {
  47130. constructor(attributes) {
  47131. super(CONFIG_NS_ID, "linearized");
  47132. }
  47133. }
  47134. class Locale extends StringObject {
  47135. constructor(attributes) {
  47136. super(CONFIG_NS_ID, "locale");
  47137. }
  47138. }
  47139. class LocaleSet extends StringObject {
  47140. constructor(attributes) {
  47141. super(CONFIG_NS_ID, "localeSet");
  47142. }
  47143. }
  47144. class Log extends XFAObject {
  47145. constructor(attributes) {
  47146. super(CONFIG_NS_ID, "log", true);
  47147. this.mode = null;
  47148. this.threshold = null;
  47149. this.to = null;
  47150. this.uri = null;
  47151. }
  47152. }
  47153. class MapElement extends XFAObject {
  47154. constructor(attributes) {
  47155. super(CONFIG_NS_ID, "map", true);
  47156. this.equate = new XFAObjectArray();
  47157. this.equateRange = new XFAObjectArray();
  47158. }
  47159. }
  47160. class MediumInfo extends XFAObject {
  47161. constructor(attributes) {
  47162. super(CONFIG_NS_ID, "mediumInfo", true);
  47163. this.map = null;
  47164. }
  47165. }
  47166. class config_Message extends XFAObject {
  47167. constructor(attributes) {
  47168. super(CONFIG_NS_ID, "message", true);
  47169. this.msgId = null;
  47170. this.severity = null;
  47171. }
  47172. }
  47173. class Messaging extends XFAObject {
  47174. constructor(attributes) {
  47175. super(CONFIG_NS_ID, "messaging", true);
  47176. this.message = new XFAObjectArray();
  47177. }
  47178. }
  47179. class Mode extends OptionObject {
  47180. constructor(attributes) {
  47181. super(CONFIG_NS_ID, "mode", ["append", "overwrite"]);
  47182. }
  47183. }
  47184. class ModifyAnnots extends Option01 {
  47185. constructor(attributes) {
  47186. super(CONFIG_NS_ID, "modifyAnnots");
  47187. }
  47188. }
  47189. class MsgId extends IntegerObject {
  47190. constructor(attributes) {
  47191. super(CONFIG_NS_ID, "msgId", 1, n => n >= 1);
  47192. }
  47193. }
  47194. class NameAttr extends StringObject {
  47195. constructor(attributes) {
  47196. super(CONFIG_NS_ID, "nameAttr");
  47197. }
  47198. }
  47199. class NeverEmbed extends ContentObject {
  47200. constructor(attributes) {
  47201. super(CONFIG_NS_ID, "neverEmbed");
  47202. }
  47203. }
  47204. class NumberOfCopies extends IntegerObject {
  47205. constructor(attributes) {
  47206. super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5);
  47207. }
  47208. }
  47209. class OpenAction extends XFAObject {
  47210. constructor(attributes) {
  47211. super(CONFIG_NS_ID, "openAction", true);
  47212. this.destination = null;
  47213. }
  47214. }
  47215. class Output extends XFAObject {
  47216. constructor(attributes) {
  47217. super(CONFIG_NS_ID, "output", true);
  47218. this.to = null;
  47219. this.type = null;
  47220. this.uri = null;
  47221. }
  47222. }
  47223. class OutputBin extends StringObject {
  47224. constructor(attributes) {
  47225. super(CONFIG_NS_ID, "outputBin");
  47226. }
  47227. }
  47228. class OutputXSL extends XFAObject {
  47229. constructor(attributes) {
  47230. super(CONFIG_NS_ID, "outputXSL", true);
  47231. this.uri = null;
  47232. }
  47233. }
  47234. class Overprint extends OptionObject {
  47235. constructor(attributes) {
  47236. super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]);
  47237. }
  47238. }
  47239. class Packets extends StringObject {
  47240. constructor(attributes) {
  47241. super(CONFIG_NS_ID, "packets");
  47242. }
  47243. [$finalize]() {
  47244. if (this[$content] === "*") {
  47245. return;
  47246. }
  47247. this[$content] = this[$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x));
  47248. }
  47249. }
  47250. class PageOffset extends XFAObject {
  47251. constructor(attributes) {
  47252. super(CONFIG_NS_ID, "pageOffset");
  47253. this.x = getInteger({
  47254. data: attributes.x,
  47255. defaultValue: "useXDCSetting",
  47256. validate: n => true
  47257. });
  47258. this.y = getInteger({
  47259. data: attributes.y,
  47260. defaultValue: "useXDCSetting",
  47261. validate: n => true
  47262. });
  47263. }
  47264. }
  47265. class PageRange extends StringObject {
  47266. constructor(attributes) {
  47267. super(CONFIG_NS_ID, "pageRange");
  47268. }
  47269. [$finalize]() {
  47270. const numbers = this[$content].trim().split(/\s+/).map(x => parseInt(x, 10));
  47271. const ranges = [];
  47272. for (let i = 0, ii = numbers.length; i < ii; i += 2) {
  47273. ranges.push(numbers.slice(i, i + 2));
  47274. }
  47275. this[$content] = ranges;
  47276. }
  47277. }
  47278. class Pagination extends OptionObject {
  47279. constructor(attributes) {
  47280. super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]);
  47281. }
  47282. }
  47283. class PaginationOverride extends OptionObject {
  47284. constructor(attributes) {
  47285. super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]);
  47286. }
  47287. }
  47288. class Part extends IntegerObject {
  47289. constructor(attributes) {
  47290. super(CONFIG_NS_ID, "part", 1, n => false);
  47291. }
  47292. }
  47293. class Pcl extends XFAObject {
  47294. constructor(attributes) {
  47295. super(CONFIG_NS_ID, "pcl", true);
  47296. this.name = attributes.name || "";
  47297. this.batchOutput = null;
  47298. this.fontInfo = null;
  47299. this.jog = null;
  47300. this.mediumInfo = null;
  47301. this.outputBin = null;
  47302. this.pageOffset = null;
  47303. this.staple = null;
  47304. this.xdc = null;
  47305. }
  47306. }
  47307. class Pdf extends XFAObject {
  47308. constructor(attributes) {
  47309. super(CONFIG_NS_ID, "pdf", true);
  47310. this.name = attributes.name || "";
  47311. this.adobeExtensionLevel = null;
  47312. this.batchOutput = null;
  47313. this.compression = null;
  47314. this.creator = null;
  47315. this.encryption = null;
  47316. this.fontInfo = null;
  47317. this.interactive = null;
  47318. this.linearized = null;
  47319. this.openAction = null;
  47320. this.pdfa = null;
  47321. this.producer = null;
  47322. this.renderPolicy = null;
  47323. this.scriptModel = null;
  47324. this.silentPrint = null;
  47325. this.submitFormat = null;
  47326. this.tagged = null;
  47327. this.version = null;
  47328. this.viewerPreferences = null;
  47329. this.xdc = null;
  47330. }
  47331. }
  47332. class Pdfa extends XFAObject {
  47333. constructor(attributes) {
  47334. super(CONFIG_NS_ID, "pdfa", true);
  47335. this.amd = null;
  47336. this.conformance = null;
  47337. this.includeXDPContent = null;
  47338. this.part = null;
  47339. }
  47340. }
  47341. class Permissions extends XFAObject {
  47342. constructor(attributes) {
  47343. super(CONFIG_NS_ID, "permissions", true);
  47344. this.accessibleContent = null;
  47345. this.change = null;
  47346. this.contentCopy = null;
  47347. this.documentAssembly = null;
  47348. this.formFieldFilling = null;
  47349. this.modifyAnnots = null;
  47350. this.plaintextMetadata = null;
  47351. this.print = null;
  47352. this.printHighQuality = null;
  47353. }
  47354. }
  47355. class PickTrayByPDFSize extends Option01 {
  47356. constructor(attributes) {
  47357. super(CONFIG_NS_ID, "pickTrayByPDFSize");
  47358. }
  47359. }
  47360. class config_Picture extends StringObject {
  47361. constructor(attributes) {
  47362. super(CONFIG_NS_ID, "picture");
  47363. }
  47364. }
  47365. class PlaintextMetadata extends Option01 {
  47366. constructor(attributes) {
  47367. super(CONFIG_NS_ID, "plaintextMetadata");
  47368. }
  47369. }
  47370. class Presence extends OptionObject {
  47371. constructor(attributes) {
  47372. super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]);
  47373. }
  47374. }
  47375. class Present extends XFAObject {
  47376. constructor(attributes) {
  47377. super(CONFIG_NS_ID, "present", true);
  47378. this.behaviorOverride = null;
  47379. this.cache = null;
  47380. this.common = null;
  47381. this.copies = null;
  47382. this.destination = null;
  47383. this.incrementalMerge = null;
  47384. this.layout = null;
  47385. this.output = null;
  47386. this.overprint = null;
  47387. this.pagination = null;
  47388. this.paginationOverride = null;
  47389. this.script = null;
  47390. this.validate = null;
  47391. this.xdp = null;
  47392. this.driver = new XFAObjectArray();
  47393. this.labelPrinter = new XFAObjectArray();
  47394. this.pcl = new XFAObjectArray();
  47395. this.pdf = new XFAObjectArray();
  47396. this.ps = new XFAObjectArray();
  47397. this.submitUrl = new XFAObjectArray();
  47398. this.webClient = new XFAObjectArray();
  47399. this.zpl = new XFAObjectArray();
  47400. }
  47401. }
  47402. class Print extends Option01 {
  47403. constructor(attributes) {
  47404. super(CONFIG_NS_ID, "print");
  47405. }
  47406. }
  47407. class PrintHighQuality extends Option01 {
  47408. constructor(attributes) {
  47409. super(CONFIG_NS_ID, "printHighQuality");
  47410. }
  47411. }
  47412. class PrintScaling extends OptionObject {
  47413. constructor(attributes) {
  47414. super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]);
  47415. }
  47416. }
  47417. class PrinterName extends StringObject {
  47418. constructor(attributes) {
  47419. super(CONFIG_NS_ID, "printerName");
  47420. }
  47421. }
  47422. class Producer extends StringObject {
  47423. constructor(attributes) {
  47424. super(CONFIG_NS_ID, "producer");
  47425. }
  47426. }
  47427. class Ps extends XFAObject {
  47428. constructor(attributes) {
  47429. super(CONFIG_NS_ID, "ps", true);
  47430. this.name = attributes.name || "";
  47431. this.batchOutput = null;
  47432. this.fontInfo = null;
  47433. this.jog = null;
  47434. this.mediumInfo = null;
  47435. this.outputBin = null;
  47436. this.staple = null;
  47437. this.xdc = null;
  47438. }
  47439. }
  47440. class Range extends ContentObject {
  47441. constructor(attributes) {
  47442. super(CONFIG_NS_ID, "range");
  47443. }
  47444. [$finalize]() {
  47445. this[$content] = this[$content].trim().split(/\s*,\s*/, 2).map(range => range.split("-").map(x => parseInt(x.trim(), 10))).filter(range => range.every(x => !isNaN(x))).map(range => {
  47446. if (range.length === 1) {
  47447. range.push(range[0]);
  47448. }
  47449. return range;
  47450. });
  47451. }
  47452. }
  47453. class Record extends ContentObject {
  47454. constructor(attributes) {
  47455. super(CONFIG_NS_ID, "record");
  47456. }
  47457. [$finalize]() {
  47458. this[$content] = this[$content].trim();
  47459. const n = parseInt(this[$content], 10);
  47460. if (!isNaN(n) && n >= 0) {
  47461. this[$content] = n;
  47462. }
  47463. }
  47464. }
  47465. class Relevant extends ContentObject {
  47466. constructor(attributes) {
  47467. super(CONFIG_NS_ID, "relevant");
  47468. }
  47469. [$finalize]() {
  47470. this[$content] = this[$content].trim().split(/\s+/);
  47471. }
  47472. }
  47473. class Rename extends ContentObject {
  47474. constructor(attributes) {
  47475. super(CONFIG_NS_ID, "rename");
  47476. }
  47477. [$finalize]() {
  47478. this[$content] = this[$content].trim();
  47479. if (this[$content].toLowerCase().startsWith("xml") || new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u").test(this[$content])) {
  47480. warn("XFA - Rename: invalid XFA name");
  47481. }
  47482. }
  47483. }
  47484. class RenderPolicy extends OptionObject {
  47485. constructor(attributes) {
  47486. super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]);
  47487. }
  47488. }
  47489. class RunScripts extends OptionObject {
  47490. constructor(attributes) {
  47491. super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]);
  47492. }
  47493. }
  47494. class config_Script extends XFAObject {
  47495. constructor(attributes) {
  47496. super(CONFIG_NS_ID, "script", true);
  47497. this.currentPage = null;
  47498. this.exclude = null;
  47499. this.runScripts = null;
  47500. }
  47501. }
  47502. class ScriptModel extends OptionObject {
  47503. constructor(attributes) {
  47504. super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]);
  47505. }
  47506. }
  47507. class Severity extends OptionObject {
  47508. constructor(attributes) {
  47509. super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]);
  47510. }
  47511. }
  47512. class SilentPrint extends XFAObject {
  47513. constructor(attributes) {
  47514. super(CONFIG_NS_ID, "silentPrint", true);
  47515. this.addSilentPrint = null;
  47516. this.printerName = null;
  47517. }
  47518. }
  47519. class Staple extends XFAObject {
  47520. constructor(attributes) {
  47521. super(CONFIG_NS_ID, "staple");
  47522. this.mode = getStringOption(attributes.mode, ["usePrinterSetting", "on", "off"]);
  47523. }
  47524. }
  47525. class StartNode extends StringObject {
  47526. constructor(attributes) {
  47527. super(CONFIG_NS_ID, "startNode");
  47528. }
  47529. }
  47530. class StartPage extends IntegerObject {
  47531. constructor(attributes) {
  47532. super(CONFIG_NS_ID, "startPage", 0, n => true);
  47533. }
  47534. }
  47535. class SubmitFormat extends OptionObject {
  47536. constructor(attributes) {
  47537. super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]);
  47538. }
  47539. }
  47540. class SubmitUrl extends StringObject {
  47541. constructor(attributes) {
  47542. super(CONFIG_NS_ID, "submitUrl");
  47543. }
  47544. }
  47545. class SubsetBelow extends IntegerObject {
  47546. constructor(attributes) {
  47547. super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100);
  47548. }
  47549. }
  47550. class SuppressBanner extends Option01 {
  47551. constructor(attributes) {
  47552. super(CONFIG_NS_ID, "suppressBanner");
  47553. }
  47554. }
  47555. class Tagged extends Option01 {
  47556. constructor(attributes) {
  47557. super(CONFIG_NS_ID, "tagged");
  47558. }
  47559. }
  47560. class config_Template extends XFAObject {
  47561. constructor(attributes) {
  47562. super(CONFIG_NS_ID, "template", true);
  47563. this.base = null;
  47564. this.relevant = null;
  47565. this.startPage = null;
  47566. this.uri = null;
  47567. this.xsl = null;
  47568. }
  47569. }
  47570. class Threshold extends OptionObject {
  47571. constructor(attributes) {
  47572. super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]);
  47573. }
  47574. }
  47575. class To extends OptionObject {
  47576. constructor(attributes) {
  47577. super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]);
  47578. }
  47579. }
  47580. class TemplateCache extends XFAObject {
  47581. constructor(attributes) {
  47582. super(CONFIG_NS_ID, "templateCache");
  47583. this.maxEntries = getInteger({
  47584. data: attributes.maxEntries,
  47585. defaultValue: 5,
  47586. validate: n => n >= 0
  47587. });
  47588. }
  47589. }
  47590. class Trace extends XFAObject {
  47591. constructor(attributes) {
  47592. super(CONFIG_NS_ID, "trace", true);
  47593. this.area = new XFAObjectArray();
  47594. }
  47595. }
  47596. class Transform extends XFAObject {
  47597. constructor(attributes) {
  47598. super(CONFIG_NS_ID, "transform", true);
  47599. this.groupParent = null;
  47600. this.ifEmpty = null;
  47601. this.nameAttr = null;
  47602. this.picture = null;
  47603. this.presence = null;
  47604. this.rename = null;
  47605. this.whitespace = null;
  47606. }
  47607. }
  47608. class Type extends OptionObject {
  47609. constructor(attributes) {
  47610. super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]);
  47611. }
  47612. }
  47613. class Uri extends StringObject {
  47614. constructor(attributes) {
  47615. super(CONFIG_NS_ID, "uri");
  47616. }
  47617. }
  47618. class config_Validate extends OptionObject {
  47619. constructor(attributes) {
  47620. super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]);
  47621. }
  47622. }
  47623. class ValidateApprovalSignatures extends ContentObject {
  47624. constructor(attributes) {
  47625. super(CONFIG_NS_ID, "validateApprovalSignatures");
  47626. }
  47627. [$finalize]() {
  47628. this[$content] = this[$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x));
  47629. }
  47630. }
  47631. class ValidationMessaging extends OptionObject {
  47632. constructor(attributes) {
  47633. super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]);
  47634. }
  47635. }
  47636. class Version extends OptionObject {
  47637. constructor(attributes) {
  47638. super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]);
  47639. }
  47640. }
  47641. class VersionControl extends XFAObject {
  47642. constructor(attributes) {
  47643. super(CONFIG_NS_ID, "VersionControl");
  47644. this.outputBelow = getStringOption(attributes.outputBelow, ["warn", "error", "update"]);
  47645. this.sourceAbove = getStringOption(attributes.sourceAbove, ["warn", "error"]);
  47646. this.sourceBelow = getStringOption(attributes.sourceBelow, ["update", "maintain"]);
  47647. }
  47648. }
  47649. class ViewerPreferences extends XFAObject {
  47650. constructor(attributes) {
  47651. super(CONFIG_NS_ID, "viewerPreferences", true);
  47652. this.ADBE_JSConsole = null;
  47653. this.ADBE_JSDebugger = null;
  47654. this.addViewerPreferences = null;
  47655. this.duplexOption = null;
  47656. this.enforce = null;
  47657. this.numberOfCopies = null;
  47658. this.pageRange = null;
  47659. this.pickTrayByPDFSize = null;
  47660. this.printScaling = null;
  47661. }
  47662. }
  47663. class WebClient extends XFAObject {
  47664. constructor(attributes) {
  47665. super(CONFIG_NS_ID, "webClient", true);
  47666. this.name = attributes.name ? attributes.name.trim() : "";
  47667. this.fontInfo = null;
  47668. this.xdc = null;
  47669. }
  47670. }
  47671. class Whitespace extends OptionObject {
  47672. constructor(attributes) {
  47673. super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]);
  47674. }
  47675. }
  47676. class Window extends ContentObject {
  47677. constructor(attributes) {
  47678. super(CONFIG_NS_ID, "window");
  47679. }
  47680. [$finalize]() {
  47681. const pair = this[$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10));
  47682. if (pair.some(x => isNaN(x))) {
  47683. this[$content] = [0, 0];
  47684. return;
  47685. }
  47686. if (pair.length === 1) {
  47687. pair.push(pair[0]);
  47688. }
  47689. this[$content] = pair;
  47690. }
  47691. }
  47692. class Xdc extends XFAObject {
  47693. constructor(attributes) {
  47694. super(CONFIG_NS_ID, "xdc", true);
  47695. this.uri = new XFAObjectArray();
  47696. this.xsl = new XFAObjectArray();
  47697. }
  47698. }
  47699. class Xdp extends XFAObject {
  47700. constructor(attributes) {
  47701. super(CONFIG_NS_ID, "xdp", true);
  47702. this.packets = null;
  47703. }
  47704. }
  47705. class Xsl extends XFAObject {
  47706. constructor(attributes) {
  47707. super(CONFIG_NS_ID, "xsl", true);
  47708. this.debug = null;
  47709. this.uri = null;
  47710. }
  47711. }
  47712. class Zpl extends XFAObject {
  47713. constructor(attributes) {
  47714. super(CONFIG_NS_ID, "zpl", true);
  47715. this.name = attributes.name ? attributes.name.trim() : "";
  47716. this.batchOutput = null;
  47717. this.flipLabel = null;
  47718. this.fontInfo = null;
  47719. this.xdc = null;
  47720. }
  47721. }
  47722. class ConfigNamespace {
  47723. static [$buildXFAObject](name, attributes) {
  47724. if (ConfigNamespace.hasOwnProperty(name)) {
  47725. return ConfigNamespace[name](attributes);
  47726. }
  47727. return undefined;
  47728. }
  47729. static acrobat(attrs) {
  47730. return new Acrobat(attrs);
  47731. }
  47732. static acrobat7(attrs) {
  47733. return new Acrobat7(attrs);
  47734. }
  47735. static ADBE_JSConsole(attrs) {
  47736. return new ADBE_JSConsole(attrs);
  47737. }
  47738. static ADBE_JSDebugger(attrs) {
  47739. return new ADBE_JSDebugger(attrs);
  47740. }
  47741. static addSilentPrint(attrs) {
  47742. return new AddSilentPrint(attrs);
  47743. }
  47744. static addViewerPreferences(attrs) {
  47745. return new AddViewerPreferences(attrs);
  47746. }
  47747. static adjustData(attrs) {
  47748. return new AdjustData(attrs);
  47749. }
  47750. static adobeExtensionLevel(attrs) {
  47751. return new AdobeExtensionLevel(attrs);
  47752. }
  47753. static agent(attrs) {
  47754. return new Agent(attrs);
  47755. }
  47756. static alwaysEmbed(attrs) {
  47757. return new AlwaysEmbed(attrs);
  47758. }
  47759. static amd(attrs) {
  47760. return new Amd(attrs);
  47761. }
  47762. static area(attrs) {
  47763. return new config_Area(attrs);
  47764. }
  47765. static attributes(attrs) {
  47766. return new Attributes(attrs);
  47767. }
  47768. static autoSave(attrs) {
  47769. return new AutoSave(attrs);
  47770. }
  47771. static base(attrs) {
  47772. return new Base(attrs);
  47773. }
  47774. static batchOutput(attrs) {
  47775. return new BatchOutput(attrs);
  47776. }
  47777. static behaviorOverride(attrs) {
  47778. return new BehaviorOverride(attrs);
  47779. }
  47780. static cache(attrs) {
  47781. return new Cache(attrs);
  47782. }
  47783. static change(attrs) {
  47784. return new Change(attrs);
  47785. }
  47786. static common(attrs) {
  47787. return new Common(attrs);
  47788. }
  47789. static compress(attrs) {
  47790. return new Compress(attrs);
  47791. }
  47792. static compressLogicalStructure(attrs) {
  47793. return new CompressLogicalStructure(attrs);
  47794. }
  47795. static compressObjectStream(attrs) {
  47796. return new CompressObjectStream(attrs);
  47797. }
  47798. static compression(attrs) {
  47799. return new Compression(attrs);
  47800. }
  47801. static config(attrs) {
  47802. return new Config(attrs);
  47803. }
  47804. static conformance(attrs) {
  47805. return new Conformance(attrs);
  47806. }
  47807. static contentCopy(attrs) {
  47808. return new ContentCopy(attrs);
  47809. }
  47810. static copies(attrs) {
  47811. return new Copies(attrs);
  47812. }
  47813. static creator(attrs) {
  47814. return new Creator(attrs);
  47815. }
  47816. static currentPage(attrs) {
  47817. return new CurrentPage(attrs);
  47818. }
  47819. static data(attrs) {
  47820. return new Data(attrs);
  47821. }
  47822. static debug(attrs) {
  47823. return new Debug(attrs);
  47824. }
  47825. static defaultTypeface(attrs) {
  47826. return new DefaultTypeface(attrs);
  47827. }
  47828. static destination(attrs) {
  47829. return new Destination(attrs);
  47830. }
  47831. static documentAssembly(attrs) {
  47832. return new DocumentAssembly(attrs);
  47833. }
  47834. static driver(attrs) {
  47835. return new Driver(attrs);
  47836. }
  47837. static duplexOption(attrs) {
  47838. return new DuplexOption(attrs);
  47839. }
  47840. static dynamicRender(attrs) {
  47841. return new DynamicRender(attrs);
  47842. }
  47843. static embed(attrs) {
  47844. return new Embed(attrs);
  47845. }
  47846. static encrypt(attrs) {
  47847. return new config_Encrypt(attrs);
  47848. }
  47849. static encryption(attrs) {
  47850. return new config_Encryption(attrs);
  47851. }
  47852. static encryptionLevel(attrs) {
  47853. return new EncryptionLevel(attrs);
  47854. }
  47855. static enforce(attrs) {
  47856. return new Enforce(attrs);
  47857. }
  47858. static equate(attrs) {
  47859. return new Equate(attrs);
  47860. }
  47861. static equateRange(attrs) {
  47862. return new EquateRange(attrs);
  47863. }
  47864. static exclude(attrs) {
  47865. return new Exclude(attrs);
  47866. }
  47867. static excludeNS(attrs) {
  47868. return new ExcludeNS(attrs);
  47869. }
  47870. static flipLabel(attrs) {
  47871. return new FlipLabel(attrs);
  47872. }
  47873. static fontInfo(attrs) {
  47874. return new config_FontInfo(attrs);
  47875. }
  47876. static formFieldFilling(attrs) {
  47877. return new FormFieldFilling(attrs);
  47878. }
  47879. static groupParent(attrs) {
  47880. return new GroupParent(attrs);
  47881. }
  47882. static ifEmpty(attrs) {
  47883. return new IfEmpty(attrs);
  47884. }
  47885. static includeXDPContent(attrs) {
  47886. return new IncludeXDPContent(attrs);
  47887. }
  47888. static incrementalLoad(attrs) {
  47889. return new IncrementalLoad(attrs);
  47890. }
  47891. static incrementalMerge(attrs) {
  47892. return new IncrementalMerge(attrs);
  47893. }
  47894. static interactive(attrs) {
  47895. return new Interactive(attrs);
  47896. }
  47897. static jog(attrs) {
  47898. return new Jog(attrs);
  47899. }
  47900. static labelPrinter(attrs) {
  47901. return new LabelPrinter(attrs);
  47902. }
  47903. static layout(attrs) {
  47904. return new Layout(attrs);
  47905. }
  47906. static level(attrs) {
  47907. return new Level(attrs);
  47908. }
  47909. static linearized(attrs) {
  47910. return new Linearized(attrs);
  47911. }
  47912. static locale(attrs) {
  47913. return new Locale(attrs);
  47914. }
  47915. static localeSet(attrs) {
  47916. return new LocaleSet(attrs);
  47917. }
  47918. static log(attrs) {
  47919. return new Log(attrs);
  47920. }
  47921. static map(attrs) {
  47922. return new MapElement(attrs);
  47923. }
  47924. static mediumInfo(attrs) {
  47925. return new MediumInfo(attrs);
  47926. }
  47927. static message(attrs) {
  47928. return new config_Message(attrs);
  47929. }
  47930. static messaging(attrs) {
  47931. return new Messaging(attrs);
  47932. }
  47933. static mode(attrs) {
  47934. return new Mode(attrs);
  47935. }
  47936. static modifyAnnots(attrs) {
  47937. return new ModifyAnnots(attrs);
  47938. }
  47939. static msgId(attrs) {
  47940. return new MsgId(attrs);
  47941. }
  47942. static nameAttr(attrs) {
  47943. return new NameAttr(attrs);
  47944. }
  47945. static neverEmbed(attrs) {
  47946. return new NeverEmbed(attrs);
  47947. }
  47948. static numberOfCopies(attrs) {
  47949. return new NumberOfCopies(attrs);
  47950. }
  47951. static openAction(attrs) {
  47952. return new OpenAction(attrs);
  47953. }
  47954. static output(attrs) {
  47955. return new Output(attrs);
  47956. }
  47957. static outputBin(attrs) {
  47958. return new OutputBin(attrs);
  47959. }
  47960. static outputXSL(attrs) {
  47961. return new OutputXSL(attrs);
  47962. }
  47963. static overprint(attrs) {
  47964. return new Overprint(attrs);
  47965. }
  47966. static packets(attrs) {
  47967. return new Packets(attrs);
  47968. }
  47969. static pageOffset(attrs) {
  47970. return new PageOffset(attrs);
  47971. }
  47972. static pageRange(attrs) {
  47973. return new PageRange(attrs);
  47974. }
  47975. static pagination(attrs) {
  47976. return new Pagination(attrs);
  47977. }
  47978. static paginationOverride(attrs) {
  47979. return new PaginationOverride(attrs);
  47980. }
  47981. static part(attrs) {
  47982. return new Part(attrs);
  47983. }
  47984. static pcl(attrs) {
  47985. return new Pcl(attrs);
  47986. }
  47987. static pdf(attrs) {
  47988. return new Pdf(attrs);
  47989. }
  47990. static pdfa(attrs) {
  47991. return new Pdfa(attrs);
  47992. }
  47993. static permissions(attrs) {
  47994. return new Permissions(attrs);
  47995. }
  47996. static pickTrayByPDFSize(attrs) {
  47997. return new PickTrayByPDFSize(attrs);
  47998. }
  47999. static picture(attrs) {
  48000. return new config_Picture(attrs);
  48001. }
  48002. static plaintextMetadata(attrs) {
  48003. return new PlaintextMetadata(attrs);
  48004. }
  48005. static presence(attrs) {
  48006. return new Presence(attrs);
  48007. }
  48008. static present(attrs) {
  48009. return new Present(attrs);
  48010. }
  48011. static print(attrs) {
  48012. return new Print(attrs);
  48013. }
  48014. static printHighQuality(attrs) {
  48015. return new PrintHighQuality(attrs);
  48016. }
  48017. static printScaling(attrs) {
  48018. return new PrintScaling(attrs);
  48019. }
  48020. static printerName(attrs) {
  48021. return new PrinterName(attrs);
  48022. }
  48023. static producer(attrs) {
  48024. return new Producer(attrs);
  48025. }
  48026. static ps(attrs) {
  48027. return new Ps(attrs);
  48028. }
  48029. static range(attrs) {
  48030. return new Range(attrs);
  48031. }
  48032. static record(attrs) {
  48033. return new Record(attrs);
  48034. }
  48035. static relevant(attrs) {
  48036. return new Relevant(attrs);
  48037. }
  48038. static rename(attrs) {
  48039. return new Rename(attrs);
  48040. }
  48041. static renderPolicy(attrs) {
  48042. return new RenderPolicy(attrs);
  48043. }
  48044. static runScripts(attrs) {
  48045. return new RunScripts(attrs);
  48046. }
  48047. static script(attrs) {
  48048. return new config_Script(attrs);
  48049. }
  48050. static scriptModel(attrs) {
  48051. return new ScriptModel(attrs);
  48052. }
  48053. static severity(attrs) {
  48054. return new Severity(attrs);
  48055. }
  48056. static silentPrint(attrs) {
  48057. return new SilentPrint(attrs);
  48058. }
  48059. static staple(attrs) {
  48060. return new Staple(attrs);
  48061. }
  48062. static startNode(attrs) {
  48063. return new StartNode(attrs);
  48064. }
  48065. static startPage(attrs) {
  48066. return new StartPage(attrs);
  48067. }
  48068. static submitFormat(attrs) {
  48069. return new SubmitFormat(attrs);
  48070. }
  48071. static submitUrl(attrs) {
  48072. return new SubmitUrl(attrs);
  48073. }
  48074. static subsetBelow(attrs) {
  48075. return new SubsetBelow(attrs);
  48076. }
  48077. static suppressBanner(attrs) {
  48078. return new SuppressBanner(attrs);
  48079. }
  48080. static tagged(attrs) {
  48081. return new Tagged(attrs);
  48082. }
  48083. static template(attrs) {
  48084. return new config_Template(attrs);
  48085. }
  48086. static templateCache(attrs) {
  48087. return new TemplateCache(attrs);
  48088. }
  48089. static threshold(attrs) {
  48090. return new Threshold(attrs);
  48091. }
  48092. static to(attrs) {
  48093. return new To(attrs);
  48094. }
  48095. static trace(attrs) {
  48096. return new Trace(attrs);
  48097. }
  48098. static transform(attrs) {
  48099. return new Transform(attrs);
  48100. }
  48101. static type(attrs) {
  48102. return new Type(attrs);
  48103. }
  48104. static uri(attrs) {
  48105. return new Uri(attrs);
  48106. }
  48107. static validate(attrs) {
  48108. return new config_Validate(attrs);
  48109. }
  48110. static validateApprovalSignatures(attrs) {
  48111. return new ValidateApprovalSignatures(attrs);
  48112. }
  48113. static validationMessaging(attrs) {
  48114. return new ValidationMessaging(attrs);
  48115. }
  48116. static version(attrs) {
  48117. return new Version(attrs);
  48118. }
  48119. static versionControl(attrs) {
  48120. return new VersionControl(attrs);
  48121. }
  48122. static viewerPreferences(attrs) {
  48123. return new ViewerPreferences(attrs);
  48124. }
  48125. static webClient(attrs) {
  48126. return new WebClient(attrs);
  48127. }
  48128. static whitespace(attrs) {
  48129. return new Whitespace(attrs);
  48130. }
  48131. static window(attrs) {
  48132. return new Window(attrs);
  48133. }
  48134. static xdc(attrs) {
  48135. return new Xdc(attrs);
  48136. }
  48137. static xdp(attrs) {
  48138. return new Xdp(attrs);
  48139. }
  48140. static xsl(attrs) {
  48141. return new Xsl(attrs);
  48142. }
  48143. static zpl(attrs) {
  48144. return new Zpl(attrs);
  48145. }
  48146. }
  48147. ;// ./src/core/xfa/connection_set.js
  48148. const CONNECTION_SET_NS_ID = NamespaceIds.connectionSet.id;
  48149. class ConnectionSet extends XFAObject {
  48150. constructor(attributes) {
  48151. super(CONNECTION_SET_NS_ID, "connectionSet", true);
  48152. this.wsdlConnection = new XFAObjectArray();
  48153. this.xmlConnection = new XFAObjectArray();
  48154. this.xsdConnection = new XFAObjectArray();
  48155. }
  48156. }
  48157. class EffectiveInputPolicy extends XFAObject {
  48158. constructor(attributes) {
  48159. super(CONNECTION_SET_NS_ID, "effectiveInputPolicy");
  48160. this.id = attributes.id || "";
  48161. this.name = attributes.name || "";
  48162. this.use = attributes.use || "";
  48163. this.usehref = attributes.usehref || "";
  48164. }
  48165. }
  48166. class EffectiveOutputPolicy extends XFAObject {
  48167. constructor(attributes) {
  48168. super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy");
  48169. this.id = attributes.id || "";
  48170. this.name = attributes.name || "";
  48171. this.use = attributes.use || "";
  48172. this.usehref = attributes.usehref || "";
  48173. }
  48174. }
  48175. class Operation extends StringObject {
  48176. constructor(attributes) {
  48177. super(CONNECTION_SET_NS_ID, "operation");
  48178. this.id = attributes.id || "";
  48179. this.input = attributes.input || "";
  48180. this.name = attributes.name || "";
  48181. this.output = attributes.output || "";
  48182. this.use = attributes.use || "";
  48183. this.usehref = attributes.usehref || "";
  48184. }
  48185. }
  48186. class RootElement extends StringObject {
  48187. constructor(attributes) {
  48188. super(CONNECTION_SET_NS_ID, "rootElement");
  48189. this.id = attributes.id || "";
  48190. this.name = attributes.name || "";
  48191. this.use = attributes.use || "";
  48192. this.usehref = attributes.usehref || "";
  48193. }
  48194. }
  48195. class SoapAction extends StringObject {
  48196. constructor(attributes) {
  48197. super(CONNECTION_SET_NS_ID, "soapAction");
  48198. this.id = attributes.id || "";
  48199. this.name = attributes.name || "";
  48200. this.use = attributes.use || "";
  48201. this.usehref = attributes.usehref || "";
  48202. }
  48203. }
  48204. class SoapAddress extends StringObject {
  48205. constructor(attributes) {
  48206. super(CONNECTION_SET_NS_ID, "soapAddress");
  48207. this.id = attributes.id || "";
  48208. this.name = attributes.name || "";
  48209. this.use = attributes.use || "";
  48210. this.usehref = attributes.usehref || "";
  48211. }
  48212. }
  48213. class connection_set_Uri extends StringObject {
  48214. constructor(attributes) {
  48215. super(CONNECTION_SET_NS_ID, "uri");
  48216. this.id = attributes.id || "";
  48217. this.name = attributes.name || "";
  48218. this.use = attributes.use || "";
  48219. this.usehref = attributes.usehref || "";
  48220. }
  48221. }
  48222. class WsdlAddress extends StringObject {
  48223. constructor(attributes) {
  48224. super(CONNECTION_SET_NS_ID, "wsdlAddress");
  48225. this.id = attributes.id || "";
  48226. this.name = attributes.name || "";
  48227. this.use = attributes.use || "";
  48228. this.usehref = attributes.usehref || "";
  48229. }
  48230. }
  48231. class WsdlConnection extends XFAObject {
  48232. constructor(attributes) {
  48233. super(CONNECTION_SET_NS_ID, "wsdlConnection", true);
  48234. this.dataDescription = attributes.dataDescription || "";
  48235. this.name = attributes.name || "";
  48236. this.effectiveInputPolicy = null;
  48237. this.effectiveOutputPolicy = null;
  48238. this.operation = null;
  48239. this.soapAction = null;
  48240. this.soapAddress = null;
  48241. this.wsdlAddress = null;
  48242. }
  48243. }
  48244. class XmlConnection extends XFAObject {
  48245. constructor(attributes) {
  48246. super(CONNECTION_SET_NS_ID, "xmlConnection", true);
  48247. this.dataDescription = attributes.dataDescription || "";
  48248. this.name = attributes.name || "";
  48249. this.uri = null;
  48250. }
  48251. }
  48252. class XsdConnection extends XFAObject {
  48253. constructor(attributes) {
  48254. super(CONNECTION_SET_NS_ID, "xsdConnection", true);
  48255. this.dataDescription = attributes.dataDescription || "";
  48256. this.name = attributes.name || "";
  48257. this.rootElement = null;
  48258. this.uri = null;
  48259. }
  48260. }
  48261. class ConnectionSetNamespace {
  48262. static [$buildXFAObject](name, attributes) {
  48263. if (ConnectionSetNamespace.hasOwnProperty(name)) {
  48264. return ConnectionSetNamespace[name](attributes);
  48265. }
  48266. return undefined;
  48267. }
  48268. static connectionSet(attrs) {
  48269. return new ConnectionSet(attrs);
  48270. }
  48271. static effectiveInputPolicy(attrs) {
  48272. return new EffectiveInputPolicy(attrs);
  48273. }
  48274. static effectiveOutputPolicy(attrs) {
  48275. return new EffectiveOutputPolicy(attrs);
  48276. }
  48277. static operation(attrs) {
  48278. return new Operation(attrs);
  48279. }
  48280. static rootElement(attrs) {
  48281. return new RootElement(attrs);
  48282. }
  48283. static soapAction(attrs) {
  48284. return new SoapAction(attrs);
  48285. }
  48286. static soapAddress(attrs) {
  48287. return new SoapAddress(attrs);
  48288. }
  48289. static uri(attrs) {
  48290. return new connection_set_Uri(attrs);
  48291. }
  48292. static wsdlAddress(attrs) {
  48293. return new WsdlAddress(attrs);
  48294. }
  48295. static wsdlConnection(attrs) {
  48296. return new WsdlConnection(attrs);
  48297. }
  48298. static xmlConnection(attrs) {
  48299. return new XmlConnection(attrs);
  48300. }
  48301. static xsdConnection(attrs) {
  48302. return new XsdConnection(attrs);
  48303. }
  48304. }
  48305. ;// ./src/core/xfa/datasets.js
  48306. const DATASETS_NS_ID = NamespaceIds.datasets.id;
  48307. class datasets_Data extends XmlObject {
  48308. constructor(attributes) {
  48309. super(DATASETS_NS_ID, "data", attributes);
  48310. }
  48311. [$isNsAgnostic]() {
  48312. return true;
  48313. }
  48314. }
  48315. class Datasets extends XFAObject {
  48316. constructor(attributes) {
  48317. super(DATASETS_NS_ID, "datasets", true);
  48318. this.data = null;
  48319. this.Signature = null;
  48320. }
  48321. [$onChild](child) {
  48322. const name = child[$nodeName];
  48323. if (name === "data" && child[$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[$namespaceId] === NamespaceIds.signature.id) {
  48324. this[name] = child;
  48325. }
  48326. this[$appendChild](child);
  48327. }
  48328. }
  48329. class DatasetsNamespace {
  48330. static [$buildXFAObject](name, attributes) {
  48331. if (DatasetsNamespace.hasOwnProperty(name)) {
  48332. return DatasetsNamespace[name](attributes);
  48333. }
  48334. return undefined;
  48335. }
  48336. static datasets(attributes) {
  48337. return new Datasets(attributes);
  48338. }
  48339. static data(attributes) {
  48340. return new datasets_Data(attributes);
  48341. }
  48342. }
  48343. ;// ./src/core/xfa/locale_set.js
  48344. const LOCALE_SET_NS_ID = NamespaceIds.localeSet.id;
  48345. class CalendarSymbols extends XFAObject {
  48346. constructor(attributes) {
  48347. super(LOCALE_SET_NS_ID, "calendarSymbols", true);
  48348. this.name = "gregorian";
  48349. this.dayNames = new XFAObjectArray(2);
  48350. this.eraNames = null;
  48351. this.meridiemNames = null;
  48352. this.monthNames = new XFAObjectArray(2);
  48353. }
  48354. }
  48355. class CurrencySymbol extends StringObject {
  48356. constructor(attributes) {
  48357. super(LOCALE_SET_NS_ID, "currencySymbol");
  48358. this.name = getStringOption(attributes.name, ["symbol", "isoname", "decimal"]);
  48359. }
  48360. }
  48361. class CurrencySymbols extends XFAObject {
  48362. constructor(attributes) {
  48363. super(LOCALE_SET_NS_ID, "currencySymbols", true);
  48364. this.currencySymbol = new XFAObjectArray(3);
  48365. }
  48366. }
  48367. class DatePattern extends StringObject {
  48368. constructor(attributes) {
  48369. super(LOCALE_SET_NS_ID, "datePattern");
  48370. this.name = getStringOption(attributes.name, ["full", "long", "med", "short"]);
  48371. }
  48372. }
  48373. class DatePatterns extends XFAObject {
  48374. constructor(attributes) {
  48375. super(LOCALE_SET_NS_ID, "datePatterns", true);
  48376. this.datePattern = new XFAObjectArray(4);
  48377. }
  48378. }
  48379. class DateTimeSymbols extends ContentObject {
  48380. constructor(attributes) {
  48381. super(LOCALE_SET_NS_ID, "dateTimeSymbols");
  48382. }
  48383. }
  48384. class Day extends StringObject {
  48385. constructor(attributes) {
  48386. super(LOCALE_SET_NS_ID, "day");
  48387. }
  48388. }
  48389. class DayNames extends XFAObject {
  48390. constructor(attributes) {
  48391. super(LOCALE_SET_NS_ID, "dayNames", true);
  48392. this.abbr = getInteger({
  48393. data: attributes.abbr,
  48394. defaultValue: 0,
  48395. validate: x => x === 1
  48396. });
  48397. this.day = new XFAObjectArray(7);
  48398. }
  48399. }
  48400. class Era extends StringObject {
  48401. constructor(attributes) {
  48402. super(LOCALE_SET_NS_ID, "era");
  48403. }
  48404. }
  48405. class EraNames extends XFAObject {
  48406. constructor(attributes) {
  48407. super(LOCALE_SET_NS_ID, "eraNames", true);
  48408. this.era = new XFAObjectArray(2);
  48409. }
  48410. }
  48411. class locale_set_Locale extends XFAObject {
  48412. constructor(attributes) {
  48413. super(LOCALE_SET_NS_ID, "locale", true);
  48414. this.desc = attributes.desc || "";
  48415. this.name = "isoname";
  48416. this.calendarSymbols = null;
  48417. this.currencySymbols = null;
  48418. this.datePatterns = null;
  48419. this.dateTimeSymbols = null;
  48420. this.numberPatterns = null;
  48421. this.numberSymbols = null;
  48422. this.timePatterns = null;
  48423. this.typeFaces = null;
  48424. }
  48425. }
  48426. class locale_set_LocaleSet extends XFAObject {
  48427. constructor(attributes) {
  48428. super(LOCALE_SET_NS_ID, "localeSet", true);
  48429. this.locale = new XFAObjectArray();
  48430. }
  48431. }
  48432. class Meridiem extends StringObject {
  48433. constructor(attributes) {
  48434. super(LOCALE_SET_NS_ID, "meridiem");
  48435. }
  48436. }
  48437. class MeridiemNames extends XFAObject {
  48438. constructor(attributes) {
  48439. super(LOCALE_SET_NS_ID, "meridiemNames", true);
  48440. this.meridiem = new XFAObjectArray(2);
  48441. }
  48442. }
  48443. class Month extends StringObject {
  48444. constructor(attributes) {
  48445. super(LOCALE_SET_NS_ID, "month");
  48446. }
  48447. }
  48448. class MonthNames extends XFAObject {
  48449. constructor(attributes) {
  48450. super(LOCALE_SET_NS_ID, "monthNames", true);
  48451. this.abbr = getInteger({
  48452. data: attributes.abbr,
  48453. defaultValue: 0,
  48454. validate: x => x === 1
  48455. });
  48456. this.month = new XFAObjectArray(12);
  48457. }
  48458. }
  48459. class NumberPattern extends StringObject {
  48460. constructor(attributes) {
  48461. super(LOCALE_SET_NS_ID, "numberPattern");
  48462. this.name = getStringOption(attributes.name, ["full", "long", "med", "short"]);
  48463. }
  48464. }
  48465. class NumberPatterns extends XFAObject {
  48466. constructor(attributes) {
  48467. super(LOCALE_SET_NS_ID, "numberPatterns", true);
  48468. this.numberPattern = new XFAObjectArray(4);
  48469. }
  48470. }
  48471. class NumberSymbol extends StringObject {
  48472. constructor(attributes) {
  48473. super(LOCALE_SET_NS_ID, "numberSymbol");
  48474. this.name = getStringOption(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]);
  48475. }
  48476. }
  48477. class NumberSymbols extends XFAObject {
  48478. constructor(attributes) {
  48479. super(LOCALE_SET_NS_ID, "numberSymbols", true);
  48480. this.numberSymbol = new XFAObjectArray(5);
  48481. }
  48482. }
  48483. class TimePattern extends StringObject {
  48484. constructor(attributes) {
  48485. super(LOCALE_SET_NS_ID, "timePattern");
  48486. this.name = getStringOption(attributes.name, ["full", "long", "med", "short"]);
  48487. }
  48488. }
  48489. class TimePatterns extends XFAObject {
  48490. constructor(attributes) {
  48491. super(LOCALE_SET_NS_ID, "timePatterns", true);
  48492. this.timePattern = new XFAObjectArray(4);
  48493. }
  48494. }
  48495. class TypeFace extends XFAObject {
  48496. constructor(attributes) {
  48497. super(LOCALE_SET_NS_ID, "typeFace", true);
  48498. this.name = attributes.name | "";
  48499. }
  48500. }
  48501. class TypeFaces extends XFAObject {
  48502. constructor(attributes) {
  48503. super(LOCALE_SET_NS_ID, "typeFaces", true);
  48504. this.typeFace = new XFAObjectArray();
  48505. }
  48506. }
  48507. class LocaleSetNamespace {
  48508. static [$buildXFAObject](name, attributes) {
  48509. if (LocaleSetNamespace.hasOwnProperty(name)) {
  48510. return LocaleSetNamespace[name](attributes);
  48511. }
  48512. return undefined;
  48513. }
  48514. static calendarSymbols(attrs) {
  48515. return new CalendarSymbols(attrs);
  48516. }
  48517. static currencySymbol(attrs) {
  48518. return new CurrencySymbol(attrs);
  48519. }
  48520. static currencySymbols(attrs) {
  48521. return new CurrencySymbols(attrs);
  48522. }
  48523. static datePattern(attrs) {
  48524. return new DatePattern(attrs);
  48525. }
  48526. static datePatterns(attrs) {
  48527. return new DatePatterns(attrs);
  48528. }
  48529. static dateTimeSymbols(attrs) {
  48530. return new DateTimeSymbols(attrs);
  48531. }
  48532. static day(attrs) {
  48533. return new Day(attrs);
  48534. }
  48535. static dayNames(attrs) {
  48536. return new DayNames(attrs);
  48537. }
  48538. static era(attrs) {
  48539. return new Era(attrs);
  48540. }
  48541. static eraNames(attrs) {
  48542. return new EraNames(attrs);
  48543. }
  48544. static locale(attrs) {
  48545. return new locale_set_Locale(attrs);
  48546. }
  48547. static localeSet(attrs) {
  48548. return new locale_set_LocaleSet(attrs);
  48549. }
  48550. static meridiem(attrs) {
  48551. return new Meridiem(attrs);
  48552. }
  48553. static meridiemNames(attrs) {
  48554. return new MeridiemNames(attrs);
  48555. }
  48556. static month(attrs) {
  48557. return new Month(attrs);
  48558. }
  48559. static monthNames(attrs) {
  48560. return new MonthNames(attrs);
  48561. }
  48562. static numberPattern(attrs) {
  48563. return new NumberPattern(attrs);
  48564. }
  48565. static numberPatterns(attrs) {
  48566. return new NumberPatterns(attrs);
  48567. }
  48568. static numberSymbol(attrs) {
  48569. return new NumberSymbol(attrs);
  48570. }
  48571. static numberSymbols(attrs) {
  48572. return new NumberSymbols(attrs);
  48573. }
  48574. static timePattern(attrs) {
  48575. return new TimePattern(attrs);
  48576. }
  48577. static timePatterns(attrs) {
  48578. return new TimePatterns(attrs);
  48579. }
  48580. static typeFace(attrs) {
  48581. return new TypeFace(attrs);
  48582. }
  48583. static typeFaces(attrs) {
  48584. return new TypeFaces(attrs);
  48585. }
  48586. }
  48587. ;// ./src/core/xfa/signature.js
  48588. const SIGNATURE_NS_ID = NamespaceIds.signature.id;
  48589. class signature_Signature extends XFAObject {
  48590. constructor(attributes) {
  48591. super(SIGNATURE_NS_ID, "signature", true);
  48592. }
  48593. }
  48594. class SignatureNamespace {
  48595. static [$buildXFAObject](name, attributes) {
  48596. if (SignatureNamespace.hasOwnProperty(name)) {
  48597. return SignatureNamespace[name](attributes);
  48598. }
  48599. return undefined;
  48600. }
  48601. static signature(attributes) {
  48602. return new signature_Signature(attributes);
  48603. }
  48604. }
  48605. ;// ./src/core/xfa/stylesheet.js
  48606. const STYLESHEET_NS_ID = NamespaceIds.stylesheet.id;
  48607. class Stylesheet extends XFAObject {
  48608. constructor(attributes) {
  48609. super(STYLESHEET_NS_ID, "stylesheet", true);
  48610. }
  48611. }
  48612. class StylesheetNamespace {
  48613. static [$buildXFAObject](name, attributes) {
  48614. if (StylesheetNamespace.hasOwnProperty(name)) {
  48615. return StylesheetNamespace[name](attributes);
  48616. }
  48617. return undefined;
  48618. }
  48619. static stylesheet(attributes) {
  48620. return new Stylesheet(attributes);
  48621. }
  48622. }
  48623. ;// ./src/core/xfa/xdp.js
  48624. const XDP_NS_ID = NamespaceIds.xdp.id;
  48625. class xdp_Xdp extends XFAObject {
  48626. constructor(attributes) {
  48627. super(XDP_NS_ID, "xdp", true);
  48628. this.uuid = attributes.uuid || "";
  48629. this.timeStamp = attributes.timeStamp || "";
  48630. this.config = null;
  48631. this.connectionSet = null;
  48632. this.datasets = null;
  48633. this.localeSet = null;
  48634. this.stylesheet = new XFAObjectArray();
  48635. this.template = null;
  48636. }
  48637. [$onChildCheck](child) {
  48638. const ns = NamespaceIds[child[$nodeName]];
  48639. return ns && child[$namespaceId] === ns.id;
  48640. }
  48641. }
  48642. class XdpNamespace {
  48643. static [$buildXFAObject](name, attributes) {
  48644. if (XdpNamespace.hasOwnProperty(name)) {
  48645. return XdpNamespace[name](attributes);
  48646. }
  48647. return undefined;
  48648. }
  48649. static xdp(attributes) {
  48650. return new xdp_Xdp(attributes);
  48651. }
  48652. }
  48653. ;// ./src/core/xfa/xhtml.js
  48654. const XHTML_NS_ID = NamespaceIds.xhtml.id;
  48655. const $richText = Symbol();
  48656. const VALID_STYLES = new Set(["color", "font", "font-family", "font-size", "font-stretch", "font-style", "font-weight", "margin", "margin-bottom", "margin-left", "margin-right", "margin-top", "letter-spacing", "line-height", "orphans", "page-break-after", "page-break-before", "page-break-inside", "tab-interval", "tab-stop", "text-align", "text-decoration", "text-indent", "vertical-align", "widows", "kerning-mode", "xfa-font-horizontal-scale", "xfa-font-vertical-scale", "xfa-spacerun", "xfa-tab-stops"]);
  48657. const StyleMapping = new Map([["page-break-after", "breakAfter"], ["page-break-before", "breakBefore"], ["page-break-inside", "breakInside"], ["kerning-mode", value => value === "none" ? "none" : "normal"], ["xfa-font-horizontal-scale", value => `scaleX(${Math.max(0, Math.min(parseInt(value) / 100)).toFixed(2)})`], ["xfa-font-vertical-scale", value => `scaleY(${Math.max(0, Math.min(parseInt(value) / 100)).toFixed(2)})`], ["xfa-spacerun", ""], ["xfa-tab-stops", ""], ["font-size", (value, original) => {
  48658. value = original.fontSize = getMeasurement(value);
  48659. return measureToString(0.99 * value);
  48660. }], ["letter-spacing", value => measureToString(getMeasurement(value))], ["line-height", value => measureToString(getMeasurement(value))], ["margin", value => measureToString(getMeasurement(value))], ["margin-bottom", value => measureToString(getMeasurement(value))], ["margin-left", value => measureToString(getMeasurement(value))], ["margin-right", value => measureToString(getMeasurement(value))], ["margin-top", value => measureToString(getMeasurement(value))], ["text-indent", value => measureToString(getMeasurement(value))], ["font-family", value => value], ["vertical-align", value => measureToString(getMeasurement(value))]]);
  48661. const spacesRegExp = /\s+/g;
  48662. const crlfRegExp = /[\r\n]+/g;
  48663. const crlfForRichTextRegExp = /\r\n?/g;
  48664. function mapStyle(styleStr, node, richText) {
  48665. const style = Object.create(null);
  48666. if (!styleStr) {
  48667. return style;
  48668. }
  48669. const original = Object.create(null);
  48670. for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) {
  48671. const mapping = StyleMapping.get(key);
  48672. if (mapping === "") {
  48673. continue;
  48674. }
  48675. let newValue = value;
  48676. if (mapping) {
  48677. newValue = typeof mapping === "string" ? mapping : mapping(value, original);
  48678. }
  48679. if (key.endsWith("scale")) {
  48680. style.transform = style.transform ? `${style[key]} ${newValue}` : newValue;
  48681. } else {
  48682. style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue;
  48683. }
  48684. }
  48685. if (style.fontFamily) {
  48686. setFontFamily({
  48687. typeface: style.fontFamily,
  48688. weight: style.fontWeight || "normal",
  48689. posture: style.fontStyle || "normal",
  48690. size: original.fontSize || 0
  48691. }, node, node[$globalData].fontFinder, style);
  48692. }
  48693. if (richText && style.verticalAlign && style.verticalAlign !== "0px" && style.fontSize) {
  48694. const SUB_SUPER_SCRIPT_FACTOR = 0.583;
  48695. const VERTICAL_FACTOR = 0.333;
  48696. const fontSize = getMeasurement(style.fontSize);
  48697. style.fontSize = measureToString(fontSize * SUB_SUPER_SCRIPT_FACTOR);
  48698. style.verticalAlign = measureToString(Math.sign(getMeasurement(style.verticalAlign)) * fontSize * VERTICAL_FACTOR);
  48699. }
  48700. if (richText && style.fontSize) {
  48701. style.fontSize = `calc(${style.fontSize} * var(--scale-factor))`;
  48702. }
  48703. fixTextIndent(style);
  48704. return style;
  48705. }
  48706. function checkStyle(node) {
  48707. if (!node.style) {
  48708. return "";
  48709. }
  48710. return node.style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(([key, value]) => {
  48711. if (key === "font-family") {
  48712. node[$globalData].usedTypefaces.add(value);
  48713. }
  48714. return VALID_STYLES.has(key);
  48715. }).map(kv => kv.join(":")).join(";");
  48716. }
  48717. const NoWhites = new Set(["body", "html"]);
  48718. class XhtmlObject extends XmlObject {
  48719. constructor(attributes, name) {
  48720. super(XHTML_NS_ID, name);
  48721. this[$richText] = false;
  48722. this.style = attributes.style || "";
  48723. }
  48724. [$clean](builder) {
  48725. super[$clean](builder);
  48726. this.style = checkStyle(this);
  48727. }
  48728. [$acceptWhitespace]() {
  48729. return !NoWhites.has(this[$nodeName]);
  48730. }
  48731. [$onText](str, richText = false) {
  48732. if (!richText) {
  48733. str = str.replaceAll(crlfRegExp, "");
  48734. if (!this.style.includes("xfa-spacerun:yes")) {
  48735. str = str.replaceAll(spacesRegExp, " ");
  48736. }
  48737. } else {
  48738. this[$richText] = true;
  48739. }
  48740. if (str) {
  48741. this[$content] += str;
  48742. }
  48743. }
  48744. [$pushGlyphs](measure, mustPop = true) {
  48745. const xfaFont = Object.create(null);
  48746. const margin = {
  48747. top: NaN,
  48748. bottom: NaN,
  48749. left: NaN,
  48750. right: NaN
  48751. };
  48752. let lineHeight = null;
  48753. for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) {
  48754. switch (key) {
  48755. case "font-family":
  48756. xfaFont.typeface = stripQuotes(value);
  48757. break;
  48758. case "font-size":
  48759. xfaFont.size = getMeasurement(value);
  48760. break;
  48761. case "font-weight":
  48762. xfaFont.weight = value;
  48763. break;
  48764. case "font-style":
  48765. xfaFont.posture = value;
  48766. break;
  48767. case "letter-spacing":
  48768. xfaFont.letterSpacing = getMeasurement(value);
  48769. break;
  48770. case "margin":
  48771. const values = value.split(/ \t/).map(x => getMeasurement(x));
  48772. switch (values.length) {
  48773. case 1:
  48774. margin.top = margin.bottom = margin.left = margin.right = values[0];
  48775. break;
  48776. case 2:
  48777. margin.top = margin.bottom = values[0];
  48778. margin.left = margin.right = values[1];
  48779. break;
  48780. case 3:
  48781. margin.top = values[0];
  48782. margin.bottom = values[2];
  48783. margin.left = margin.right = values[1];
  48784. break;
  48785. case 4:
  48786. margin.top = values[0];
  48787. margin.left = values[1];
  48788. margin.bottom = values[2];
  48789. margin.right = values[3];
  48790. break;
  48791. }
  48792. break;
  48793. case "margin-top":
  48794. margin.top = getMeasurement(value);
  48795. break;
  48796. case "margin-bottom":
  48797. margin.bottom = getMeasurement(value);
  48798. break;
  48799. case "margin-left":
  48800. margin.left = getMeasurement(value);
  48801. break;
  48802. case "margin-right":
  48803. margin.right = getMeasurement(value);
  48804. break;
  48805. case "line-height":
  48806. lineHeight = getMeasurement(value);
  48807. break;
  48808. }
  48809. }
  48810. measure.pushData(xfaFont, margin, lineHeight);
  48811. if (this[$content]) {
  48812. measure.addString(this[$content]);
  48813. } else {
  48814. for (const child of this[$getChildren]()) {
  48815. if (child[$nodeName] === "#text") {
  48816. measure.addString(child[$content]);
  48817. continue;
  48818. }
  48819. child[$pushGlyphs](measure);
  48820. }
  48821. }
  48822. if (mustPop) {
  48823. measure.popFont();
  48824. }
  48825. }
  48826. [$toHTML](availableSpace) {
  48827. const children = [];
  48828. this[$extra] = {
  48829. children
  48830. };
  48831. this[$childrenToHTML]({});
  48832. if (children.length === 0 && !this[$content]) {
  48833. return HTMLResult.EMPTY;
  48834. }
  48835. let value;
  48836. if (this[$richText]) {
  48837. value = this[$content] ? this[$content].replaceAll(crlfForRichTextRegExp, "\n") : undefined;
  48838. } else {
  48839. value = this[$content] || undefined;
  48840. }
  48841. return HTMLResult.success({
  48842. name: this[$nodeName],
  48843. attributes: {
  48844. href: this.href,
  48845. style: mapStyle(this.style, this, this[$richText])
  48846. },
  48847. children,
  48848. value
  48849. });
  48850. }
  48851. }
  48852. class A extends XhtmlObject {
  48853. constructor(attributes) {
  48854. super(attributes, "a");
  48855. this.href = fixURL(attributes.href) || "";
  48856. }
  48857. }
  48858. class B extends XhtmlObject {
  48859. constructor(attributes) {
  48860. super(attributes, "b");
  48861. }
  48862. [$pushGlyphs](measure) {
  48863. measure.pushFont({
  48864. weight: "bold"
  48865. });
  48866. super[$pushGlyphs](measure);
  48867. measure.popFont();
  48868. }
  48869. }
  48870. class Body extends XhtmlObject {
  48871. constructor(attributes) {
  48872. super(attributes, "body");
  48873. }
  48874. [$toHTML](availableSpace) {
  48875. const res = super[$toHTML](availableSpace);
  48876. const {
  48877. html
  48878. } = res;
  48879. if (!html) {
  48880. return HTMLResult.EMPTY;
  48881. }
  48882. html.name = "div";
  48883. html.attributes.class = ["xfaRich"];
  48884. return res;
  48885. }
  48886. }
  48887. class Br extends XhtmlObject {
  48888. constructor(attributes) {
  48889. super(attributes, "br");
  48890. }
  48891. [$text]() {
  48892. return "\n";
  48893. }
  48894. [$pushGlyphs](measure) {
  48895. measure.addString("\n");
  48896. }
  48897. [$toHTML](availableSpace) {
  48898. return HTMLResult.success({
  48899. name: "br"
  48900. });
  48901. }
  48902. }
  48903. class Html extends XhtmlObject {
  48904. constructor(attributes) {
  48905. super(attributes, "html");
  48906. }
  48907. [$toHTML](availableSpace) {
  48908. const children = [];
  48909. this[$extra] = {
  48910. children
  48911. };
  48912. this[$childrenToHTML]({});
  48913. if (children.length === 0) {
  48914. return HTMLResult.success({
  48915. name: "div",
  48916. attributes: {
  48917. class: ["xfaRich"],
  48918. style: {}
  48919. },
  48920. value: this[$content] || ""
  48921. });
  48922. }
  48923. if (children.length === 1) {
  48924. const child = children[0];
  48925. if (child.attributes?.class.includes("xfaRich")) {
  48926. return HTMLResult.success(child);
  48927. }
  48928. }
  48929. return HTMLResult.success({
  48930. name: "div",
  48931. attributes: {
  48932. class: ["xfaRich"],
  48933. style: {}
  48934. },
  48935. children
  48936. });
  48937. }
  48938. }
  48939. class I extends XhtmlObject {
  48940. constructor(attributes) {
  48941. super(attributes, "i");
  48942. }
  48943. [$pushGlyphs](measure) {
  48944. measure.pushFont({
  48945. posture: "italic"
  48946. });
  48947. super[$pushGlyphs](measure);
  48948. measure.popFont();
  48949. }
  48950. }
  48951. class Li extends XhtmlObject {
  48952. constructor(attributes) {
  48953. super(attributes, "li");
  48954. }
  48955. }
  48956. class Ol extends XhtmlObject {
  48957. constructor(attributes) {
  48958. super(attributes, "ol");
  48959. }
  48960. }
  48961. class P extends XhtmlObject {
  48962. constructor(attributes) {
  48963. super(attributes, "p");
  48964. }
  48965. [$pushGlyphs](measure) {
  48966. super[$pushGlyphs](measure, false);
  48967. measure.addString("\n");
  48968. measure.addPara();
  48969. measure.popFont();
  48970. }
  48971. [$text]() {
  48972. const siblings = this[$getParent]()[$getChildren]();
  48973. if (siblings.at(-1) === this) {
  48974. return super[$text]();
  48975. }
  48976. return super[$text]() + "\n";
  48977. }
  48978. }
  48979. class Span extends XhtmlObject {
  48980. constructor(attributes) {
  48981. super(attributes, "span");
  48982. }
  48983. }
  48984. class Sub extends XhtmlObject {
  48985. constructor(attributes) {
  48986. super(attributes, "sub");
  48987. }
  48988. }
  48989. class Sup extends XhtmlObject {
  48990. constructor(attributes) {
  48991. super(attributes, "sup");
  48992. }
  48993. }
  48994. class Ul extends XhtmlObject {
  48995. constructor(attributes) {
  48996. super(attributes, "ul");
  48997. }
  48998. }
  48999. class XhtmlNamespace {
  49000. static [$buildXFAObject](name, attributes) {
  49001. if (XhtmlNamespace.hasOwnProperty(name)) {
  49002. return XhtmlNamespace[name](attributes);
  49003. }
  49004. return undefined;
  49005. }
  49006. static a(attributes) {
  49007. return new A(attributes);
  49008. }
  49009. static b(attributes) {
  49010. return new B(attributes);
  49011. }
  49012. static body(attributes) {
  49013. return new Body(attributes);
  49014. }
  49015. static br(attributes) {
  49016. return new Br(attributes);
  49017. }
  49018. static html(attributes) {
  49019. return new Html(attributes);
  49020. }
  49021. static i(attributes) {
  49022. return new I(attributes);
  49023. }
  49024. static li(attributes) {
  49025. return new Li(attributes);
  49026. }
  49027. static ol(attributes) {
  49028. return new Ol(attributes);
  49029. }
  49030. static p(attributes) {
  49031. return new P(attributes);
  49032. }
  49033. static span(attributes) {
  49034. return new Span(attributes);
  49035. }
  49036. static sub(attributes) {
  49037. return new Sub(attributes);
  49038. }
  49039. static sup(attributes) {
  49040. return new Sup(attributes);
  49041. }
  49042. static ul(attributes) {
  49043. return new Ul(attributes);
  49044. }
  49045. }
  49046. ;// ./src/core/xfa/setup.js
  49047. const NamespaceSetUp = {
  49048. config: ConfigNamespace,
  49049. connection: ConnectionSetNamespace,
  49050. datasets: DatasetsNamespace,
  49051. localeSet: LocaleSetNamespace,
  49052. signature: SignatureNamespace,
  49053. stylesheet: StylesheetNamespace,
  49054. template: TemplateNamespace,
  49055. xdp: XdpNamespace,
  49056. xhtml: XhtmlNamespace
  49057. };
  49058. ;// ./src/core/xfa/unknown.js
  49059. class UnknownNamespace {
  49060. constructor(nsId) {
  49061. this.namespaceId = nsId;
  49062. }
  49063. [$buildXFAObject](name, attributes) {
  49064. return new XmlObject(this.namespaceId, name, attributes);
  49065. }
  49066. }
  49067. ;// ./src/core/xfa/builder.js
  49068. class Root extends XFAObject {
  49069. constructor(ids) {
  49070. super(-1, "root", Object.create(null));
  49071. this.element = null;
  49072. this[$ids] = ids;
  49073. }
  49074. [$onChild](child) {
  49075. this.element = child;
  49076. return true;
  49077. }
  49078. [$finalize]() {
  49079. super[$finalize]();
  49080. if (this.element.template instanceof Template) {
  49081. this[$ids].set($root, this.element);
  49082. this.element.template[$resolvePrototypes](this[$ids]);
  49083. this.element.template[$ids] = this[$ids];
  49084. }
  49085. }
  49086. }
  49087. class Empty extends XFAObject {
  49088. constructor() {
  49089. super(-1, "", Object.create(null));
  49090. }
  49091. [$onChild](_) {
  49092. return false;
  49093. }
  49094. }
  49095. class Builder {
  49096. constructor(rootNameSpace = null) {
  49097. this._namespaceStack = [];
  49098. this._nsAgnosticLevel = 0;
  49099. this._namespacePrefixes = new Map();
  49100. this._namespaces = new Map();
  49101. this._nextNsId = Math.max(...Object.values(NamespaceIds).map(({
  49102. id
  49103. }) => id));
  49104. this._currentNamespace = rootNameSpace || new UnknownNamespace(++this._nextNsId);
  49105. }
  49106. buildRoot(ids) {
  49107. return new Root(ids);
  49108. }
  49109. build({
  49110. nsPrefix,
  49111. name,
  49112. attributes,
  49113. namespace,
  49114. prefixes
  49115. }) {
  49116. const hasNamespaceDef = namespace !== null;
  49117. if (hasNamespaceDef) {
  49118. this._namespaceStack.push(this._currentNamespace);
  49119. this._currentNamespace = this._searchNamespace(namespace);
  49120. }
  49121. if (prefixes) {
  49122. this._addNamespacePrefix(prefixes);
  49123. }
  49124. if (attributes.hasOwnProperty($nsAttributes)) {
  49125. const dataTemplate = NamespaceSetUp.datasets;
  49126. const nsAttrs = attributes[$nsAttributes];
  49127. let xfaAttrs = null;
  49128. for (const [ns, attrs] of Object.entries(nsAttrs)) {
  49129. const nsToUse = this._getNamespaceToUse(ns);
  49130. if (nsToUse === dataTemplate) {
  49131. xfaAttrs = {
  49132. xfa: attrs
  49133. };
  49134. break;
  49135. }
  49136. }
  49137. if (xfaAttrs) {
  49138. attributes[$nsAttributes] = xfaAttrs;
  49139. } else {
  49140. delete attributes[$nsAttributes];
  49141. }
  49142. }
  49143. const namespaceToUse = this._getNamespaceToUse(nsPrefix);
  49144. const node = namespaceToUse?.[$buildXFAObject](name, attributes) || new Empty();
  49145. if (node[$isNsAgnostic]()) {
  49146. this._nsAgnosticLevel++;
  49147. }
  49148. if (hasNamespaceDef || prefixes || node[$isNsAgnostic]()) {
  49149. node[$cleanup] = {
  49150. hasNamespace: hasNamespaceDef,
  49151. prefixes,
  49152. nsAgnostic: node[$isNsAgnostic]()
  49153. };
  49154. }
  49155. return node;
  49156. }
  49157. isNsAgnostic() {
  49158. return this._nsAgnosticLevel > 0;
  49159. }
  49160. _searchNamespace(nsName) {
  49161. let ns = this._namespaces.get(nsName);
  49162. if (ns) {
  49163. return ns;
  49164. }
  49165. for (const [name, {
  49166. check
  49167. }] of Object.entries(NamespaceIds)) {
  49168. if (check(nsName)) {
  49169. ns = NamespaceSetUp[name];
  49170. if (ns) {
  49171. this._namespaces.set(nsName, ns);
  49172. return ns;
  49173. }
  49174. break;
  49175. }
  49176. }
  49177. ns = new UnknownNamespace(++this._nextNsId);
  49178. this._namespaces.set(nsName, ns);
  49179. return ns;
  49180. }
  49181. _addNamespacePrefix(prefixes) {
  49182. for (const {
  49183. prefix,
  49184. value
  49185. } of prefixes) {
  49186. const namespace = this._searchNamespace(value);
  49187. let prefixStack = this._namespacePrefixes.get(prefix);
  49188. if (!prefixStack) {
  49189. prefixStack = [];
  49190. this._namespacePrefixes.set(prefix, prefixStack);
  49191. }
  49192. prefixStack.push(namespace);
  49193. }
  49194. }
  49195. _getNamespaceToUse(prefix) {
  49196. if (!prefix) {
  49197. return this._currentNamespace;
  49198. }
  49199. const prefixStack = this._namespacePrefixes.get(prefix);
  49200. if (prefixStack?.length > 0) {
  49201. return prefixStack.at(-1);
  49202. }
  49203. warn(`Unknown namespace prefix: ${prefix}.`);
  49204. return null;
  49205. }
  49206. clean(data) {
  49207. const {
  49208. hasNamespace,
  49209. prefixes,
  49210. nsAgnostic
  49211. } = data;
  49212. if (hasNamespace) {
  49213. this._currentNamespace = this._namespaceStack.pop();
  49214. }
  49215. if (prefixes) {
  49216. prefixes.forEach(({
  49217. prefix
  49218. }) => {
  49219. this._namespacePrefixes.get(prefix).pop();
  49220. });
  49221. }
  49222. if (nsAgnostic) {
  49223. this._nsAgnosticLevel--;
  49224. }
  49225. }
  49226. }
  49227. ;// ./src/core/xfa/parser.js
  49228. class XFAParser extends XMLParserBase {
  49229. constructor(rootNameSpace = null, richText = false) {
  49230. super();
  49231. this._builder = new Builder(rootNameSpace);
  49232. this._stack = [];
  49233. this._globalData = {
  49234. usedTypefaces: new Set()
  49235. };
  49236. this._ids = new Map();
  49237. this._current = this._builder.buildRoot(this._ids);
  49238. this._errorCode = XMLParserErrorCode.NoError;
  49239. this._whiteRegex = /^\s+$/;
  49240. this._nbsps = /\xa0+/g;
  49241. this._richText = richText;
  49242. }
  49243. parse(data) {
  49244. this.parseXml(data);
  49245. if (this._errorCode !== XMLParserErrorCode.NoError) {
  49246. return undefined;
  49247. }
  49248. this._current[$finalize]();
  49249. return this._current.element;
  49250. }
  49251. onText(text) {
  49252. text = text.replace(this._nbsps, match => match.slice(1) + " ");
  49253. if (this._richText || this._current[$acceptWhitespace]()) {
  49254. this._current[$onText](text, this._richText);
  49255. return;
  49256. }
  49257. if (this._whiteRegex.test(text)) {
  49258. return;
  49259. }
  49260. this._current[$onText](text.trim());
  49261. }
  49262. onCdata(text) {
  49263. this._current[$onText](text);
  49264. }
  49265. _mkAttributes(attributes, tagName) {
  49266. let namespace = null;
  49267. let prefixes = null;
  49268. const attributeObj = Object.create({});
  49269. for (const {
  49270. name,
  49271. value
  49272. } of attributes) {
  49273. if (name === "xmlns") {
  49274. if (!namespace) {
  49275. namespace = value;
  49276. } else {
  49277. warn(`XFA - multiple namespace definition in <${tagName}>`);
  49278. }
  49279. } else if (name.startsWith("xmlns:")) {
  49280. const prefix = name.substring("xmlns:".length);
  49281. if (!prefixes) {
  49282. prefixes = [];
  49283. }
  49284. prefixes.push({
  49285. prefix,
  49286. value
  49287. });
  49288. } else {
  49289. const i = name.indexOf(":");
  49290. if (i === -1) {
  49291. attributeObj[name] = value;
  49292. } else {
  49293. let nsAttrs = attributeObj[$nsAttributes];
  49294. if (!nsAttrs) {
  49295. nsAttrs = attributeObj[$nsAttributes] = Object.create(null);
  49296. }
  49297. const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
  49298. const attrs = nsAttrs[ns] ||= Object.create(null);
  49299. attrs[attrName] = value;
  49300. }
  49301. }
  49302. }
  49303. return [namespace, prefixes, attributeObj];
  49304. }
  49305. _getNameAndPrefix(name, nsAgnostic) {
  49306. const i = name.indexOf(":");
  49307. if (i === -1) {
  49308. return [name, null];
  49309. }
  49310. return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)];
  49311. }
  49312. onBeginElement(tagName, attributes, isEmpty) {
  49313. const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName);
  49314. const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic());
  49315. const node = this._builder.build({
  49316. nsPrefix,
  49317. name,
  49318. attributes: attributesObj,
  49319. namespace,
  49320. prefixes
  49321. });
  49322. node[$globalData] = this._globalData;
  49323. if (isEmpty) {
  49324. node[$finalize]();
  49325. if (this._current[$onChild](node)) {
  49326. node[$setId](this._ids);
  49327. }
  49328. node[$clean](this._builder);
  49329. return;
  49330. }
  49331. this._stack.push(this._current);
  49332. this._current = node;
  49333. }
  49334. onEndElement(name) {
  49335. const node = this._current;
  49336. if (node[$isCDATAXml]() && typeof node[$content] === "string") {
  49337. const parser = new XFAParser();
  49338. parser._globalData = this._globalData;
  49339. const root = parser.parse(node[$content]);
  49340. node[$content] = null;
  49341. node[$onChild](root);
  49342. }
  49343. node[$finalize]();
  49344. this._current = this._stack.pop();
  49345. if (this._current[$onChild](node)) {
  49346. node[$setId](this._ids);
  49347. }
  49348. node[$clean](this._builder);
  49349. }
  49350. onError(code) {
  49351. this._errorCode = code;
  49352. }
  49353. }
  49354. ;// ./src/core/xfa/factory.js
  49355. class XFAFactory {
  49356. constructor(data) {
  49357. try {
  49358. this.root = new XFAParser().parse(XFAFactory._createDocument(data));
  49359. const binder = new Binder(this.root);
  49360. this.form = binder.bind();
  49361. this.dataHandler = new DataHandler(this.root, binder.getData());
  49362. this.form[$globalData].template = this.form;
  49363. } catch (e) {
  49364. warn(`XFA - an error occurred during parsing and binding: ${e}`);
  49365. }
  49366. }
  49367. isValid() {
  49368. return this.root && this.form;
  49369. }
  49370. _createPagesHelper() {
  49371. const iterator = this.form[$toPages]();
  49372. return new Promise((resolve, reject) => {
  49373. const nextIteration = () => {
  49374. try {
  49375. const value = iterator.next();
  49376. if (value.done) {
  49377. resolve(value.value);
  49378. } else {
  49379. setTimeout(nextIteration, 0);
  49380. }
  49381. } catch (e) {
  49382. reject(e);
  49383. }
  49384. };
  49385. setTimeout(nextIteration, 0);
  49386. });
  49387. }
  49388. async _createPages() {
  49389. try {
  49390. this.pages = await this._createPagesHelper();
  49391. this.dims = this.pages.children.map(c => {
  49392. const {
  49393. width,
  49394. height
  49395. } = c.attributes.style;
  49396. return [0, 0, parseInt(width), parseInt(height)];
  49397. });
  49398. } catch (e) {
  49399. warn(`XFA - an error occurred during layout: ${e}`);
  49400. }
  49401. }
  49402. getBoundingBox(pageIndex) {
  49403. return this.dims[pageIndex];
  49404. }
  49405. async getNumPages() {
  49406. if (!this.pages) {
  49407. await this._createPages();
  49408. }
  49409. return this.dims.length;
  49410. }
  49411. setImages(images) {
  49412. this.form[$globalData].images = images;
  49413. }
  49414. setFonts(fonts) {
  49415. this.form[$globalData].fontFinder = new FontFinder(fonts);
  49416. const missingFonts = [];
  49417. for (let typeface of this.form[$globalData].usedTypefaces) {
  49418. typeface = stripQuotes(typeface);
  49419. const font = this.form[$globalData].fontFinder.find(typeface);
  49420. if (!font) {
  49421. missingFonts.push(typeface);
  49422. }
  49423. }
  49424. if (missingFonts.length > 0) {
  49425. return missingFonts;
  49426. }
  49427. return null;
  49428. }
  49429. appendFonts(fonts, reallyMissingFonts) {
  49430. this.form[$globalData].fontFinder.add(fonts, reallyMissingFonts);
  49431. }
  49432. async getPages() {
  49433. if (!this.pages) {
  49434. await this._createPages();
  49435. }
  49436. const pages = this.pages;
  49437. this.pages = null;
  49438. return pages;
  49439. }
  49440. serializeData(storage) {
  49441. return this.dataHandler.serialize(storage);
  49442. }
  49443. static _createDocument(data) {
  49444. if (!data["/xdp:xdp"]) {
  49445. return data["xdp:xdp"];
  49446. }
  49447. return Object.values(data).join("");
  49448. }
  49449. static getRichTextAsHtml(rc) {
  49450. if (!rc || typeof rc !== "string") {
  49451. return null;
  49452. }
  49453. try {
  49454. let root = new XFAParser(XhtmlNamespace, true).parse(rc);
  49455. if (!["body", "xhtml"].includes(root[$nodeName])) {
  49456. const newRoot = XhtmlNamespace.body({});
  49457. newRoot[$appendChild](root);
  49458. root = newRoot;
  49459. }
  49460. const result = root[$toHTML]();
  49461. if (!result.success) {
  49462. return null;
  49463. }
  49464. const {
  49465. html
  49466. } = result;
  49467. const {
  49468. attributes
  49469. } = html;
  49470. if (attributes) {
  49471. if (attributes.class) {
  49472. attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa"));
  49473. }
  49474. attributes.dir = "auto";
  49475. }
  49476. return {
  49477. html,
  49478. str: root[$text]()
  49479. };
  49480. } catch (e) {
  49481. warn(`XFA - an error occurred during parsing of rich text: ${e}`);
  49482. }
  49483. return null;
  49484. }
  49485. }
  49486. ;// ./src/core/annotation.js
  49487. class AnnotationFactory {
  49488. static createGlobals(pdfManager) {
  49489. return Promise.all([pdfManager.ensureCatalog("acroForm"), pdfManager.ensureDoc("xfaDatasets"), pdfManager.ensureCatalog("structTreeRoot"), pdfManager.ensureCatalog("baseUrl"), pdfManager.ensureCatalog("attachments")]).then(([acroForm, xfaDatasets, structTreeRoot, baseUrl, attachments]) => {
  49490. return {
  49491. pdfManager,
  49492. acroForm: acroForm instanceof Dict ? acroForm : Dict.empty,
  49493. xfaDatasets,
  49494. structTreeRoot,
  49495. baseUrl,
  49496. attachments
  49497. };
  49498. }, reason => {
  49499. warn(`createGlobals: "${reason}".`);
  49500. return null;
  49501. });
  49502. }
  49503. static async create(xref, ref, annotationGlobals, idFactory, collectFields, orphanFields, pageRef) {
  49504. const pageIndex = collectFields ? await this._getPageIndex(xref, ref, annotationGlobals.pdfManager) : null;
  49505. return annotationGlobals.pdfManager.ensure(this, "_create", [xref, ref, annotationGlobals, idFactory, collectFields, orphanFields, pageIndex, pageRef]);
  49506. }
  49507. static _create(xref, ref, annotationGlobals, idFactory, collectFields = false, orphanFields = null, pageIndex = null, pageRef = null) {
  49508. const dict = xref.fetchIfRef(ref);
  49509. if (!(dict instanceof Dict)) {
  49510. return undefined;
  49511. }
  49512. const {
  49513. acroForm,
  49514. pdfManager
  49515. } = annotationGlobals;
  49516. const id = ref instanceof Ref ? ref.toString() : `annot_${idFactory.createObjId()}`;
  49517. let subtype = dict.get("Subtype");
  49518. subtype = subtype instanceof Name ? subtype.name : null;
  49519. const parameters = {
  49520. xref,
  49521. ref,
  49522. dict,
  49523. subtype,
  49524. id,
  49525. annotationGlobals,
  49526. collectFields,
  49527. orphanFields,
  49528. needAppearances: !collectFields && acroForm.get("NeedAppearances") === true,
  49529. pageIndex,
  49530. evaluatorOptions: pdfManager.evaluatorOptions,
  49531. pageRef
  49532. };
  49533. switch (subtype) {
  49534. case "Link":
  49535. return new LinkAnnotation(parameters);
  49536. case "Text":
  49537. return new TextAnnotation(parameters);
  49538. case "Widget":
  49539. let fieldType = getInheritableProperty({
  49540. dict,
  49541. key: "FT"
  49542. });
  49543. fieldType = fieldType instanceof Name ? fieldType.name : null;
  49544. switch (fieldType) {
  49545. case "Tx":
  49546. return new TextWidgetAnnotation(parameters);
  49547. case "Btn":
  49548. return new ButtonWidgetAnnotation(parameters);
  49549. case "Ch":
  49550. return new ChoiceWidgetAnnotation(parameters);
  49551. case "Sig":
  49552. return new SignatureWidgetAnnotation(parameters);
  49553. }
  49554. warn(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type.");
  49555. return new WidgetAnnotation(parameters);
  49556. case "Popup":
  49557. return new PopupAnnotation(parameters);
  49558. case "FreeText":
  49559. return new FreeTextAnnotation(parameters);
  49560. case "Line":
  49561. return new LineAnnotation(parameters);
  49562. case "Square":
  49563. return new SquareAnnotation(parameters);
  49564. case "Circle":
  49565. return new CircleAnnotation(parameters);
  49566. case "PolyLine":
  49567. return new PolylineAnnotation(parameters);
  49568. case "Polygon":
  49569. return new PolygonAnnotation(parameters);
  49570. case "Caret":
  49571. return new CaretAnnotation(parameters);
  49572. case "Ink":
  49573. return new InkAnnotation(parameters);
  49574. case "Highlight":
  49575. return new HighlightAnnotation(parameters);
  49576. case "Underline":
  49577. return new UnderlineAnnotation(parameters);
  49578. case "Squiggly":
  49579. return new SquigglyAnnotation(parameters);
  49580. case "StrikeOut":
  49581. return new StrikeOutAnnotation(parameters);
  49582. case "Stamp":
  49583. return new StampAnnotation(parameters);
  49584. case "FileAttachment":
  49585. return new FileAttachmentAnnotation(parameters);
  49586. default:
  49587. if (!collectFields) {
  49588. if (!subtype) {
  49589. warn("Annotation is missing the required /Subtype.");
  49590. } else {
  49591. warn(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation.");
  49592. }
  49593. }
  49594. return new Annotation(parameters);
  49595. }
  49596. }
  49597. static async _getPageIndex(xref, ref, pdfManager) {
  49598. try {
  49599. const annotDict = await xref.fetchIfRefAsync(ref);
  49600. if (!(annotDict instanceof Dict)) {
  49601. return -1;
  49602. }
  49603. const pageRef = annotDict.getRaw("P");
  49604. if (pageRef instanceof Ref) {
  49605. try {
  49606. const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  49607. return pageIndex;
  49608. } catch (ex) {
  49609. info(`_getPageIndex -- not a valid page reference: "${ex}".`);
  49610. }
  49611. }
  49612. if (annotDict.has("Kids")) {
  49613. return -1;
  49614. }
  49615. const numPages = await pdfManager.ensureDoc("numPages");
  49616. for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
  49617. const page = await pdfManager.getPage(pageIndex);
  49618. const annotations = await pdfManager.ensure(page, "annotations");
  49619. for (const annotRef of annotations) {
  49620. if (annotRef instanceof Ref && isRefsEqual(annotRef, ref)) {
  49621. return pageIndex;
  49622. }
  49623. }
  49624. }
  49625. } catch (ex) {
  49626. warn(`_getPageIndex: "${ex}".`);
  49627. }
  49628. return -1;
  49629. }
  49630. static generateImages(annotations, xref, isOffscreenCanvasSupported) {
  49631. if (!isOffscreenCanvasSupported) {
  49632. warn("generateImages: OffscreenCanvas is not supported, cannot save or print some annotations with images.");
  49633. return null;
  49634. }
  49635. let imagePromises;
  49636. for (const {
  49637. bitmapId,
  49638. bitmap
  49639. } of annotations) {
  49640. if (!bitmap) {
  49641. continue;
  49642. }
  49643. imagePromises ||= new Map();
  49644. imagePromises.set(bitmapId, StampAnnotation.createImage(bitmap, xref));
  49645. }
  49646. return imagePromises;
  49647. }
  49648. static async saveNewAnnotations(evaluator, task, annotations, imagePromises) {
  49649. const xref = evaluator.xref;
  49650. let baseFontRef;
  49651. const dependencies = [];
  49652. const promises = [];
  49653. const {
  49654. isOffscreenCanvasSupported
  49655. } = evaluator.options;
  49656. for (const annotation of annotations) {
  49657. if (annotation.deleted) {
  49658. continue;
  49659. }
  49660. switch (annotation.annotationType) {
  49661. case AnnotationEditorType.FREETEXT:
  49662. if (!baseFontRef) {
  49663. const baseFont = new Dict(xref);
  49664. baseFont.set("BaseFont", Name.get("Helvetica"));
  49665. baseFont.set("Type", Name.get("Font"));
  49666. baseFont.set("Subtype", Name.get("Type1"));
  49667. baseFont.set("Encoding", Name.get("WinAnsiEncoding"));
  49668. const buffer = [];
  49669. baseFontRef = xref.getNewTemporaryRef();
  49670. await writeObject(baseFontRef, baseFont, buffer, xref);
  49671. dependencies.push({
  49672. ref: baseFontRef,
  49673. data: buffer.join("")
  49674. });
  49675. }
  49676. promises.push(FreeTextAnnotation.createNewAnnotation(xref, annotation, dependencies, {
  49677. evaluator,
  49678. task,
  49679. baseFontRef
  49680. }));
  49681. break;
  49682. case AnnotationEditorType.HIGHLIGHT:
  49683. if (annotation.quadPoints) {
  49684. promises.push(HighlightAnnotation.createNewAnnotation(xref, annotation, dependencies));
  49685. } else {
  49686. promises.push(InkAnnotation.createNewAnnotation(xref, annotation, dependencies));
  49687. }
  49688. break;
  49689. case AnnotationEditorType.INK:
  49690. promises.push(InkAnnotation.createNewAnnotation(xref, annotation, dependencies));
  49691. break;
  49692. case AnnotationEditorType.STAMP:
  49693. const image = isOffscreenCanvasSupported ? await imagePromises?.get(annotation.bitmapId) : null;
  49694. if (image?.imageStream) {
  49695. const {
  49696. imageStream,
  49697. smaskStream
  49698. } = image;
  49699. const buffer = [];
  49700. if (smaskStream) {
  49701. const smaskRef = xref.getNewTemporaryRef();
  49702. await writeObject(smaskRef, smaskStream, buffer, xref);
  49703. dependencies.push({
  49704. ref: smaskRef,
  49705. data: buffer.join("")
  49706. });
  49707. imageStream.dict.set("SMask", smaskRef);
  49708. buffer.length = 0;
  49709. }
  49710. const imageRef = image.imageRef = xref.getNewTemporaryRef();
  49711. await writeObject(imageRef, imageStream, buffer, xref);
  49712. dependencies.push({
  49713. ref: imageRef,
  49714. data: buffer.join("")
  49715. });
  49716. image.imageStream = image.smaskStream = null;
  49717. }
  49718. promises.push(StampAnnotation.createNewAnnotation(xref, annotation, dependencies, {
  49719. image
  49720. }));
  49721. break;
  49722. }
  49723. }
  49724. return {
  49725. annotations: await Promise.all(promises),
  49726. dependencies
  49727. };
  49728. }
  49729. static async printNewAnnotations(annotationGlobals, evaluator, task, annotations, imagePromises) {
  49730. if (!annotations) {
  49731. return null;
  49732. }
  49733. const {
  49734. options,
  49735. xref
  49736. } = evaluator;
  49737. const promises = [];
  49738. for (const annotation of annotations) {
  49739. if (annotation.deleted) {
  49740. continue;
  49741. }
  49742. switch (annotation.annotationType) {
  49743. case AnnotationEditorType.FREETEXT:
  49744. promises.push(FreeTextAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, {
  49745. evaluator,
  49746. task,
  49747. evaluatorOptions: options
  49748. }));
  49749. break;
  49750. case AnnotationEditorType.HIGHLIGHT:
  49751. if (annotation.quadPoints) {
  49752. promises.push(HighlightAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, {
  49753. evaluatorOptions: options
  49754. }));
  49755. } else {
  49756. promises.push(InkAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, {
  49757. evaluatorOptions: options
  49758. }));
  49759. }
  49760. break;
  49761. case AnnotationEditorType.INK:
  49762. promises.push(InkAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, {
  49763. evaluatorOptions: options
  49764. }));
  49765. break;
  49766. case AnnotationEditorType.STAMP:
  49767. const image = options.isOffscreenCanvasSupported ? await imagePromises?.get(annotation.bitmapId) : null;
  49768. if (image?.imageStream) {
  49769. const {
  49770. imageStream,
  49771. smaskStream
  49772. } = image;
  49773. if (smaskStream) {
  49774. imageStream.dict.set("SMask", smaskStream);
  49775. }
  49776. image.imageRef = new JpegStream(imageStream, imageStream.length);
  49777. image.imageStream = image.smaskStream = null;
  49778. }
  49779. promises.push(StampAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, {
  49780. image,
  49781. evaluatorOptions: options
  49782. }));
  49783. break;
  49784. }
  49785. }
  49786. return Promise.all(promises);
  49787. }
  49788. }
  49789. function getRgbColor(color, defaultColor = new Uint8ClampedArray(3)) {
  49790. if (!Array.isArray(color)) {
  49791. return defaultColor;
  49792. }
  49793. const rgbColor = defaultColor || new Uint8ClampedArray(3);
  49794. switch (color.length) {
  49795. case 0:
  49796. return null;
  49797. case 1:
  49798. ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  49799. return rgbColor;
  49800. case 3:
  49801. ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  49802. return rgbColor;
  49803. case 4:
  49804. ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  49805. return rgbColor;
  49806. default:
  49807. return defaultColor;
  49808. }
  49809. }
  49810. function getPdfColorArray(color) {
  49811. return Array.from(color, c => c / 255);
  49812. }
  49813. function getQuadPoints(dict, rect) {
  49814. const quadPoints = dict.getArray("QuadPoints");
  49815. if (!isNumberArray(quadPoints, null) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
  49816. return null;
  49817. }
  49818. const newQuadPoints = new Float32Array(quadPoints.length);
  49819. for (let i = 0, ii = quadPoints.length; i < ii; i += 8) {
  49820. const [x1, y1, x2, y2, x3, y3, x4, y4] = quadPoints.slice(i, i + 8);
  49821. const minX = Math.min(x1, x2, x3, x4);
  49822. const maxX = Math.max(x1, x2, x3, x4);
  49823. const minY = Math.min(y1, y2, y3, y4);
  49824. const maxY = Math.max(y1, y2, y3, y4);
  49825. if (rect !== null && (minX < rect[0] || maxX > rect[2] || minY < rect[1] || maxY > rect[3])) {
  49826. return null;
  49827. }
  49828. newQuadPoints.set([minX, maxY, maxX, maxY, minX, minY, maxX, minY], i);
  49829. }
  49830. return newQuadPoints;
  49831. }
  49832. function getTransformMatrix(rect, bbox, matrix) {
  49833. const [minX, minY, maxX, maxY] = Util.getAxialAlignedBoundingBox(bbox, matrix);
  49834. if (minX === maxX || minY === maxY) {
  49835. return [1, 0, 0, 1, rect[0], rect[1]];
  49836. }
  49837. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  49838. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  49839. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  49840. }
  49841. class Annotation {
  49842. constructor(params) {
  49843. const {
  49844. dict,
  49845. xref,
  49846. annotationGlobals,
  49847. ref,
  49848. orphanFields
  49849. } = params;
  49850. const parentRef = orphanFields?.get(ref);
  49851. if (parentRef) {
  49852. dict.set("Parent", parentRef);
  49853. }
  49854. this.setTitle(dict.get("T"));
  49855. this.setContents(dict.get("Contents"));
  49856. this.setModificationDate(dict.get("M"));
  49857. this.setFlags(dict.get("F"));
  49858. this.setRectangle(dict.getArray("Rect"));
  49859. this.setColor(dict.getArray("C"));
  49860. this.setBorderStyle(dict);
  49861. this.setAppearance(dict);
  49862. this.setOptionalContent(dict);
  49863. const MK = dict.get("MK");
  49864. this.setBorderAndBackgroundColors(MK);
  49865. this.setRotation(MK, dict);
  49866. this.ref = params.ref instanceof Ref ? params.ref : null;
  49867. this._streams = [];
  49868. if (this.appearance) {
  49869. this._streams.push(this.appearance);
  49870. }
  49871. const isLocked = !!(this.flags & AnnotationFlag.LOCKED);
  49872. const isContentLocked = !!(this.flags & AnnotationFlag.LOCKEDCONTENTS);
  49873. this.data = {
  49874. annotationFlags: this.flags,
  49875. borderStyle: this.borderStyle,
  49876. color: this.color,
  49877. backgroundColor: this.backgroundColor,
  49878. borderColor: this.borderColor,
  49879. rotation: this.rotation,
  49880. contentsObj: this._contents,
  49881. hasAppearance: !!this.appearance,
  49882. id: params.id,
  49883. modificationDate: this.modificationDate,
  49884. rect: this.rectangle,
  49885. subtype: params.subtype,
  49886. hasOwnCanvas: false,
  49887. noRotate: !!(this.flags & AnnotationFlag.NOROTATE),
  49888. noHTML: isLocked && isContentLocked,
  49889. isEditable: false,
  49890. structParent: -1
  49891. };
  49892. if (annotationGlobals.structTreeRoot) {
  49893. let structParent = dict.get("StructParent");
  49894. this.data.structParent = structParent = Number.isInteger(structParent) && structParent >= 0 ? structParent : -1;
  49895. annotationGlobals.structTreeRoot.addAnnotationIdToPage(params.pageRef, structParent);
  49896. }
  49897. if (params.collectFields) {
  49898. const kids = dict.get("Kids");
  49899. if (Array.isArray(kids)) {
  49900. const kidIds = [];
  49901. for (const kid of kids) {
  49902. if (kid instanceof Ref) {
  49903. kidIds.push(kid.toString());
  49904. }
  49905. }
  49906. if (kidIds.length !== 0) {
  49907. this.data.kidIds = kidIds;
  49908. }
  49909. }
  49910. this.data.actions = collectActions(xref, dict, AnnotationActionEventType);
  49911. this.data.fieldName = this._constructFieldName(dict);
  49912. this.data.pageIndex = params.pageIndex;
  49913. }
  49914. const it = dict.get("IT");
  49915. if (it instanceof Name) {
  49916. this.data.it = it.name;
  49917. }
  49918. this._isOffscreenCanvasSupported = params.evaluatorOptions.isOffscreenCanvasSupported;
  49919. this._fallbackFontDict = null;
  49920. this._needAppearances = false;
  49921. }
  49922. _hasFlag(flags, flag) {
  49923. return !!(flags & flag);
  49924. }
  49925. _buildFlags(noView, noPrint) {
  49926. let {
  49927. flags
  49928. } = this;
  49929. if (noView === undefined) {
  49930. if (noPrint === undefined) {
  49931. return undefined;
  49932. }
  49933. if (noPrint) {
  49934. return flags & ~AnnotationFlag.PRINT;
  49935. }
  49936. return flags & ~AnnotationFlag.HIDDEN | AnnotationFlag.PRINT;
  49937. }
  49938. if (noView) {
  49939. flags |= AnnotationFlag.PRINT;
  49940. if (noPrint) {
  49941. return flags & ~AnnotationFlag.NOVIEW | AnnotationFlag.HIDDEN;
  49942. }
  49943. return flags & ~AnnotationFlag.HIDDEN | AnnotationFlag.NOVIEW;
  49944. }
  49945. flags &= ~(AnnotationFlag.HIDDEN | AnnotationFlag.NOVIEW);
  49946. if (noPrint) {
  49947. return flags & ~AnnotationFlag.PRINT;
  49948. }
  49949. return flags | AnnotationFlag.PRINT;
  49950. }
  49951. _isViewable(flags) {
  49952. return !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.NOVIEW);
  49953. }
  49954. _isPrintable(flags) {
  49955. return this._hasFlag(flags, AnnotationFlag.PRINT) && !this._hasFlag(flags, AnnotationFlag.HIDDEN) && !this._hasFlag(flags, AnnotationFlag.INVISIBLE);
  49956. }
  49957. mustBeViewed(annotationStorage, _renderForms) {
  49958. const noView = annotationStorage?.get(this.data.id)?.noView;
  49959. if (noView !== undefined) {
  49960. return !noView;
  49961. }
  49962. return this.viewable && !this._hasFlag(this.flags, AnnotationFlag.HIDDEN);
  49963. }
  49964. mustBePrinted(annotationStorage) {
  49965. const noPrint = annotationStorage?.get(this.data.id)?.noPrint;
  49966. if (noPrint !== undefined) {
  49967. return !noPrint;
  49968. }
  49969. return this.printable;
  49970. }
  49971. mustBeViewedWhenEditing(isEditing, modifiedIds = null) {
  49972. return isEditing ? !this.data.isEditable : !modifiedIds?.has(this.data.id);
  49973. }
  49974. get viewable() {
  49975. if (this.data.quadPoints === null) {
  49976. return false;
  49977. }
  49978. if (this.flags === 0) {
  49979. return true;
  49980. }
  49981. return this._isViewable(this.flags);
  49982. }
  49983. get printable() {
  49984. if (this.data.quadPoints === null) {
  49985. return false;
  49986. }
  49987. if (this.flags === 0) {
  49988. return false;
  49989. }
  49990. return this._isPrintable(this.flags);
  49991. }
  49992. _parseStringHelper(data) {
  49993. const str = typeof data === "string" ? stringToPDFString(data) : "";
  49994. const dir = str && bidi(str).dir === "rtl" ? "rtl" : "ltr";
  49995. return {
  49996. str,
  49997. dir
  49998. };
  49999. }
  50000. setDefaultAppearance(params) {
  50001. const {
  50002. dict,
  50003. annotationGlobals
  50004. } = params;
  50005. const defaultAppearance = getInheritableProperty({
  50006. dict,
  50007. key: "DA"
  50008. }) || annotationGlobals.acroForm.get("DA");
  50009. this._defaultAppearance = typeof defaultAppearance === "string" ? defaultAppearance : "";
  50010. this.data.defaultAppearanceData = parseDefaultAppearance(this._defaultAppearance);
  50011. }
  50012. setTitle(title) {
  50013. this._title = this._parseStringHelper(title);
  50014. }
  50015. setContents(contents) {
  50016. this._contents = this._parseStringHelper(contents);
  50017. }
  50018. setModificationDate(modificationDate) {
  50019. this.modificationDate = typeof modificationDate === "string" ? modificationDate : null;
  50020. }
  50021. setFlags(flags) {
  50022. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  50023. if (this.flags & AnnotationFlag.INVISIBLE && this.constructor.name !== "Annotation") {
  50024. this.flags ^= AnnotationFlag.INVISIBLE;
  50025. }
  50026. }
  50027. hasFlag(flag) {
  50028. return this._hasFlag(this.flags, flag);
  50029. }
  50030. setRectangle(rectangle) {
  50031. this.rectangle = lookupNormalRect(rectangle, [0, 0, 0, 0]);
  50032. }
  50033. setColor(color) {
  50034. this.color = getRgbColor(color);
  50035. }
  50036. setLineEndings(lineEndings) {
  50037. this.lineEndings = ["None", "None"];
  50038. if (Array.isArray(lineEndings) && lineEndings.length === 2) {
  50039. for (let i = 0; i < 2; i++) {
  50040. const obj = lineEndings[i];
  50041. if (obj instanceof Name) {
  50042. switch (obj.name) {
  50043. case "None":
  50044. continue;
  50045. case "Square":
  50046. case "Circle":
  50047. case "Diamond":
  50048. case "OpenArrow":
  50049. case "ClosedArrow":
  50050. case "Butt":
  50051. case "ROpenArrow":
  50052. case "RClosedArrow":
  50053. case "Slash":
  50054. this.lineEndings[i] = obj.name;
  50055. continue;
  50056. }
  50057. }
  50058. warn(`Ignoring invalid lineEnding: ${obj}`);
  50059. }
  50060. }
  50061. }
  50062. setRotation(mk, dict) {
  50063. this.rotation = 0;
  50064. let angle = mk instanceof Dict ? mk.get("R") || 0 : dict.get("Rotate") || 0;
  50065. if (Number.isInteger(angle) && angle !== 0) {
  50066. angle %= 360;
  50067. if (angle < 0) {
  50068. angle += 360;
  50069. }
  50070. if (angle % 90 === 0) {
  50071. this.rotation = angle;
  50072. }
  50073. }
  50074. }
  50075. setBorderAndBackgroundColors(mk) {
  50076. if (mk instanceof Dict) {
  50077. this.borderColor = getRgbColor(mk.getArray("BC"), null);
  50078. this.backgroundColor = getRgbColor(mk.getArray("BG"), null);
  50079. } else {
  50080. this.borderColor = this.backgroundColor = null;
  50081. }
  50082. }
  50083. setBorderStyle(borderStyle) {
  50084. this.borderStyle = new AnnotationBorderStyle();
  50085. if (!(borderStyle instanceof Dict)) {
  50086. return;
  50087. }
  50088. if (borderStyle.has("BS")) {
  50089. const dict = borderStyle.get("BS");
  50090. if (dict instanceof Dict) {
  50091. const dictType = dict.get("Type");
  50092. if (!dictType || isName(dictType, "Border")) {
  50093. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  50094. this.borderStyle.setStyle(dict.get("S"));
  50095. this.borderStyle.setDashArray(dict.getArray("D"));
  50096. }
  50097. }
  50098. } else if (borderStyle.has("Border")) {
  50099. const array = borderStyle.getArray("Border");
  50100. if (Array.isArray(array) && array.length >= 3) {
  50101. this.borderStyle.setHorizontalCornerRadius(array[0]);
  50102. this.borderStyle.setVerticalCornerRadius(array[1]);
  50103. this.borderStyle.setWidth(array[2], this.rectangle);
  50104. if (array.length === 4) {
  50105. this.borderStyle.setDashArray(array[3], true);
  50106. }
  50107. }
  50108. } else {
  50109. this.borderStyle.setWidth(0);
  50110. }
  50111. }
  50112. setAppearance(dict) {
  50113. this.appearance = null;
  50114. const appearanceStates = dict.get("AP");
  50115. if (!(appearanceStates instanceof Dict)) {
  50116. return;
  50117. }
  50118. const normalAppearanceState = appearanceStates.get("N");
  50119. if (normalAppearanceState instanceof BaseStream) {
  50120. this.appearance = normalAppearanceState;
  50121. return;
  50122. }
  50123. if (!(normalAppearanceState instanceof Dict)) {
  50124. return;
  50125. }
  50126. const as = dict.get("AS");
  50127. if (!(as instanceof Name) || !normalAppearanceState.has(as.name)) {
  50128. return;
  50129. }
  50130. const appearance = normalAppearanceState.get(as.name);
  50131. if (appearance instanceof BaseStream) {
  50132. this.appearance = appearance;
  50133. }
  50134. }
  50135. setOptionalContent(dict) {
  50136. this.oc = null;
  50137. const oc = dict.get("OC");
  50138. if (oc instanceof Name) {
  50139. warn("setOptionalContent: Support for /Name-entry is not implemented.");
  50140. } else if (oc instanceof Dict) {
  50141. this.oc = oc;
  50142. }
  50143. }
  50144. loadResources(keys, appearance) {
  50145. return appearance.dict.getAsync("Resources").then(resources => {
  50146. if (!resources) {
  50147. return undefined;
  50148. }
  50149. const objectLoader = new ObjectLoader(resources, keys, resources.xref);
  50150. return objectLoader.load().then(function () {
  50151. return resources;
  50152. });
  50153. });
  50154. }
  50155. async getOperatorList(evaluator, task, intent, annotationStorage) {
  50156. const {
  50157. hasOwnCanvas,
  50158. id,
  50159. rect
  50160. } = this.data;
  50161. let appearance = this.appearance;
  50162. const isUsingOwnCanvas = !!(hasOwnCanvas && intent & RenderingIntentFlag.DISPLAY);
  50163. if (isUsingOwnCanvas && (rect[0] === rect[2] || rect[1] === rect[3])) {
  50164. this.data.hasOwnCanvas = false;
  50165. return {
  50166. opList: new OperatorList(),
  50167. separateForm: false,
  50168. separateCanvas: false
  50169. };
  50170. }
  50171. if (!appearance) {
  50172. if (!isUsingOwnCanvas) {
  50173. return {
  50174. opList: new OperatorList(),
  50175. separateForm: false,
  50176. separateCanvas: false
  50177. };
  50178. }
  50179. appearance = new StringStream("");
  50180. appearance.dict = new Dict();
  50181. }
  50182. const appearanceDict = appearance.dict;
  50183. const resources = await this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"], appearance);
  50184. const bbox = lookupRect(appearanceDict.getArray("BBox"), [0, 0, 1, 1]);
  50185. const matrix = lookupMatrix(appearanceDict.getArray("Matrix"), IDENTITY_MATRIX);
  50186. const transform = getTransformMatrix(rect, bbox, matrix);
  50187. const opList = new OperatorList();
  50188. let optionalContent;
  50189. if (this.oc) {
  50190. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  50191. }
  50192. if (optionalContent !== undefined) {
  50193. opList.addOp(OPS.beginMarkedContentProps, ["OC", optionalContent]);
  50194. }
  50195. opList.addOp(OPS.beginAnnotation, [id, rect, transform, matrix, isUsingOwnCanvas]);
  50196. await evaluator.getOperatorList({
  50197. stream: appearance,
  50198. task,
  50199. resources,
  50200. operatorList: opList,
  50201. fallbackFontDict: this._fallbackFontDict
  50202. });
  50203. opList.addOp(OPS.endAnnotation, []);
  50204. if (optionalContent !== undefined) {
  50205. opList.addOp(OPS.endMarkedContent, []);
  50206. }
  50207. this.reset();
  50208. return {
  50209. opList,
  50210. separateForm: false,
  50211. separateCanvas: isUsingOwnCanvas
  50212. };
  50213. }
  50214. async save(evaluator, task, annotationStorage) {
  50215. return null;
  50216. }
  50217. get hasTextContent() {
  50218. return false;
  50219. }
  50220. async extractTextContent(evaluator, task, viewBox) {
  50221. if (!this.appearance) {
  50222. return;
  50223. }
  50224. const resources = await this.loadResources(["ExtGState", "Font", "Properties", "XObject"], this.appearance);
  50225. const text = [];
  50226. const buffer = [];
  50227. let firstPosition = null;
  50228. const sink = {
  50229. desiredSize: Math.Infinity,
  50230. ready: true,
  50231. enqueue(chunk, size) {
  50232. for (const item of chunk.items) {
  50233. if (item.str === undefined) {
  50234. continue;
  50235. }
  50236. firstPosition ||= item.transform.slice(-2);
  50237. buffer.push(item.str);
  50238. if (item.hasEOL) {
  50239. text.push(buffer.join("").trimEnd());
  50240. buffer.length = 0;
  50241. }
  50242. }
  50243. }
  50244. };
  50245. await evaluator.getTextContent({
  50246. stream: this.appearance,
  50247. task,
  50248. resources,
  50249. includeMarkedContent: true,
  50250. keepWhiteSpace: true,
  50251. sink,
  50252. viewBox
  50253. });
  50254. this.reset();
  50255. if (buffer.length) {
  50256. text.push(buffer.join("").trimEnd());
  50257. }
  50258. if (text.length > 1 || text[0]) {
  50259. const appearanceDict = this.appearance.dict;
  50260. const bbox = lookupRect(appearanceDict.getArray("BBox"), null);
  50261. const matrix = lookupMatrix(appearanceDict.getArray("Matrix"), null);
  50262. this.data.textPosition = this._transformPoint(firstPosition, bbox, matrix);
  50263. this.data.textContent = text;
  50264. }
  50265. }
  50266. _transformPoint(coords, bbox, matrix) {
  50267. const {
  50268. rect
  50269. } = this.data;
  50270. bbox ||= [0, 0, 1, 1];
  50271. matrix ||= [1, 0, 0, 1, 0, 0];
  50272. const transform = getTransformMatrix(rect, bbox, matrix);
  50273. transform[4] -= rect[0];
  50274. transform[5] -= rect[1];
  50275. coords = Util.applyTransform(coords, transform);
  50276. return Util.applyTransform(coords, matrix);
  50277. }
  50278. getFieldObject() {
  50279. if (this.data.kidIds) {
  50280. return {
  50281. id: this.data.id,
  50282. actions: this.data.actions,
  50283. name: this.data.fieldName,
  50284. strokeColor: this.data.borderColor,
  50285. fillColor: this.data.backgroundColor,
  50286. type: "",
  50287. kidIds: this.data.kidIds,
  50288. page: this.data.pageIndex,
  50289. rotation: this.rotation
  50290. };
  50291. }
  50292. return null;
  50293. }
  50294. reset() {
  50295. for (const stream of this._streams) {
  50296. stream.reset();
  50297. }
  50298. }
  50299. _constructFieldName(dict) {
  50300. if (!dict.has("T") && !dict.has("Parent")) {
  50301. warn("Unknown field name, falling back to empty field name.");
  50302. return "";
  50303. }
  50304. if (!dict.has("Parent")) {
  50305. return stringToPDFString(dict.get("T"));
  50306. }
  50307. const fieldName = [];
  50308. if (dict.has("T")) {
  50309. fieldName.unshift(stringToPDFString(dict.get("T")));
  50310. }
  50311. let loopDict = dict;
  50312. const visited = new RefSet();
  50313. if (dict.objId) {
  50314. visited.put(dict.objId);
  50315. }
  50316. while (loopDict.has("Parent")) {
  50317. loopDict = loopDict.get("Parent");
  50318. if (!(loopDict instanceof Dict) || loopDict.objId && visited.has(loopDict.objId)) {
  50319. break;
  50320. }
  50321. if (loopDict.objId) {
  50322. visited.put(loopDict.objId);
  50323. }
  50324. if (loopDict.has("T")) {
  50325. fieldName.unshift(stringToPDFString(loopDict.get("T")));
  50326. }
  50327. }
  50328. return fieldName.join(".");
  50329. }
  50330. }
  50331. class AnnotationBorderStyle {
  50332. constructor() {
  50333. this.width = 1;
  50334. this.rawWidth = 1;
  50335. this.style = AnnotationBorderStyleType.SOLID;
  50336. this.dashArray = [3];
  50337. this.horizontalCornerRadius = 0;
  50338. this.verticalCornerRadius = 0;
  50339. }
  50340. setWidth(width, rect = [0, 0, 0, 0]) {
  50341. if (width instanceof Name) {
  50342. this.width = 0;
  50343. return;
  50344. }
  50345. if (typeof width === "number") {
  50346. if (width > 0) {
  50347. this.rawWidth = width;
  50348. const maxWidth = (rect[2] - rect[0]) / 2;
  50349. const maxHeight = (rect[3] - rect[1]) / 2;
  50350. if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
  50351. warn(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
  50352. width = 1;
  50353. }
  50354. }
  50355. this.width = width;
  50356. }
  50357. }
  50358. setStyle(style) {
  50359. if (!(style instanceof Name)) {
  50360. return;
  50361. }
  50362. switch (style.name) {
  50363. case "S":
  50364. this.style = AnnotationBorderStyleType.SOLID;
  50365. break;
  50366. case "D":
  50367. this.style = AnnotationBorderStyleType.DASHED;
  50368. break;
  50369. case "B":
  50370. this.style = AnnotationBorderStyleType.BEVELED;
  50371. break;
  50372. case "I":
  50373. this.style = AnnotationBorderStyleType.INSET;
  50374. break;
  50375. case "U":
  50376. this.style = AnnotationBorderStyleType.UNDERLINE;
  50377. break;
  50378. default:
  50379. break;
  50380. }
  50381. }
  50382. setDashArray(dashArray, forceStyle = false) {
  50383. if (Array.isArray(dashArray)) {
  50384. let isValid = true;
  50385. let allZeros = true;
  50386. for (const element of dashArray) {
  50387. const validNumber = +element >= 0;
  50388. if (!validNumber) {
  50389. isValid = false;
  50390. break;
  50391. } else if (element > 0) {
  50392. allZeros = false;
  50393. }
  50394. }
  50395. if (dashArray.length === 0 || isValid && !allZeros) {
  50396. this.dashArray = dashArray;
  50397. if (forceStyle) {
  50398. this.setStyle(Name.get("D"));
  50399. }
  50400. } else {
  50401. this.width = 0;
  50402. }
  50403. } else if (dashArray) {
  50404. this.width = 0;
  50405. }
  50406. }
  50407. setHorizontalCornerRadius(radius) {
  50408. if (Number.isInteger(radius)) {
  50409. this.horizontalCornerRadius = radius;
  50410. }
  50411. }
  50412. setVerticalCornerRadius(radius) {
  50413. if (Number.isInteger(radius)) {
  50414. this.verticalCornerRadius = radius;
  50415. }
  50416. }
  50417. }
  50418. class MarkupAnnotation extends Annotation {
  50419. constructor(params) {
  50420. super(params);
  50421. const {
  50422. dict
  50423. } = params;
  50424. if (dict.has("IRT")) {
  50425. const rawIRT = dict.getRaw("IRT");
  50426. this.data.inReplyTo = rawIRT instanceof Ref ? rawIRT.toString() : null;
  50427. const rt = dict.get("RT");
  50428. this.data.replyType = rt instanceof Name ? rt.name : AnnotationReplyType.REPLY;
  50429. }
  50430. let popupRef = null;
  50431. if (this.data.replyType === AnnotationReplyType.GROUP) {
  50432. const parent = dict.get("IRT");
  50433. this.setTitle(parent.get("T"));
  50434. this.data.titleObj = this._title;
  50435. this.setContents(parent.get("Contents"));
  50436. this.data.contentsObj = this._contents;
  50437. if (!parent.has("CreationDate")) {
  50438. this.data.creationDate = null;
  50439. } else {
  50440. this.setCreationDate(parent.get("CreationDate"));
  50441. this.data.creationDate = this.creationDate;
  50442. }
  50443. if (!parent.has("M")) {
  50444. this.data.modificationDate = null;
  50445. } else {
  50446. this.setModificationDate(parent.get("M"));
  50447. this.data.modificationDate = this.modificationDate;
  50448. }
  50449. popupRef = parent.getRaw("Popup");
  50450. if (!parent.has("C")) {
  50451. this.data.color = null;
  50452. } else {
  50453. this.setColor(parent.getArray("C"));
  50454. this.data.color = this.color;
  50455. }
  50456. } else {
  50457. this.data.titleObj = this._title;
  50458. this.setCreationDate(dict.get("CreationDate"));
  50459. this.data.creationDate = this.creationDate;
  50460. popupRef = dict.getRaw("Popup");
  50461. if (!dict.has("C")) {
  50462. this.data.color = null;
  50463. }
  50464. }
  50465. this.data.popupRef = popupRef instanceof Ref ? popupRef.toString() : null;
  50466. if (dict.has("RC")) {
  50467. this.data.richText = XFAFactory.getRichTextAsHtml(dict.get("RC"));
  50468. }
  50469. }
  50470. setCreationDate(creationDate) {
  50471. this.creationDate = typeof creationDate === "string" ? creationDate : null;
  50472. }
  50473. _setDefaultAppearance({
  50474. xref,
  50475. extra,
  50476. strokeColor,
  50477. fillColor,
  50478. blendMode,
  50479. strokeAlpha,
  50480. fillAlpha,
  50481. pointsCallback
  50482. }) {
  50483. let minX = Number.MAX_VALUE;
  50484. let minY = Number.MAX_VALUE;
  50485. let maxX = Number.MIN_VALUE;
  50486. let maxY = Number.MIN_VALUE;
  50487. const buffer = ["q"];
  50488. if (extra) {
  50489. buffer.push(extra);
  50490. }
  50491. if (strokeColor) {
  50492. buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`);
  50493. }
  50494. if (fillColor) {
  50495. buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
  50496. }
  50497. let pointsArray = this.data.quadPoints;
  50498. if (!pointsArray) {
  50499. pointsArray = Float32Array.from([this.rectangle[0], this.rectangle[3], this.rectangle[2], this.rectangle[3], this.rectangle[0], this.rectangle[1], this.rectangle[2], this.rectangle[1]]);
  50500. }
  50501. for (let i = 0, ii = pointsArray.length; i < ii; i += 8) {
  50502. const [mX, MX, mY, MY] = pointsCallback(buffer, pointsArray.subarray(i, i + 8));
  50503. minX = Math.min(minX, mX);
  50504. maxX = Math.max(maxX, MX);
  50505. minY = Math.min(minY, mY);
  50506. maxY = Math.max(maxY, MY);
  50507. }
  50508. buffer.push("Q");
  50509. const formDict = new Dict(xref);
  50510. const appearanceStreamDict = new Dict(xref);
  50511. appearanceStreamDict.set("Subtype", Name.get("Form"));
  50512. const appearanceStream = new StringStream(buffer.join(" "));
  50513. appearanceStream.dict = appearanceStreamDict;
  50514. formDict.set("Fm0", appearanceStream);
  50515. const gsDict = new Dict(xref);
  50516. if (blendMode) {
  50517. gsDict.set("BM", Name.get(blendMode));
  50518. }
  50519. if (typeof strokeAlpha === "number") {
  50520. gsDict.set("CA", strokeAlpha);
  50521. }
  50522. if (typeof fillAlpha === "number") {
  50523. gsDict.set("ca", fillAlpha);
  50524. }
  50525. const stateDict = new Dict(xref);
  50526. stateDict.set("GS0", gsDict);
  50527. const resources = new Dict(xref);
  50528. resources.set("ExtGState", stateDict);
  50529. resources.set("XObject", formDict);
  50530. const appearanceDict = new Dict(xref);
  50531. appearanceDict.set("Resources", resources);
  50532. const bbox = this.data.rect = [minX, minY, maxX, maxY];
  50533. appearanceDict.set("BBox", bbox);
  50534. this.appearance = new StringStream("/GS0 gs /Fm0 Do");
  50535. this.appearance.dict = appearanceDict;
  50536. this._streams.push(this.appearance, appearanceStream);
  50537. }
  50538. static async createNewAnnotation(xref, annotation, dependencies, params) {
  50539. if (!annotation.ref) {
  50540. annotation.ref = xref.getNewTemporaryRef();
  50541. }
  50542. const annotationRef = annotation.ref;
  50543. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  50544. const buffer = [];
  50545. let annotationDict;
  50546. if (ap) {
  50547. const apRef = xref.getNewTemporaryRef();
  50548. annotationDict = this.createNewDict(annotation, xref, {
  50549. apRef
  50550. });
  50551. await writeObject(apRef, ap, buffer, xref);
  50552. dependencies.push({
  50553. ref: apRef,
  50554. data: buffer.join("")
  50555. });
  50556. } else {
  50557. annotationDict = this.createNewDict(annotation, xref, {});
  50558. }
  50559. if (Number.isInteger(annotation.parentTreeId)) {
  50560. annotationDict.set("StructParent", annotation.parentTreeId);
  50561. }
  50562. buffer.length = 0;
  50563. await writeObject(annotationRef, annotationDict, buffer, xref);
  50564. return {
  50565. ref: annotationRef,
  50566. data: buffer.join("")
  50567. };
  50568. }
  50569. static async createNewPrintAnnotation(annotationGlobals, xref, annotation, params) {
  50570. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  50571. const annotationDict = this.createNewDict(annotation, xref, ap ? {
  50572. ap
  50573. } : {});
  50574. const newAnnotation = new this.prototype.constructor({
  50575. dict: annotationDict,
  50576. xref,
  50577. annotationGlobals,
  50578. evaluatorOptions: params.evaluatorOptions
  50579. });
  50580. if (annotation.ref) {
  50581. newAnnotation.ref = newAnnotation.refToReplace = annotation.ref;
  50582. }
  50583. return newAnnotation;
  50584. }
  50585. }
  50586. class WidgetAnnotation extends Annotation {
  50587. constructor(params) {
  50588. super(params);
  50589. const {
  50590. dict,
  50591. xref,
  50592. annotationGlobals
  50593. } = params;
  50594. const data = this.data;
  50595. this._needAppearances = params.needAppearances;
  50596. data.annotationType = AnnotationType.WIDGET;
  50597. if (data.fieldName === undefined) {
  50598. data.fieldName = this._constructFieldName(dict);
  50599. }
  50600. if (data.actions === undefined) {
  50601. data.actions = collectActions(xref, dict, AnnotationActionEventType);
  50602. }
  50603. let fieldValue = getInheritableProperty({
  50604. dict,
  50605. key: "V",
  50606. getArray: true
  50607. });
  50608. data.fieldValue = this._decodeFormValue(fieldValue);
  50609. const defaultFieldValue = getInheritableProperty({
  50610. dict,
  50611. key: "DV",
  50612. getArray: true
  50613. });
  50614. data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
  50615. if (fieldValue === undefined && annotationGlobals.xfaDatasets) {
  50616. const path = this._title.str;
  50617. if (path) {
  50618. this._hasValueFromXFA = true;
  50619. data.fieldValue = fieldValue = annotationGlobals.xfaDatasets.getValue(path);
  50620. }
  50621. }
  50622. if (fieldValue === undefined && data.defaultFieldValue !== null) {
  50623. data.fieldValue = data.defaultFieldValue;
  50624. }
  50625. data.alternativeText = stringToPDFString(dict.get("TU") || "");
  50626. this.setDefaultAppearance(params);
  50627. data.hasAppearance ||= this._needAppearances && data.fieldValue !== undefined && data.fieldValue !== null;
  50628. const fieldType = getInheritableProperty({
  50629. dict,
  50630. key: "FT"
  50631. });
  50632. data.fieldType = fieldType instanceof Name ? fieldType.name : null;
  50633. const localResources = getInheritableProperty({
  50634. dict,
  50635. key: "DR"
  50636. });
  50637. const acroFormResources = annotationGlobals.acroForm.get("DR");
  50638. const appearanceResources = this.appearance?.dict.get("Resources");
  50639. this._fieldResources = {
  50640. localResources,
  50641. acroFormResources,
  50642. appearanceResources,
  50643. mergedResources: Dict.merge({
  50644. xref,
  50645. dictArray: [localResources, appearanceResources, acroFormResources],
  50646. mergeSubDicts: true
  50647. })
  50648. };
  50649. data.fieldFlags = getInheritableProperty({
  50650. dict,
  50651. key: "Ff"
  50652. });
  50653. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  50654. data.fieldFlags = 0;
  50655. }
  50656. data.readOnly = this.hasFieldFlag(AnnotationFieldFlag.READONLY);
  50657. data.required = this.hasFieldFlag(AnnotationFieldFlag.REQUIRED);
  50658. data.hidden = this._hasFlag(data.annotationFlags, AnnotationFlag.HIDDEN) || this._hasFlag(data.annotationFlags, AnnotationFlag.NOVIEW);
  50659. }
  50660. _decodeFormValue(formValue) {
  50661. if (Array.isArray(formValue)) {
  50662. return formValue.filter(item => typeof item === "string").map(item => stringToPDFString(item));
  50663. } else if (formValue instanceof Name) {
  50664. return stringToPDFString(formValue.name);
  50665. } else if (typeof formValue === "string") {
  50666. return stringToPDFString(formValue);
  50667. }
  50668. return null;
  50669. }
  50670. hasFieldFlag(flag) {
  50671. return !!(this.data.fieldFlags & flag);
  50672. }
  50673. _isViewable(flags) {
  50674. return true;
  50675. }
  50676. mustBeViewed(annotationStorage, renderForms) {
  50677. if (renderForms) {
  50678. return this.viewable;
  50679. }
  50680. return super.mustBeViewed(annotationStorage, renderForms) && !this._hasFlag(this.flags, AnnotationFlag.NOVIEW);
  50681. }
  50682. getRotationMatrix(annotationStorage) {
  50683. let rotation = annotationStorage?.get(this.data.id)?.rotation;
  50684. if (rotation === undefined) {
  50685. rotation = this.rotation;
  50686. }
  50687. if (rotation === 0) {
  50688. return IDENTITY_MATRIX;
  50689. }
  50690. const width = this.data.rect[2] - this.data.rect[0];
  50691. const height = this.data.rect[3] - this.data.rect[1];
  50692. return getRotationMatrix(rotation, width, height);
  50693. }
  50694. getBorderAndBackgroundAppearances(annotationStorage) {
  50695. let rotation = annotationStorage?.get(this.data.id)?.rotation;
  50696. if (rotation === undefined) {
  50697. rotation = this.rotation;
  50698. }
  50699. if (!this.backgroundColor && !this.borderColor) {
  50700. return "";
  50701. }
  50702. const width = this.data.rect[2] - this.data.rect[0];
  50703. const height = this.data.rect[3] - this.data.rect[1];
  50704. const rect = rotation === 0 || rotation === 180 ? `0 0 ${width} ${height} re` : `0 0 ${height} ${width} re`;
  50705. let str = "";
  50706. if (this.backgroundColor) {
  50707. str = `${getPdfColor(this.backgroundColor, true)} ${rect} f `;
  50708. }
  50709. if (this.borderColor) {
  50710. const borderWidth = this.borderStyle.width || 1;
  50711. str += `${borderWidth} w ${getPdfColor(this.borderColor, false)} ${rect} S `;
  50712. }
  50713. return str;
  50714. }
  50715. async getOperatorList(evaluator, task, intent, annotationStorage) {
  50716. if (intent & RenderingIntentFlag.ANNOTATIONS_FORMS && !(this instanceof SignatureWidgetAnnotation) && !this.data.noHTML && !this.data.hasOwnCanvas) {
  50717. return {
  50718. opList: new OperatorList(),
  50719. separateForm: true,
  50720. separateCanvas: false
  50721. };
  50722. }
  50723. if (!this._hasText) {
  50724. return super.getOperatorList(evaluator, task, intent, annotationStorage);
  50725. }
  50726. const content = await this._getAppearance(evaluator, task, intent, annotationStorage);
  50727. if (this.appearance && content === null) {
  50728. return super.getOperatorList(evaluator, task, intent, annotationStorage);
  50729. }
  50730. const opList = new OperatorList();
  50731. if (!this._defaultAppearance || content === null) {
  50732. return {
  50733. opList,
  50734. separateForm: false,
  50735. separateCanvas: false
  50736. };
  50737. }
  50738. const isUsingOwnCanvas = !!(this.data.hasOwnCanvas && intent & RenderingIntentFlag.DISPLAY);
  50739. const matrix = [1, 0, 0, 1, 0, 0];
  50740. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  50741. const transform = getTransformMatrix(this.data.rect, bbox, matrix);
  50742. let optionalContent;
  50743. if (this.oc) {
  50744. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  50745. }
  50746. if (optionalContent !== undefined) {
  50747. opList.addOp(OPS.beginMarkedContentProps, ["OC", optionalContent]);
  50748. }
  50749. opList.addOp(OPS.beginAnnotation, [this.data.id, this.data.rect, transform, this.getRotationMatrix(annotationStorage), isUsingOwnCanvas]);
  50750. const stream = new StringStream(content);
  50751. await evaluator.getOperatorList({
  50752. stream,
  50753. task,
  50754. resources: this._fieldResources.mergedResources,
  50755. operatorList: opList
  50756. });
  50757. opList.addOp(OPS.endAnnotation, []);
  50758. if (optionalContent !== undefined) {
  50759. opList.addOp(OPS.endMarkedContent, []);
  50760. }
  50761. return {
  50762. opList,
  50763. separateForm: false,
  50764. separateCanvas: isUsingOwnCanvas
  50765. };
  50766. }
  50767. _getMKDict(rotation) {
  50768. const mk = new Dict(null);
  50769. if (rotation) {
  50770. mk.set("R", rotation);
  50771. }
  50772. if (this.borderColor) {
  50773. mk.set("BC", getPdfColorArray(this.borderColor));
  50774. }
  50775. if (this.backgroundColor) {
  50776. mk.set("BG", getPdfColorArray(this.backgroundColor));
  50777. }
  50778. return mk.size > 0 ? mk : null;
  50779. }
  50780. amendSavedDict(annotationStorage, dict) {}
  50781. async save(evaluator, task, annotationStorage) {
  50782. const storageEntry = annotationStorage?.get(this.data.id);
  50783. const flags = this._buildFlags(storageEntry?.noView, storageEntry?.noPrint);
  50784. let value = storageEntry?.value,
  50785. rotation = storageEntry?.rotation;
  50786. if (value === this.data.fieldValue || value === undefined) {
  50787. if (!this._hasValueFromXFA && rotation === undefined && flags === undefined) {
  50788. return null;
  50789. }
  50790. value ||= this.data.fieldValue;
  50791. }
  50792. if (rotation === undefined && !this._hasValueFromXFA && Array.isArray(value) && Array.isArray(this.data.fieldValue) && isArrayEqual(value, this.data.fieldValue) && flags === undefined) {
  50793. return null;
  50794. }
  50795. if (rotation === undefined) {
  50796. rotation = this.rotation;
  50797. }
  50798. let appearance = null;
  50799. if (!this._needAppearances) {
  50800. appearance = await this._getAppearance(evaluator, task, RenderingIntentFlag.SAVE, annotationStorage);
  50801. if (appearance === null && flags === undefined) {
  50802. return null;
  50803. }
  50804. } else {}
  50805. let needAppearances = false;
  50806. if (appearance?.needAppearances) {
  50807. needAppearances = true;
  50808. appearance = null;
  50809. }
  50810. const {
  50811. xref
  50812. } = evaluator;
  50813. const originalDict = xref.fetchIfRef(this.ref);
  50814. if (!(originalDict instanceof Dict)) {
  50815. return null;
  50816. }
  50817. const dict = new Dict(xref);
  50818. for (const key of originalDict.getKeys()) {
  50819. if (key !== "AP") {
  50820. dict.set(key, originalDict.getRaw(key));
  50821. }
  50822. }
  50823. if (flags !== undefined) {
  50824. dict.set("F", flags);
  50825. if (appearance === null && !needAppearances) {
  50826. const ap = originalDict.getRaw("AP");
  50827. if (ap) {
  50828. dict.set("AP", ap);
  50829. }
  50830. }
  50831. }
  50832. const xfa = {
  50833. path: this.data.fieldName,
  50834. value
  50835. };
  50836. dict.set("V", Array.isArray(value) ? value.map(stringToAsciiOrUTF16BE) : stringToAsciiOrUTF16BE(value));
  50837. this.amendSavedDict(annotationStorage, dict);
  50838. const maybeMK = this._getMKDict(rotation);
  50839. if (maybeMK) {
  50840. dict.set("MK", maybeMK);
  50841. }
  50842. const buffer = [];
  50843. const changes = [{
  50844. ref: this.ref,
  50845. data: "",
  50846. xfa,
  50847. needAppearances
  50848. }];
  50849. if (appearance !== null) {
  50850. const newRef = xref.getNewTemporaryRef();
  50851. const AP = new Dict(xref);
  50852. dict.set("AP", AP);
  50853. AP.set("N", newRef);
  50854. const resources = this._getSaveFieldResources(xref);
  50855. const appearanceStream = new StringStream(appearance);
  50856. const appearanceDict = appearanceStream.dict = new Dict(xref);
  50857. appearanceDict.set("Subtype", Name.get("Form"));
  50858. appearanceDict.set("Resources", resources);
  50859. appearanceDict.set("BBox", [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]]);
  50860. const rotationMatrix = this.getRotationMatrix(annotationStorage);
  50861. if (rotationMatrix !== IDENTITY_MATRIX) {
  50862. appearanceDict.set("Matrix", rotationMatrix);
  50863. }
  50864. await writeObject(newRef, appearanceStream, buffer, xref);
  50865. changes.push({
  50866. ref: newRef,
  50867. data: buffer.join(""),
  50868. xfa: null,
  50869. needAppearances: false
  50870. });
  50871. buffer.length = 0;
  50872. }
  50873. dict.set("M", `D:${getModificationDate()}`);
  50874. await writeObject(this.ref, dict, buffer, xref);
  50875. changes[0].data = buffer.join("");
  50876. return changes;
  50877. }
  50878. async _getAppearance(evaluator, task, intent, annotationStorage) {
  50879. const isPassword = this.hasFieldFlag(AnnotationFieldFlag.PASSWORD);
  50880. if (isPassword) {
  50881. return null;
  50882. }
  50883. const storageEntry = annotationStorage?.get(this.data.id);
  50884. let value, rotation;
  50885. if (storageEntry) {
  50886. value = storageEntry.formattedValue || storageEntry.value;
  50887. rotation = storageEntry.rotation;
  50888. }
  50889. if (rotation === undefined && value === undefined && !this._needAppearances) {
  50890. if (!this._hasValueFromXFA || this.appearance) {
  50891. return null;
  50892. }
  50893. }
  50894. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  50895. if (value === undefined) {
  50896. value = this.data.fieldValue;
  50897. if (!value) {
  50898. return `/Tx BMC q ${colors}Q EMC`;
  50899. }
  50900. }
  50901. if (Array.isArray(value) && value.length === 1) {
  50902. value = value[0];
  50903. }
  50904. assert(typeof value === "string", "Expected `value` to be a string.");
  50905. value = value.trimEnd();
  50906. if (this.data.combo) {
  50907. const option = this.data.options.find(({
  50908. exportValue
  50909. }) => value === exportValue);
  50910. value = option?.displayValue || value;
  50911. }
  50912. if (value === "") {
  50913. return `/Tx BMC q ${colors}Q EMC`;
  50914. }
  50915. if (rotation === undefined) {
  50916. rotation = this.rotation;
  50917. }
  50918. let lineCount = -1;
  50919. let lines;
  50920. if (this.data.multiLine) {
  50921. lines = value.split(/\r\n?|\n/).map(line => line.normalize("NFC"));
  50922. lineCount = lines.length;
  50923. } else {
  50924. lines = [value.replace(/\r\n?|\n/, "").normalize("NFC")];
  50925. }
  50926. const defaultPadding = 1;
  50927. const defaultHPadding = 2;
  50928. let totalHeight = this.data.rect[3] - this.data.rect[1];
  50929. let totalWidth = this.data.rect[2] - this.data.rect[0];
  50930. if (rotation === 90 || rotation === 270) {
  50931. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  50932. }
  50933. if (!this._defaultAppearance) {
  50934. this.data.defaultAppearanceData = parseDefaultAppearance(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  50935. }
  50936. let font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  50937. let defaultAppearance, fontSize, lineHeight;
  50938. const encodedLines = [];
  50939. let encodingError = false;
  50940. for (const line of lines) {
  50941. const encodedString = font.encodeString(line);
  50942. if (encodedString.length > 1) {
  50943. encodingError = true;
  50944. }
  50945. encodedLines.push(encodedString.join(""));
  50946. }
  50947. if (encodingError && intent & RenderingIntentFlag.SAVE) {
  50948. return {
  50949. needAppearances: true
  50950. };
  50951. }
  50952. if (encodingError && this._isOffscreenCanvasSupported) {
  50953. const fontFamily = this.data.comb ? "monospace" : "sans-serif";
  50954. const fakeUnicodeFont = new FakeUnicodeFont(evaluator.xref, fontFamily);
  50955. const resources = fakeUnicodeFont.createFontResources(lines.join(""));
  50956. const newFont = resources.getRaw("Font");
  50957. if (this._fieldResources.mergedResources.has("Font")) {
  50958. const oldFont = this._fieldResources.mergedResources.get("Font");
  50959. for (const key of newFont.getKeys()) {
  50960. oldFont.set(key, newFont.getRaw(key));
  50961. }
  50962. } else {
  50963. this._fieldResources.mergedResources.set("Font", newFont);
  50964. }
  50965. const fontName = fakeUnicodeFont.fontName.name;
  50966. font = await WidgetAnnotation._getFontData(evaluator, task, {
  50967. fontName,
  50968. fontSize: 0
  50969. }, resources);
  50970. for (let i = 0, ii = encodedLines.length; i < ii; i++) {
  50971. encodedLines[i] = stringToUTF16String(lines[i]);
  50972. }
  50973. const savedDefaultAppearance = Object.assign(Object.create(null), this.data.defaultAppearanceData);
  50974. this.data.defaultAppearanceData.fontSize = 0;
  50975. this.data.defaultAppearanceData.fontName = fontName;
  50976. [defaultAppearance, fontSize, lineHeight] = this._computeFontSize(totalHeight - 2 * defaultPadding, totalWidth - 2 * defaultHPadding, value, font, lineCount);
  50977. this.data.defaultAppearanceData = savedDefaultAppearance;
  50978. } else {
  50979. if (!this._isOffscreenCanvasSupported) {
  50980. warn("_getAppearance: OffscreenCanvas is not supported, annotation may not render correctly.");
  50981. }
  50982. [defaultAppearance, fontSize, lineHeight] = this._computeFontSize(totalHeight - 2 * defaultPadding, totalWidth - 2 * defaultHPadding, value, font, lineCount);
  50983. }
  50984. let descent = font.descent;
  50985. if (isNaN(descent)) {
  50986. descent = BASELINE_FACTOR * lineHeight;
  50987. } else {
  50988. descent = Math.max(BASELINE_FACTOR * lineHeight, Math.abs(descent) * fontSize);
  50989. }
  50990. const defaultVPadding = Math.min(Math.floor((totalHeight - fontSize) / 2), defaultPadding);
  50991. const alignment = this.data.textAlignment;
  50992. if (this.data.multiLine) {
  50993. return this._getMultilineAppearance(defaultAppearance, encodedLines, font, fontSize, totalWidth, totalHeight, alignment, defaultHPadding, defaultVPadding, descent, lineHeight, annotationStorage);
  50994. }
  50995. if (this.data.comb) {
  50996. return this._getCombAppearance(defaultAppearance, font, encodedLines[0], fontSize, totalWidth, totalHeight, defaultHPadding, defaultVPadding, descent, lineHeight, annotationStorage);
  50997. }
  50998. const bottomPadding = defaultVPadding + descent;
  50999. if (alignment === 0 || alignment > 2) {
  51000. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${numberToString(defaultHPadding)} ${numberToString(bottomPadding)} Tm (${escapeString(encodedLines[0])}) Tj` + " ET Q EMC";
  51001. }
  51002. const prevInfo = {
  51003. shift: 0
  51004. };
  51005. const renderedText = this._renderText(encodedLines[0], font, fontSize, totalWidth, alignment, prevInfo, defaultHPadding, bottomPadding);
  51006. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC";
  51007. }
  51008. static async _getFontData(evaluator, task, appearanceData, resources) {
  51009. const operatorList = new OperatorList();
  51010. const initialState = {
  51011. font: null,
  51012. clone() {
  51013. return this;
  51014. }
  51015. };
  51016. const {
  51017. fontName,
  51018. fontSize
  51019. } = appearanceData;
  51020. await evaluator.handleSetFont(resources, [fontName && Name.get(fontName), fontSize], null, operatorList, task, initialState, null);
  51021. return initialState.font;
  51022. }
  51023. _getTextWidth(text, font) {
  51024. return font.charsToGlyphs(text).reduce((width, glyph) => width + glyph.width, 0) / 1000;
  51025. }
  51026. _computeFontSize(height, width, text, font, lineCount) {
  51027. let {
  51028. fontSize
  51029. } = this.data.defaultAppearanceData;
  51030. let lineHeight = (fontSize || 12) * LINE_FACTOR,
  51031. numberOfLines = Math.round(height / lineHeight);
  51032. if (!fontSize) {
  51033. const roundWithTwoDigits = x => Math.floor(x * 100) / 100;
  51034. if (lineCount === -1) {
  51035. const textWidth = this._getTextWidth(text, font);
  51036. fontSize = roundWithTwoDigits(Math.min(height / LINE_FACTOR, width / textWidth));
  51037. numberOfLines = 1;
  51038. } else {
  51039. const lines = text.split(/\r\n?|\n/);
  51040. const cachedLines = [];
  51041. for (const line of lines) {
  51042. const encoded = font.encodeString(line).join("");
  51043. const glyphs = font.charsToGlyphs(encoded);
  51044. const positions = font.getCharPositions(encoded);
  51045. cachedLines.push({
  51046. line: encoded,
  51047. glyphs,
  51048. positions
  51049. });
  51050. }
  51051. const isTooBig = fsize => {
  51052. let totalHeight = 0;
  51053. for (const cache of cachedLines) {
  51054. const chunks = this._splitLine(null, font, fsize, width, cache);
  51055. totalHeight += chunks.length * fsize;
  51056. if (totalHeight > height) {
  51057. return true;
  51058. }
  51059. }
  51060. return false;
  51061. };
  51062. numberOfLines = Math.max(numberOfLines, lineCount);
  51063. while (true) {
  51064. lineHeight = height / numberOfLines;
  51065. fontSize = roundWithTwoDigits(lineHeight / LINE_FACTOR);
  51066. if (isTooBig(fontSize)) {
  51067. numberOfLines++;
  51068. continue;
  51069. }
  51070. break;
  51071. }
  51072. }
  51073. const {
  51074. fontName,
  51075. fontColor
  51076. } = this.data.defaultAppearanceData;
  51077. this._defaultAppearance = createDefaultAppearance({
  51078. fontSize,
  51079. fontName,
  51080. fontColor
  51081. });
  51082. }
  51083. return [this._defaultAppearance, fontSize, height / numberOfLines];
  51084. }
  51085. _renderText(text, font, fontSize, totalWidth, alignment, prevInfo, hPadding, vPadding) {
  51086. let shift;
  51087. if (alignment === 1) {
  51088. const width = this._getTextWidth(text, font) * fontSize;
  51089. shift = (totalWidth - width) / 2;
  51090. } else if (alignment === 2) {
  51091. const width = this._getTextWidth(text, font) * fontSize;
  51092. shift = totalWidth - width - hPadding;
  51093. } else {
  51094. shift = hPadding;
  51095. }
  51096. const shiftStr = numberToString(shift - prevInfo.shift);
  51097. prevInfo.shift = shift;
  51098. vPadding = numberToString(vPadding);
  51099. return `${shiftStr} ${vPadding} Td (${escapeString(text)}) Tj`;
  51100. }
  51101. _getSaveFieldResources(xref) {
  51102. const {
  51103. localResources,
  51104. appearanceResources,
  51105. acroFormResources
  51106. } = this._fieldResources;
  51107. const fontName = this.data.defaultAppearanceData?.fontName;
  51108. if (!fontName) {
  51109. return localResources || Dict.empty;
  51110. }
  51111. for (const resources of [localResources, appearanceResources]) {
  51112. if (resources instanceof Dict) {
  51113. const localFont = resources.get("Font");
  51114. if (localFont instanceof Dict && localFont.has(fontName)) {
  51115. return resources;
  51116. }
  51117. }
  51118. }
  51119. if (acroFormResources instanceof Dict) {
  51120. const acroFormFont = acroFormResources.get("Font");
  51121. if (acroFormFont instanceof Dict && acroFormFont.has(fontName)) {
  51122. const subFontDict = new Dict(xref);
  51123. subFontDict.set(fontName, acroFormFont.getRaw(fontName));
  51124. const subResourcesDict = new Dict(xref);
  51125. subResourcesDict.set("Font", subFontDict);
  51126. return Dict.merge({
  51127. xref,
  51128. dictArray: [subResourcesDict, localResources],
  51129. mergeSubDicts: true
  51130. });
  51131. }
  51132. }
  51133. return localResources || Dict.empty;
  51134. }
  51135. getFieldObject() {
  51136. return null;
  51137. }
  51138. }
  51139. class TextWidgetAnnotation extends WidgetAnnotation {
  51140. constructor(params) {
  51141. super(params);
  51142. const {
  51143. dict
  51144. } = params;
  51145. if (dict.has("PMD")) {
  51146. this.flags |= AnnotationFlag.HIDDEN;
  51147. this.data.hidden = true;
  51148. warn("Barcodes are not supported");
  51149. }
  51150. this.data.hasOwnCanvas = this.data.readOnly && !this.data.noHTML;
  51151. this._hasText = true;
  51152. if (typeof this.data.fieldValue !== "string") {
  51153. this.data.fieldValue = "";
  51154. }
  51155. let alignment = getInheritableProperty({
  51156. dict,
  51157. key: "Q"
  51158. });
  51159. if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
  51160. alignment = null;
  51161. }
  51162. this.data.textAlignment = alignment;
  51163. let maximumLength = getInheritableProperty({
  51164. dict,
  51165. key: "MaxLen"
  51166. });
  51167. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  51168. maximumLength = 0;
  51169. }
  51170. this.data.maxLen = maximumLength;
  51171. this.data.multiLine = this.hasFieldFlag(AnnotationFieldFlag.MULTILINE);
  51172. this.data.comb = this.hasFieldFlag(AnnotationFieldFlag.COMB) && !this.hasFieldFlag(AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== 0;
  51173. this.data.doNotScroll = this.hasFieldFlag(AnnotationFieldFlag.DONOTSCROLL);
  51174. }
  51175. get hasTextContent() {
  51176. return !!this.appearance && !this._needAppearances;
  51177. }
  51178. _getCombAppearance(defaultAppearance, font, text, fontSize, width, height, hPadding, vPadding, descent, lineHeight, annotationStorage) {
  51179. const combWidth = width / this.data.maxLen;
  51180. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  51181. const buf = [];
  51182. const positions = font.getCharPositions(text);
  51183. for (const [start, end] of positions) {
  51184. buf.push(`(${escapeString(text.substring(start, end))}) Tj`);
  51185. }
  51186. const renderedComb = buf.join(` ${numberToString(combWidth)} 0 Td `);
  51187. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${numberToString(hPadding)} ${numberToString(vPadding + descent)} Tm ${renderedComb}` + " ET Q EMC";
  51188. }
  51189. _getMultilineAppearance(defaultAppearance, lines, font, fontSize, width, height, alignment, hPadding, vPadding, descent, lineHeight, annotationStorage) {
  51190. const buf = [];
  51191. const totalWidth = width - 2 * hPadding;
  51192. const prevInfo = {
  51193. shift: 0
  51194. };
  51195. for (let i = 0, ii = lines.length; i < ii; i++) {
  51196. const line = lines[i];
  51197. const chunks = this._splitLine(line, font, fontSize, totalWidth);
  51198. for (let j = 0, jj = chunks.length; j < jj; j++) {
  51199. const chunk = chunks[j];
  51200. const vShift = i === 0 && j === 0 ? -vPadding - (lineHeight - descent) : -lineHeight;
  51201. buf.push(this._renderText(chunk, font, fontSize, width, alignment, prevInfo, hPadding, vShift));
  51202. }
  51203. }
  51204. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  51205. const renderedText = buf.join("\n");
  51206. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 ${numberToString(height)} Tm ${renderedText}` + " ET Q EMC";
  51207. }
  51208. _splitLine(line, font, fontSize, width, cache = {}) {
  51209. line = cache.line || line;
  51210. const glyphs = cache.glyphs || font.charsToGlyphs(line);
  51211. if (glyphs.length <= 1) {
  51212. return [line];
  51213. }
  51214. const positions = cache.positions || font.getCharPositions(line);
  51215. const scale = fontSize / 1000;
  51216. const chunks = [];
  51217. let lastSpacePosInStringStart = -1,
  51218. lastSpacePosInStringEnd = -1,
  51219. lastSpacePos = -1,
  51220. startChunk = 0,
  51221. currentWidth = 0;
  51222. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  51223. const [start, end] = positions[i];
  51224. const glyph = glyphs[i];
  51225. const glyphWidth = glyph.width * scale;
  51226. if (glyph.unicode === " ") {
  51227. if (currentWidth + glyphWidth > width) {
  51228. chunks.push(line.substring(startChunk, start));
  51229. startChunk = start;
  51230. currentWidth = glyphWidth;
  51231. lastSpacePosInStringStart = -1;
  51232. lastSpacePos = -1;
  51233. } else {
  51234. currentWidth += glyphWidth;
  51235. lastSpacePosInStringStart = start;
  51236. lastSpacePosInStringEnd = end;
  51237. lastSpacePos = i;
  51238. }
  51239. } else if (currentWidth + glyphWidth > width) {
  51240. if (lastSpacePosInStringStart !== -1) {
  51241. chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
  51242. startChunk = lastSpacePosInStringEnd;
  51243. i = lastSpacePos + 1;
  51244. lastSpacePosInStringStart = -1;
  51245. currentWidth = 0;
  51246. } else {
  51247. chunks.push(line.substring(startChunk, start));
  51248. startChunk = start;
  51249. currentWidth = glyphWidth;
  51250. }
  51251. } else {
  51252. currentWidth += glyphWidth;
  51253. }
  51254. }
  51255. if (startChunk < line.length) {
  51256. chunks.push(line.substring(startChunk, line.length));
  51257. }
  51258. return chunks;
  51259. }
  51260. async extractTextContent(evaluator, task, viewBox) {
  51261. await super.extractTextContent(evaluator, task, viewBox);
  51262. const text = this.data.textContent;
  51263. if (!text) {
  51264. return;
  51265. }
  51266. const allText = text.join("\n");
  51267. if (allText === this.data.fieldValue) {
  51268. return;
  51269. }
  51270. const regex = allText.replaceAll(/([.*+?^${}()|[\]\\])|(\s+)/g, (_m, p1) => p1 ? `\\${p1}` : "\\s+");
  51271. if (new RegExp(`^\\s*${regex}\\s*$`).test(this.data.fieldValue)) {
  51272. this.data.textContent = this.data.fieldValue.split("\n");
  51273. }
  51274. }
  51275. getFieldObject() {
  51276. return {
  51277. id: this.data.id,
  51278. value: this.data.fieldValue,
  51279. defaultValue: this.data.defaultFieldValue || "",
  51280. multiline: this.data.multiLine,
  51281. password: this.hasFieldFlag(AnnotationFieldFlag.PASSWORD),
  51282. charLimit: this.data.maxLen,
  51283. comb: this.data.comb,
  51284. editable: !this.data.readOnly,
  51285. hidden: this.data.hidden,
  51286. name: this.data.fieldName,
  51287. rect: this.data.rect,
  51288. actions: this.data.actions,
  51289. page: this.data.pageIndex,
  51290. strokeColor: this.data.borderColor,
  51291. fillColor: this.data.backgroundColor,
  51292. rotation: this.rotation,
  51293. type: "text"
  51294. };
  51295. }
  51296. }
  51297. class ButtonWidgetAnnotation extends WidgetAnnotation {
  51298. constructor(params) {
  51299. super(params);
  51300. this.checkedAppearance = null;
  51301. this.uncheckedAppearance = null;
  51302. this.data.checkBox = !this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  51303. this.data.radioButton = this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  51304. this.data.pushButton = this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  51305. this.data.isTooltipOnly = false;
  51306. if (this.data.checkBox) {
  51307. this._processCheckBox(params);
  51308. } else if (this.data.radioButton) {
  51309. this._processRadioButton(params);
  51310. } else if (this.data.pushButton) {
  51311. this.data.hasOwnCanvas = true;
  51312. this.data.noHTML = false;
  51313. this._processPushButton(params);
  51314. } else {
  51315. warn("Invalid field flags for button widget annotation");
  51316. }
  51317. }
  51318. async getOperatorList(evaluator, task, intent, annotationStorage) {
  51319. if (this.data.pushButton) {
  51320. return super.getOperatorList(evaluator, task, intent, false, annotationStorage);
  51321. }
  51322. let value = null;
  51323. let rotation = null;
  51324. if (annotationStorage) {
  51325. const storageEntry = annotationStorage.get(this.data.id);
  51326. value = storageEntry ? storageEntry.value : null;
  51327. rotation = storageEntry ? storageEntry.rotation : null;
  51328. }
  51329. if (value === null && this.appearance) {
  51330. return super.getOperatorList(evaluator, task, intent, annotationStorage);
  51331. }
  51332. if (value === null || value === undefined) {
  51333. value = this.data.checkBox ? this.data.fieldValue === this.data.exportValue : this.data.fieldValue === this.data.buttonValue;
  51334. }
  51335. const appearance = value ? this.checkedAppearance : this.uncheckedAppearance;
  51336. if (appearance) {
  51337. const savedAppearance = this.appearance;
  51338. const savedMatrix = lookupMatrix(appearance.dict.getArray("Matrix"), IDENTITY_MATRIX);
  51339. if (rotation) {
  51340. appearance.dict.set("Matrix", this.getRotationMatrix(annotationStorage));
  51341. }
  51342. this.appearance = appearance;
  51343. const operatorList = super.getOperatorList(evaluator, task, intent, annotationStorage);
  51344. this.appearance = savedAppearance;
  51345. appearance.dict.set("Matrix", savedMatrix);
  51346. return operatorList;
  51347. }
  51348. return {
  51349. opList: new OperatorList(),
  51350. separateForm: false,
  51351. separateCanvas: false
  51352. };
  51353. }
  51354. async save(evaluator, task, annotationStorage) {
  51355. if (this.data.checkBox) {
  51356. return this._saveCheckbox(evaluator, task, annotationStorage);
  51357. }
  51358. if (this.data.radioButton) {
  51359. return this._saveRadioButton(evaluator, task, annotationStorage);
  51360. }
  51361. return null;
  51362. }
  51363. async _saveCheckbox(evaluator, task, annotationStorage) {
  51364. if (!annotationStorage) {
  51365. return null;
  51366. }
  51367. const storageEntry = annotationStorage.get(this.data.id);
  51368. const flags = this._buildFlags(storageEntry?.noView, storageEntry?.noPrint);
  51369. let rotation = storageEntry?.rotation,
  51370. value = storageEntry?.value;
  51371. if (rotation === undefined && flags === undefined) {
  51372. if (value === undefined) {
  51373. return null;
  51374. }
  51375. const defaultValue = this.data.fieldValue === this.data.exportValue;
  51376. if (defaultValue === value) {
  51377. return null;
  51378. }
  51379. }
  51380. let dict = evaluator.xref.fetchIfRef(this.ref);
  51381. if (!(dict instanceof Dict)) {
  51382. return null;
  51383. }
  51384. dict = dict.clone();
  51385. if (rotation === undefined) {
  51386. rotation = this.rotation;
  51387. }
  51388. if (value === undefined) {
  51389. value = this.data.fieldValue === this.data.exportValue;
  51390. }
  51391. const xfa = {
  51392. path: this.data.fieldName,
  51393. value: value ? this.data.exportValue : ""
  51394. };
  51395. const name = Name.get(value ? this.data.exportValue : "Off");
  51396. dict.set("V", name);
  51397. dict.set("AS", name);
  51398. dict.set("M", `D:${getModificationDate()}`);
  51399. if (flags !== undefined) {
  51400. dict.set("F", flags);
  51401. }
  51402. const maybeMK = this._getMKDict(rotation);
  51403. if (maybeMK) {
  51404. dict.set("MK", maybeMK);
  51405. }
  51406. const buffer = [];
  51407. await writeObject(this.ref, dict, buffer, evaluator.xref);
  51408. return [{
  51409. ref: this.ref,
  51410. data: buffer.join(""),
  51411. xfa
  51412. }];
  51413. }
  51414. async _saveRadioButton(evaluator, task, annotationStorage) {
  51415. if (!annotationStorage) {
  51416. return null;
  51417. }
  51418. const storageEntry = annotationStorage.get(this.data.id);
  51419. const flags = this._buildFlags(storageEntry?.noView, storageEntry?.noPrint);
  51420. let rotation = storageEntry?.rotation,
  51421. value = storageEntry?.value;
  51422. if (rotation === undefined && flags === undefined) {
  51423. if (value === undefined) {
  51424. return null;
  51425. }
  51426. const defaultValue = this.data.fieldValue === this.data.buttonValue;
  51427. if (defaultValue === value) {
  51428. return null;
  51429. }
  51430. }
  51431. let dict = evaluator.xref.fetchIfRef(this.ref);
  51432. if (!(dict instanceof Dict)) {
  51433. return null;
  51434. }
  51435. dict = dict.clone();
  51436. if (value === undefined) {
  51437. value = this.data.fieldValue === this.data.buttonValue;
  51438. }
  51439. if (rotation === undefined) {
  51440. rotation = this.rotation;
  51441. }
  51442. const xfa = {
  51443. path: this.data.fieldName,
  51444. value: value ? this.data.buttonValue : ""
  51445. };
  51446. const name = Name.get(value ? this.data.buttonValue : "Off");
  51447. const buffer = [];
  51448. let parentData = null;
  51449. if (value) {
  51450. if (this.parent instanceof Ref) {
  51451. const parent = evaluator.xref.fetch(this.parent);
  51452. parent.set("V", name);
  51453. await writeObject(this.parent, parent, buffer, evaluator.xref);
  51454. parentData = buffer.join("");
  51455. buffer.length = 0;
  51456. } else if (this.parent instanceof Dict) {
  51457. this.parent.set("V", name);
  51458. }
  51459. }
  51460. if (!this.parent) {
  51461. dict.set("V", name);
  51462. }
  51463. dict.set("AS", name);
  51464. dict.set("M", `D:${getModificationDate()}`);
  51465. if (flags !== undefined) {
  51466. dict.set("F", flags);
  51467. }
  51468. const maybeMK = this._getMKDict(rotation);
  51469. if (maybeMK) {
  51470. dict.set("MK", maybeMK);
  51471. }
  51472. await writeObject(this.ref, dict, buffer, evaluator.xref);
  51473. const newRefs = [{
  51474. ref: this.ref,
  51475. data: buffer.join(""),
  51476. xfa
  51477. }];
  51478. if (parentData) {
  51479. newRefs.push({
  51480. ref: this.parent,
  51481. data: parentData,
  51482. xfa: null
  51483. });
  51484. }
  51485. return newRefs;
  51486. }
  51487. _getDefaultCheckedAppearance(params, type) {
  51488. const width = this.data.rect[2] - this.data.rect[0];
  51489. const height = this.data.rect[3] - this.data.rect[1];
  51490. const bbox = [0, 0, width, height];
  51491. const FONT_RATIO = 0.8;
  51492. const fontSize = Math.min(width, height) * FONT_RATIO;
  51493. let metrics, char;
  51494. if (type === "check") {
  51495. metrics = {
  51496. width: 0.755 * fontSize,
  51497. height: 0.705 * fontSize
  51498. };
  51499. char = "\x33";
  51500. } else if (type === "disc") {
  51501. metrics = {
  51502. width: 0.791 * fontSize,
  51503. height: 0.705 * fontSize
  51504. };
  51505. char = "\x6C";
  51506. } else {
  51507. unreachable(`_getDefaultCheckedAppearance - unsupported type: ${type}`);
  51508. }
  51509. const xShift = numberToString((width - metrics.width) / 2);
  51510. const yShift = numberToString((height - metrics.height) / 2);
  51511. const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`;
  51512. const appearanceStreamDict = new Dict(params.xref);
  51513. appearanceStreamDict.set("FormType", 1);
  51514. appearanceStreamDict.set("Subtype", Name.get("Form"));
  51515. appearanceStreamDict.set("Type", Name.get("XObject"));
  51516. appearanceStreamDict.set("BBox", bbox);
  51517. appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]);
  51518. appearanceStreamDict.set("Length", appearance.length);
  51519. const resources = new Dict(params.xref);
  51520. const font = new Dict(params.xref);
  51521. font.set("PdfJsZaDb", this.fallbackFontDict);
  51522. resources.set("Font", font);
  51523. appearanceStreamDict.set("Resources", resources);
  51524. this.checkedAppearance = new StringStream(appearance);
  51525. this.checkedAppearance.dict = appearanceStreamDict;
  51526. this._streams.push(this.checkedAppearance);
  51527. }
  51528. _processCheckBox(params) {
  51529. const customAppearance = params.dict.get("AP");
  51530. if (!(customAppearance instanceof Dict)) {
  51531. return;
  51532. }
  51533. const normalAppearance = customAppearance.get("N");
  51534. if (!(normalAppearance instanceof Dict)) {
  51535. return;
  51536. }
  51537. const asValue = this._decodeFormValue(params.dict.get("AS"));
  51538. if (typeof asValue === "string") {
  51539. this.data.fieldValue = asValue;
  51540. }
  51541. const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes";
  51542. const exportValues = normalAppearance.getKeys();
  51543. if (exportValues.length === 0) {
  51544. exportValues.push("Off", yes);
  51545. } else if (exportValues.length === 1) {
  51546. if (exportValues[0] === "Off") {
  51547. exportValues.push(yes);
  51548. } else {
  51549. exportValues.unshift("Off");
  51550. }
  51551. } else if (exportValues.includes(yes)) {
  51552. exportValues.length = 0;
  51553. exportValues.push("Off", yes);
  51554. } else {
  51555. const otherYes = exportValues.find(v => v !== "Off");
  51556. exportValues.length = 0;
  51557. exportValues.push("Off", otherYes);
  51558. }
  51559. if (!exportValues.includes(this.data.fieldValue)) {
  51560. this.data.fieldValue = "Off";
  51561. }
  51562. this.data.exportValue = exportValues[1];
  51563. const checkedAppearance = normalAppearance.get(this.data.exportValue);
  51564. this.checkedAppearance = checkedAppearance instanceof BaseStream ? checkedAppearance : null;
  51565. const uncheckedAppearance = normalAppearance.get("Off");
  51566. this.uncheckedAppearance = uncheckedAppearance instanceof BaseStream ? uncheckedAppearance : null;
  51567. if (this.checkedAppearance) {
  51568. this._streams.push(this.checkedAppearance);
  51569. } else {
  51570. this._getDefaultCheckedAppearance(params, "check");
  51571. }
  51572. if (this.uncheckedAppearance) {
  51573. this._streams.push(this.uncheckedAppearance);
  51574. }
  51575. this._fallbackFontDict = this.fallbackFontDict;
  51576. if (this.data.defaultFieldValue === null) {
  51577. this.data.defaultFieldValue = "Off";
  51578. }
  51579. }
  51580. _processRadioButton(params) {
  51581. this.data.buttonValue = null;
  51582. const fieldParent = params.dict.get("Parent");
  51583. if (fieldParent instanceof Dict) {
  51584. this.parent = params.dict.getRaw("Parent");
  51585. const fieldParentValue = fieldParent.get("V");
  51586. if (fieldParentValue instanceof Name) {
  51587. this.data.fieldValue = this._decodeFormValue(fieldParentValue);
  51588. }
  51589. }
  51590. const appearanceStates = params.dict.get("AP");
  51591. if (!(appearanceStates instanceof Dict)) {
  51592. return;
  51593. }
  51594. const normalAppearance = appearanceStates.get("N");
  51595. if (!(normalAppearance instanceof Dict)) {
  51596. return;
  51597. }
  51598. for (const key of normalAppearance.getKeys()) {
  51599. if (key !== "Off") {
  51600. this.data.buttonValue = this._decodeFormValue(key);
  51601. break;
  51602. }
  51603. }
  51604. const checkedAppearance = normalAppearance.get(this.data.buttonValue);
  51605. this.checkedAppearance = checkedAppearance instanceof BaseStream ? checkedAppearance : null;
  51606. const uncheckedAppearance = normalAppearance.get("Off");
  51607. this.uncheckedAppearance = uncheckedAppearance instanceof BaseStream ? uncheckedAppearance : null;
  51608. if (this.checkedAppearance) {
  51609. this._streams.push(this.checkedAppearance);
  51610. } else {
  51611. this._getDefaultCheckedAppearance(params, "disc");
  51612. }
  51613. if (this.uncheckedAppearance) {
  51614. this._streams.push(this.uncheckedAppearance);
  51615. }
  51616. this._fallbackFontDict = this.fallbackFontDict;
  51617. if (this.data.defaultFieldValue === null) {
  51618. this.data.defaultFieldValue = "Off";
  51619. }
  51620. }
  51621. _processPushButton(params) {
  51622. const {
  51623. dict,
  51624. annotationGlobals
  51625. } = params;
  51626. if (!dict.has("A") && !dict.has("AA") && !this.data.alternativeText) {
  51627. warn("Push buttons without action dictionaries are not supported");
  51628. return;
  51629. }
  51630. this.data.isTooltipOnly = !dict.has("A") && !dict.has("AA");
  51631. Catalog.parseDestDictionary({
  51632. destDict: dict,
  51633. resultObj: this.data,
  51634. docBaseUrl: annotationGlobals.baseUrl,
  51635. docAttachments: annotationGlobals.attachments
  51636. });
  51637. }
  51638. getFieldObject() {
  51639. let type = "button";
  51640. let exportValues;
  51641. if (this.data.checkBox) {
  51642. type = "checkbox";
  51643. exportValues = this.data.exportValue;
  51644. } else if (this.data.radioButton) {
  51645. type = "radiobutton";
  51646. exportValues = this.data.buttonValue;
  51647. }
  51648. return {
  51649. id: this.data.id,
  51650. value: this.data.fieldValue || "Off",
  51651. defaultValue: this.data.defaultFieldValue,
  51652. exportValues,
  51653. editable: !this.data.readOnly,
  51654. name: this.data.fieldName,
  51655. rect: this.data.rect,
  51656. hidden: this.data.hidden,
  51657. actions: this.data.actions,
  51658. page: this.data.pageIndex,
  51659. strokeColor: this.data.borderColor,
  51660. fillColor: this.data.backgroundColor,
  51661. rotation: this.rotation,
  51662. type
  51663. };
  51664. }
  51665. get fallbackFontDict() {
  51666. const dict = new Dict();
  51667. dict.set("BaseFont", Name.get("ZapfDingbats"));
  51668. dict.set("Type", Name.get("FallbackType"));
  51669. dict.set("Subtype", Name.get("FallbackType"));
  51670. dict.set("Encoding", Name.get("ZapfDingbatsEncoding"));
  51671. return shadow(this, "fallbackFontDict", dict);
  51672. }
  51673. }
  51674. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  51675. constructor(params) {
  51676. super(params);
  51677. const {
  51678. dict,
  51679. xref
  51680. } = params;
  51681. this.indices = dict.getArray("I");
  51682. this.hasIndices = Array.isArray(this.indices) && this.indices.length > 0;
  51683. this.data.options = [];
  51684. const options = getInheritableProperty({
  51685. dict,
  51686. key: "Opt"
  51687. });
  51688. if (Array.isArray(options)) {
  51689. for (let i = 0, ii = options.length; i < ii; i++) {
  51690. const option = xref.fetchIfRef(options[i]);
  51691. const isOptionArray = Array.isArray(option);
  51692. this.data.options[i] = {
  51693. exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
  51694. displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
  51695. };
  51696. }
  51697. }
  51698. if (!this.hasIndices) {
  51699. if (typeof this.data.fieldValue === "string") {
  51700. this.data.fieldValue = [this.data.fieldValue];
  51701. } else if (!this.data.fieldValue) {
  51702. this.data.fieldValue = [];
  51703. }
  51704. } else {
  51705. this.data.fieldValue = [];
  51706. const ii = this.data.options.length;
  51707. for (const i of this.indices) {
  51708. if (Number.isInteger(i) && i >= 0 && i < ii) {
  51709. this.data.fieldValue.push(this.data.options[i].exportValue);
  51710. }
  51711. }
  51712. }
  51713. this.data.combo = this.hasFieldFlag(AnnotationFieldFlag.COMBO);
  51714. this.data.multiSelect = this.hasFieldFlag(AnnotationFieldFlag.MULTISELECT);
  51715. this._hasText = true;
  51716. }
  51717. getFieldObject() {
  51718. const type = this.data.combo ? "combobox" : "listbox";
  51719. const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
  51720. return {
  51721. id: this.data.id,
  51722. value,
  51723. defaultValue: this.data.defaultFieldValue,
  51724. editable: !this.data.readOnly,
  51725. name: this.data.fieldName,
  51726. rect: this.data.rect,
  51727. numItems: this.data.fieldValue.length,
  51728. multipleSelection: this.data.multiSelect,
  51729. hidden: this.data.hidden,
  51730. actions: this.data.actions,
  51731. items: this.data.options,
  51732. page: this.data.pageIndex,
  51733. strokeColor: this.data.borderColor,
  51734. fillColor: this.data.backgroundColor,
  51735. rotation: this.rotation,
  51736. type
  51737. };
  51738. }
  51739. amendSavedDict(annotationStorage, dict) {
  51740. if (!this.hasIndices) {
  51741. return;
  51742. }
  51743. let values = annotationStorage?.get(this.data.id)?.value;
  51744. if (!Array.isArray(values)) {
  51745. values = [values];
  51746. }
  51747. const indices = [];
  51748. const {
  51749. options
  51750. } = this.data;
  51751. for (let i = 0, j = 0, ii = options.length; i < ii; i++) {
  51752. if (options[i].exportValue === values[j]) {
  51753. indices.push(i);
  51754. j += 1;
  51755. }
  51756. }
  51757. dict.set("I", indices);
  51758. }
  51759. async _getAppearance(evaluator, task, intent, annotationStorage) {
  51760. if (this.data.combo) {
  51761. return super._getAppearance(evaluator, task, intent, annotationStorage);
  51762. }
  51763. let exportedValue, rotation;
  51764. const storageEntry = annotationStorage?.get(this.data.id);
  51765. if (storageEntry) {
  51766. rotation = storageEntry.rotation;
  51767. exportedValue = storageEntry.value;
  51768. }
  51769. if (rotation === undefined && exportedValue === undefined && !this._needAppearances) {
  51770. return null;
  51771. }
  51772. if (exportedValue === undefined) {
  51773. exportedValue = this.data.fieldValue;
  51774. } else if (!Array.isArray(exportedValue)) {
  51775. exportedValue = [exportedValue];
  51776. }
  51777. const defaultPadding = 1;
  51778. const defaultHPadding = 2;
  51779. let totalHeight = this.data.rect[3] - this.data.rect[1];
  51780. let totalWidth = this.data.rect[2] - this.data.rect[0];
  51781. if (rotation === 90 || rotation === 270) {
  51782. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  51783. }
  51784. const lineCount = this.data.options.length;
  51785. const valueIndices = [];
  51786. for (let i = 0; i < lineCount; i++) {
  51787. const {
  51788. exportValue
  51789. } = this.data.options[i];
  51790. if (exportedValue.includes(exportValue)) {
  51791. valueIndices.push(i);
  51792. }
  51793. }
  51794. if (!this._defaultAppearance) {
  51795. this.data.defaultAppearanceData = parseDefaultAppearance(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  51796. }
  51797. const font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  51798. let defaultAppearance;
  51799. let {
  51800. fontSize
  51801. } = this.data.defaultAppearanceData;
  51802. if (!fontSize) {
  51803. const lineHeight = (totalHeight - defaultPadding) / lineCount;
  51804. let lineWidth = -1;
  51805. let value;
  51806. for (const {
  51807. displayValue
  51808. } of this.data.options) {
  51809. const width = this._getTextWidth(displayValue, font);
  51810. if (width > lineWidth) {
  51811. lineWidth = width;
  51812. value = displayValue;
  51813. }
  51814. }
  51815. [defaultAppearance, fontSize] = this._computeFontSize(lineHeight, totalWidth - 2 * defaultHPadding, value, font, -1);
  51816. } else {
  51817. defaultAppearance = this._defaultAppearance;
  51818. }
  51819. const lineHeight = fontSize * LINE_FACTOR;
  51820. const vPadding = (lineHeight - fontSize) / 2;
  51821. const numberOfVisibleLines = Math.floor(totalHeight / lineHeight);
  51822. let firstIndex = 0;
  51823. if (valueIndices.length > 0) {
  51824. const minIndex = Math.min(...valueIndices);
  51825. const maxIndex = Math.max(...valueIndices);
  51826. firstIndex = Math.max(0, maxIndex - numberOfVisibleLines + 1);
  51827. if (firstIndex > minIndex) {
  51828. firstIndex = minIndex;
  51829. }
  51830. }
  51831. const end = Math.min(firstIndex + numberOfVisibleLines + 1, lineCount);
  51832. const buf = ["/Tx BMC q", `1 1 ${totalWidth} ${totalHeight} re W n`];
  51833. if (valueIndices.length) {
  51834. buf.push("0.600006 0.756866 0.854904 rg");
  51835. for (const index of valueIndices) {
  51836. if (firstIndex <= index && index < end) {
  51837. buf.push(`1 ${totalHeight - (index - firstIndex + 1) * lineHeight} ${totalWidth} ${lineHeight} re f`);
  51838. }
  51839. }
  51840. }
  51841. buf.push("BT", defaultAppearance, `1 0 0 1 0 ${totalHeight} Tm`);
  51842. const prevInfo = {
  51843. shift: 0
  51844. };
  51845. for (let i = firstIndex; i < end; i++) {
  51846. const {
  51847. displayValue
  51848. } = this.data.options[i];
  51849. const vpadding = i === firstIndex ? vPadding : 0;
  51850. buf.push(this._renderText(displayValue, font, fontSize, totalWidth, 0, prevInfo, defaultHPadding, -lineHeight + vpadding));
  51851. }
  51852. buf.push("ET Q EMC");
  51853. return buf.join("\n");
  51854. }
  51855. }
  51856. class SignatureWidgetAnnotation extends WidgetAnnotation {
  51857. constructor(params) {
  51858. super(params);
  51859. this.data.fieldValue = null;
  51860. this.data.hasOwnCanvas = this.data.noRotate;
  51861. this.data.noHTML = !this.data.hasOwnCanvas;
  51862. }
  51863. getFieldObject() {
  51864. return {
  51865. id: this.data.id,
  51866. value: null,
  51867. page: this.data.pageIndex,
  51868. type: "signature"
  51869. };
  51870. }
  51871. }
  51872. class TextAnnotation extends MarkupAnnotation {
  51873. constructor(params) {
  51874. const DEFAULT_ICON_SIZE = 22;
  51875. super(params);
  51876. this.data.noRotate = true;
  51877. this.data.hasOwnCanvas = this.data.noRotate;
  51878. this.data.noHTML = false;
  51879. const {
  51880. dict
  51881. } = params;
  51882. this.data.annotationType = AnnotationType.TEXT;
  51883. if (this.data.hasAppearance) {
  51884. this.data.name = "NoIcon";
  51885. } else {
  51886. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  51887. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  51888. this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
  51889. }
  51890. if (dict.has("State")) {
  51891. this.data.state = dict.get("State") || null;
  51892. this.data.stateModel = dict.get("StateModel") || null;
  51893. } else {
  51894. this.data.state = null;
  51895. this.data.stateModel = null;
  51896. }
  51897. }
  51898. }
  51899. class LinkAnnotation extends Annotation {
  51900. constructor(params) {
  51901. super(params);
  51902. const {
  51903. dict,
  51904. annotationGlobals
  51905. } = params;
  51906. this.data.annotationType = AnnotationType.LINK;
  51907. this.data.noHTML = false;
  51908. const quadPoints = getQuadPoints(dict, this.rectangle);
  51909. if (quadPoints) {
  51910. this.data.quadPoints = quadPoints;
  51911. }
  51912. this.data.borderColor ||= this.data.color;
  51913. Catalog.parseDestDictionary({
  51914. destDict: dict,
  51915. resultObj: this.data,
  51916. docBaseUrl: annotationGlobals.baseUrl,
  51917. docAttachments: annotationGlobals.attachments
  51918. });
  51919. }
  51920. }
  51921. class PopupAnnotation extends Annotation {
  51922. constructor(params) {
  51923. super(params);
  51924. const {
  51925. dict
  51926. } = params;
  51927. this.data.annotationType = AnnotationType.POPUP;
  51928. this.data.noHTML = false;
  51929. if (this.data.rect[0] === this.data.rect[2] || this.data.rect[1] === this.data.rect[3]) {
  51930. this.data.rect = null;
  51931. }
  51932. let parentItem = dict.get("Parent");
  51933. if (!parentItem) {
  51934. warn("Popup annotation has a missing or invalid parent annotation.");
  51935. return;
  51936. }
  51937. this.data.parentRect = lookupNormalRect(parentItem.getArray("Rect"), null);
  51938. const rt = parentItem.get("RT");
  51939. if (isName(rt, AnnotationReplyType.GROUP)) {
  51940. parentItem = parentItem.get("IRT");
  51941. }
  51942. if (!parentItem.has("M")) {
  51943. this.data.modificationDate = null;
  51944. } else {
  51945. this.setModificationDate(parentItem.get("M"));
  51946. this.data.modificationDate = this.modificationDate;
  51947. }
  51948. if (!parentItem.has("C")) {
  51949. this.data.color = null;
  51950. } else {
  51951. this.setColor(parentItem.getArray("C"));
  51952. this.data.color = this.color;
  51953. }
  51954. if (!this.viewable) {
  51955. const parentFlags = parentItem.get("F");
  51956. if (this._isViewable(parentFlags)) {
  51957. this.setFlags(parentFlags);
  51958. }
  51959. }
  51960. this.setTitle(parentItem.get("T"));
  51961. this.data.titleObj = this._title;
  51962. this.setContents(parentItem.get("Contents"));
  51963. this.data.contentsObj = this._contents;
  51964. if (parentItem.has("RC")) {
  51965. this.data.richText = XFAFactory.getRichTextAsHtml(parentItem.get("RC"));
  51966. }
  51967. this.data.open = !!dict.get("Open");
  51968. }
  51969. }
  51970. class FreeTextAnnotation extends MarkupAnnotation {
  51971. constructor(params) {
  51972. super(params);
  51973. this.data.hasOwnCanvas = this.data.noRotate;
  51974. this.data.isEditable = !this.data.noHTML;
  51975. this.data.noHTML = false;
  51976. const {
  51977. evaluatorOptions,
  51978. xref
  51979. } = params;
  51980. this.data.annotationType = AnnotationType.FREETEXT;
  51981. this.setDefaultAppearance(params);
  51982. this._hasAppearance = !!this.appearance;
  51983. if (this._hasAppearance) {
  51984. const {
  51985. fontColor,
  51986. fontSize
  51987. } = parseAppearanceStream(this.appearance, evaluatorOptions, xref);
  51988. this.data.defaultAppearanceData.fontColor = fontColor;
  51989. this.data.defaultAppearanceData.fontSize = fontSize || 10;
  51990. } else {
  51991. this.data.defaultAppearanceData.fontSize ||= 10;
  51992. const {
  51993. fontColor,
  51994. fontSize
  51995. } = this.data.defaultAppearanceData;
  51996. if (this._contents.str) {
  51997. this.data.textContent = this._contents.str.split(/\r\n?|\n/).map(line => line.trimEnd());
  51998. const {
  51999. coords,
  52000. bbox,
  52001. matrix
  52002. } = FakeUnicodeFont.getFirstPositionInfo(this.rectangle, this.rotation, fontSize);
  52003. this.data.textPosition = this._transformPoint(coords, bbox, matrix);
  52004. }
  52005. if (this._isOffscreenCanvasSupported) {
  52006. const strokeAlpha = params.dict.get("CA");
  52007. const fakeUnicodeFont = new FakeUnicodeFont(xref, "sans-serif");
  52008. this.appearance = fakeUnicodeFont.createAppearance(this._contents.str, this.rectangle, this.rotation, fontSize, fontColor, strokeAlpha);
  52009. this._streams.push(this.appearance);
  52010. } else {
  52011. warn("FreeTextAnnotation: OffscreenCanvas is not supported, annotation may not render correctly.");
  52012. }
  52013. }
  52014. }
  52015. get hasTextContent() {
  52016. return this._hasAppearance;
  52017. }
  52018. static createNewDict(annotation, xref, {
  52019. apRef,
  52020. ap
  52021. }) {
  52022. const {
  52023. color,
  52024. fontSize,
  52025. oldAnnotation,
  52026. rect,
  52027. rotation,
  52028. user,
  52029. value
  52030. } = annotation;
  52031. const freetext = oldAnnotation || new Dict(xref);
  52032. freetext.set("Type", Name.get("Annot"));
  52033. freetext.set("Subtype", Name.get("FreeText"));
  52034. if (oldAnnotation) {
  52035. freetext.set("M", `D:${getModificationDate()}`);
  52036. freetext.delete("RC");
  52037. } else {
  52038. freetext.set("CreationDate", `D:${getModificationDate()}`);
  52039. }
  52040. freetext.set("Rect", rect);
  52041. const da = `/Helv ${fontSize} Tf ${getPdfColor(color, true)}`;
  52042. freetext.set("DA", da);
  52043. freetext.set("Contents", stringToAsciiOrUTF16BE(value));
  52044. freetext.set("F", 4);
  52045. freetext.set("Border", [0, 0, 0]);
  52046. freetext.set("Rotate", rotation);
  52047. if (user) {
  52048. freetext.set("T", stringToAsciiOrUTF16BE(user));
  52049. }
  52050. if (apRef || ap) {
  52051. const n = new Dict(xref);
  52052. freetext.set("AP", n);
  52053. if (apRef) {
  52054. n.set("N", apRef);
  52055. } else {
  52056. n.set("N", ap);
  52057. }
  52058. }
  52059. return freetext;
  52060. }
  52061. static async createNewAppearanceStream(annotation, xref, params) {
  52062. const {
  52063. baseFontRef,
  52064. evaluator,
  52065. task
  52066. } = params;
  52067. const {
  52068. color,
  52069. fontSize,
  52070. rect,
  52071. rotation,
  52072. value
  52073. } = annotation;
  52074. const resources = new Dict(xref);
  52075. const font = new Dict(xref);
  52076. if (baseFontRef) {
  52077. font.set("Helv", baseFontRef);
  52078. } else {
  52079. const baseFont = new Dict(xref);
  52080. baseFont.set("BaseFont", Name.get("Helvetica"));
  52081. baseFont.set("Type", Name.get("Font"));
  52082. baseFont.set("Subtype", Name.get("Type1"));
  52083. baseFont.set("Encoding", Name.get("WinAnsiEncoding"));
  52084. font.set("Helv", baseFont);
  52085. }
  52086. resources.set("Font", font);
  52087. const helv = await WidgetAnnotation._getFontData(evaluator, task, {
  52088. fontName: "Helv",
  52089. fontSize
  52090. }, resources);
  52091. const [x1, y1, x2, y2] = rect;
  52092. let w = x2 - x1;
  52093. let h = y2 - y1;
  52094. if (rotation % 180 !== 0) {
  52095. [w, h] = [h, w];
  52096. }
  52097. const lines = value.split("\n");
  52098. const scale = fontSize / 1000;
  52099. let totalWidth = -Infinity;
  52100. const encodedLines = [];
  52101. for (let line of lines) {
  52102. const encoded = helv.encodeString(line);
  52103. if (encoded.length > 1) {
  52104. return null;
  52105. }
  52106. line = encoded.join("");
  52107. encodedLines.push(line);
  52108. let lineWidth = 0;
  52109. const glyphs = helv.charsToGlyphs(line);
  52110. for (const glyph of glyphs) {
  52111. lineWidth += glyph.width * scale;
  52112. }
  52113. totalWidth = Math.max(totalWidth, lineWidth);
  52114. }
  52115. let hscale = 1;
  52116. if (totalWidth > w) {
  52117. hscale = w / totalWidth;
  52118. }
  52119. let vscale = 1;
  52120. const lineHeight = LINE_FACTOR * fontSize;
  52121. const lineAscent = (LINE_FACTOR - LINE_DESCENT_FACTOR) * fontSize;
  52122. const totalHeight = lineHeight * lines.length;
  52123. if (totalHeight > h) {
  52124. vscale = h / totalHeight;
  52125. }
  52126. const fscale = Math.min(hscale, vscale);
  52127. const newFontSize = fontSize * fscale;
  52128. let firstPoint, clipBox, matrix;
  52129. switch (rotation) {
  52130. case 0:
  52131. matrix = [1, 0, 0, 1];
  52132. clipBox = [rect[0], rect[1], w, h];
  52133. firstPoint = [rect[0], rect[3] - lineAscent];
  52134. break;
  52135. case 90:
  52136. matrix = [0, 1, -1, 0];
  52137. clipBox = [rect[1], -rect[2], w, h];
  52138. firstPoint = [rect[1], -rect[0] - lineAscent];
  52139. break;
  52140. case 180:
  52141. matrix = [-1, 0, 0, -1];
  52142. clipBox = [-rect[2], -rect[3], w, h];
  52143. firstPoint = [-rect[2], -rect[1] - lineAscent];
  52144. break;
  52145. case 270:
  52146. matrix = [0, -1, 1, 0];
  52147. clipBox = [-rect[3], rect[0], w, h];
  52148. firstPoint = [-rect[3], rect[2] - lineAscent];
  52149. break;
  52150. }
  52151. const buffer = ["q", `${matrix.join(" ")} 0 0 cm`, `${clipBox.join(" ")} re W n`, `BT`, `${getPdfColor(color, true)}`, `0 Tc /Helv ${numberToString(newFontSize)} Tf`];
  52152. buffer.push(`${firstPoint.join(" ")} Td (${escapeString(encodedLines[0])}) Tj`);
  52153. const vShift = numberToString(lineHeight);
  52154. for (let i = 1, ii = encodedLines.length; i < ii; i++) {
  52155. const line = encodedLines[i];
  52156. buffer.push(`0 -${vShift} Td (${escapeString(line)}) Tj`);
  52157. }
  52158. buffer.push("ET", "Q");
  52159. const appearance = buffer.join("\n");
  52160. const appearanceStreamDict = new Dict(xref);
  52161. appearanceStreamDict.set("FormType", 1);
  52162. appearanceStreamDict.set("Subtype", Name.get("Form"));
  52163. appearanceStreamDict.set("Type", Name.get("XObject"));
  52164. appearanceStreamDict.set("BBox", rect);
  52165. appearanceStreamDict.set("Resources", resources);
  52166. appearanceStreamDict.set("Matrix", [1, 0, 0, 1, -rect[0], -rect[1]]);
  52167. const ap = new StringStream(appearance);
  52168. ap.dict = appearanceStreamDict;
  52169. return ap;
  52170. }
  52171. }
  52172. class LineAnnotation extends MarkupAnnotation {
  52173. constructor(params) {
  52174. super(params);
  52175. const {
  52176. dict,
  52177. xref
  52178. } = params;
  52179. this.data.annotationType = AnnotationType.LINE;
  52180. this.data.hasOwnCanvas = this.data.noRotate;
  52181. this.data.noHTML = false;
  52182. const lineCoordinates = lookupRect(dict.getArray("L"), [0, 0, 0, 0]);
  52183. this.data.lineCoordinates = Util.normalizeRect(lineCoordinates);
  52184. this.setLineEndings(dict.getArray("LE"));
  52185. this.data.lineEndings = this.lineEndings;
  52186. if (!this.appearance) {
  52187. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  52188. const strokeAlpha = dict.get("CA");
  52189. const interiorColor = getRgbColor(dict.getArray("IC"), null);
  52190. const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
  52191. const fillAlpha = fillColor ? strokeAlpha : null;
  52192. const borderWidth = this.borderStyle.width || 1,
  52193. borderAdjust = 2 * borderWidth;
  52194. const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust];
  52195. if (!Util.intersect(this.rectangle, bbox)) {
  52196. this.rectangle = bbox;
  52197. }
  52198. this._setDefaultAppearance({
  52199. xref,
  52200. extra: `${borderWidth} w`,
  52201. strokeColor,
  52202. fillColor,
  52203. strokeAlpha,
  52204. fillAlpha,
  52205. pointsCallback: (buffer, points) => {
  52206. buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
  52207. return [points[0] - borderWidth, points[2] + borderWidth, points[7] - borderWidth, points[3] + borderWidth];
  52208. }
  52209. });
  52210. }
  52211. }
  52212. }
  52213. class SquareAnnotation extends MarkupAnnotation {
  52214. constructor(params) {
  52215. super(params);
  52216. const {
  52217. dict,
  52218. xref
  52219. } = params;
  52220. this.data.annotationType = AnnotationType.SQUARE;
  52221. this.data.hasOwnCanvas = this.data.noRotate;
  52222. this.data.noHTML = false;
  52223. if (!this.appearance) {
  52224. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  52225. const strokeAlpha = dict.get("CA");
  52226. const interiorColor = getRgbColor(dict.getArray("IC"), null);
  52227. const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
  52228. const fillAlpha = fillColor ? strokeAlpha : null;
  52229. if (this.borderStyle.width === 0 && !fillColor) {
  52230. return;
  52231. }
  52232. this._setDefaultAppearance({
  52233. xref,
  52234. extra: `${this.borderStyle.width} w`,
  52235. strokeColor,
  52236. fillColor,
  52237. strokeAlpha,
  52238. fillAlpha,
  52239. pointsCallback: (buffer, points) => {
  52240. const x = points[4] + this.borderStyle.width / 2;
  52241. const y = points[5] + this.borderStyle.width / 2;
  52242. const width = points[6] - points[4] - this.borderStyle.width;
  52243. const height = points[3] - points[7] - this.borderStyle.width;
  52244. buffer.push(`${x} ${y} ${width} ${height} re`);
  52245. if (fillColor) {
  52246. buffer.push("B");
  52247. } else {
  52248. buffer.push("S");
  52249. }
  52250. return [points[0], points[2], points[7], points[3]];
  52251. }
  52252. });
  52253. }
  52254. }
  52255. }
  52256. class CircleAnnotation extends MarkupAnnotation {
  52257. constructor(params) {
  52258. super(params);
  52259. const {
  52260. dict,
  52261. xref
  52262. } = params;
  52263. this.data.annotationType = AnnotationType.CIRCLE;
  52264. if (!this.appearance) {
  52265. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  52266. const strokeAlpha = dict.get("CA");
  52267. const interiorColor = getRgbColor(dict.getArray("IC"), null);
  52268. const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
  52269. const fillAlpha = fillColor ? strokeAlpha : null;
  52270. if (this.borderStyle.width === 0 && !fillColor) {
  52271. return;
  52272. }
  52273. const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4));
  52274. this._setDefaultAppearance({
  52275. xref,
  52276. extra: `${this.borderStyle.width} w`,
  52277. strokeColor,
  52278. fillColor,
  52279. strokeAlpha,
  52280. fillAlpha,
  52281. pointsCallback: (buffer, points) => {
  52282. const x0 = points[0] + this.borderStyle.width / 2;
  52283. const y0 = points[1] - this.borderStyle.width / 2;
  52284. const x1 = points[6] - this.borderStyle.width / 2;
  52285. const y1 = points[7] + this.borderStyle.width / 2;
  52286. const xMid = x0 + (x1 - x0) / 2;
  52287. const yMid = y0 + (y1 - y0) / 2;
  52288. const xOffset = (x1 - x0) / 2 * controlPointsDistance;
  52289. const yOffset = (y1 - y0) / 2 * controlPointsDistance;
  52290. buffer.push(`${xMid} ${y1} m`, `${xMid + xOffset} ${y1} ${x1} ${yMid + yOffset} ${x1} ${yMid} c`, `${x1} ${yMid - yOffset} ${xMid + xOffset} ${y0} ${xMid} ${y0} c`, `${xMid - xOffset} ${y0} ${x0} ${yMid - yOffset} ${x0} ${yMid} c`, `${x0} ${yMid + yOffset} ${xMid - xOffset} ${y1} ${xMid} ${y1} c`, "h");
  52291. if (fillColor) {
  52292. buffer.push("B");
  52293. } else {
  52294. buffer.push("S");
  52295. }
  52296. return [points[0], points[2], points[7], points[3]];
  52297. }
  52298. });
  52299. }
  52300. }
  52301. }
  52302. class PolylineAnnotation extends MarkupAnnotation {
  52303. constructor(params) {
  52304. super(params);
  52305. const {
  52306. dict,
  52307. xref
  52308. } = params;
  52309. this.data.annotationType = AnnotationType.POLYLINE;
  52310. this.data.hasOwnCanvas = this.data.noRotate;
  52311. this.data.noHTML = false;
  52312. this.data.vertices = null;
  52313. if (!(this instanceof PolygonAnnotation)) {
  52314. this.setLineEndings(dict.getArray("LE"));
  52315. this.data.lineEndings = this.lineEndings;
  52316. }
  52317. const rawVertices = dict.getArray("Vertices");
  52318. if (!isNumberArray(rawVertices, null)) {
  52319. return;
  52320. }
  52321. const vertices = this.data.vertices = Float32Array.from(rawVertices);
  52322. if (!this.appearance) {
  52323. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  52324. const strokeAlpha = dict.get("CA");
  52325. const borderWidth = this.borderStyle.width || 1,
  52326. borderAdjust = 2 * borderWidth;
  52327. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  52328. for (let i = 0, ii = vertices.length; i < ii; i += 2) {
  52329. bbox[0] = Math.min(bbox[0], vertices[i] - borderAdjust);
  52330. bbox[1] = Math.min(bbox[1], vertices[i + 1] - borderAdjust);
  52331. bbox[2] = Math.max(bbox[2], vertices[i] + borderAdjust);
  52332. bbox[3] = Math.max(bbox[3], vertices[i + 1] + borderAdjust);
  52333. }
  52334. if (!Util.intersect(this.rectangle, bbox)) {
  52335. this.rectangle = bbox;
  52336. }
  52337. this._setDefaultAppearance({
  52338. xref,
  52339. extra: `${borderWidth} w`,
  52340. strokeColor,
  52341. strokeAlpha,
  52342. pointsCallback: (buffer, points) => {
  52343. for (let i = 0, ii = vertices.length; i < ii; i += 2) {
  52344. buffer.push(`${vertices[i]} ${vertices[i + 1]} ${i === 0 ? "m" : "l"}`);
  52345. }
  52346. buffer.push("S");
  52347. return [points[0], points[2], points[7], points[3]];
  52348. }
  52349. });
  52350. }
  52351. }
  52352. }
  52353. class PolygonAnnotation extends PolylineAnnotation {
  52354. constructor(params) {
  52355. super(params);
  52356. this.data.annotationType = AnnotationType.POLYGON;
  52357. }
  52358. }
  52359. class CaretAnnotation extends MarkupAnnotation {
  52360. constructor(params) {
  52361. super(params);
  52362. this.data.annotationType = AnnotationType.CARET;
  52363. }
  52364. }
  52365. class InkAnnotation extends MarkupAnnotation {
  52366. constructor(params) {
  52367. super(params);
  52368. this.data.hasOwnCanvas = this.data.noRotate;
  52369. this.data.noHTML = false;
  52370. const {
  52371. dict,
  52372. xref
  52373. } = params;
  52374. this.data.annotationType = AnnotationType.INK;
  52375. this.data.inkLists = [];
  52376. this.data.isEditable = !this.data.noHTML && this.data.it === "InkHighlight";
  52377. this.data.noHTML = false;
  52378. this.data.opacity = dict.get("CA") || 1;
  52379. const rawInkLists = dict.getArray("InkList");
  52380. if (!Array.isArray(rawInkLists)) {
  52381. return;
  52382. }
  52383. for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
  52384. if (!Array.isArray(rawInkLists[i])) {
  52385. continue;
  52386. }
  52387. const inkList = new Float32Array(rawInkLists[i].length);
  52388. this.data.inkLists.push(inkList);
  52389. for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
  52390. const x = xref.fetchIfRef(rawInkLists[i][j]),
  52391. y = xref.fetchIfRef(rawInkLists[i][j + 1]);
  52392. if (typeof x === "number" && typeof y === "number") {
  52393. inkList[j] = x;
  52394. inkList[j + 1] = y;
  52395. }
  52396. }
  52397. }
  52398. if (!this.appearance) {
  52399. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  52400. const strokeAlpha = dict.get("CA");
  52401. const borderWidth = this.borderStyle.width || 1,
  52402. borderAdjust = 2 * borderWidth;
  52403. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  52404. for (const inkList of this.data.inkLists) {
  52405. for (let i = 0, ii = inkList.length; i < ii; i += 2) {
  52406. bbox[0] = Math.min(bbox[0], inkList[i] - borderAdjust);
  52407. bbox[1] = Math.min(bbox[1], inkList[i + 1] - borderAdjust);
  52408. bbox[2] = Math.max(bbox[2], inkList[i] + borderAdjust);
  52409. bbox[3] = Math.max(bbox[3], inkList[i + 1] + borderAdjust);
  52410. }
  52411. }
  52412. if (!Util.intersect(this.rectangle, bbox)) {
  52413. this.rectangle = bbox;
  52414. }
  52415. this._setDefaultAppearance({
  52416. xref,
  52417. extra: `${borderWidth} w`,
  52418. strokeColor,
  52419. strokeAlpha,
  52420. pointsCallback: (buffer, points) => {
  52421. for (const inkList of this.data.inkLists) {
  52422. for (let i = 0, ii = inkList.length; i < ii; i += 2) {
  52423. buffer.push(`${inkList[i]} ${inkList[i + 1]} ${i === 0 ? "m" : "l"}`);
  52424. }
  52425. buffer.push("S");
  52426. }
  52427. return [points[0], points[2], points[7], points[3]];
  52428. }
  52429. });
  52430. }
  52431. }
  52432. static createNewDict(annotation, xref, {
  52433. apRef,
  52434. ap
  52435. }) {
  52436. const {
  52437. color,
  52438. opacity,
  52439. paths,
  52440. outlines,
  52441. rect,
  52442. rotation,
  52443. thickness
  52444. } = annotation;
  52445. const ink = new Dict(xref);
  52446. ink.set("Type", Name.get("Annot"));
  52447. ink.set("Subtype", Name.get("Ink"));
  52448. ink.set("CreationDate", `D:${getModificationDate()}`);
  52449. ink.set("Rect", rect);
  52450. ink.set("InkList", outlines?.points || paths.map(p => p.points));
  52451. ink.set("F", 4);
  52452. ink.set("Rotate", rotation);
  52453. if (outlines) {
  52454. ink.set("IT", Name.get("InkHighlight"));
  52455. }
  52456. const bs = new Dict(xref);
  52457. ink.set("BS", bs);
  52458. bs.set("W", thickness);
  52459. ink.set("C", Array.from(color, c => c / 255));
  52460. ink.set("CA", opacity);
  52461. const n = new Dict(xref);
  52462. ink.set("AP", n);
  52463. if (apRef) {
  52464. n.set("N", apRef);
  52465. } else {
  52466. n.set("N", ap);
  52467. }
  52468. return ink;
  52469. }
  52470. static async createNewAppearanceStream(annotation, xref, params) {
  52471. if (annotation.outlines) {
  52472. return this.createNewAppearanceStreamForHighlight(annotation, xref, params);
  52473. }
  52474. const {
  52475. color,
  52476. rect,
  52477. paths,
  52478. thickness,
  52479. opacity
  52480. } = annotation;
  52481. const appearanceBuffer = [`${thickness} w 1 J 1 j`, `${getPdfColor(color, false)}`];
  52482. if (opacity !== 1) {
  52483. appearanceBuffer.push("/R0 gs");
  52484. }
  52485. const buffer = [];
  52486. for (const {
  52487. bezier
  52488. } of paths) {
  52489. buffer.length = 0;
  52490. buffer.push(`${numberToString(bezier[0])} ${numberToString(bezier[1])} m`);
  52491. if (bezier.length === 2) {
  52492. buffer.push(`${numberToString(bezier[0])} ${numberToString(bezier[1])} l S`);
  52493. } else {
  52494. for (let i = 2, ii = bezier.length; i < ii; i += 6) {
  52495. const curve = bezier.slice(i, i + 6).map(numberToString).join(" ");
  52496. buffer.push(`${curve} c`);
  52497. }
  52498. buffer.push("S");
  52499. }
  52500. appearanceBuffer.push(buffer.join("\n"));
  52501. }
  52502. const appearance = appearanceBuffer.join("\n");
  52503. const appearanceStreamDict = new Dict(xref);
  52504. appearanceStreamDict.set("FormType", 1);
  52505. appearanceStreamDict.set("Subtype", Name.get("Form"));
  52506. appearanceStreamDict.set("Type", Name.get("XObject"));
  52507. appearanceStreamDict.set("BBox", rect);
  52508. appearanceStreamDict.set("Length", appearance.length);
  52509. if (opacity !== 1) {
  52510. const resources = new Dict(xref);
  52511. const extGState = new Dict(xref);
  52512. const r0 = new Dict(xref);
  52513. r0.set("CA", opacity);
  52514. r0.set("Type", Name.get("ExtGState"));
  52515. extGState.set("R0", r0);
  52516. resources.set("ExtGState", extGState);
  52517. appearanceStreamDict.set("Resources", resources);
  52518. }
  52519. const ap = new StringStream(appearance);
  52520. ap.dict = appearanceStreamDict;
  52521. return ap;
  52522. }
  52523. static async createNewAppearanceStreamForHighlight(annotation, xref, params) {
  52524. const {
  52525. color,
  52526. rect,
  52527. outlines: {
  52528. outline
  52529. },
  52530. opacity
  52531. } = annotation;
  52532. const appearanceBuffer = [`${getPdfColor(color, true)}`, "/R0 gs"];
  52533. appearanceBuffer.push(`${numberToString(outline[4])} ${numberToString(outline[5])} m`);
  52534. for (let i = 6, ii = outline.length; i < ii; i += 6) {
  52535. if (isNaN(outline[i]) || outline[i] === null) {
  52536. appearanceBuffer.push(`${numberToString(outline[i + 4])} ${numberToString(outline[i + 5])} l`);
  52537. } else {
  52538. const curve = outline.slice(i, i + 6).map(numberToString).join(" ");
  52539. appearanceBuffer.push(`${curve} c`);
  52540. }
  52541. }
  52542. appearanceBuffer.push("h f");
  52543. const appearance = appearanceBuffer.join("\n");
  52544. const appearanceStreamDict = new Dict(xref);
  52545. appearanceStreamDict.set("FormType", 1);
  52546. appearanceStreamDict.set("Subtype", Name.get("Form"));
  52547. appearanceStreamDict.set("Type", Name.get("XObject"));
  52548. appearanceStreamDict.set("BBox", rect);
  52549. appearanceStreamDict.set("Length", appearance.length);
  52550. const resources = new Dict(xref);
  52551. const extGState = new Dict(xref);
  52552. resources.set("ExtGState", extGState);
  52553. appearanceStreamDict.set("Resources", resources);
  52554. const r0 = new Dict(xref);
  52555. extGState.set("R0", r0);
  52556. r0.set("BM", Name.get("Multiply"));
  52557. if (opacity !== 1) {
  52558. r0.set("ca", opacity);
  52559. r0.set("Type", Name.get("ExtGState"));
  52560. }
  52561. const ap = new StringStream(appearance);
  52562. ap.dict = appearanceStreamDict;
  52563. return ap;
  52564. }
  52565. }
  52566. class HighlightAnnotation extends MarkupAnnotation {
  52567. constructor(params) {
  52568. super(params);
  52569. const {
  52570. dict,
  52571. xref
  52572. } = params;
  52573. this.data.annotationType = AnnotationType.HIGHLIGHT;
  52574. this.data.isEditable = !this.data.noHTML;
  52575. this.data.noHTML = false;
  52576. this.data.opacity = dict.get("CA") || 1;
  52577. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  52578. if (quadPoints) {
  52579. const resources = this.appearance?.dict.get("Resources");
  52580. if (!this.appearance || !resources?.has("ExtGState")) {
  52581. if (this.appearance) {
  52582. warn("HighlightAnnotation - ignoring built-in appearance stream.");
  52583. }
  52584. const fillColor = this.color ? getPdfColorArray(this.color) : [1, 1, 0];
  52585. const fillAlpha = dict.get("CA");
  52586. this._setDefaultAppearance({
  52587. xref,
  52588. fillColor,
  52589. blendMode: "Multiply",
  52590. fillAlpha,
  52591. pointsCallback: (buffer, points) => {
  52592. buffer.push(`${points[0]} ${points[1]} m`, `${points[2]} ${points[3]} l`, `${points[6]} ${points[7]} l`, `${points[4]} ${points[5]} l`, "f");
  52593. return [points[0], points[2], points[7], points[3]];
  52594. }
  52595. });
  52596. }
  52597. } else {
  52598. this.data.popupRef = null;
  52599. }
  52600. }
  52601. static createNewDict(annotation, xref, {
  52602. apRef,
  52603. ap
  52604. }) {
  52605. const {
  52606. color,
  52607. oldAnnotation,
  52608. opacity,
  52609. rect,
  52610. rotation,
  52611. user,
  52612. quadPoints
  52613. } = annotation;
  52614. const highlight = oldAnnotation || new Dict(xref);
  52615. highlight.set("Type", Name.get("Annot"));
  52616. highlight.set("Subtype", Name.get("Highlight"));
  52617. highlight.set(oldAnnotation ? "M" : "CreationDate", `D:${getModificationDate()}`);
  52618. highlight.set("CreationDate", `D:${getModificationDate()}`);
  52619. highlight.set("Rect", rect);
  52620. highlight.set("F", 4);
  52621. highlight.set("Border", [0, 0, 0]);
  52622. highlight.set("Rotate", rotation);
  52623. highlight.set("QuadPoints", quadPoints);
  52624. highlight.set("C", Array.from(color, c => c / 255));
  52625. highlight.set("CA", opacity);
  52626. if (user) {
  52627. highlight.set("T", stringToAsciiOrUTF16BE(user));
  52628. }
  52629. if (apRef || ap) {
  52630. const n = new Dict(xref);
  52631. highlight.set("AP", n);
  52632. n.set("N", apRef || ap);
  52633. }
  52634. return highlight;
  52635. }
  52636. static async createNewAppearanceStream(annotation, xref, params) {
  52637. const {
  52638. color,
  52639. rect,
  52640. outlines,
  52641. opacity
  52642. } = annotation;
  52643. const appearanceBuffer = [`${getPdfColor(color, true)}`, "/R0 gs"];
  52644. const buffer = [];
  52645. for (const outline of outlines) {
  52646. buffer.length = 0;
  52647. buffer.push(`${numberToString(outline[0])} ${numberToString(outline[1])} m`);
  52648. for (let i = 2, ii = outline.length; i < ii; i += 2) {
  52649. buffer.push(`${numberToString(outline[i])} ${numberToString(outline[i + 1])} l`);
  52650. }
  52651. buffer.push("h");
  52652. appearanceBuffer.push(buffer.join("\n"));
  52653. }
  52654. appearanceBuffer.push("f*");
  52655. const appearance = appearanceBuffer.join("\n");
  52656. const appearanceStreamDict = new Dict(xref);
  52657. appearanceStreamDict.set("FormType", 1);
  52658. appearanceStreamDict.set("Subtype", Name.get("Form"));
  52659. appearanceStreamDict.set("Type", Name.get("XObject"));
  52660. appearanceStreamDict.set("BBox", rect);
  52661. appearanceStreamDict.set("Length", appearance.length);
  52662. const resources = new Dict(xref);
  52663. const extGState = new Dict(xref);
  52664. resources.set("ExtGState", extGState);
  52665. appearanceStreamDict.set("Resources", resources);
  52666. const r0 = new Dict(xref);
  52667. extGState.set("R0", r0);
  52668. r0.set("BM", Name.get("Multiply"));
  52669. if (opacity !== 1) {
  52670. r0.set("ca", opacity);
  52671. r0.set("Type", Name.get("ExtGState"));
  52672. }
  52673. const ap = new StringStream(appearance);
  52674. ap.dict = appearanceStreamDict;
  52675. return ap;
  52676. }
  52677. }
  52678. class UnderlineAnnotation extends MarkupAnnotation {
  52679. constructor(params) {
  52680. super(params);
  52681. const {
  52682. dict,
  52683. xref
  52684. } = params;
  52685. this.data.annotationType = AnnotationType.UNDERLINE;
  52686. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  52687. if (quadPoints) {
  52688. if (!this.appearance) {
  52689. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  52690. const strokeAlpha = dict.get("CA");
  52691. this._setDefaultAppearance({
  52692. xref,
  52693. extra: "[] 0 d 0.571 w",
  52694. strokeColor,
  52695. strokeAlpha,
  52696. pointsCallback: (buffer, points) => {
  52697. buffer.push(`${points[4]} ${points[5] + 1.3} m`, `${points[6]} ${points[7] + 1.3} l`, "S");
  52698. return [points[0], points[2], points[7], points[3]];
  52699. }
  52700. });
  52701. }
  52702. } else {
  52703. this.data.popupRef = null;
  52704. }
  52705. }
  52706. }
  52707. class SquigglyAnnotation extends MarkupAnnotation {
  52708. constructor(params) {
  52709. super(params);
  52710. const {
  52711. dict,
  52712. xref
  52713. } = params;
  52714. this.data.annotationType = AnnotationType.SQUIGGLY;
  52715. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  52716. if (quadPoints) {
  52717. if (!this.appearance) {
  52718. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  52719. const strokeAlpha = dict.get("CA");
  52720. this._setDefaultAppearance({
  52721. xref,
  52722. extra: "[] 0 d 1 w",
  52723. strokeColor,
  52724. strokeAlpha,
  52725. pointsCallback: (buffer, points) => {
  52726. const dy = (points[1] - points[5]) / 6;
  52727. let shift = dy;
  52728. let x = points[4];
  52729. const y = points[5];
  52730. const xEnd = points[6];
  52731. buffer.push(`${x} ${y + shift} m`);
  52732. do {
  52733. x += 2;
  52734. shift = shift === 0 ? dy : 0;
  52735. buffer.push(`${x} ${y + shift} l`);
  52736. } while (x < xEnd);
  52737. buffer.push("S");
  52738. return [points[4], xEnd, y - 2 * dy, y + 2 * dy];
  52739. }
  52740. });
  52741. }
  52742. } else {
  52743. this.data.popupRef = null;
  52744. }
  52745. }
  52746. }
  52747. class StrikeOutAnnotation extends MarkupAnnotation {
  52748. constructor(params) {
  52749. super(params);
  52750. const {
  52751. dict,
  52752. xref
  52753. } = params;
  52754. this.data.annotationType = AnnotationType.STRIKEOUT;
  52755. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  52756. if (quadPoints) {
  52757. if (!this.appearance) {
  52758. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  52759. const strokeAlpha = dict.get("CA");
  52760. this._setDefaultAppearance({
  52761. xref,
  52762. extra: "[] 0 d 1 w",
  52763. strokeColor,
  52764. strokeAlpha,
  52765. pointsCallback: (buffer, points) => {
  52766. buffer.push(`${(points[0] + points[4]) / 2} ` + `${(points[1] + points[5]) / 2} m`, `${(points[2] + points[6]) / 2} ` + `${(points[3] + points[7]) / 2} l`, "S");
  52767. return [points[0], points[2], points[7], points[3]];
  52768. }
  52769. });
  52770. }
  52771. } else {
  52772. this.data.popupRef = null;
  52773. }
  52774. }
  52775. }
  52776. class StampAnnotation extends MarkupAnnotation {
  52777. #savedHasOwnCanvas;
  52778. constructor(params) {
  52779. super(params);
  52780. this.data.annotationType = AnnotationType.STAMP;
  52781. this.#savedHasOwnCanvas = this.data.hasOwnCanvas = this.data.noRotate;
  52782. this.data.isEditable = !this.data.noHTML;
  52783. this.data.noHTML = false;
  52784. }
  52785. mustBeViewedWhenEditing(isEditing, modifiedIds = null) {
  52786. if (isEditing) {
  52787. if (!this.data.isEditable) {
  52788. return false;
  52789. }
  52790. this.#savedHasOwnCanvas = this.data.hasOwnCanvas;
  52791. this.data.hasOwnCanvas = true;
  52792. return true;
  52793. }
  52794. this.data.hasOwnCanvas = this.#savedHasOwnCanvas;
  52795. return !modifiedIds?.has(this.data.id);
  52796. }
  52797. static async createImage(bitmap, xref) {
  52798. const {
  52799. width,
  52800. height
  52801. } = bitmap;
  52802. const canvas = new OffscreenCanvas(width, height);
  52803. const ctx = canvas.getContext("2d", {
  52804. alpha: true
  52805. });
  52806. ctx.drawImage(bitmap, 0, 0);
  52807. const data = ctx.getImageData(0, 0, width, height).data;
  52808. const buf32 = new Uint32Array(data.buffer);
  52809. const hasAlpha = buf32.some(FeatureTest.isLittleEndian ? x => x >>> 24 !== 0xff : x => (x & 0xff) !== 0xff);
  52810. if (hasAlpha) {
  52811. ctx.fillStyle = "white";
  52812. ctx.fillRect(0, 0, width, height);
  52813. ctx.drawImage(bitmap, 0, 0);
  52814. }
  52815. const jpegBufferPromise = canvas.convertToBlob({
  52816. type: "image/jpeg",
  52817. quality: 1
  52818. }).then(blob => blob.arrayBuffer());
  52819. const xobjectName = Name.get("XObject");
  52820. const imageName = Name.get("Image");
  52821. const image = new Dict(xref);
  52822. image.set("Type", xobjectName);
  52823. image.set("Subtype", imageName);
  52824. image.set("BitsPerComponent", 8);
  52825. image.set("ColorSpace", Name.get("DeviceRGB"));
  52826. image.set("Filter", Name.get("DCTDecode"));
  52827. image.set("BBox", [0, 0, width, height]);
  52828. image.set("Width", width);
  52829. image.set("Height", height);
  52830. let smaskStream = null;
  52831. if (hasAlpha) {
  52832. const alphaBuffer = new Uint8Array(buf32.length);
  52833. if (FeatureTest.isLittleEndian) {
  52834. for (let i = 0, ii = buf32.length; i < ii; i++) {
  52835. alphaBuffer[i] = buf32[i] >>> 24;
  52836. }
  52837. } else {
  52838. for (let i = 0, ii = buf32.length; i < ii; i++) {
  52839. alphaBuffer[i] = buf32[i] & 0xff;
  52840. }
  52841. }
  52842. const smask = new Dict(xref);
  52843. smask.set("Type", xobjectName);
  52844. smask.set("Subtype", imageName);
  52845. smask.set("BitsPerComponent", 8);
  52846. smask.set("ColorSpace", Name.get("DeviceGray"));
  52847. smask.set("Width", width);
  52848. smask.set("Height", height);
  52849. smaskStream = new Stream(alphaBuffer, 0, 0, smask);
  52850. }
  52851. const imageStream = new Stream(await jpegBufferPromise, 0, 0, image);
  52852. return {
  52853. imageStream,
  52854. smaskStream,
  52855. width,
  52856. height
  52857. };
  52858. }
  52859. static createNewDict(annotation, xref, {
  52860. apRef,
  52861. ap
  52862. }) {
  52863. const {
  52864. oldAnnotation,
  52865. rect,
  52866. rotation,
  52867. user
  52868. } = annotation;
  52869. const stamp = oldAnnotation || new Dict(xref);
  52870. stamp.set("Type", Name.get("Annot"));
  52871. stamp.set("Subtype", Name.get("Stamp"));
  52872. stamp.set(oldAnnotation ? "M" : "CreationDate", `D:${getModificationDate()}`);
  52873. stamp.set("CreationDate", `D:${getModificationDate()}`);
  52874. stamp.set("Rect", rect);
  52875. stamp.set("F", 4);
  52876. stamp.set("Border", [0, 0, 0]);
  52877. stamp.set("Rotate", rotation);
  52878. if (user) {
  52879. stamp.set("T", stringToAsciiOrUTF16BE(user));
  52880. }
  52881. if (apRef || ap) {
  52882. const n = new Dict(xref);
  52883. stamp.set("AP", n);
  52884. if (apRef) {
  52885. n.set("N", apRef);
  52886. } else {
  52887. n.set("N", ap);
  52888. }
  52889. }
  52890. return stamp;
  52891. }
  52892. static async createNewAppearanceStream(annotation, xref, params) {
  52893. if (annotation.oldAnnotation) {
  52894. return null;
  52895. }
  52896. const {
  52897. rotation
  52898. } = annotation;
  52899. const {
  52900. imageRef,
  52901. width,
  52902. height
  52903. } = params.image;
  52904. const resources = new Dict(xref);
  52905. const xobject = new Dict(xref);
  52906. resources.set("XObject", xobject);
  52907. xobject.set("Im0", imageRef);
  52908. const appearance = `q ${width} 0 0 ${height} 0 0 cm /Im0 Do Q`;
  52909. const appearanceStreamDict = new Dict(xref);
  52910. appearanceStreamDict.set("FormType", 1);
  52911. appearanceStreamDict.set("Subtype", Name.get("Form"));
  52912. appearanceStreamDict.set("Type", Name.get("XObject"));
  52913. appearanceStreamDict.set("BBox", [0, 0, width, height]);
  52914. appearanceStreamDict.set("Resources", resources);
  52915. if (rotation) {
  52916. const matrix = getRotationMatrix(rotation, width, height);
  52917. appearanceStreamDict.set("Matrix", matrix);
  52918. }
  52919. const ap = new StringStream(appearance);
  52920. ap.dict = appearanceStreamDict;
  52921. return ap;
  52922. }
  52923. }
  52924. class FileAttachmentAnnotation extends MarkupAnnotation {
  52925. constructor(params) {
  52926. super(params);
  52927. const {
  52928. dict,
  52929. xref
  52930. } = params;
  52931. const file = new FileSpec(dict.get("FS"), xref);
  52932. this.data.annotationType = AnnotationType.FILEATTACHMENT;
  52933. this.data.hasOwnCanvas = this.data.noRotate;
  52934. this.data.noHTML = false;
  52935. this.data.file = file.serializable;
  52936. const name = dict.get("Name");
  52937. this.data.name = name instanceof Name ? stringToPDFString(name.name) : "PushPin";
  52938. const fillAlpha = dict.get("ca");
  52939. this.data.fillAlpha = typeof fillAlpha === "number" && fillAlpha >= 0 && fillAlpha <= 1 ? fillAlpha : null;
  52940. }
  52941. }
  52942. ;// ./src/core/dataset_reader.js
  52943. function decodeString(str) {
  52944. try {
  52945. return stringToUTF8String(str);
  52946. } catch (ex) {
  52947. warn(`UTF-8 decoding failed: "${ex}".`);
  52948. return str;
  52949. }
  52950. }
  52951. class DatasetXMLParser extends SimpleXMLParser {
  52952. constructor(options) {
  52953. super(options);
  52954. this.node = null;
  52955. }
  52956. onEndElement(name) {
  52957. const node = super.onEndElement(name);
  52958. if (node && name === "xfa:datasets") {
  52959. this.node = node;
  52960. throw new Error("Aborting DatasetXMLParser.");
  52961. }
  52962. }
  52963. }
  52964. class DatasetReader {
  52965. constructor(data) {
  52966. if (data.datasets) {
  52967. this.node = new SimpleXMLParser({
  52968. hasAttributes: true
  52969. }).parseFromString(data.datasets).documentElement;
  52970. } else {
  52971. const parser = new DatasetXMLParser({
  52972. hasAttributes: true
  52973. });
  52974. try {
  52975. parser.parseFromString(data["xdp:xdp"]);
  52976. } catch {}
  52977. this.node = parser.node;
  52978. }
  52979. }
  52980. getValue(path) {
  52981. if (!this.node || !path) {
  52982. return "";
  52983. }
  52984. const node = this.node.searchNode(parseXFAPath(path), 0);
  52985. if (!node) {
  52986. return "";
  52987. }
  52988. const first = node.firstChild;
  52989. if (first?.nodeName === "value") {
  52990. return node.children.map(child => decodeString(child.textContent));
  52991. }
  52992. return decodeString(node.textContent);
  52993. }
  52994. }
  52995. ;// ./src/core/xref.js
  52996. class XRef {
  52997. #firstXRefStmPos = null;
  52998. constructor(stream, pdfManager) {
  52999. this.stream = stream;
  53000. this.pdfManager = pdfManager;
  53001. this.entries = [];
  53002. this._xrefStms = new Set();
  53003. this._cacheMap = new Map();
  53004. this._pendingRefs = new RefSet();
  53005. this._newPersistentRefNum = null;
  53006. this._newTemporaryRefNum = null;
  53007. this._persistentRefsCache = null;
  53008. }
  53009. getNewPersistentRef(obj) {
  53010. if (this._newPersistentRefNum === null) {
  53011. this._newPersistentRefNum = this.entries.length || 1;
  53012. }
  53013. const num = this._newPersistentRefNum++;
  53014. this._cacheMap.set(num, obj);
  53015. return Ref.get(num, 0);
  53016. }
  53017. getNewTemporaryRef() {
  53018. if (this._newTemporaryRefNum === null) {
  53019. this._newTemporaryRefNum = this.entries.length || 1;
  53020. if (this._newPersistentRefNum) {
  53021. this._persistentRefsCache = new Map();
  53022. for (let i = this._newTemporaryRefNum; i < this._newPersistentRefNum; i++) {
  53023. this._persistentRefsCache.set(i, this._cacheMap.get(i));
  53024. this._cacheMap.delete(i);
  53025. }
  53026. }
  53027. }
  53028. return Ref.get(this._newTemporaryRefNum++, 0);
  53029. }
  53030. resetNewTemporaryRef() {
  53031. this._newTemporaryRefNum = null;
  53032. if (this._persistentRefsCache) {
  53033. for (const [num, obj] of this._persistentRefsCache) {
  53034. this._cacheMap.set(num, obj);
  53035. }
  53036. }
  53037. this._persistentRefsCache = null;
  53038. }
  53039. setStartXRef(startXRef) {
  53040. this.startXRefQueue = [startXRef];
  53041. }
  53042. parse(recoveryMode = false) {
  53043. let trailerDict;
  53044. if (!recoveryMode) {
  53045. trailerDict = this.readXRef();
  53046. } else {
  53047. warn("Indexing all PDF objects");
  53048. trailerDict = this.indexObjects();
  53049. }
  53050. trailerDict.assignXref(this);
  53051. this.trailer = trailerDict;
  53052. let encrypt;
  53053. try {
  53054. encrypt = trailerDict.get("Encrypt");
  53055. } catch (ex) {
  53056. if (ex instanceof MissingDataException) {
  53057. throw ex;
  53058. }
  53059. warn(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
  53060. }
  53061. if (encrypt instanceof Dict) {
  53062. const ids = trailerDict.get("ID");
  53063. const fileId = ids?.length ? ids[0] : "";
  53064. encrypt.suppressEncryption = true;
  53065. this.encrypt = new CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  53066. }
  53067. let root;
  53068. try {
  53069. root = trailerDict.get("Root");
  53070. } catch (ex) {
  53071. if (ex instanceof MissingDataException) {
  53072. throw ex;
  53073. }
  53074. warn(`XRef.parse - Invalid "Root" reference: "${ex}".`);
  53075. }
  53076. if (root instanceof Dict) {
  53077. try {
  53078. const pages = root.get("Pages");
  53079. if (pages instanceof Dict) {
  53080. this.root = root;
  53081. return;
  53082. }
  53083. } catch (ex) {
  53084. if (ex instanceof MissingDataException) {
  53085. throw ex;
  53086. }
  53087. warn(`XRef.parse - Invalid "Pages" reference: "${ex}".`);
  53088. }
  53089. }
  53090. if (!recoveryMode) {
  53091. throw new XRefParseException();
  53092. }
  53093. throw new InvalidPDFException("Invalid Root reference.");
  53094. }
  53095. processXRefTable(parser) {
  53096. if (!("tableState" in this)) {
  53097. this.tableState = {
  53098. entryNum: 0,
  53099. streamPos: parser.lexer.stream.pos,
  53100. parserBuf1: parser.buf1,
  53101. parserBuf2: parser.buf2
  53102. };
  53103. }
  53104. const obj = this.readXRefTable(parser);
  53105. if (!isCmd(obj, "trailer")) {
  53106. throw new FormatError("Invalid XRef table: could not find trailer dictionary");
  53107. }
  53108. let dict = parser.getObj();
  53109. if (!(dict instanceof Dict) && dict.dict) {
  53110. dict = dict.dict;
  53111. }
  53112. if (!(dict instanceof Dict)) {
  53113. throw new FormatError("Invalid XRef table: could not parse trailer dictionary");
  53114. }
  53115. delete this.tableState;
  53116. return dict;
  53117. }
  53118. readXRefTable(parser) {
  53119. const stream = parser.lexer.stream;
  53120. const tableState = this.tableState;
  53121. stream.pos = tableState.streamPos;
  53122. parser.buf1 = tableState.parserBuf1;
  53123. parser.buf2 = tableState.parserBuf2;
  53124. let obj;
  53125. while (true) {
  53126. if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
  53127. if (isCmd(obj = parser.getObj(), "trailer")) {
  53128. break;
  53129. }
  53130. tableState.firstEntryNum = obj;
  53131. tableState.entryCount = parser.getObj();
  53132. }
  53133. let first = tableState.firstEntryNum;
  53134. const count = tableState.entryCount;
  53135. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  53136. throw new FormatError("Invalid XRef table: wrong types in subsection header");
  53137. }
  53138. for (let i = tableState.entryNum; i < count; i++) {
  53139. tableState.streamPos = stream.pos;
  53140. tableState.entryNum = i;
  53141. tableState.parserBuf1 = parser.buf1;
  53142. tableState.parserBuf2 = parser.buf2;
  53143. const entry = {};
  53144. entry.offset = parser.getObj();
  53145. entry.gen = parser.getObj();
  53146. const type = parser.getObj();
  53147. if (type instanceof Cmd) {
  53148. switch (type.cmd) {
  53149. case "f":
  53150. entry.free = true;
  53151. break;
  53152. case "n":
  53153. entry.uncompressed = true;
  53154. break;
  53155. }
  53156. }
  53157. if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
  53158. throw new FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
  53159. }
  53160. if (i === 0 && entry.free && first === 1) {
  53161. first = 0;
  53162. }
  53163. if (!this.entries[i + first]) {
  53164. this.entries[i + first] = entry;
  53165. }
  53166. }
  53167. tableState.entryNum = 0;
  53168. tableState.streamPos = stream.pos;
  53169. tableState.parserBuf1 = parser.buf1;
  53170. tableState.parserBuf2 = parser.buf2;
  53171. delete tableState.firstEntryNum;
  53172. delete tableState.entryCount;
  53173. }
  53174. if (this.entries[0] && !this.entries[0].free) {
  53175. throw new FormatError("Invalid XRef table: unexpected first object");
  53176. }
  53177. return obj;
  53178. }
  53179. processXRefStream(stream) {
  53180. if (!("streamState" in this)) {
  53181. const streamParameters = stream.dict;
  53182. const byteWidths = streamParameters.get("W");
  53183. let range = streamParameters.get("Index");
  53184. if (!range) {
  53185. range = [0, streamParameters.get("Size")];
  53186. }
  53187. this.streamState = {
  53188. entryRanges: range,
  53189. byteWidths,
  53190. entryNum: 0,
  53191. streamPos: stream.pos
  53192. };
  53193. }
  53194. this.readXRefStream(stream);
  53195. delete this.streamState;
  53196. return stream.dict;
  53197. }
  53198. readXRefStream(stream) {
  53199. const streamState = this.streamState;
  53200. stream.pos = streamState.streamPos;
  53201. const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths;
  53202. const entryRanges = streamState.entryRanges;
  53203. while (entryRanges.length > 0) {
  53204. const [first, n] = entryRanges;
  53205. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  53206. throw new FormatError(`Invalid XRef range fields: ${first}, ${n}`);
  53207. }
  53208. if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
  53209. throw new FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
  53210. }
  53211. for (let i = streamState.entryNum; i < n; ++i) {
  53212. streamState.entryNum = i;
  53213. streamState.streamPos = stream.pos;
  53214. let type = 0,
  53215. offset = 0,
  53216. generation = 0;
  53217. for (let j = 0; j < typeFieldWidth; ++j) {
  53218. const typeByte = stream.getByte();
  53219. if (typeByte === -1) {
  53220. throw new FormatError("Invalid XRef byteWidths 'type'.");
  53221. }
  53222. type = type << 8 | typeByte;
  53223. }
  53224. if (typeFieldWidth === 0) {
  53225. type = 1;
  53226. }
  53227. for (let j = 0; j < offsetFieldWidth; ++j) {
  53228. const offsetByte = stream.getByte();
  53229. if (offsetByte === -1) {
  53230. throw new FormatError("Invalid XRef byteWidths 'offset'.");
  53231. }
  53232. offset = offset << 8 | offsetByte;
  53233. }
  53234. for (let j = 0; j < generationFieldWidth; ++j) {
  53235. const generationByte = stream.getByte();
  53236. if (generationByte === -1) {
  53237. throw new FormatError("Invalid XRef byteWidths 'generation'.");
  53238. }
  53239. generation = generation << 8 | generationByte;
  53240. }
  53241. const entry = {};
  53242. entry.offset = offset;
  53243. entry.gen = generation;
  53244. switch (type) {
  53245. case 0:
  53246. entry.free = true;
  53247. break;
  53248. case 1:
  53249. entry.uncompressed = true;
  53250. break;
  53251. case 2:
  53252. break;
  53253. default:
  53254. throw new FormatError(`Invalid XRef entry type: ${type}`);
  53255. }
  53256. if (!this.entries[first + i]) {
  53257. this.entries[first + i] = entry;
  53258. }
  53259. }
  53260. streamState.entryNum = 0;
  53261. streamState.streamPos = stream.pos;
  53262. entryRanges.splice(0, 2);
  53263. }
  53264. }
  53265. indexObjects() {
  53266. const TAB = 0x9,
  53267. LF = 0xa,
  53268. CR = 0xd,
  53269. SPACE = 0x20;
  53270. const PERCENT = 0x25,
  53271. LT = 0x3c;
  53272. function readToken(data, offset) {
  53273. let token = "",
  53274. ch = data[offset];
  53275. while (ch !== LF && ch !== CR && ch !== LT) {
  53276. if (++offset >= data.length) {
  53277. break;
  53278. }
  53279. token += String.fromCharCode(ch);
  53280. ch = data[offset];
  53281. }
  53282. return token;
  53283. }
  53284. function skipUntil(data, offset, what) {
  53285. const length = what.length,
  53286. dataLength = data.length;
  53287. let skipped = 0;
  53288. while (offset < dataLength) {
  53289. let i = 0;
  53290. while (i < length && data[offset + i] === what[i]) {
  53291. ++i;
  53292. }
  53293. if (i >= length) {
  53294. break;
  53295. }
  53296. offset++;
  53297. skipped++;
  53298. }
  53299. return skipped;
  53300. }
  53301. const gEndobjRegExp = /\b(endobj|\d+\s+\d+\s+obj|xref|trailer\s*<<)\b/g;
  53302. const gStartxrefRegExp = /\b(startxref|\d+\s+\d+\s+obj)\b/g;
  53303. const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  53304. const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  53305. const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  53306. const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  53307. this.entries.length = 0;
  53308. this._cacheMap.clear();
  53309. const stream = this.stream;
  53310. stream.pos = 0;
  53311. const buffer = stream.getBytes(),
  53312. bufferStr = bytesToString(buffer),
  53313. length = buffer.length;
  53314. let position = stream.start;
  53315. const trailers = [],
  53316. xrefStms = [];
  53317. while (position < length) {
  53318. let ch = buffer[position];
  53319. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  53320. ++position;
  53321. continue;
  53322. }
  53323. if (ch === PERCENT) {
  53324. do {
  53325. ++position;
  53326. if (position >= length) {
  53327. break;
  53328. }
  53329. ch = buffer[position];
  53330. } while (ch !== LF && ch !== CR);
  53331. continue;
  53332. }
  53333. const token = readToken(buffer, position);
  53334. let m;
  53335. if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
  53336. position += skipUntil(buffer, position, trailerBytes);
  53337. trailers.push(position);
  53338. position += skipUntil(buffer, position, startxrefBytes);
  53339. } else if (m = objRegExp.exec(token)) {
  53340. const num = m[1] | 0,
  53341. gen = m[2] | 0;
  53342. const startPos = position + token.length;
  53343. let contentLength,
  53344. updateEntries = false;
  53345. if (!this.entries[num]) {
  53346. updateEntries = true;
  53347. } else if (this.entries[num].gen === gen) {
  53348. try {
  53349. const parser = new Parser({
  53350. lexer: new Lexer(stream.makeSubStream(startPos))
  53351. });
  53352. parser.getObj();
  53353. updateEntries = true;
  53354. } catch (ex) {
  53355. if (ex instanceof ParserEOFException) {
  53356. warn(`indexObjects -- checking object (${token}): "${ex}".`);
  53357. } else {
  53358. updateEntries = true;
  53359. }
  53360. }
  53361. }
  53362. if (updateEntries) {
  53363. this.entries[num] = {
  53364. offset: position - stream.start,
  53365. gen,
  53366. uncompressed: true
  53367. };
  53368. }
  53369. gEndobjRegExp.lastIndex = startPos;
  53370. const match = gEndobjRegExp.exec(bufferStr);
  53371. if (match) {
  53372. const endPos = gEndobjRegExp.lastIndex + 1;
  53373. contentLength = endPos - position;
  53374. if (match[1] !== "endobj") {
  53375. warn(`indexObjects: Found "${match[1]}" inside of another "obj", ` + 'caused by missing "endobj" -- trying to recover.');
  53376. contentLength -= match[1].length + 1;
  53377. }
  53378. } else {
  53379. contentLength = length - position;
  53380. }
  53381. const content = buffer.subarray(position, position + contentLength);
  53382. const xrefTagOffset = skipUntil(content, 0, xrefBytes);
  53383. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  53384. xrefStms.push(position - stream.start);
  53385. this._xrefStms.add(position - stream.start);
  53386. }
  53387. position += contentLength;
  53388. } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
  53389. trailers.push(position);
  53390. const startPos = position + token.length;
  53391. let contentLength;
  53392. gStartxrefRegExp.lastIndex = startPos;
  53393. const match = gStartxrefRegExp.exec(bufferStr);
  53394. if (match) {
  53395. const endPos = gStartxrefRegExp.lastIndex + 1;
  53396. contentLength = endPos - position;
  53397. if (match[1] !== "startxref") {
  53398. warn(`indexObjects: Found "${match[1]}" after "trailer", ` + 'caused by missing "startxref" -- trying to recover.');
  53399. contentLength -= match[1].length + 1;
  53400. }
  53401. } else {
  53402. contentLength = length - position;
  53403. }
  53404. position += contentLength;
  53405. } else {
  53406. position += token.length + 1;
  53407. }
  53408. }
  53409. for (const xrefStm of xrefStms) {
  53410. this.startXRefQueue.push(xrefStm);
  53411. this.readXRef(true);
  53412. }
  53413. const trailerDicts = [];
  53414. let isEncrypted = false;
  53415. for (const trailer of trailers) {
  53416. stream.pos = trailer;
  53417. const parser = new Parser({
  53418. lexer: new Lexer(stream),
  53419. xref: this,
  53420. allowStreams: true,
  53421. recoveryMode: true
  53422. });
  53423. const obj = parser.getObj();
  53424. if (!isCmd(obj, "trailer")) {
  53425. continue;
  53426. }
  53427. const dict = parser.getObj();
  53428. if (!(dict instanceof Dict)) {
  53429. continue;
  53430. }
  53431. trailerDicts.push(dict);
  53432. if (dict.has("Encrypt")) {
  53433. isEncrypted = true;
  53434. }
  53435. }
  53436. let trailerDict, trailerError;
  53437. for (const dict of [...trailerDicts, "genFallback", ...trailerDicts]) {
  53438. if (dict === "genFallback") {
  53439. if (!trailerError) {
  53440. break;
  53441. }
  53442. this._generationFallback = true;
  53443. continue;
  53444. }
  53445. let validPagesDict = false;
  53446. try {
  53447. const rootDict = dict.get("Root");
  53448. if (!(rootDict instanceof Dict)) {
  53449. continue;
  53450. }
  53451. const pagesDict = rootDict.get("Pages");
  53452. if (!(pagesDict instanceof Dict)) {
  53453. continue;
  53454. }
  53455. const pagesCount = pagesDict.get("Count");
  53456. if (Number.isInteger(pagesCount)) {
  53457. validPagesDict = true;
  53458. }
  53459. } catch (ex) {
  53460. trailerError = ex;
  53461. continue;
  53462. }
  53463. if (validPagesDict && (!isEncrypted || dict.has("Encrypt")) && dict.has("ID")) {
  53464. return dict;
  53465. }
  53466. trailerDict = dict;
  53467. }
  53468. if (trailerDict) {
  53469. return trailerDict;
  53470. }
  53471. if (this.topDict) {
  53472. return this.topDict;
  53473. }
  53474. throw new InvalidPDFException("Invalid PDF structure.");
  53475. }
  53476. readXRef(recoveryMode = false) {
  53477. const stream = this.stream;
  53478. const startXRefParsedCache = new Set();
  53479. while (this.startXRefQueue.length) {
  53480. try {
  53481. const startXRef = this.startXRefQueue[0];
  53482. if (startXRefParsedCache.has(startXRef)) {
  53483. warn("readXRef - skipping XRef table since it was already parsed.");
  53484. this.startXRefQueue.shift();
  53485. continue;
  53486. }
  53487. startXRefParsedCache.add(startXRef);
  53488. stream.pos = startXRef + stream.start;
  53489. const parser = new Parser({
  53490. lexer: new Lexer(stream),
  53491. xref: this,
  53492. allowStreams: true
  53493. });
  53494. let obj = parser.getObj();
  53495. let dict;
  53496. if (isCmd(obj, "xref")) {
  53497. dict = this.processXRefTable(parser);
  53498. if (!this.topDict) {
  53499. this.topDict = dict;
  53500. }
  53501. obj = dict.get("XRefStm");
  53502. if (Number.isInteger(obj) && !this._xrefStms.has(obj)) {
  53503. this._xrefStms.add(obj);
  53504. this.startXRefQueue.push(obj);
  53505. this.#firstXRefStmPos ??= obj;
  53506. }
  53507. } else if (Number.isInteger(obj)) {
  53508. if (!Number.isInteger(parser.getObj()) || !isCmd(parser.getObj(), "obj") || !((obj = parser.getObj()) instanceof BaseStream)) {
  53509. throw new FormatError("Invalid XRef stream");
  53510. }
  53511. dict = this.processXRefStream(obj);
  53512. if (!this.topDict) {
  53513. this.topDict = dict;
  53514. }
  53515. if (!dict) {
  53516. throw new FormatError("Failed to read XRef stream");
  53517. }
  53518. } else {
  53519. throw new FormatError("Invalid XRef stream header");
  53520. }
  53521. obj = dict.get("Prev");
  53522. if (Number.isInteger(obj)) {
  53523. this.startXRefQueue.push(obj);
  53524. } else if (obj instanceof Ref) {
  53525. this.startXRefQueue.push(obj.num);
  53526. }
  53527. } catch (e) {
  53528. if (e instanceof MissingDataException) {
  53529. throw e;
  53530. }
  53531. info("(while reading XRef): " + e);
  53532. }
  53533. this.startXRefQueue.shift();
  53534. }
  53535. if (this.topDict) {
  53536. return this.topDict;
  53537. }
  53538. if (recoveryMode) {
  53539. return undefined;
  53540. }
  53541. throw new XRefParseException();
  53542. }
  53543. get lastXRefStreamPos() {
  53544. return this.#firstXRefStmPos ?? (this._xrefStms.size > 0 ? Math.max(...this._xrefStms) : null);
  53545. }
  53546. getEntry(i) {
  53547. const xrefEntry = this.entries[i];
  53548. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  53549. return xrefEntry;
  53550. }
  53551. return null;
  53552. }
  53553. fetchIfRef(obj, suppressEncryption = false) {
  53554. if (obj instanceof Ref) {
  53555. return this.fetch(obj, suppressEncryption);
  53556. }
  53557. return obj;
  53558. }
  53559. fetch(ref, suppressEncryption = false) {
  53560. if (!(ref instanceof Ref)) {
  53561. throw new Error("ref object is not a reference");
  53562. }
  53563. const num = ref.num;
  53564. const cacheEntry = this._cacheMap.get(num);
  53565. if (cacheEntry !== undefined) {
  53566. if (cacheEntry instanceof Dict && !cacheEntry.objId) {
  53567. cacheEntry.objId = ref.toString();
  53568. }
  53569. return cacheEntry;
  53570. }
  53571. let xrefEntry = this.getEntry(num);
  53572. if (xrefEntry === null) {
  53573. this._cacheMap.set(num, xrefEntry);
  53574. return xrefEntry;
  53575. }
  53576. if (this._pendingRefs.has(ref)) {
  53577. this._pendingRefs.remove(ref);
  53578. warn(`Ignoring circular reference: ${ref}.`);
  53579. return CIRCULAR_REF;
  53580. }
  53581. this._pendingRefs.put(ref);
  53582. try {
  53583. xrefEntry = xrefEntry.uncompressed ? this.fetchUncompressed(ref, xrefEntry, suppressEncryption) : this.fetchCompressed(ref, xrefEntry, suppressEncryption);
  53584. this._pendingRefs.remove(ref);
  53585. } catch (ex) {
  53586. this._pendingRefs.remove(ref);
  53587. throw ex;
  53588. }
  53589. if (xrefEntry instanceof Dict) {
  53590. xrefEntry.objId = ref.toString();
  53591. } else if (xrefEntry instanceof BaseStream) {
  53592. xrefEntry.dict.objId = ref.toString();
  53593. }
  53594. return xrefEntry;
  53595. }
  53596. fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {
  53597. const gen = ref.gen;
  53598. let num = ref.num;
  53599. if (xrefEntry.gen !== gen) {
  53600. const msg = `Inconsistent generation in XRef: ${ref}`;
  53601. if (this._generationFallback && xrefEntry.gen < gen) {
  53602. warn(msg);
  53603. return this.fetchUncompressed(Ref.get(num, xrefEntry.gen), xrefEntry, suppressEncryption);
  53604. }
  53605. throw new XRefEntryException(msg);
  53606. }
  53607. const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  53608. const parser = new Parser({
  53609. lexer: new Lexer(stream),
  53610. xref: this,
  53611. allowStreams: true
  53612. });
  53613. const obj1 = parser.getObj();
  53614. const obj2 = parser.getObj();
  53615. const obj3 = parser.getObj();
  53616. if (obj1 !== num || obj2 !== gen || !(obj3 instanceof Cmd)) {
  53617. throw new XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  53618. }
  53619. if (obj3.cmd !== "obj") {
  53620. if (obj3.cmd.startsWith("obj")) {
  53621. num = parseInt(obj3.cmd.substring(3), 10);
  53622. if (!Number.isNaN(num)) {
  53623. return num;
  53624. }
  53625. }
  53626. throw new XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  53627. }
  53628. xrefEntry = this.encrypt && !suppressEncryption ? parser.getObj(this.encrypt.createCipherTransform(num, gen)) : parser.getObj();
  53629. if (!(xrefEntry instanceof BaseStream)) {
  53630. this._cacheMap.set(num, xrefEntry);
  53631. }
  53632. return xrefEntry;
  53633. }
  53634. fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
  53635. const tableOffset = xrefEntry.offset;
  53636. const stream = this.fetch(Ref.get(tableOffset, 0));
  53637. if (!(stream instanceof BaseStream)) {
  53638. throw new FormatError("bad ObjStm stream");
  53639. }
  53640. const first = stream.dict.get("First");
  53641. const n = stream.dict.get("N");
  53642. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  53643. throw new FormatError("invalid first and n parameters for ObjStm stream");
  53644. }
  53645. let parser = new Parser({
  53646. lexer: new Lexer(stream),
  53647. xref: this,
  53648. allowStreams: true
  53649. });
  53650. const nums = new Array(n);
  53651. const offsets = new Array(n);
  53652. for (let i = 0; i < n; ++i) {
  53653. const num = parser.getObj();
  53654. if (!Number.isInteger(num)) {
  53655. throw new FormatError(`invalid object number in the ObjStm stream: ${num}`);
  53656. }
  53657. const offset = parser.getObj();
  53658. if (!Number.isInteger(offset)) {
  53659. throw new FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
  53660. }
  53661. nums[i] = num;
  53662. offsets[i] = offset;
  53663. }
  53664. const start = (stream.start || 0) + first;
  53665. const entries = new Array(n);
  53666. for (let i = 0; i < n; ++i) {
  53667. const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;
  53668. if (length < 0) {
  53669. throw new FormatError("Invalid offset in the ObjStm stream.");
  53670. }
  53671. parser = new Parser({
  53672. lexer: new Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)),
  53673. xref: this,
  53674. allowStreams: true
  53675. });
  53676. const obj = parser.getObj();
  53677. entries[i] = obj;
  53678. if (obj instanceof BaseStream) {
  53679. continue;
  53680. }
  53681. const num = nums[i],
  53682. entry = this.entries[num];
  53683. if (entry && entry.offset === tableOffset && entry.gen === i) {
  53684. this._cacheMap.set(num, obj);
  53685. }
  53686. }
  53687. xrefEntry = entries[xrefEntry.gen];
  53688. if (xrefEntry === undefined) {
  53689. throw new XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
  53690. }
  53691. return xrefEntry;
  53692. }
  53693. async fetchIfRefAsync(obj, suppressEncryption) {
  53694. if (obj instanceof Ref) {
  53695. return this.fetchAsync(obj, suppressEncryption);
  53696. }
  53697. return obj;
  53698. }
  53699. async fetchAsync(ref, suppressEncryption) {
  53700. try {
  53701. return this.fetch(ref, suppressEncryption);
  53702. } catch (ex) {
  53703. if (!(ex instanceof MissingDataException)) {
  53704. throw ex;
  53705. }
  53706. await this.pdfManager.requestRange(ex.begin, ex.end);
  53707. return this.fetchAsync(ref, suppressEncryption);
  53708. }
  53709. }
  53710. getCatalogObj() {
  53711. return this.root;
  53712. }
  53713. }
  53714. ;// ./src/core/document.js
  53715. const DEFAULT_USER_UNIT = 1.0;
  53716. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  53717. class Page {
  53718. constructor({
  53719. pdfManager,
  53720. xref,
  53721. pageIndex,
  53722. pageDict,
  53723. ref,
  53724. globalIdFactory,
  53725. fontCache,
  53726. builtInCMapCache,
  53727. standardFontDataCache,
  53728. globalImageCache,
  53729. systemFontCache,
  53730. nonBlendModesSet,
  53731. xfaFactory
  53732. }) {
  53733. this.pdfManager = pdfManager;
  53734. this.pageIndex = pageIndex;
  53735. this.pageDict = pageDict;
  53736. this.xref = xref;
  53737. this.ref = ref;
  53738. this.fontCache = fontCache;
  53739. this.builtInCMapCache = builtInCMapCache;
  53740. this.standardFontDataCache = standardFontDataCache;
  53741. this.globalImageCache = globalImageCache;
  53742. this.systemFontCache = systemFontCache;
  53743. this.nonBlendModesSet = nonBlendModesSet;
  53744. this.evaluatorOptions = pdfManager.evaluatorOptions;
  53745. this.resourcesPromise = null;
  53746. this.xfaFactory = xfaFactory;
  53747. const idCounters = {
  53748. obj: 0
  53749. };
  53750. this._localIdFactory = class extends globalIdFactory {
  53751. static createObjId() {
  53752. return `p${pageIndex}_${++idCounters.obj}`;
  53753. }
  53754. static getPageObjId() {
  53755. return `p${ref.toString()}`;
  53756. }
  53757. };
  53758. }
  53759. _getInheritableProperty(key, getArray = false) {
  53760. const value = getInheritableProperty({
  53761. dict: this.pageDict,
  53762. key,
  53763. getArray,
  53764. stopWhenFound: false
  53765. });
  53766. if (!Array.isArray(value)) {
  53767. return value;
  53768. }
  53769. if (value.length === 1 || !(value[0] instanceof Dict)) {
  53770. return value[0];
  53771. }
  53772. return Dict.merge({
  53773. xref: this.xref,
  53774. dictArray: value
  53775. });
  53776. }
  53777. get content() {
  53778. return this.pageDict.getArray("Contents");
  53779. }
  53780. get resources() {
  53781. const resources = this._getInheritableProperty("Resources");
  53782. return shadow(this, "resources", resources instanceof Dict ? resources : Dict.empty);
  53783. }
  53784. _getBoundingBox(name) {
  53785. if (this.xfaData) {
  53786. return this.xfaData.bbox;
  53787. }
  53788. const box = lookupNormalRect(this._getInheritableProperty(name, true), null);
  53789. if (box) {
  53790. if (box[2] - box[0] > 0 && box[3] - box[1] > 0) {
  53791. return box;
  53792. }
  53793. warn(`Empty, or invalid, /${name} entry.`);
  53794. }
  53795. return null;
  53796. }
  53797. get mediaBox() {
  53798. return shadow(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
  53799. }
  53800. get cropBox() {
  53801. return shadow(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
  53802. }
  53803. get userUnit() {
  53804. let obj = this.pageDict.get("UserUnit");
  53805. if (typeof obj !== "number" || obj <= 0) {
  53806. obj = DEFAULT_USER_UNIT;
  53807. }
  53808. return shadow(this, "userUnit", obj);
  53809. }
  53810. get view() {
  53811. const {
  53812. cropBox,
  53813. mediaBox
  53814. } = this;
  53815. if (cropBox !== mediaBox && !isArrayEqual(cropBox, mediaBox)) {
  53816. const box = Util.intersect(cropBox, mediaBox);
  53817. if (box && box[2] - box[0] > 0 && box[3] - box[1] > 0) {
  53818. return shadow(this, "view", box);
  53819. }
  53820. warn("Empty /CropBox and /MediaBox intersection.");
  53821. }
  53822. return shadow(this, "view", mediaBox);
  53823. }
  53824. get rotate() {
  53825. let rotate = this._getInheritableProperty("Rotate") || 0;
  53826. if (rotate % 90 !== 0) {
  53827. rotate = 0;
  53828. } else if (rotate >= 360) {
  53829. rotate %= 360;
  53830. } else if (rotate < 0) {
  53831. rotate = (rotate % 360 + 360) % 360;
  53832. }
  53833. return shadow(this, "rotate", rotate);
  53834. }
  53835. _onSubStreamError(reason, objId) {
  53836. if (this.evaluatorOptions.ignoreErrors) {
  53837. warn(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`);
  53838. return;
  53839. }
  53840. throw reason;
  53841. }
  53842. getContentStream() {
  53843. return this.pdfManager.ensure(this, "content").then(content => {
  53844. if (content instanceof BaseStream) {
  53845. return content;
  53846. }
  53847. if (Array.isArray(content)) {
  53848. return new StreamsSequenceStream(content, this._onSubStreamError.bind(this));
  53849. }
  53850. return new NullStream();
  53851. });
  53852. }
  53853. get xfaData() {
  53854. return shadow(this, "xfaData", this.xfaFactory ? {
  53855. bbox: this.xfaFactory.getBoundingBox(this.pageIndex)
  53856. } : null);
  53857. }
  53858. async #replaceIdByRef(annotations, deletedAnnotations, existingAnnotations) {
  53859. const promises = [];
  53860. for (const annotation of annotations) {
  53861. if (annotation.id) {
  53862. const ref = Ref.fromString(annotation.id);
  53863. if (!ref) {
  53864. warn(`A non-linked annotation cannot be modified: ${annotation.id}`);
  53865. continue;
  53866. }
  53867. if (annotation.deleted) {
  53868. deletedAnnotations.put(ref, ref);
  53869. if (annotation.popupRef) {
  53870. const popupRef = Ref.fromString(annotation.popupRef);
  53871. if (popupRef) {
  53872. deletedAnnotations.put(popupRef, popupRef);
  53873. }
  53874. }
  53875. continue;
  53876. }
  53877. existingAnnotations?.put(ref);
  53878. annotation.ref = ref;
  53879. promises.push(this.xref.fetchAsync(ref).then(obj => {
  53880. if (obj instanceof Dict) {
  53881. annotation.oldAnnotation = obj.clone();
  53882. }
  53883. }, () => {
  53884. warn(`Cannot fetch \`oldAnnotation\` for: ${ref}.`);
  53885. }));
  53886. delete annotation.id;
  53887. }
  53888. }
  53889. await Promise.all(promises);
  53890. }
  53891. async saveNewAnnotations(handler, task, annotations, imagePromises) {
  53892. if (this.xfaFactory) {
  53893. throw new Error("XFA: Cannot save new annotations.");
  53894. }
  53895. const partialEvaluator = new PartialEvaluator({
  53896. xref: this.xref,
  53897. handler,
  53898. pageIndex: this.pageIndex,
  53899. idFactory: this._localIdFactory,
  53900. fontCache: this.fontCache,
  53901. builtInCMapCache: this.builtInCMapCache,
  53902. standardFontDataCache: this.standardFontDataCache,
  53903. globalImageCache: this.globalImageCache,
  53904. systemFontCache: this.systemFontCache,
  53905. options: this.evaluatorOptions
  53906. });
  53907. const deletedAnnotations = new RefSetCache();
  53908. const existingAnnotations = new RefSet();
  53909. await this.#replaceIdByRef(annotations, deletedAnnotations, existingAnnotations);
  53910. const pageDict = this.pageDict;
  53911. const annotationsArray = this.annotations.filter(a => !(a instanceof Ref && deletedAnnotations.has(a)));
  53912. const newData = await AnnotationFactory.saveNewAnnotations(partialEvaluator, task, annotations, imagePromises);
  53913. for (const {
  53914. ref
  53915. } of newData.annotations) {
  53916. if (ref instanceof Ref && !existingAnnotations.has(ref)) {
  53917. annotationsArray.push(ref);
  53918. }
  53919. }
  53920. const savedDict = pageDict.get("Annots");
  53921. pageDict.set("Annots", annotationsArray);
  53922. const buffer = [];
  53923. await writeObject(this.ref, pageDict, buffer, this.xref);
  53924. if (savedDict) {
  53925. pageDict.set("Annots", savedDict);
  53926. }
  53927. const objects = newData.dependencies;
  53928. objects.push({
  53929. ref: this.ref,
  53930. data: buffer.join("")
  53931. }, ...newData.annotations);
  53932. for (const deletedRef of deletedAnnotations) {
  53933. objects.push({
  53934. ref: deletedRef,
  53935. data: null
  53936. });
  53937. }
  53938. return objects;
  53939. }
  53940. save(handler, task, annotationStorage) {
  53941. const partialEvaluator = new PartialEvaluator({
  53942. xref: this.xref,
  53943. handler,
  53944. pageIndex: this.pageIndex,
  53945. idFactory: this._localIdFactory,
  53946. fontCache: this.fontCache,
  53947. builtInCMapCache: this.builtInCMapCache,
  53948. standardFontDataCache: this.standardFontDataCache,
  53949. globalImageCache: this.globalImageCache,
  53950. systemFontCache: this.systemFontCache,
  53951. options: this.evaluatorOptions
  53952. });
  53953. return this._parsedAnnotations.then(function (annotations) {
  53954. const newRefsPromises = [];
  53955. for (const annotation of annotations) {
  53956. newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) {
  53957. warn("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  53958. return null;
  53959. }));
  53960. }
  53961. return Promise.all(newRefsPromises).then(function (newRefs) {
  53962. return newRefs.filter(newRef => !!newRef);
  53963. });
  53964. });
  53965. }
  53966. loadResources(keys) {
  53967. this.resourcesPromise ||= this.pdfManager.ensure(this, "resources");
  53968. return this.resourcesPromise.then(() => {
  53969. const objectLoader = new ObjectLoader(this.resources, keys, this.xref);
  53970. return objectLoader.load();
  53971. });
  53972. }
  53973. getOperatorList({
  53974. handler,
  53975. sink,
  53976. task,
  53977. intent,
  53978. cacheKey,
  53979. annotationStorage = null,
  53980. modifiedIds = null
  53981. }) {
  53982. const contentStreamPromise = this.getContentStream();
  53983. const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]);
  53984. const partialEvaluator = new PartialEvaluator({
  53985. xref: this.xref,
  53986. handler,
  53987. pageIndex: this.pageIndex,
  53988. idFactory: this._localIdFactory,
  53989. fontCache: this.fontCache,
  53990. builtInCMapCache: this.builtInCMapCache,
  53991. standardFontDataCache: this.standardFontDataCache,
  53992. globalImageCache: this.globalImageCache,
  53993. systemFontCache: this.systemFontCache,
  53994. options: this.evaluatorOptions
  53995. });
  53996. const newAnnotsByPage = !this.xfaFactory ? getNewAnnotationsMap(annotationStorage) : null;
  53997. const newAnnots = newAnnotsByPage?.get(this.pageIndex);
  53998. let newAnnotationsPromise = Promise.resolve(null);
  53999. let deletedAnnotations = null;
  54000. if (newAnnots) {
  54001. const annotationGlobalsPromise = this.pdfManager.ensureDoc("annotationGlobals");
  54002. let imagePromises;
  54003. const missingBitmaps = new Set();
  54004. for (const {
  54005. bitmapId,
  54006. bitmap
  54007. } of newAnnots) {
  54008. if (bitmapId && !bitmap && !missingBitmaps.has(bitmapId)) {
  54009. missingBitmaps.add(bitmapId);
  54010. }
  54011. }
  54012. const {
  54013. isOffscreenCanvasSupported
  54014. } = this.evaluatorOptions;
  54015. if (missingBitmaps.size > 0) {
  54016. const annotationWithBitmaps = newAnnots.slice();
  54017. for (const [key, annotation] of annotationStorage) {
  54018. if (!key.startsWith(AnnotationEditorPrefix)) {
  54019. continue;
  54020. }
  54021. if (annotation.bitmap && missingBitmaps.has(annotation.bitmapId)) {
  54022. annotationWithBitmaps.push(annotation);
  54023. }
  54024. }
  54025. imagePromises = AnnotationFactory.generateImages(annotationWithBitmaps, this.xref, isOffscreenCanvasSupported);
  54026. } else {
  54027. imagePromises = AnnotationFactory.generateImages(newAnnots, this.xref, isOffscreenCanvasSupported);
  54028. }
  54029. deletedAnnotations = new RefSet();
  54030. newAnnotationsPromise = Promise.all([annotationGlobalsPromise, this.#replaceIdByRef(newAnnots, deletedAnnotations, null)]).then(([annotationGlobals]) => {
  54031. if (!annotationGlobals) {
  54032. return null;
  54033. }
  54034. return AnnotationFactory.printNewAnnotations(annotationGlobals, partialEvaluator, task, newAnnots, imagePromises);
  54035. });
  54036. }
  54037. const pageListPromise = Promise.all([contentStreamPromise, resourcesPromise]).then(([contentStream]) => {
  54038. const opList = new OperatorList(intent, sink);
  54039. handler.send("StartRenderPage", {
  54040. transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
  54041. pageIndex: this.pageIndex,
  54042. cacheKey
  54043. });
  54044. return partialEvaluator.getOperatorList({
  54045. stream: contentStream,
  54046. task,
  54047. resources: this.resources,
  54048. operatorList: opList
  54049. }).then(function () {
  54050. return opList;
  54051. });
  54052. });
  54053. return Promise.all([pageListPromise, this._parsedAnnotations, newAnnotationsPromise]).then(function ([pageOpList, annotations, newAnnotations]) {
  54054. if (newAnnotations) {
  54055. annotations = annotations.filter(a => !(a.ref && deletedAnnotations.has(a.ref)));
  54056. for (let i = 0, ii = newAnnotations.length; i < ii; i++) {
  54057. const newAnnotation = newAnnotations[i];
  54058. if (newAnnotation.refToReplace) {
  54059. const j = annotations.findIndex(a => a.ref && isRefsEqual(a.ref, newAnnotation.refToReplace));
  54060. if (j >= 0) {
  54061. annotations.splice(j, 1, newAnnotation);
  54062. newAnnotations.splice(i--, 1);
  54063. ii--;
  54064. }
  54065. }
  54066. }
  54067. annotations = annotations.concat(newAnnotations);
  54068. }
  54069. if (annotations.length === 0 || intent & RenderingIntentFlag.ANNOTATIONS_DISABLE) {
  54070. pageOpList.flush(true);
  54071. return {
  54072. length: pageOpList.totalLength
  54073. };
  54074. }
  54075. const renderForms = !!(intent & RenderingIntentFlag.ANNOTATIONS_FORMS),
  54076. isEditing = !!(intent & RenderingIntentFlag.IS_EDITING),
  54077. intentAny = !!(intent & RenderingIntentFlag.ANY),
  54078. intentDisplay = !!(intent & RenderingIntentFlag.DISPLAY),
  54079. intentPrint = !!(intent & RenderingIntentFlag.PRINT);
  54080. const opListPromises = [];
  54081. for (const annotation of annotations) {
  54082. if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage, renderForms) && annotation.mustBeViewedWhenEditing(isEditing, modifiedIds) || intentPrint && annotation.mustBePrinted(annotationStorage)) {
  54083. opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, annotationStorage).catch(function (reason) {
  54084. warn("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  54085. return {
  54086. opList: null,
  54087. separateForm: false,
  54088. separateCanvas: false
  54089. };
  54090. }));
  54091. }
  54092. }
  54093. return Promise.all(opListPromises).then(function (opLists) {
  54094. let form = false,
  54095. canvas = false;
  54096. for (const {
  54097. opList,
  54098. separateForm,
  54099. separateCanvas
  54100. } of opLists) {
  54101. pageOpList.addOpList(opList);
  54102. form ||= separateForm;
  54103. canvas ||= separateCanvas;
  54104. }
  54105. pageOpList.flush(true, {
  54106. form,
  54107. canvas
  54108. });
  54109. return {
  54110. length: pageOpList.totalLength
  54111. };
  54112. });
  54113. });
  54114. }
  54115. async extractTextContent({
  54116. handler,
  54117. task,
  54118. includeMarkedContent,
  54119. disableNormalization,
  54120. sink
  54121. }) {
  54122. const contentStreamPromise = this.getContentStream();
  54123. const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]);
  54124. const langPromise = this.pdfManager.ensureCatalog("lang");
  54125. const [contentStream,, lang] = await Promise.all([contentStreamPromise, resourcesPromise, langPromise]);
  54126. const partialEvaluator = new PartialEvaluator({
  54127. xref: this.xref,
  54128. handler,
  54129. pageIndex: this.pageIndex,
  54130. idFactory: this._localIdFactory,
  54131. fontCache: this.fontCache,
  54132. builtInCMapCache: this.builtInCMapCache,
  54133. standardFontDataCache: this.standardFontDataCache,
  54134. globalImageCache: this.globalImageCache,
  54135. systemFontCache: this.systemFontCache,
  54136. options: this.evaluatorOptions
  54137. });
  54138. return partialEvaluator.getTextContent({
  54139. stream: contentStream,
  54140. task,
  54141. resources: this.resources,
  54142. includeMarkedContent,
  54143. disableNormalization,
  54144. sink,
  54145. viewBox: this.view,
  54146. lang
  54147. });
  54148. }
  54149. async getStructTree() {
  54150. const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot");
  54151. if (!structTreeRoot) {
  54152. return null;
  54153. }
  54154. await this._parsedAnnotations;
  54155. const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]);
  54156. return this.pdfManager.ensure(structTree, "serializable");
  54157. }
  54158. _parseStructTree(structTreeRoot) {
  54159. const tree = new StructTreePage(structTreeRoot, this.pageDict);
  54160. tree.parse(this.ref);
  54161. return tree;
  54162. }
  54163. async getAnnotationsData(handler, task, intent) {
  54164. const annotations = await this._parsedAnnotations;
  54165. if (annotations.length === 0) {
  54166. return annotations;
  54167. }
  54168. const annotationsData = [],
  54169. textContentPromises = [];
  54170. let partialEvaluator;
  54171. const intentAny = !!(intent & RenderingIntentFlag.ANY),
  54172. intentDisplay = !!(intent & RenderingIntentFlag.DISPLAY),
  54173. intentPrint = !!(intent & RenderingIntentFlag.PRINT);
  54174. for (const annotation of annotations) {
  54175. const isVisible = intentAny || intentDisplay && annotation.viewable;
  54176. if (isVisible || intentPrint && annotation.printable) {
  54177. annotationsData.push(annotation.data);
  54178. }
  54179. if (annotation.hasTextContent && isVisible) {
  54180. partialEvaluator ||= new PartialEvaluator({
  54181. xref: this.xref,
  54182. handler,
  54183. pageIndex: this.pageIndex,
  54184. idFactory: this._localIdFactory,
  54185. fontCache: this.fontCache,
  54186. builtInCMapCache: this.builtInCMapCache,
  54187. standardFontDataCache: this.standardFontDataCache,
  54188. globalImageCache: this.globalImageCache,
  54189. systemFontCache: this.systemFontCache,
  54190. options: this.evaluatorOptions
  54191. });
  54192. textContentPromises.push(annotation.extractTextContent(partialEvaluator, task, [-Infinity, -Infinity, Infinity, Infinity]).catch(function (reason) {
  54193. warn(`getAnnotationsData - ignoring textContent during "${task.name}" task: "${reason}".`);
  54194. }));
  54195. }
  54196. }
  54197. await Promise.all(textContentPromises);
  54198. return annotationsData;
  54199. }
  54200. get annotations() {
  54201. const annots = this._getInheritableProperty("Annots");
  54202. return shadow(this, "annotations", Array.isArray(annots) ? annots : []);
  54203. }
  54204. get _parsedAnnotations() {
  54205. const promise = this.pdfManager.ensure(this, "annotations").then(async annots => {
  54206. if (annots.length === 0) {
  54207. return annots;
  54208. }
  54209. const [annotationGlobals, fieldObjects] = await Promise.all([this.pdfManager.ensureDoc("annotationGlobals"), this.pdfManager.ensureDoc("fieldObjects")]);
  54210. if (!annotationGlobals) {
  54211. return [];
  54212. }
  54213. const orphanFields = fieldObjects?.orphanFields;
  54214. const annotationPromises = [];
  54215. for (const annotationRef of annots) {
  54216. annotationPromises.push(AnnotationFactory.create(this.xref, annotationRef, annotationGlobals, this._localIdFactory, false, orphanFields, this.ref).catch(function (reason) {
  54217. warn(`_parsedAnnotations: "${reason}".`);
  54218. return null;
  54219. }));
  54220. }
  54221. const sortedAnnotations = [];
  54222. let popupAnnotations, widgetAnnotations;
  54223. for (const annotation of await Promise.all(annotationPromises)) {
  54224. if (!annotation) {
  54225. continue;
  54226. }
  54227. if (annotation instanceof WidgetAnnotation) {
  54228. (widgetAnnotations ||= []).push(annotation);
  54229. continue;
  54230. }
  54231. if (annotation instanceof PopupAnnotation) {
  54232. (popupAnnotations ||= []).push(annotation);
  54233. continue;
  54234. }
  54235. sortedAnnotations.push(annotation);
  54236. }
  54237. if (widgetAnnotations) {
  54238. sortedAnnotations.push(...widgetAnnotations);
  54239. }
  54240. if (popupAnnotations) {
  54241. sortedAnnotations.push(...popupAnnotations);
  54242. }
  54243. return sortedAnnotations;
  54244. });
  54245. return shadow(this, "_parsedAnnotations", promise);
  54246. }
  54247. get jsActions() {
  54248. const actions = collectActions(this.xref, this.pageDict, PageActionEventType);
  54249. return shadow(this, "jsActions", actions);
  54250. }
  54251. }
  54252. const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
  54253. const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
  54254. const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
  54255. function find(stream, signature, limit = 1024, backwards = false) {
  54256. const signatureLength = signature.length;
  54257. const scanBytes = stream.peekBytes(limit);
  54258. const scanLength = scanBytes.length - signatureLength;
  54259. if (scanLength <= 0) {
  54260. return false;
  54261. }
  54262. if (backwards) {
  54263. const signatureEnd = signatureLength - 1;
  54264. let pos = scanBytes.length - 1;
  54265. while (pos >= signatureEnd) {
  54266. let j = 0;
  54267. while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
  54268. j++;
  54269. }
  54270. if (j >= signatureLength) {
  54271. stream.pos += pos - signatureEnd;
  54272. return true;
  54273. }
  54274. pos--;
  54275. }
  54276. } else {
  54277. let pos = 0;
  54278. while (pos <= scanLength) {
  54279. let j = 0;
  54280. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  54281. j++;
  54282. }
  54283. if (j >= signatureLength) {
  54284. stream.pos += pos;
  54285. return true;
  54286. }
  54287. pos++;
  54288. }
  54289. }
  54290. return false;
  54291. }
  54292. class PDFDocument {
  54293. constructor(pdfManager, stream) {
  54294. if (stream.length <= 0) {
  54295. throw new InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
  54296. }
  54297. this.pdfManager = pdfManager;
  54298. this.stream = stream;
  54299. this.xref = new XRef(stream, pdfManager);
  54300. this._pagePromises = new Map();
  54301. this._version = null;
  54302. const idCounters = {
  54303. font: 0
  54304. };
  54305. this._globalIdFactory = class {
  54306. static getDocId() {
  54307. return `g_${pdfManager.docId}`;
  54308. }
  54309. static createFontId() {
  54310. return `f${++idCounters.font}`;
  54311. }
  54312. static createObjId() {
  54313. unreachable("Abstract method `createObjId` called.");
  54314. }
  54315. static getPageObjId() {
  54316. unreachable("Abstract method `getPageObjId` called.");
  54317. }
  54318. };
  54319. }
  54320. parse(recoveryMode) {
  54321. this.xref.parse(recoveryMode);
  54322. this.catalog = new Catalog(this.pdfManager, this.xref);
  54323. }
  54324. get linearization() {
  54325. let linearization = null;
  54326. try {
  54327. linearization = Linearization.create(this.stream);
  54328. } catch (err) {
  54329. if (err instanceof MissingDataException) {
  54330. throw err;
  54331. }
  54332. info(err);
  54333. }
  54334. return shadow(this, "linearization", linearization);
  54335. }
  54336. get startXRef() {
  54337. const stream = this.stream;
  54338. let startXRef = 0;
  54339. if (this.linearization) {
  54340. stream.reset();
  54341. if (find(stream, ENDOBJ_SIGNATURE)) {
  54342. stream.skip(6);
  54343. let ch = stream.peekByte();
  54344. while (isWhiteSpace(ch)) {
  54345. stream.pos++;
  54346. ch = stream.peekByte();
  54347. }
  54348. startXRef = stream.pos - stream.start;
  54349. }
  54350. } else {
  54351. const step = 1024;
  54352. const startXRefLength = STARTXREF_SIGNATURE.length;
  54353. let found = false,
  54354. pos = stream.end;
  54355. while (!found && pos > 0) {
  54356. pos -= step - startXRefLength;
  54357. if (pos < 0) {
  54358. pos = 0;
  54359. }
  54360. stream.pos = pos;
  54361. found = find(stream, STARTXREF_SIGNATURE, step, true);
  54362. }
  54363. if (found) {
  54364. stream.skip(9);
  54365. let ch;
  54366. do {
  54367. ch = stream.getByte();
  54368. } while (isWhiteSpace(ch));
  54369. let str = "";
  54370. while (ch >= 0x20 && ch <= 0x39) {
  54371. str += String.fromCharCode(ch);
  54372. ch = stream.getByte();
  54373. }
  54374. startXRef = parseInt(str, 10);
  54375. if (isNaN(startXRef)) {
  54376. startXRef = 0;
  54377. }
  54378. }
  54379. }
  54380. return shadow(this, "startXRef", startXRef);
  54381. }
  54382. checkHeader() {
  54383. const stream = this.stream;
  54384. stream.reset();
  54385. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  54386. return;
  54387. }
  54388. stream.moveStart();
  54389. stream.skip(PDF_HEADER_SIGNATURE.length);
  54390. let version = "",
  54391. ch;
  54392. while ((ch = stream.getByte()) > 0x20 && version.length < 7) {
  54393. version += String.fromCharCode(ch);
  54394. }
  54395. if (PDF_VERSION_REGEXP.test(version)) {
  54396. this._version = version;
  54397. } else {
  54398. warn(`Invalid PDF header version: ${version}`);
  54399. }
  54400. }
  54401. parseStartXRef() {
  54402. this.xref.setStartXRef(this.startXRef);
  54403. }
  54404. get numPages() {
  54405. let num = 0;
  54406. if (this.catalog.hasActualNumPages) {
  54407. num = this.catalog.numPages;
  54408. } else if (this.xfaFactory) {
  54409. num = this.xfaFactory.getNumPages();
  54410. } else if (this.linearization) {
  54411. num = this.linearization.numPages;
  54412. } else {
  54413. num = this.catalog.numPages;
  54414. }
  54415. return shadow(this, "numPages", num);
  54416. }
  54417. _hasOnlyDocumentSignatures(fields, recursionDepth = 0) {
  54418. const RECURSION_LIMIT = 10;
  54419. if (!Array.isArray(fields)) {
  54420. return false;
  54421. }
  54422. return fields.every(field => {
  54423. field = this.xref.fetchIfRef(field);
  54424. if (!(field instanceof Dict)) {
  54425. return false;
  54426. }
  54427. if (field.has("Kids")) {
  54428. if (++recursionDepth > RECURSION_LIMIT) {
  54429. warn("_hasOnlyDocumentSignatures: maximum recursion depth reached");
  54430. return false;
  54431. }
  54432. return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
  54433. }
  54434. const isSignature = isName(field.get("FT"), "Sig");
  54435. const rectangle = field.get("Rect");
  54436. const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
  54437. return isSignature && isInvisible;
  54438. });
  54439. }
  54440. get _xfaStreams() {
  54441. const acroForm = this.catalog.acroForm;
  54442. if (!acroForm) {
  54443. return null;
  54444. }
  54445. const xfa = acroForm.get("XFA");
  54446. const entries = {
  54447. "xdp:xdp": "",
  54448. template: "",
  54449. datasets: "",
  54450. config: "",
  54451. connectionSet: "",
  54452. localeSet: "",
  54453. stylesheet: "",
  54454. "/xdp:xdp": ""
  54455. };
  54456. if (xfa instanceof BaseStream && !xfa.isEmpty) {
  54457. entries["xdp:xdp"] = xfa;
  54458. return entries;
  54459. }
  54460. if (!Array.isArray(xfa) || xfa.length === 0) {
  54461. return null;
  54462. }
  54463. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  54464. let name;
  54465. if (i === 0) {
  54466. name = "xdp:xdp";
  54467. } else if (i === ii - 2) {
  54468. name = "/xdp:xdp";
  54469. } else {
  54470. name = xfa[i];
  54471. }
  54472. if (!entries.hasOwnProperty(name)) {
  54473. continue;
  54474. }
  54475. const data = this.xref.fetchIfRef(xfa[i + 1]);
  54476. if (!(data instanceof BaseStream) || data.isEmpty) {
  54477. continue;
  54478. }
  54479. entries[name] = data;
  54480. }
  54481. return entries;
  54482. }
  54483. get xfaDatasets() {
  54484. const streams = this._xfaStreams;
  54485. if (!streams) {
  54486. return shadow(this, "xfaDatasets", null);
  54487. }
  54488. for (const key of ["datasets", "xdp:xdp"]) {
  54489. const stream = streams[key];
  54490. if (!stream) {
  54491. continue;
  54492. }
  54493. try {
  54494. const str = stringToUTF8String(stream.getString());
  54495. const data = {
  54496. [key]: str
  54497. };
  54498. return shadow(this, "xfaDatasets", new DatasetReader(data));
  54499. } catch {
  54500. warn("XFA - Invalid utf-8 string.");
  54501. break;
  54502. }
  54503. }
  54504. return shadow(this, "xfaDatasets", null);
  54505. }
  54506. get xfaData() {
  54507. const streams = this._xfaStreams;
  54508. if (!streams) {
  54509. return null;
  54510. }
  54511. const data = Object.create(null);
  54512. for (const [key, stream] of Object.entries(streams)) {
  54513. if (!stream) {
  54514. continue;
  54515. }
  54516. try {
  54517. data[key] = stringToUTF8String(stream.getString());
  54518. } catch {
  54519. warn("XFA - Invalid utf-8 string.");
  54520. return null;
  54521. }
  54522. }
  54523. return data;
  54524. }
  54525. get xfaFactory() {
  54526. let data;
  54527. if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
  54528. data = this.xfaData;
  54529. }
  54530. return shadow(this, "xfaFactory", data ? new XFAFactory(data) : null);
  54531. }
  54532. get isPureXfa() {
  54533. return this.xfaFactory ? this.xfaFactory.isValid() : false;
  54534. }
  54535. get htmlForXfa() {
  54536. return this.xfaFactory ? this.xfaFactory.getPages() : null;
  54537. }
  54538. async loadXfaImages() {
  54539. const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages");
  54540. if (!xfaImagesDict) {
  54541. return;
  54542. }
  54543. const keys = xfaImagesDict.getKeys();
  54544. const objectLoader = new ObjectLoader(xfaImagesDict, keys, this.xref);
  54545. await objectLoader.load();
  54546. const xfaImages = new Map();
  54547. for (const key of keys) {
  54548. const stream = xfaImagesDict.get(key);
  54549. if (stream instanceof BaseStream) {
  54550. xfaImages.set(key, stream.getBytes());
  54551. }
  54552. }
  54553. this.xfaFactory.setImages(xfaImages);
  54554. }
  54555. async loadXfaFonts(handler, task) {
  54556. const acroForm = await this.pdfManager.ensureCatalog("acroForm");
  54557. if (!acroForm) {
  54558. return;
  54559. }
  54560. const resources = await acroForm.getAsync("DR");
  54561. if (!(resources instanceof Dict)) {
  54562. return;
  54563. }
  54564. const objectLoader = new ObjectLoader(resources, ["Font"], this.xref);
  54565. await objectLoader.load();
  54566. const fontRes = resources.get("Font");
  54567. if (!(fontRes instanceof Dict)) {
  54568. return;
  54569. }
  54570. const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions);
  54571. options.useSystemFonts = false;
  54572. const partialEvaluator = new PartialEvaluator({
  54573. xref: this.xref,
  54574. handler,
  54575. pageIndex: -1,
  54576. idFactory: this._globalIdFactory,
  54577. fontCache: this.catalog.fontCache,
  54578. builtInCMapCache: this.catalog.builtInCMapCache,
  54579. standardFontDataCache: this.catalog.standardFontDataCache,
  54580. options
  54581. });
  54582. const operatorList = new OperatorList();
  54583. const pdfFonts = [];
  54584. const initialState = {
  54585. get font() {
  54586. return pdfFonts.at(-1);
  54587. },
  54588. set font(font) {
  54589. pdfFonts.push(font);
  54590. },
  54591. clone() {
  54592. return this;
  54593. }
  54594. };
  54595. const fonts = new Map();
  54596. fontRes.forEach((fontName, font) => {
  54597. fonts.set(fontName, font);
  54598. });
  54599. const promises = [];
  54600. for (const [fontName, font] of fonts) {
  54601. const descriptor = font.get("FontDescriptor");
  54602. if (!(descriptor instanceof Dict)) {
  54603. continue;
  54604. }
  54605. let fontFamily = descriptor.get("FontFamily");
  54606. fontFamily = fontFamily.replaceAll(/[ ]+(\d)/g, "$1");
  54607. const fontWeight = descriptor.get("FontWeight");
  54608. const italicAngle = -descriptor.get("ItalicAngle");
  54609. const cssFontInfo = {
  54610. fontFamily,
  54611. fontWeight,
  54612. italicAngle
  54613. };
  54614. if (!validateCSSFont(cssFontInfo)) {
  54615. continue;
  54616. }
  54617. promises.push(partialEvaluator.handleSetFont(resources, [Name.get(fontName), 1], null, operatorList, task, initialState, null, cssFontInfo).catch(function (reason) {
  54618. warn(`loadXfaFonts: "${reason}".`);
  54619. return null;
  54620. }));
  54621. }
  54622. await Promise.all(promises);
  54623. const missingFonts = this.xfaFactory.setFonts(pdfFonts);
  54624. if (!missingFonts) {
  54625. return;
  54626. }
  54627. options.ignoreErrors = true;
  54628. promises.length = 0;
  54629. pdfFonts.length = 0;
  54630. const reallyMissingFonts = new Set();
  54631. for (const missing of missingFonts) {
  54632. if (!getXfaFontName(`${missing}-Regular`)) {
  54633. reallyMissingFonts.add(missing);
  54634. }
  54635. }
  54636. if (reallyMissingFonts.size) {
  54637. missingFonts.push("PdfJS-Fallback");
  54638. }
  54639. for (const missing of missingFonts) {
  54640. if (reallyMissingFonts.has(missing)) {
  54641. continue;
  54642. }
  54643. for (const fontInfo of [{
  54644. name: "Regular",
  54645. fontWeight: 400,
  54646. italicAngle: 0
  54647. }, {
  54648. name: "Bold",
  54649. fontWeight: 700,
  54650. italicAngle: 0
  54651. }, {
  54652. name: "Italic",
  54653. fontWeight: 400,
  54654. italicAngle: 12
  54655. }, {
  54656. name: "BoldItalic",
  54657. fontWeight: 700,
  54658. italicAngle: 12
  54659. }]) {
  54660. const name = `${missing}-${fontInfo.name}`;
  54661. const dict = getXfaFontDict(name);
  54662. promises.push(partialEvaluator.handleSetFont(resources, [Name.get(name), 1], null, operatorList, task, initialState, dict, {
  54663. fontFamily: missing,
  54664. fontWeight: fontInfo.fontWeight,
  54665. italicAngle: fontInfo.italicAngle
  54666. }).catch(function (reason) {
  54667. warn(`loadXfaFonts: "${reason}".`);
  54668. return null;
  54669. }));
  54670. }
  54671. }
  54672. await Promise.all(promises);
  54673. this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts);
  54674. }
  54675. async serializeXfaData(annotationStorage) {
  54676. return this.xfaFactory ? this.xfaFactory.serializeData(annotationStorage) : null;
  54677. }
  54678. get version() {
  54679. return this.catalog.version || this._version;
  54680. }
  54681. get formInfo() {
  54682. const formInfo = {
  54683. hasFields: false,
  54684. hasAcroForm: false,
  54685. hasXfa: false,
  54686. hasSignatures: false
  54687. };
  54688. const acroForm = this.catalog.acroForm;
  54689. if (!acroForm) {
  54690. return shadow(this, "formInfo", formInfo);
  54691. }
  54692. try {
  54693. const fields = acroForm.get("Fields");
  54694. const hasFields = Array.isArray(fields) && fields.length > 0;
  54695. formInfo.hasFields = hasFields;
  54696. const xfa = acroForm.get("XFA");
  54697. formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || xfa instanceof BaseStream && !xfa.isEmpty;
  54698. const sigFlags = acroForm.get("SigFlags");
  54699. const hasSignatures = !!(sigFlags & 0x1);
  54700. const hasOnlyDocumentSignatures = hasSignatures && this._hasOnlyDocumentSignatures(fields);
  54701. formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
  54702. formInfo.hasSignatures = hasSignatures;
  54703. } catch (ex) {
  54704. if (ex instanceof MissingDataException) {
  54705. throw ex;
  54706. }
  54707. warn(`Cannot fetch form information: "${ex}".`);
  54708. }
  54709. return shadow(this, "formInfo", formInfo);
  54710. }
  54711. get documentInfo() {
  54712. const docInfo = {
  54713. PDFFormatVersion: this.version,
  54714. Language: this.catalog.lang,
  54715. EncryptFilterName: this.xref.encrypt ? this.xref.encrypt.filterName : null,
  54716. IsLinearized: !!this.linearization,
  54717. IsAcroFormPresent: this.formInfo.hasAcroForm,
  54718. IsXFAPresent: this.formInfo.hasXfa,
  54719. IsCollectionPresent: !!this.catalog.collection,
  54720. IsSignaturesPresent: this.formInfo.hasSignatures
  54721. };
  54722. let infoDict;
  54723. try {
  54724. infoDict = this.xref.trailer.get("Info");
  54725. } catch (err) {
  54726. if (err instanceof MissingDataException) {
  54727. throw err;
  54728. }
  54729. info("The document information dictionary is invalid.");
  54730. }
  54731. if (!(infoDict instanceof Dict)) {
  54732. return shadow(this, "documentInfo", docInfo);
  54733. }
  54734. for (const key of infoDict.getKeys()) {
  54735. const value = infoDict.get(key);
  54736. switch (key) {
  54737. case "Title":
  54738. case "Author":
  54739. case "Subject":
  54740. case "Keywords":
  54741. case "Creator":
  54742. case "Producer":
  54743. case "CreationDate":
  54744. case "ModDate":
  54745. if (typeof value === "string") {
  54746. docInfo[key] = stringToPDFString(value);
  54747. continue;
  54748. }
  54749. break;
  54750. case "Trapped":
  54751. if (value instanceof Name) {
  54752. docInfo[key] = value;
  54753. continue;
  54754. }
  54755. break;
  54756. default:
  54757. let customValue;
  54758. switch (typeof value) {
  54759. case "string":
  54760. customValue = stringToPDFString(value);
  54761. break;
  54762. case "number":
  54763. case "boolean":
  54764. customValue = value;
  54765. break;
  54766. default:
  54767. if (value instanceof Name) {
  54768. customValue = value;
  54769. }
  54770. break;
  54771. }
  54772. if (customValue === undefined) {
  54773. warn(`Bad value, for custom key "${key}", in Info: ${value}.`);
  54774. continue;
  54775. }
  54776. if (!docInfo.Custom) {
  54777. docInfo.Custom = Object.create(null);
  54778. }
  54779. docInfo.Custom[key] = customValue;
  54780. continue;
  54781. }
  54782. warn(`Bad value, for key "${key}", in Info: ${value}.`);
  54783. }
  54784. return shadow(this, "documentInfo", docInfo);
  54785. }
  54786. get fingerprints() {
  54787. const FINGERPRINT_FIRST_BYTES = 1024;
  54788. const EMPTY_FINGERPRINT = "\x00".repeat(16);
  54789. function validate(data) {
  54790. return typeof data === "string" && data.length === 16 && data !== EMPTY_FINGERPRINT;
  54791. }
  54792. const id = this.xref.trailer.get("ID");
  54793. let hashOriginal, hashModified;
  54794. if (Array.isArray(id) && validate(id[0])) {
  54795. hashOriginal = stringToBytes(id[0]);
  54796. if (id[1] !== id[0] && validate(id[1])) {
  54797. hashModified = stringToBytes(id[1]);
  54798. }
  54799. } else {
  54800. hashOriginal = calculateMD5(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  54801. }
  54802. return shadow(this, "fingerprints", [toHexUtil(hashOriginal), hashModified ? toHexUtil(hashModified) : null]);
  54803. }
  54804. async _getLinearizationPage(pageIndex) {
  54805. const {
  54806. catalog,
  54807. linearization,
  54808. xref
  54809. } = this;
  54810. const ref = Ref.get(linearization.objectNumberFirst, 0);
  54811. try {
  54812. const obj = await xref.fetchAsync(ref);
  54813. if (obj instanceof Dict) {
  54814. let type = obj.getRaw("Type");
  54815. if (type instanceof Ref) {
  54816. type = await xref.fetchAsync(type);
  54817. }
  54818. if (isName(type, "Page") || !obj.has("Type") && !obj.has("Kids") && obj.has("Contents")) {
  54819. if (!catalog.pageKidsCountCache.has(ref)) {
  54820. catalog.pageKidsCountCache.put(ref, 1);
  54821. }
  54822. if (!catalog.pageIndexCache.has(ref)) {
  54823. catalog.pageIndexCache.put(ref, 0);
  54824. }
  54825. return [obj, ref];
  54826. }
  54827. }
  54828. throw new FormatError("The Linearization dictionary doesn't point to a valid Page dictionary.");
  54829. } catch (reason) {
  54830. warn(`_getLinearizationPage: "${reason.message}".`);
  54831. return catalog.getPageDict(pageIndex);
  54832. }
  54833. }
  54834. getPage(pageIndex) {
  54835. const cachedPromise = this._pagePromises.get(pageIndex);
  54836. if (cachedPromise) {
  54837. return cachedPromise;
  54838. }
  54839. const {
  54840. catalog,
  54841. linearization,
  54842. xfaFactory
  54843. } = this;
  54844. let promise;
  54845. if (xfaFactory) {
  54846. promise = Promise.resolve([Dict.empty, null]);
  54847. } else if (linearization?.pageFirst === pageIndex) {
  54848. promise = this._getLinearizationPage(pageIndex);
  54849. } else {
  54850. promise = catalog.getPageDict(pageIndex);
  54851. }
  54852. promise = promise.then(([pageDict, ref]) => {
  54853. return new Page({
  54854. pdfManager: this.pdfManager,
  54855. xref: this.xref,
  54856. pageIndex,
  54857. pageDict,
  54858. ref,
  54859. globalIdFactory: this._globalIdFactory,
  54860. fontCache: catalog.fontCache,
  54861. builtInCMapCache: catalog.builtInCMapCache,
  54862. standardFontDataCache: catalog.standardFontDataCache,
  54863. globalImageCache: catalog.globalImageCache,
  54864. systemFontCache: catalog.systemFontCache,
  54865. nonBlendModesSet: catalog.nonBlendModesSet,
  54866. xfaFactory
  54867. });
  54868. });
  54869. this._pagePromises.set(pageIndex, promise);
  54870. return promise;
  54871. }
  54872. async checkFirstPage(recoveryMode = false) {
  54873. if (recoveryMode) {
  54874. return;
  54875. }
  54876. try {
  54877. await this.getPage(0);
  54878. } catch (reason) {
  54879. if (reason instanceof XRefEntryException) {
  54880. this._pagePromises.delete(0);
  54881. await this.cleanup();
  54882. throw new XRefParseException();
  54883. }
  54884. }
  54885. }
  54886. async checkLastPage(recoveryMode = false) {
  54887. const {
  54888. catalog,
  54889. pdfManager
  54890. } = this;
  54891. catalog.setActualNumPages();
  54892. let numPages;
  54893. try {
  54894. await Promise.all([pdfManager.ensureDoc("xfaFactory"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("numPages")]);
  54895. if (this.xfaFactory) {
  54896. return;
  54897. } else if (this.linearization) {
  54898. numPages = this.linearization.numPages;
  54899. } else {
  54900. numPages = catalog.numPages;
  54901. }
  54902. if (!Number.isInteger(numPages)) {
  54903. throw new FormatError("Page count is not an integer.");
  54904. } else if (numPages <= 1) {
  54905. return;
  54906. }
  54907. await this.getPage(numPages - 1);
  54908. } catch (reason) {
  54909. this._pagePromises.delete(numPages - 1);
  54910. await this.cleanup();
  54911. if (reason instanceof XRefEntryException && !recoveryMode) {
  54912. throw new XRefParseException();
  54913. }
  54914. warn(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`);
  54915. let pagesTree;
  54916. try {
  54917. pagesTree = await catalog.getAllPageDicts(recoveryMode);
  54918. } catch (reasonAll) {
  54919. if (reasonAll instanceof XRefEntryException && !recoveryMode) {
  54920. throw new XRefParseException();
  54921. }
  54922. catalog.setActualNumPages(1);
  54923. return;
  54924. }
  54925. for (const [pageIndex, [pageDict, ref]] of pagesTree) {
  54926. let promise;
  54927. if (pageDict instanceof Error) {
  54928. promise = Promise.reject(pageDict);
  54929. promise.catch(() => {});
  54930. } else {
  54931. promise = Promise.resolve(new Page({
  54932. pdfManager,
  54933. xref: this.xref,
  54934. pageIndex,
  54935. pageDict,
  54936. ref,
  54937. globalIdFactory: this._globalIdFactory,
  54938. fontCache: catalog.fontCache,
  54939. builtInCMapCache: catalog.builtInCMapCache,
  54940. standardFontDataCache: catalog.standardFontDataCache,
  54941. globalImageCache: catalog.globalImageCache,
  54942. systemFontCache: catalog.systemFontCache,
  54943. nonBlendModesSet: catalog.nonBlendModesSet,
  54944. xfaFactory: null
  54945. }));
  54946. }
  54947. this._pagePromises.set(pageIndex, promise);
  54948. }
  54949. catalog.setActualNumPages(pagesTree.size);
  54950. }
  54951. }
  54952. fontFallback(id, handler) {
  54953. return this.catalog.fontFallback(id, handler);
  54954. }
  54955. async cleanup(manuallyTriggered = false) {
  54956. return this.catalog ? this.catalog.cleanup(manuallyTriggered) : clearGlobalCaches();
  54957. }
  54958. async #collectFieldObjects(name, parentRef, fieldRef, promises, annotationGlobals, visitedRefs, orphanFields) {
  54959. const {
  54960. xref
  54961. } = this;
  54962. if (!(fieldRef instanceof Ref) || visitedRefs.has(fieldRef)) {
  54963. return;
  54964. }
  54965. visitedRefs.put(fieldRef);
  54966. const field = await xref.fetchAsync(fieldRef);
  54967. if (!(field instanceof Dict)) {
  54968. return;
  54969. }
  54970. if (field.has("T")) {
  54971. const partName = stringToPDFString(await field.getAsync("T"));
  54972. name = name === "" ? partName : `${name}.${partName}`;
  54973. } else {
  54974. let obj = field;
  54975. while (true) {
  54976. obj = obj.getRaw("Parent") || parentRef;
  54977. if (obj instanceof Ref) {
  54978. if (visitedRefs.has(obj)) {
  54979. break;
  54980. }
  54981. obj = await xref.fetchAsync(obj);
  54982. }
  54983. if (!(obj instanceof Dict)) {
  54984. break;
  54985. }
  54986. if (obj.has("T")) {
  54987. const partName = stringToPDFString(await obj.getAsync("T"));
  54988. name = name === "" ? partName : `${name}.${partName}`;
  54989. break;
  54990. }
  54991. }
  54992. }
  54993. if (parentRef && !field.has("Parent") && isName(field.get("Subtype"), "Widget")) {
  54994. orphanFields.put(fieldRef, parentRef);
  54995. }
  54996. if (!promises.has(name)) {
  54997. promises.set(name, []);
  54998. }
  54999. promises.get(name).push(AnnotationFactory.create(xref, fieldRef, annotationGlobals, null, true, orphanFields, null).then(annotation => annotation?.getFieldObject()).catch(function (reason) {
  55000. warn(`#collectFieldObjects: "${reason}".`);
  55001. return null;
  55002. }));
  55003. if (!field.has("Kids")) {
  55004. return;
  55005. }
  55006. const kids = await field.getAsync("Kids");
  55007. if (Array.isArray(kids)) {
  55008. for (const kid of kids) {
  55009. await this.#collectFieldObjects(name, fieldRef, kid, promises, annotationGlobals, visitedRefs, orphanFields);
  55010. }
  55011. }
  55012. }
  55013. get fieldObjects() {
  55014. const promise = this.pdfManager.ensureDoc("formInfo").then(async formInfo => {
  55015. if (!formInfo.hasFields) {
  55016. return null;
  55017. }
  55018. const [annotationGlobals, acroForm] = await Promise.all([this.pdfManager.ensureDoc("annotationGlobals"), this.pdfManager.ensureCatalog("acroForm")]);
  55019. if (!annotationGlobals) {
  55020. return null;
  55021. }
  55022. const visitedRefs = new RefSet();
  55023. const allFields = Object.create(null);
  55024. const fieldPromises = new Map();
  55025. const orphanFields = new RefSetCache();
  55026. for (const fieldRef of await acroForm.getAsync("Fields")) {
  55027. await this.#collectFieldObjects("", null, fieldRef, fieldPromises, annotationGlobals, visitedRefs, orphanFields);
  55028. }
  55029. const allPromises = [];
  55030. for (const [name, promises] of fieldPromises) {
  55031. allPromises.push(Promise.all(promises).then(fields => {
  55032. fields = fields.filter(field => !!field);
  55033. if (fields.length > 0) {
  55034. allFields[name] = fields;
  55035. }
  55036. }));
  55037. }
  55038. await Promise.all(allPromises);
  55039. return {
  55040. allFields,
  55041. orphanFields
  55042. };
  55043. });
  55044. return shadow(this, "fieldObjects", promise);
  55045. }
  55046. get hasJSActions() {
  55047. const promise = this.pdfManager.ensureDoc("_parseHasJSActions");
  55048. return shadow(this, "hasJSActions", promise);
  55049. }
  55050. async _parseHasJSActions() {
  55051. const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]);
  55052. if (catalogJsActions) {
  55053. return true;
  55054. }
  55055. if (fieldObjects) {
  55056. return Object.values(fieldObjects.allFields).some(fieldObject => fieldObject.some(object => object.actions !== null));
  55057. }
  55058. return false;
  55059. }
  55060. get calculationOrderIds() {
  55061. const calculationOrder = this.catalog.acroForm?.get("CO");
  55062. if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
  55063. return shadow(this, "calculationOrderIds", null);
  55064. }
  55065. const ids = [];
  55066. for (const id of calculationOrder) {
  55067. if (id instanceof Ref) {
  55068. ids.push(id.toString());
  55069. }
  55070. }
  55071. return shadow(this, "calculationOrderIds", ids.length ? ids : null);
  55072. }
  55073. get annotationGlobals() {
  55074. return shadow(this, "annotationGlobals", AnnotationFactory.createGlobals(this.pdfManager));
  55075. }
  55076. }
  55077. ;// ./src/core/pdf_manager.js
  55078. function parseDocBaseUrl(url) {
  55079. if (url) {
  55080. const absoluteUrl = createValidAbsoluteUrl(url);
  55081. if (absoluteUrl) {
  55082. return absoluteUrl.href;
  55083. }
  55084. warn(`Invalid absolute docBaseUrl: "${url}".`);
  55085. }
  55086. return null;
  55087. }
  55088. class BasePdfManager {
  55089. constructor(args) {
  55090. this._docBaseUrl = parseDocBaseUrl(args.docBaseUrl);
  55091. this._docId = args.docId;
  55092. this._password = args.password;
  55093. this.enableXfa = args.enableXfa;
  55094. args.evaluatorOptions.isOffscreenCanvasSupported &&= FeatureTest.isOffscreenCanvasSupported;
  55095. this.evaluatorOptions = Object.freeze(args.evaluatorOptions);
  55096. }
  55097. get docId() {
  55098. return this._docId;
  55099. }
  55100. get password() {
  55101. return this._password;
  55102. }
  55103. get docBaseUrl() {
  55104. return this._docBaseUrl;
  55105. }
  55106. get catalog() {
  55107. return this.pdfDocument.catalog;
  55108. }
  55109. ensureDoc(prop, args) {
  55110. return this.ensure(this.pdfDocument, prop, args);
  55111. }
  55112. ensureXRef(prop, args) {
  55113. return this.ensure(this.pdfDocument.xref, prop, args);
  55114. }
  55115. ensureCatalog(prop, args) {
  55116. return this.ensure(this.pdfDocument.catalog, prop, args);
  55117. }
  55118. getPage(pageIndex) {
  55119. return this.pdfDocument.getPage(pageIndex);
  55120. }
  55121. fontFallback(id, handler) {
  55122. return this.pdfDocument.fontFallback(id, handler);
  55123. }
  55124. loadXfaFonts(handler, task) {
  55125. return this.pdfDocument.loadXfaFonts(handler, task);
  55126. }
  55127. loadXfaImages() {
  55128. return this.pdfDocument.loadXfaImages();
  55129. }
  55130. serializeXfaData(annotationStorage) {
  55131. return this.pdfDocument.serializeXfaData(annotationStorage);
  55132. }
  55133. cleanup(manuallyTriggered = false) {
  55134. return this.pdfDocument.cleanup(manuallyTriggered);
  55135. }
  55136. async ensure(obj, prop, args) {
  55137. unreachable("Abstract method `ensure` called");
  55138. }
  55139. requestRange(begin, end) {
  55140. unreachable("Abstract method `requestRange` called");
  55141. }
  55142. requestLoadedStream(noFetch = false) {
  55143. unreachable("Abstract method `requestLoadedStream` called");
  55144. }
  55145. sendProgressiveData(chunk) {
  55146. unreachable("Abstract method `sendProgressiveData` called");
  55147. }
  55148. updatePassword(password) {
  55149. this._password = password;
  55150. }
  55151. terminate(reason) {
  55152. unreachable("Abstract method `terminate` called");
  55153. }
  55154. }
  55155. class LocalPdfManager extends BasePdfManager {
  55156. constructor(args) {
  55157. super(args);
  55158. const stream = new Stream(args.source);
  55159. this.pdfDocument = new PDFDocument(this, stream);
  55160. this._loadedStreamPromise = Promise.resolve(stream);
  55161. }
  55162. async ensure(obj, prop, args) {
  55163. const value = obj[prop];
  55164. if (typeof value === "function") {
  55165. return value.apply(obj, args);
  55166. }
  55167. return value;
  55168. }
  55169. requestRange(begin, end) {
  55170. return Promise.resolve();
  55171. }
  55172. requestLoadedStream(noFetch = false) {
  55173. return this._loadedStreamPromise;
  55174. }
  55175. terminate(reason) {}
  55176. }
  55177. class NetworkPdfManager extends BasePdfManager {
  55178. constructor(args) {
  55179. super(args);
  55180. this.streamManager = new ChunkedStreamManager(args.source, {
  55181. msgHandler: args.handler,
  55182. length: args.length,
  55183. disableAutoFetch: args.disableAutoFetch,
  55184. rangeChunkSize: args.rangeChunkSize
  55185. });
  55186. this.pdfDocument = new PDFDocument(this, this.streamManager.getStream());
  55187. }
  55188. async ensure(obj, prop, args) {
  55189. try {
  55190. const value = obj[prop];
  55191. if (typeof value === "function") {
  55192. return value.apply(obj, args);
  55193. }
  55194. return value;
  55195. } catch (ex) {
  55196. if (!(ex instanceof MissingDataException)) {
  55197. throw ex;
  55198. }
  55199. await this.requestRange(ex.begin, ex.end);
  55200. return this.ensure(obj, prop, args);
  55201. }
  55202. }
  55203. requestRange(begin, end) {
  55204. return this.streamManager.requestRange(begin, end);
  55205. }
  55206. requestLoadedStream(noFetch = false) {
  55207. return this.streamManager.requestAllChunks(noFetch);
  55208. }
  55209. sendProgressiveData(chunk) {
  55210. this.streamManager.onReceiveData({
  55211. chunk
  55212. });
  55213. }
  55214. terminate(reason) {
  55215. this.streamManager.abort(reason);
  55216. }
  55217. }
  55218. ;// ./src/shared/message_handler.js
  55219. const CallbackKind = {
  55220. UNKNOWN: 0,
  55221. DATA: 1,
  55222. ERROR: 2
  55223. };
  55224. const StreamKind = {
  55225. UNKNOWN: 0,
  55226. CANCEL: 1,
  55227. CANCEL_COMPLETE: 2,
  55228. CLOSE: 3,
  55229. ENQUEUE: 4,
  55230. ERROR: 5,
  55231. PULL: 6,
  55232. PULL_COMPLETE: 7,
  55233. START_COMPLETE: 8
  55234. };
  55235. function wrapReason(reason) {
  55236. if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) {
  55237. unreachable('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
  55238. }
  55239. switch (reason.name) {
  55240. case "AbortException":
  55241. return new AbortException(reason.message);
  55242. case "MissingPDFException":
  55243. return new MissingPDFException(reason.message);
  55244. case "PasswordException":
  55245. return new PasswordException(reason.message, reason.code);
  55246. case "UnexpectedResponseException":
  55247. return new UnexpectedResponseException(reason.message, reason.status);
  55248. case "UnknownErrorException":
  55249. return new UnknownErrorException(reason.message, reason.details);
  55250. default:
  55251. return new UnknownErrorException(reason.message, reason.toString());
  55252. }
  55253. }
  55254. class MessageHandler {
  55255. #messageAC = new AbortController();
  55256. constructor(sourceName, targetName, comObj) {
  55257. this.sourceName = sourceName;
  55258. this.targetName = targetName;
  55259. this.comObj = comObj;
  55260. this.callbackId = 1;
  55261. this.streamId = 1;
  55262. this.streamSinks = Object.create(null);
  55263. this.streamControllers = Object.create(null);
  55264. this.callbackCapabilities = Object.create(null);
  55265. this.actionHandler = Object.create(null);
  55266. comObj.addEventListener("message", this.#onMessage.bind(this), {
  55267. signal: this.#messageAC.signal
  55268. });
  55269. }
  55270. #onMessage({
  55271. data
  55272. }) {
  55273. if (data.targetName !== this.sourceName) {
  55274. return;
  55275. }
  55276. if (data.stream) {
  55277. this.#processStreamMessage(data);
  55278. return;
  55279. }
  55280. if (data.callback) {
  55281. const callbackId = data.callbackId;
  55282. const capability = this.callbackCapabilities[callbackId];
  55283. if (!capability) {
  55284. throw new Error(`Cannot resolve callback ${callbackId}`);
  55285. }
  55286. delete this.callbackCapabilities[callbackId];
  55287. if (data.callback === CallbackKind.DATA) {
  55288. capability.resolve(data.data);
  55289. } else if (data.callback === CallbackKind.ERROR) {
  55290. capability.reject(wrapReason(data.reason));
  55291. } else {
  55292. throw new Error("Unexpected callback case");
  55293. }
  55294. return;
  55295. }
  55296. const action = this.actionHandler[data.action];
  55297. if (!action) {
  55298. throw new Error(`Unknown action from worker: ${data.action}`);
  55299. }
  55300. if (data.callbackId) {
  55301. const sourceName = this.sourceName,
  55302. targetName = data.sourceName,
  55303. comObj = this.comObj;
  55304. new Promise(function (resolve) {
  55305. resolve(action(data.data));
  55306. }).then(function (result) {
  55307. comObj.postMessage({
  55308. sourceName,
  55309. targetName,
  55310. callback: CallbackKind.DATA,
  55311. callbackId: data.callbackId,
  55312. data: result
  55313. });
  55314. }, function (reason) {
  55315. comObj.postMessage({
  55316. sourceName,
  55317. targetName,
  55318. callback: CallbackKind.ERROR,
  55319. callbackId: data.callbackId,
  55320. reason: wrapReason(reason)
  55321. });
  55322. });
  55323. return;
  55324. }
  55325. if (data.streamId) {
  55326. this.#createStreamSink(data);
  55327. return;
  55328. }
  55329. action(data.data);
  55330. }
  55331. on(actionName, handler) {
  55332. const ah = this.actionHandler;
  55333. if (ah[actionName]) {
  55334. throw new Error(`There is already an actionName called "${actionName}"`);
  55335. }
  55336. ah[actionName] = handler;
  55337. }
  55338. send(actionName, data, transfers) {
  55339. this.comObj.postMessage({
  55340. sourceName: this.sourceName,
  55341. targetName: this.targetName,
  55342. action: actionName,
  55343. data
  55344. }, transfers);
  55345. }
  55346. sendWithPromise(actionName, data, transfers) {
  55347. const callbackId = this.callbackId++;
  55348. const capability = Promise.withResolvers();
  55349. this.callbackCapabilities[callbackId] = capability;
  55350. try {
  55351. this.comObj.postMessage({
  55352. sourceName: this.sourceName,
  55353. targetName: this.targetName,
  55354. action: actionName,
  55355. callbackId,
  55356. data
  55357. }, transfers);
  55358. } catch (ex) {
  55359. capability.reject(ex);
  55360. }
  55361. return capability.promise;
  55362. }
  55363. sendWithStream(actionName, data, queueingStrategy, transfers) {
  55364. const streamId = this.streamId++,
  55365. sourceName = this.sourceName,
  55366. targetName = this.targetName,
  55367. comObj = this.comObj;
  55368. return new ReadableStream({
  55369. start: controller => {
  55370. const startCapability = Promise.withResolvers();
  55371. this.streamControllers[streamId] = {
  55372. controller,
  55373. startCall: startCapability,
  55374. pullCall: null,
  55375. cancelCall: null,
  55376. isClosed: false
  55377. };
  55378. comObj.postMessage({
  55379. sourceName,
  55380. targetName,
  55381. action: actionName,
  55382. streamId,
  55383. data,
  55384. desiredSize: controller.desiredSize
  55385. }, transfers);
  55386. return startCapability.promise;
  55387. },
  55388. pull: controller => {
  55389. const pullCapability = Promise.withResolvers();
  55390. this.streamControllers[streamId].pullCall = pullCapability;
  55391. comObj.postMessage({
  55392. sourceName,
  55393. targetName,
  55394. stream: StreamKind.PULL,
  55395. streamId,
  55396. desiredSize: controller.desiredSize
  55397. });
  55398. return pullCapability.promise;
  55399. },
  55400. cancel: reason => {
  55401. assert(reason instanceof Error, "cancel must have a valid reason");
  55402. const cancelCapability = Promise.withResolvers();
  55403. this.streamControllers[streamId].cancelCall = cancelCapability;
  55404. this.streamControllers[streamId].isClosed = true;
  55405. comObj.postMessage({
  55406. sourceName,
  55407. targetName,
  55408. stream: StreamKind.CANCEL,
  55409. streamId,
  55410. reason: wrapReason(reason)
  55411. });
  55412. return cancelCapability.promise;
  55413. }
  55414. }, queueingStrategy);
  55415. }
  55416. #createStreamSink(data) {
  55417. const streamId = data.streamId,
  55418. sourceName = this.sourceName,
  55419. targetName = data.sourceName,
  55420. comObj = this.comObj;
  55421. const self = this,
  55422. action = this.actionHandler[data.action];
  55423. const streamSink = {
  55424. enqueue(chunk, size = 1, transfers) {
  55425. if (this.isCancelled) {
  55426. return;
  55427. }
  55428. const lastDesiredSize = this.desiredSize;
  55429. this.desiredSize -= size;
  55430. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  55431. this.sinkCapability = Promise.withResolvers();
  55432. this.ready = this.sinkCapability.promise;
  55433. }
  55434. comObj.postMessage({
  55435. sourceName,
  55436. targetName,
  55437. stream: StreamKind.ENQUEUE,
  55438. streamId,
  55439. chunk
  55440. }, transfers);
  55441. },
  55442. close() {
  55443. if (this.isCancelled) {
  55444. return;
  55445. }
  55446. this.isCancelled = true;
  55447. comObj.postMessage({
  55448. sourceName,
  55449. targetName,
  55450. stream: StreamKind.CLOSE,
  55451. streamId
  55452. });
  55453. delete self.streamSinks[streamId];
  55454. },
  55455. error(reason) {
  55456. assert(reason instanceof Error, "error must have a valid reason");
  55457. if (this.isCancelled) {
  55458. return;
  55459. }
  55460. this.isCancelled = true;
  55461. comObj.postMessage({
  55462. sourceName,
  55463. targetName,
  55464. stream: StreamKind.ERROR,
  55465. streamId,
  55466. reason: wrapReason(reason)
  55467. });
  55468. },
  55469. sinkCapability: Promise.withResolvers(),
  55470. onPull: null,
  55471. onCancel: null,
  55472. isCancelled: false,
  55473. desiredSize: data.desiredSize,
  55474. ready: null
  55475. };
  55476. streamSink.sinkCapability.resolve();
  55477. streamSink.ready = streamSink.sinkCapability.promise;
  55478. this.streamSinks[streamId] = streamSink;
  55479. new Promise(function (resolve) {
  55480. resolve(action(data.data, streamSink));
  55481. }).then(function () {
  55482. comObj.postMessage({
  55483. sourceName,
  55484. targetName,
  55485. stream: StreamKind.START_COMPLETE,
  55486. streamId,
  55487. success: true
  55488. });
  55489. }, function (reason) {
  55490. comObj.postMessage({
  55491. sourceName,
  55492. targetName,
  55493. stream: StreamKind.START_COMPLETE,
  55494. streamId,
  55495. reason: wrapReason(reason)
  55496. });
  55497. });
  55498. }
  55499. #processStreamMessage(data) {
  55500. const streamId = data.streamId,
  55501. sourceName = this.sourceName,
  55502. targetName = data.sourceName,
  55503. comObj = this.comObj;
  55504. const streamController = this.streamControllers[streamId],
  55505. streamSink = this.streamSinks[streamId];
  55506. switch (data.stream) {
  55507. case StreamKind.START_COMPLETE:
  55508. if (data.success) {
  55509. streamController.startCall.resolve();
  55510. } else {
  55511. streamController.startCall.reject(wrapReason(data.reason));
  55512. }
  55513. break;
  55514. case StreamKind.PULL_COMPLETE:
  55515. if (data.success) {
  55516. streamController.pullCall.resolve();
  55517. } else {
  55518. streamController.pullCall.reject(wrapReason(data.reason));
  55519. }
  55520. break;
  55521. case StreamKind.PULL:
  55522. if (!streamSink) {
  55523. comObj.postMessage({
  55524. sourceName,
  55525. targetName,
  55526. stream: StreamKind.PULL_COMPLETE,
  55527. streamId,
  55528. success: true
  55529. });
  55530. break;
  55531. }
  55532. if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
  55533. streamSink.sinkCapability.resolve();
  55534. }
  55535. streamSink.desiredSize = data.desiredSize;
  55536. new Promise(function (resolve) {
  55537. resolve(streamSink.onPull?.());
  55538. }).then(function () {
  55539. comObj.postMessage({
  55540. sourceName,
  55541. targetName,
  55542. stream: StreamKind.PULL_COMPLETE,
  55543. streamId,
  55544. success: true
  55545. });
  55546. }, function (reason) {
  55547. comObj.postMessage({
  55548. sourceName,
  55549. targetName,
  55550. stream: StreamKind.PULL_COMPLETE,
  55551. streamId,
  55552. reason: wrapReason(reason)
  55553. });
  55554. });
  55555. break;
  55556. case StreamKind.ENQUEUE:
  55557. assert(streamController, "enqueue should have stream controller");
  55558. if (streamController.isClosed) {
  55559. break;
  55560. }
  55561. streamController.controller.enqueue(data.chunk);
  55562. break;
  55563. case StreamKind.CLOSE:
  55564. assert(streamController, "close should have stream controller");
  55565. if (streamController.isClosed) {
  55566. break;
  55567. }
  55568. streamController.isClosed = true;
  55569. streamController.controller.close();
  55570. this.#deleteStreamController(streamController, streamId);
  55571. break;
  55572. case StreamKind.ERROR:
  55573. assert(streamController, "error should have stream controller");
  55574. streamController.controller.error(wrapReason(data.reason));
  55575. this.#deleteStreamController(streamController, streamId);
  55576. break;
  55577. case StreamKind.CANCEL_COMPLETE:
  55578. if (data.success) {
  55579. streamController.cancelCall.resolve();
  55580. } else {
  55581. streamController.cancelCall.reject(wrapReason(data.reason));
  55582. }
  55583. this.#deleteStreamController(streamController, streamId);
  55584. break;
  55585. case StreamKind.CANCEL:
  55586. if (!streamSink) {
  55587. break;
  55588. }
  55589. new Promise(function (resolve) {
  55590. resolve(streamSink.onCancel?.(wrapReason(data.reason)));
  55591. }).then(function () {
  55592. comObj.postMessage({
  55593. sourceName,
  55594. targetName,
  55595. stream: StreamKind.CANCEL_COMPLETE,
  55596. streamId,
  55597. success: true
  55598. });
  55599. }, function (reason) {
  55600. comObj.postMessage({
  55601. sourceName,
  55602. targetName,
  55603. stream: StreamKind.CANCEL_COMPLETE,
  55604. streamId,
  55605. reason: wrapReason(reason)
  55606. });
  55607. });
  55608. streamSink.sinkCapability.reject(wrapReason(data.reason));
  55609. streamSink.isCancelled = true;
  55610. delete this.streamSinks[streamId];
  55611. break;
  55612. default:
  55613. throw new Error("Unexpected stream case");
  55614. }
  55615. }
  55616. async #deleteStreamController(streamController, streamId) {
  55617. await Promise.allSettled([streamController.startCall?.promise, streamController.pullCall?.promise, streamController.cancelCall?.promise]);
  55618. delete this.streamControllers[streamId];
  55619. }
  55620. destroy() {
  55621. this.#messageAC?.abort();
  55622. this.#messageAC = null;
  55623. }
  55624. }
  55625. ;// ./src/core/worker_stream.js
  55626. class PDFWorkerStream {
  55627. constructor(msgHandler) {
  55628. this._msgHandler = msgHandler;
  55629. this._contentLength = null;
  55630. this._fullRequestReader = null;
  55631. this._rangeRequestReaders = [];
  55632. }
  55633. getFullReader() {
  55634. assert(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
  55635. this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
  55636. return this._fullRequestReader;
  55637. }
  55638. getRangeReader(begin, end) {
  55639. const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
  55640. this._rangeRequestReaders.push(reader);
  55641. return reader;
  55642. }
  55643. cancelAllRequests(reason) {
  55644. this._fullRequestReader?.cancel(reason);
  55645. for (const reader of this._rangeRequestReaders.slice(0)) {
  55646. reader.cancel(reason);
  55647. }
  55648. }
  55649. }
  55650. class PDFWorkerStreamReader {
  55651. constructor(msgHandler) {
  55652. this._msgHandler = msgHandler;
  55653. this.onProgress = null;
  55654. this._contentLength = null;
  55655. this._isRangeSupported = false;
  55656. this._isStreamingSupported = false;
  55657. const readableStream = this._msgHandler.sendWithStream("GetReader");
  55658. this._reader = readableStream.getReader();
  55659. this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
  55660. this._isStreamingSupported = data.isStreamingSupported;
  55661. this._isRangeSupported = data.isRangeSupported;
  55662. this._contentLength = data.contentLength;
  55663. });
  55664. }
  55665. get headersReady() {
  55666. return this._headersReady;
  55667. }
  55668. get contentLength() {
  55669. return this._contentLength;
  55670. }
  55671. get isStreamingSupported() {
  55672. return this._isStreamingSupported;
  55673. }
  55674. get isRangeSupported() {
  55675. return this._isRangeSupported;
  55676. }
  55677. async read() {
  55678. const {
  55679. value,
  55680. done
  55681. } = await this._reader.read();
  55682. if (done) {
  55683. return {
  55684. value: undefined,
  55685. done: true
  55686. };
  55687. }
  55688. return {
  55689. value: value.buffer,
  55690. done: false
  55691. };
  55692. }
  55693. cancel(reason) {
  55694. this._reader.cancel(reason);
  55695. }
  55696. }
  55697. class PDFWorkerStreamRangeReader {
  55698. constructor(begin, end, msgHandler) {
  55699. this._msgHandler = msgHandler;
  55700. this.onProgress = null;
  55701. const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
  55702. begin,
  55703. end
  55704. });
  55705. this._reader = readableStream.getReader();
  55706. }
  55707. get isStreamingSupported() {
  55708. return false;
  55709. }
  55710. async read() {
  55711. const {
  55712. value,
  55713. done
  55714. } = await this._reader.read();
  55715. if (done) {
  55716. return {
  55717. value: undefined,
  55718. done: true
  55719. };
  55720. }
  55721. return {
  55722. value: value.buffer,
  55723. done: false
  55724. };
  55725. }
  55726. cancel(reason) {
  55727. this._reader.cancel(reason);
  55728. }
  55729. }
  55730. ;// ./src/core/worker.js
  55731. class WorkerTask {
  55732. constructor(name) {
  55733. this.name = name;
  55734. this.terminated = false;
  55735. this._capability = Promise.withResolvers();
  55736. }
  55737. get finished() {
  55738. return this._capability.promise;
  55739. }
  55740. finish() {
  55741. this._capability.resolve();
  55742. }
  55743. terminate() {
  55744. this.terminated = true;
  55745. }
  55746. ensureNotTerminated() {
  55747. if (this.terminated) {
  55748. throw new Error("Worker task was terminated");
  55749. }
  55750. }
  55751. }
  55752. class WorkerMessageHandler {
  55753. static setup(handler, port) {
  55754. let testMessageProcessed = false;
  55755. handler.on("test", function (data) {
  55756. if (testMessageProcessed) {
  55757. return;
  55758. }
  55759. testMessageProcessed = true;
  55760. handler.send("test", data instanceof Uint8Array);
  55761. });
  55762. handler.on("configure", function (data) {
  55763. setVerbosityLevel(data.verbosity);
  55764. });
  55765. handler.on("GetDocRequest", function (data) {
  55766. return WorkerMessageHandler.createDocumentHandler(data, port);
  55767. });
  55768. }
  55769. static createDocumentHandler(docParams, port) {
  55770. let pdfManager;
  55771. let terminated = false;
  55772. let cancelXHRs = null;
  55773. const WorkerTasks = new Set();
  55774. const verbosity = getVerbosityLevel();
  55775. const {
  55776. docId,
  55777. apiVersion
  55778. } = docParams;
  55779. const workerVersion = "4.8.69";
  55780. if (apiVersion !== workerVersion) {
  55781. throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
  55782. }
  55783. const enumerableProperties = [];
  55784. for (const property in []) {
  55785. enumerableProperties.push(property);
  55786. }
  55787. if (enumerableProperties.length) {
  55788. throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s.");
  55789. }
  55790. const workerHandlerName = docId + "_worker";
  55791. let handler = new MessageHandler(workerHandlerName, docId, port);
  55792. function ensureNotTerminated() {
  55793. if (terminated) {
  55794. throw new Error("Worker was terminated");
  55795. }
  55796. }
  55797. function startWorkerTask(task) {
  55798. WorkerTasks.add(task);
  55799. }
  55800. function finishWorkerTask(task) {
  55801. task.finish();
  55802. WorkerTasks.delete(task);
  55803. }
  55804. async function loadDocument(recoveryMode) {
  55805. await pdfManager.ensureDoc("checkHeader");
  55806. await pdfManager.ensureDoc("parseStartXRef");
  55807. await pdfManager.ensureDoc("parse", [recoveryMode]);
  55808. await pdfManager.ensureDoc("checkFirstPage", [recoveryMode]);
  55809. await pdfManager.ensureDoc("checkLastPage", [recoveryMode]);
  55810. const isPureXfa = await pdfManager.ensureDoc("isPureXfa");
  55811. if (isPureXfa) {
  55812. const task = new WorkerTask("loadXfaFonts");
  55813. startWorkerTask(task);
  55814. await Promise.all([pdfManager.loadXfaFonts(handler, task).catch(reason => {}).then(() => finishWorkerTask(task)), pdfManager.loadXfaImages()]);
  55815. }
  55816. const [numPages, fingerprints] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprints")]);
  55817. const htmlForXfa = isPureXfa ? await pdfManager.ensureDoc("htmlForXfa") : null;
  55818. return {
  55819. numPages,
  55820. fingerprints,
  55821. htmlForXfa
  55822. };
  55823. }
  55824. function getPdfManager({
  55825. data,
  55826. password,
  55827. disableAutoFetch,
  55828. rangeChunkSize,
  55829. length,
  55830. docBaseUrl,
  55831. enableXfa,
  55832. evaluatorOptions
  55833. }) {
  55834. const pdfManagerArgs = {
  55835. source: null,
  55836. disableAutoFetch,
  55837. docBaseUrl,
  55838. docId,
  55839. enableXfa,
  55840. evaluatorOptions,
  55841. handler,
  55842. length,
  55843. password,
  55844. rangeChunkSize
  55845. };
  55846. const pdfManagerCapability = Promise.withResolvers();
  55847. let newPdfManager;
  55848. if (data) {
  55849. try {
  55850. pdfManagerArgs.source = data;
  55851. newPdfManager = new LocalPdfManager(pdfManagerArgs);
  55852. pdfManagerCapability.resolve(newPdfManager);
  55853. } catch (ex) {
  55854. pdfManagerCapability.reject(ex);
  55855. }
  55856. return pdfManagerCapability.promise;
  55857. }
  55858. let pdfStream,
  55859. cachedChunks = [],
  55860. loaded = 0;
  55861. try {
  55862. pdfStream = new PDFWorkerStream(handler);
  55863. } catch (ex) {
  55864. pdfManagerCapability.reject(ex);
  55865. return pdfManagerCapability.promise;
  55866. }
  55867. const fullRequest = pdfStream.getFullReader();
  55868. fullRequest.headersReady.then(function () {
  55869. if (!fullRequest.isRangeSupported) {
  55870. return;
  55871. }
  55872. pdfManagerArgs.source = pdfStream;
  55873. pdfManagerArgs.length = fullRequest.contentLength;
  55874. pdfManagerArgs.disableAutoFetch ||= fullRequest.isStreamingSupported;
  55875. newPdfManager = new NetworkPdfManager(pdfManagerArgs);
  55876. for (const chunk of cachedChunks) {
  55877. newPdfManager.sendProgressiveData(chunk);
  55878. }
  55879. cachedChunks = [];
  55880. pdfManagerCapability.resolve(newPdfManager);
  55881. cancelXHRs = null;
  55882. }).catch(function (reason) {
  55883. pdfManagerCapability.reject(reason);
  55884. cancelXHRs = null;
  55885. });
  55886. new Promise(function (resolve, reject) {
  55887. const readChunk = function ({
  55888. value,
  55889. done
  55890. }) {
  55891. try {
  55892. ensureNotTerminated();
  55893. if (done) {
  55894. if (!newPdfManager) {
  55895. const pdfFile = arrayBuffersToBytes(cachedChunks);
  55896. cachedChunks = [];
  55897. if (length && pdfFile.length !== length) {
  55898. warn("reported HTTP length is different from actual");
  55899. }
  55900. pdfManagerArgs.source = pdfFile;
  55901. newPdfManager = new LocalPdfManager(pdfManagerArgs);
  55902. pdfManagerCapability.resolve(newPdfManager);
  55903. }
  55904. cancelXHRs = null;
  55905. return;
  55906. }
  55907. loaded += value.byteLength;
  55908. if (!fullRequest.isStreamingSupported) {
  55909. handler.send("DocProgress", {
  55910. loaded,
  55911. total: Math.max(loaded, fullRequest.contentLength || 0)
  55912. });
  55913. }
  55914. if (newPdfManager) {
  55915. newPdfManager.sendProgressiveData(value);
  55916. } else {
  55917. cachedChunks.push(value);
  55918. }
  55919. fullRequest.read().then(readChunk, reject);
  55920. } catch (e) {
  55921. reject(e);
  55922. }
  55923. };
  55924. fullRequest.read().then(readChunk, reject);
  55925. }).catch(function (e) {
  55926. pdfManagerCapability.reject(e);
  55927. cancelXHRs = null;
  55928. });
  55929. cancelXHRs = function (reason) {
  55930. pdfStream.cancelAllRequests(reason);
  55931. };
  55932. return pdfManagerCapability.promise;
  55933. }
  55934. function setupDoc(data) {
  55935. function onSuccess(doc) {
  55936. ensureNotTerminated();
  55937. handler.send("GetDoc", {
  55938. pdfInfo: doc
  55939. });
  55940. }
  55941. function onFailure(ex) {
  55942. ensureNotTerminated();
  55943. if (ex instanceof PasswordException) {
  55944. const task = new WorkerTask(`PasswordException: response ${ex.code}`);
  55945. startWorkerTask(task);
  55946. handler.sendWithPromise("PasswordRequest", ex).then(function ({
  55947. password
  55948. }) {
  55949. finishWorkerTask(task);
  55950. pdfManager.updatePassword(password);
  55951. pdfManagerReady();
  55952. }).catch(function () {
  55953. finishWorkerTask(task);
  55954. handler.send("DocException", ex);
  55955. });
  55956. } else if (ex instanceof InvalidPDFException || ex instanceof MissingPDFException || ex instanceof UnexpectedResponseException || ex instanceof UnknownErrorException) {
  55957. handler.send("DocException", ex);
  55958. } else {
  55959. handler.send("DocException", new UnknownErrorException(ex.message, ex.toString()));
  55960. }
  55961. }
  55962. function pdfManagerReady() {
  55963. ensureNotTerminated();
  55964. loadDocument(false).then(onSuccess, function (reason) {
  55965. ensureNotTerminated();
  55966. if (!(reason instanceof XRefParseException)) {
  55967. onFailure(reason);
  55968. return;
  55969. }
  55970. pdfManager.requestLoadedStream().then(function () {
  55971. ensureNotTerminated();
  55972. loadDocument(true).then(onSuccess, onFailure);
  55973. });
  55974. });
  55975. }
  55976. ensureNotTerminated();
  55977. getPdfManager(data).then(function (newPdfManager) {
  55978. if (terminated) {
  55979. newPdfManager.terminate(new AbortException("Worker was terminated."));
  55980. throw new Error("Worker was terminated");
  55981. }
  55982. pdfManager = newPdfManager;
  55983. pdfManager.requestLoadedStream(true).then(stream => {
  55984. handler.send("DataLoaded", {
  55985. length: stream.bytes.byteLength
  55986. });
  55987. });
  55988. }).then(pdfManagerReady, onFailure);
  55989. }
  55990. handler.on("GetPage", function (data) {
  55991. return pdfManager.getPage(data.pageIndex).then(function (page) {
  55992. return Promise.all([pdfManager.ensure(page, "rotate"), pdfManager.ensure(page, "ref"), pdfManager.ensure(page, "userUnit"), pdfManager.ensure(page, "view")]).then(function ([rotate, ref, userUnit, view]) {
  55993. return {
  55994. rotate,
  55995. ref,
  55996. refStr: ref?.toString() ?? null,
  55997. userUnit,
  55998. view
  55999. };
  56000. });
  56001. });
  56002. });
  56003. handler.on("GetPageIndex", function (data) {
  56004. const pageRef = Ref.get(data.num, data.gen);
  56005. return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  56006. });
  56007. handler.on("GetDestinations", function (data) {
  56008. return pdfManager.ensureCatalog("destinations");
  56009. });
  56010. handler.on("GetDestination", function (data) {
  56011. return pdfManager.ensureCatalog("getDestination", [data.id]);
  56012. });
  56013. handler.on("GetPageLabels", function (data) {
  56014. return pdfManager.ensureCatalog("pageLabels");
  56015. });
  56016. handler.on("GetPageLayout", function (data) {
  56017. return pdfManager.ensureCatalog("pageLayout");
  56018. });
  56019. handler.on("GetPageMode", function (data) {
  56020. return pdfManager.ensureCatalog("pageMode");
  56021. });
  56022. handler.on("GetViewerPreferences", function (data) {
  56023. return pdfManager.ensureCatalog("viewerPreferences");
  56024. });
  56025. handler.on("GetOpenAction", function (data) {
  56026. return pdfManager.ensureCatalog("openAction");
  56027. });
  56028. handler.on("GetAttachments", function (data) {
  56029. return pdfManager.ensureCatalog("attachments");
  56030. });
  56031. handler.on("GetDocJSActions", function (data) {
  56032. return pdfManager.ensureCatalog("jsActions");
  56033. });
  56034. handler.on("GetPageJSActions", function ({
  56035. pageIndex
  56036. }) {
  56037. return pdfManager.getPage(pageIndex).then(function (page) {
  56038. return pdfManager.ensure(page, "jsActions");
  56039. });
  56040. });
  56041. handler.on("GetOutline", function (data) {
  56042. return pdfManager.ensureCatalog("documentOutline");
  56043. });
  56044. handler.on("GetOptionalContentConfig", function (data) {
  56045. return pdfManager.ensureCatalog("optionalContentConfig");
  56046. });
  56047. handler.on("GetPermissions", function (data) {
  56048. return pdfManager.ensureCatalog("permissions");
  56049. });
  56050. handler.on("GetMetadata", function (data) {
  56051. return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]);
  56052. });
  56053. handler.on("GetMarkInfo", function (data) {
  56054. return pdfManager.ensureCatalog("markInfo");
  56055. });
  56056. handler.on("GetData", function (data) {
  56057. return pdfManager.requestLoadedStream().then(function (stream) {
  56058. return stream.bytes;
  56059. });
  56060. });
  56061. handler.on("GetAnnotations", function ({
  56062. pageIndex,
  56063. intent
  56064. }) {
  56065. return pdfManager.getPage(pageIndex).then(function (page) {
  56066. const task = new WorkerTask(`GetAnnotations: page ${pageIndex}`);
  56067. startWorkerTask(task);
  56068. return page.getAnnotationsData(handler, task, intent).then(data => {
  56069. finishWorkerTask(task);
  56070. return data;
  56071. }, reason => {
  56072. finishWorkerTask(task);
  56073. throw reason;
  56074. });
  56075. });
  56076. });
  56077. handler.on("GetFieldObjects", function (data) {
  56078. return pdfManager.ensureDoc("fieldObjects").then(fieldObjects => fieldObjects?.allFields || null);
  56079. });
  56080. handler.on("HasJSActions", function (data) {
  56081. return pdfManager.ensureDoc("hasJSActions");
  56082. });
  56083. handler.on("GetCalculationOrderIds", function (data) {
  56084. return pdfManager.ensureDoc("calculationOrderIds");
  56085. });
  56086. handler.on("SaveDocument", async function ({
  56087. isPureXfa,
  56088. numPages,
  56089. annotationStorage,
  56090. filename
  56091. }) {
  56092. const globalPromises = [pdfManager.requestLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("startXRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("structTreeRoot")];
  56093. const promises = [];
  56094. const newAnnotationsByPage = !isPureXfa ? getNewAnnotationsMap(annotationStorage) : null;
  56095. const [stream, acroForm, acroFormRef, startXRef, xref, linearization, _structTreeRoot] = await Promise.all(globalPromises);
  56096. const catalogRef = xref.trailer.getRaw("Root") || null;
  56097. let structTreeRoot;
  56098. if (newAnnotationsByPage) {
  56099. if (!_structTreeRoot) {
  56100. if (await StructTreeRoot.canCreateStructureTree({
  56101. catalogRef,
  56102. pdfManager,
  56103. newAnnotationsByPage
  56104. })) {
  56105. structTreeRoot = null;
  56106. }
  56107. } else if (await _structTreeRoot.canUpdateStructTree({
  56108. pdfManager,
  56109. xref,
  56110. newAnnotationsByPage
  56111. })) {
  56112. structTreeRoot = _structTreeRoot;
  56113. }
  56114. const imagePromises = AnnotationFactory.generateImages(annotationStorage.values(), xref, pdfManager.evaluatorOptions.isOffscreenCanvasSupported);
  56115. const newAnnotationPromises = structTreeRoot === undefined ? promises : [];
  56116. for (const [pageIndex, annotations] of newAnnotationsByPage) {
  56117. newAnnotationPromises.push(pdfManager.getPage(pageIndex).then(page => {
  56118. const task = new WorkerTask(`Save (editor): page ${pageIndex}`);
  56119. return page.saveNewAnnotations(handler, task, annotations, imagePromises).finally(function () {
  56120. finishWorkerTask(task);
  56121. });
  56122. }));
  56123. }
  56124. if (structTreeRoot === null) {
  56125. promises.push(Promise.all(newAnnotationPromises).then(async newRefs => {
  56126. await StructTreeRoot.createStructureTree({
  56127. newAnnotationsByPage,
  56128. xref,
  56129. catalogRef,
  56130. pdfManager,
  56131. newRefs
  56132. });
  56133. return newRefs;
  56134. }));
  56135. } else if (structTreeRoot) {
  56136. promises.push(Promise.all(newAnnotationPromises).then(async newRefs => {
  56137. await structTreeRoot.updateStructureTree({
  56138. newAnnotationsByPage,
  56139. pdfManager,
  56140. newRefs
  56141. });
  56142. return newRefs;
  56143. }));
  56144. }
  56145. }
  56146. if (isPureXfa) {
  56147. promises.push(pdfManager.serializeXfaData(annotationStorage));
  56148. } else {
  56149. for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
  56150. promises.push(pdfManager.getPage(pageIndex).then(function (page) {
  56151. const task = new WorkerTask(`Save: page ${pageIndex}`);
  56152. return page.save(handler, task, annotationStorage).finally(function () {
  56153. finishWorkerTask(task);
  56154. });
  56155. }));
  56156. }
  56157. }
  56158. const refs = await Promise.all(promises);
  56159. let newRefs = [];
  56160. let xfaData = null;
  56161. if (isPureXfa) {
  56162. xfaData = refs[0];
  56163. if (!xfaData) {
  56164. return stream.bytes;
  56165. }
  56166. } else {
  56167. newRefs = refs.flat(2);
  56168. if (newRefs.length === 0) {
  56169. return stream.bytes;
  56170. }
  56171. }
  56172. const needAppearances = acroFormRef && acroForm instanceof Dict && newRefs.some(ref => ref.needAppearances);
  56173. const xfa = acroForm instanceof Dict && acroForm.get("XFA") || null;
  56174. let xfaDatasetsRef = null;
  56175. let hasXfaDatasetsEntry = false;
  56176. if (Array.isArray(xfa)) {
  56177. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  56178. if (xfa[i] === "datasets") {
  56179. xfaDatasetsRef = xfa[i + 1];
  56180. hasXfaDatasetsEntry = true;
  56181. }
  56182. }
  56183. if (xfaDatasetsRef === null) {
  56184. xfaDatasetsRef = xref.getNewTemporaryRef();
  56185. }
  56186. } else if (xfa) {
  56187. warn("Unsupported XFA type.");
  56188. }
  56189. let newXrefInfo = Object.create(null);
  56190. if (xref.trailer) {
  56191. const infoObj = Object.create(null);
  56192. const xrefInfo = xref.trailer.get("Info") || null;
  56193. if (xrefInfo instanceof Dict) {
  56194. xrefInfo.forEach((key, value) => {
  56195. if (typeof value === "string") {
  56196. infoObj[key] = stringToPDFString(value);
  56197. }
  56198. });
  56199. }
  56200. newXrefInfo = {
  56201. rootRef: catalogRef,
  56202. encryptRef: xref.trailer.getRaw("Encrypt") || null,
  56203. newRef: xref.getNewTemporaryRef(),
  56204. infoRef: xref.trailer.getRaw("Info") || null,
  56205. info: infoObj,
  56206. fileIds: xref.trailer.get("ID") || null,
  56207. startXRef: linearization ? startXRef : xref.lastXRefStreamPos ?? startXRef,
  56208. filename
  56209. };
  56210. }
  56211. return incrementalUpdate({
  56212. originalData: stream.bytes,
  56213. xrefInfo: newXrefInfo,
  56214. newRefs,
  56215. xref,
  56216. hasXfa: !!xfa,
  56217. xfaDatasetsRef,
  56218. hasXfaDatasetsEntry,
  56219. needAppearances,
  56220. acroFormRef,
  56221. acroForm,
  56222. xfaData,
  56223. useXrefStream: isDict(xref.topDict, "XRef")
  56224. }).finally(() => {
  56225. xref.resetNewTemporaryRef();
  56226. });
  56227. });
  56228. handler.on("GetOperatorList", function (data, sink) {
  56229. const pageIndex = data.pageIndex;
  56230. pdfManager.getPage(pageIndex).then(function (page) {
  56231. const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
  56232. startWorkerTask(task);
  56233. const start = verbosity >= VerbosityLevel.INFOS ? Date.now() : 0;
  56234. page.getOperatorList({
  56235. handler,
  56236. sink,
  56237. task,
  56238. intent: data.intent,
  56239. cacheKey: data.cacheKey,
  56240. annotationStorage: data.annotationStorage,
  56241. modifiedIds: data.modifiedIds
  56242. }).then(function (operatorListInfo) {
  56243. finishWorkerTask(task);
  56244. if (start) {
  56245. info(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
  56246. }
  56247. sink.close();
  56248. }, function (reason) {
  56249. finishWorkerTask(task);
  56250. if (task.terminated) {
  56251. return;
  56252. }
  56253. sink.error(reason);
  56254. });
  56255. });
  56256. });
  56257. handler.on("GetTextContent", function (data, sink) {
  56258. const {
  56259. pageIndex,
  56260. includeMarkedContent,
  56261. disableNormalization
  56262. } = data;
  56263. pdfManager.getPage(pageIndex).then(function (page) {
  56264. const task = new WorkerTask("GetTextContent: page " + pageIndex);
  56265. startWorkerTask(task);
  56266. const start = verbosity >= VerbosityLevel.INFOS ? Date.now() : 0;
  56267. page.extractTextContent({
  56268. handler,
  56269. task,
  56270. sink,
  56271. includeMarkedContent,
  56272. disableNormalization
  56273. }).then(function () {
  56274. finishWorkerTask(task);
  56275. if (start) {
  56276. info(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
  56277. }
  56278. sink.close();
  56279. }, function (reason) {
  56280. finishWorkerTask(task);
  56281. if (task.terminated) {
  56282. return;
  56283. }
  56284. sink.error(reason);
  56285. });
  56286. });
  56287. });
  56288. handler.on("GetStructTree", function (data) {
  56289. return pdfManager.getPage(data.pageIndex).then(function (page) {
  56290. return pdfManager.ensure(page, "getStructTree");
  56291. });
  56292. });
  56293. handler.on("FontFallback", function (data) {
  56294. return pdfManager.fontFallback(data.id, handler);
  56295. });
  56296. handler.on("Cleanup", function (data) {
  56297. return pdfManager.cleanup(true);
  56298. });
  56299. handler.on("Terminate", function (data) {
  56300. terminated = true;
  56301. const waitOn = [];
  56302. if (pdfManager) {
  56303. pdfManager.terminate(new AbortException("Worker was terminated."));
  56304. const cleanupPromise = pdfManager.cleanup();
  56305. waitOn.push(cleanupPromise);
  56306. pdfManager = null;
  56307. } else {
  56308. clearGlobalCaches();
  56309. }
  56310. cancelXHRs?.(new AbortException("Worker was terminated."));
  56311. for (const task of WorkerTasks) {
  56312. waitOn.push(task.finished);
  56313. task.terminate();
  56314. }
  56315. return Promise.all(waitOn).then(function () {
  56316. handler.destroy();
  56317. handler = null;
  56318. });
  56319. });
  56320. handler.on("Ready", function (data) {
  56321. setupDoc(docParams);
  56322. docParams = null;
  56323. });
  56324. return workerHandlerName;
  56325. }
  56326. static initializeFromPort(port) {
  56327. const handler = new MessageHandler("worker", "main", port);
  56328. WorkerMessageHandler.setup(handler, port);
  56329. handler.send("ready", null);
  56330. }
  56331. }
  56332. function isMessagePort(maybePort) {
  56333. return typeof maybePort.postMessage === "function" && "onmessage" in maybePort;
  56334. }
  56335. if (typeof window === "undefined" && !isNodeJS && typeof self !== "undefined" && isMessagePort(self)) {
  56336. WorkerMessageHandler.initializeFromPort(self);
  56337. }
  56338. ;// ./src/pdf.worker.js
  56339. const pdfjsVersion = "4.8.69";
  56340. const pdfjsBuild = "3634dab10";
  56341. var __webpack_exports__WorkerMessageHandler = __webpack_exports__.WorkerMessageHandler;
  56342. export { __webpack_exports__WorkerMessageHandler as WorkerMessageHandler };
  56343. //# sourceMappingURL=pdf.worker.mjs.map