pdf.worker.js 2.6 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983689846898568986689876898868989689906899168992689936899468995689966899768998689996900069001690026900369004690056900669007690086900969010690116901269013690146901569016690176901869019690206902169022690236902469025690266902769028690296903069031690326903369034690356903669037690386903969040690416904269043690446904569046690476904869049690506905169052690536905469055690566905769058690596906069061690626906369064690656906669067690686906969070690716907269073690746907569076690776907869079690806908169082690836908469085690866908769088690896909069091690926909369094690956909669097690986909969100691016910269103691046910569106691076910869109691106911169112691136911469115691166911769118691196912069121691226912369124691256912669127691286912969130691316913269133691346913569136691376913869139691406914169142691436914469145691466914769148691496915069151691526915369154691556915669157691586915969160691616916269163691646916569166691676916869169691706917169172691736917469175691766917769178691796918069181691826918369184691856918669187691886918969190691916919269193691946919569196691976919869199692006920169202692036920469205692066920769208692096921069211692126921369214692156921669217692186921969220692216922269223692246922569226692276922869229692306923169232692336923469235692366923769238692396924069241692426924369244692456924669247692486924969250692516925269253692546925569256692576925869259692606926169262692636926469265692666926769268692696927069271692726927369274692756927669277692786927969280692816928269283692846928569286692876928869289692906929169292692936929469295692966929769298692996930069301693026930369304693056930669307693086930969310693116931269313693146931569316693176931869319693206932169322693236932469325693266932769328693296933069331693326933369334693356933669337693386933969340693416934269343693446934569346693476934869349693506935169352693536935469355693566935769358693596936069361693626936369364693656936669367693686936969370693716937269373693746937569376693776937869379693806938169382693836938469385693866938769388693896939069391693926939369394693956939669397693986939969400694016940269403694046940569406694076940869409694106941169412694136941469415694166941769418694196942069421694226942369424694256942669427694286942969430694316943269433694346943569436694376943869439694406944169442694436944469445694466944769448694496945069451694526945369454694556945669457694586945969460694616946269463694646946569466694676946869469694706947169472694736947469475694766947769478694796948069481694826948369484694856948669487694886948969490694916949269493694946949569496694976949869499695006950169502695036950469505695066950769508695096951069511695126951369514695156951669517695186951969520695216952269523695246952569526695276952869529695306953169532695336953469535695366953769538695396954069541695426954369544695456954669547695486954969550695516955269553695546955569556695576955869559695606956169562695636956469565695666956769568695696957069571695726957369574695756957669577695786957969580695816958269583695846958569586695876958869589695906959169592695936959469595695966959769598695996960069601696026960369604696056960669607696086960969610696116961269613696146961569616696176961869619696206962169622696236962469625696266962769628696296963069631696326963369634696356963669637696386963969640696416964269643696446964569646696476964869649696506965169652696536965469655696566965769658696596966069661696626966369664696656966669667696686966969670696716967269673696746967569676696776967869679696806968169682696836968469685696866968769688696896969069691696926969369694696956969669697696986969969700697016970269703697046970569706697076970869709697106971169712697136971469715697166971769718697196972069721697226972369724697256972669727697286972969730697316973269733697346973569736697376973869739697406974169742697436974469745697466974769748697496975069751697526975369754697556975669757697586975969760697616976269763697646976569766697676976869769697706977169772697736977469775697766977769778697796978069781697826978369784697856978669787697886978969790697916979269793697946979569796697976979869799698006980169802698036980469805698066980769808698096981069811698126981369814698156981669817698186981969820698216982269823698246982569826698276982869829698306983169832698336983469835698366983769838698396984069841698426984369844698456984669847698486984969850698516985269853698546985569856698576985869859698606986169862698636986469865698666986769868698696987069871698726987369874698756987669877698786987969880698816988269883698846988569886698876988869889698906989169892698936989469895698966989769898698996990069901699026990369904699056990669907699086990969910699116991269913699146991569916699176991869919699206992169922699236992469925699266992769928699296993069931699326993369934699356993669937699386993969940699416994269943699446994569946699476994869949699506995169952699536995469955699566995769958699596996069961699626996369964699656996669967699686996969970699716997269973699746997569976699776997869979699806998169982699836998469985699866998769988699896999069991699926999369994699956999669997699986999970000700017000270003700047000570006700077000870009700107001170012700137001470015700167001770018700197002070021700227002370024700257002670027700287002970030700317003270033700347003570036700377003870039700407004170042700437004470045700467004770048700497005070051700527005370054700557005670057700587005970060700617006270063700647006570066700677006870069700707007170072700737007470075700767007770078700797008070081700827008370084700857008670087700887008970090700917009270093700947009570096700977009870099701007010170102701037010470105701067010770108701097011070111701127011370114701157011670117701187011970120701217012270123701247012570126701277012870129701307013170132701337013470135701367013770138701397014070141701427014370144701457014670147701487014970150701517015270153701547015570156701577015870159701607016170162701637016470165701667016770168701697017070171701727017370174701757017670177701787017970180701817018270183701847018570186701877018870189701907019170192701937019470195701967019770198701997020070201702027020370204702057020670207702087020970210702117021270213702147021570216702177021870219702207022170222702237022470225702267022770228702297023070231702327023370234702357023670237702387023970240702417024270243702447024570246702477024870249702507025170252702537025470255702567025770258702597026070261702627026370264702657026670267702687026970270702717027270273702747027570276702777027870279702807028170282702837028470285702867028770288702897029070291702927029370294702957029670297702987029970300703017030270303703047030570306703077030870309703107031170312703137031470315703167031770318703197032070321703227032370324703257032670327703287032970330703317033270333703347033570336703377033870339703407034170342703437034470345703467034770348703497035070351703527035370354703557035670357703587035970360703617036270363703647036570366703677036870369703707037170372703737037470375703767037770378703797038070381703827038370384703857038670387703887038970390703917039270393703947039570396703977039870399704007040170402704037040470405704067040770408704097041070411704127041370414704157041670417704187041970420704217042270423704247042570426704277042870429704307043170432704337043470435704367043770438704397044070441704427044370444704457044670447704487044970450704517045270453704547045570456704577045870459704607046170462704637046470465704667046770468704697047070471704727047370474704757047670477704787047970480704817048270483704847048570486704877048870489704907049170492704937049470495704967049770498704997050070501705027050370504705057050670507705087050970510705117051270513705147051570516705177051870519705207052170522705237052470525705267052770528705297053070531705327053370534705357053670537705387053970540705417054270543705447054570546705477054870549705507055170552705537055470555705567055770558705597056070561705627056370564705657056670567705687056970570705717057270573705747057570576705777057870579705807058170582705837058470585705867058770588705897059070591705927059370594705957059670597705987059970600706017060270603706047060570606706077060870609706107061170612706137061470615706167061770618706197062070621706227062370624706257062670627706287062970630706317063270633706347063570636706377063870639706407064170642706437064470645706467064770648706497065070651706527065370654706557065670657706587065970660706617066270663706647066570666706677066870669706707067170672706737067470675706767067770678706797068070681706827068370684706857068670687706887068970690706917069270693706947069570696706977069870699707007070170702707037070470705707067070770708707097071070711707127071370714707157071670717707187071970720707217072270723707247072570726707277072870729707307073170732707337073470735707367073770738707397074070741707427074370744707457074670747707487074970750707517075270753707547075570756707577075870759707607076170762707637076470765707667076770768707697077070771707727077370774707757077670777707787077970780707817078270783707847078570786707877078870789707907079170792707937079470795707967079770798707997080070801708027080370804708057080670807708087080970810708117081270813708147081570816708177081870819708207082170822708237082470825708267082770828708297083070831708327083370834708357083670837708387083970840708417084270843708447084570846708477084870849708507085170852708537085470855708567085770858708597086070861708627086370864708657086670867708687086970870708717087270873708747087570876708777087870879708807088170882708837088470885708867088770888708897089070891708927089370894708957089670897708987089970900709017090270903709047090570906709077090870909709107091170912709137091470915709167091770918709197092070921709227092370924709257092670927709287092970930709317093270933709347093570936709377093870939709407094170942709437094470945709467094770948709497095070951709527095370954709557095670957709587095970960709617096270963709647096570966709677096870969709707097170972709737097470975709767097770978709797098070981709827098370984709857098670987709887098970990709917099270993709947099570996709977099870999710007100171002710037100471005710067100771008710097101071011710127101371014710157101671017710187101971020710217102271023710247102571026710277102871029710307103171032710337103471035710367103771038710397104071041710427104371044710457104671047710487104971050710517105271053710547105571056710577105871059710607106171062710637106471065710667106771068710697107071071710727107371074710757107671077710787107971080710817108271083710847108571086710877108871089710907109171092710937109471095710967109771098710997110071101711027110371104711057110671107711087110971110711117111271113711147111571116711177111871119711207112171122711237112471125711267112771128711297113071131711327113371134711357113671137711387113971140711417114271143711447114571146711477114871149711507115171152711537115471155711567115771158711597116071161711627116371164711657116671167711687116971170711717117271173711747117571176711777117871179711807118171182711837118471185711867118771188711897119071191711927119371194711957119671197711987119971200712017120271203712047120571206712077120871209712107121171212712137121471215712167121771218712197122071221712227122371224712257122671227712287122971230712317123271233712347123571236712377123871239712407124171242712437124471245712467124771248712497125071251712527125371254712557125671257712587125971260712617126271263712647126571266712677126871269712707127171272712737127471275712767127771278712797128071281712827128371284712857128671287712887128971290712917129271293712947129571296712977129871299713007130171302713037130471305713067130771308713097131071311713127131371314713157131671317713187131971320713217132271323713247132571326713277132871329713307133171332713337133471335713367133771338713397134071341713427134371344713457134671347713487134971350713517135271353713547135571356713577135871359713607136171362713637136471365713667136771368713697137071371713727137371374713757137671377713787137971380713817138271383713847138571386713877138871389713907139171392713937139471395713967139771398713997140071401714027140371404714057140671407714087140971410714117141271413714147141571416714177141871419714207142171422714237142471425714267142771428714297143071431714327143371434714357143671437714387143971440714417144271443714447144571446714477144871449714507145171452714537145471455714567145771458714597146071461714627146371464714657146671467714687146971470714717147271473714747147571476714777147871479714807148171482714837148471485714867148771488714897149071491714927149371494714957149671497714987149971500715017150271503715047150571506715077150871509715107151171512715137151471515715167151771518715197152071521715227152371524715257152671527715287152971530715317153271533715347153571536715377153871539715407154171542715437154471545715467154771548715497155071551715527155371554715557155671557715587155971560715617156271563715647156571566715677156871569715707157171572715737157471575715767157771578715797158071581715827158371584715857158671587715887158971590715917159271593715947159571596715977159871599716007160171602716037160471605716067160771608716097161071611716127161371614716157161671617716187161971620716217162271623716247162571626716277162871629716307163171632716337163471635716367163771638716397164071641716427164371644716457164671647716487164971650716517165271653716547165571656716577165871659716607166171662716637166471665716667166771668716697167071671716727167371674716757167671677716787167971680716817168271683716847168571686716877168871689716907169171692716937169471695716967169771698716997170071701717027170371704717057170671707717087170971710717117171271713717147171571716717177171871719717207172171722717237172471725717267172771728717297173071731717327173371734717357173671737717387173971740717417174271743717447174571746717477174871749717507175171752717537175471755717567175771758717597176071761717627176371764717657176671767717687176971770717717177271773717747177571776717777177871779717807178171782717837178471785717867178771788717897179071791717927179371794717957179671797717987179971800718017180271803718047180571806718077180871809718107181171812718137181471815718167181771818718197182071821718227182371824718257182671827718287182971830718317183271833718347183571836718377183871839718407184171842718437184471845718467184771848718497185071851718527185371854718557185671857718587185971860718617186271863718647186571866718677186871869718707187171872718737187471875718767187771878718797188071881718827188371884718857188671887718887188971890718917189271893718947189571896718977189871899719007190171902719037190471905719067190771908719097191071911719127191371914719157191671917719187191971920719217192271923719247192571926719277192871929719307193171932719337193471935719367193771938719397194071941719427194371944719457194671947719487194971950719517195271953719547195571956719577195871959719607196171962719637196471965719667196771968719697197071971719727197371974719757197671977719787197971980719817198271983719847198571986719877198871989719907199171992719937199471995719967199771998719997200072001720027200372004720057200672007720087200972010720117201272013720147201572016720177201872019720207202172022720237202472025720267202772028720297203072031720327203372034720357203672037720387203972040720417204272043720447204572046720477204872049720507205172052720537205472055720567205772058720597206072061720627206372064720657206672067720687206972070720717207272073720747207572076720777207872079720807208172082720837208472085720867208772088720897209072091720927209372094720957209672097720987209972100721017210272103721047210572106721077210872109721107211172112721137211472115721167211772118721197212072121721227212372124721257212672127721287212972130721317213272133721347213572136721377213872139721407214172142721437214472145721467214772148721497215072151721527215372154721557215672157721587215972160721617216272163721647216572166721677216872169721707217172172721737217472175721767217772178721797218072181721827218372184721857218672187721887218972190721917219272193721947219572196721977219872199722007220172202722037220472205722067220772208722097221072211722127221372214722157221672217722187221972220722217222272223722247222572226722277222872229722307223172232722337223472235722367223772238722397224072241722427224372244722457224672247722487224972250722517225272253722547225572256722577225872259722607226172262722637226472265722667226772268722697227072271722727227372274722757227672277722787227972280722817228272283722847228572286722877228872289722907229172292722937229472295722967229772298722997230072301723027230372304723057230672307723087230972310723117231272313723147231572316723177231872319723207232172322723237232472325723267232772328723297233072331723327233372334723357233672337723387233972340723417234272343723447234572346723477234872349723507235172352723537235472355723567235772358723597236072361723627236372364723657236672367723687236972370723717237272373723747237572376723777237872379723807238172382723837238472385723867238772388723897239072391723927239372394723957239672397723987239972400724017240272403724047240572406724077240872409724107241172412724137241472415724167241772418724197242072421724227242372424724257242672427724287242972430724317243272433724347243572436724377243872439724407244172442724437244472445724467244772448724497245072451724527245372454724557245672457724587245972460724617246272463724647246572466724677246872469724707247172472724737247472475724767247772478724797248072481724827248372484724857248672487724887248972490724917249272493724947249572496724977249872499725007250172502725037250472505725067250772508725097251072511725127251372514725157251672517725187251972520725217252272523725247252572526725277252872529725307253172532725337253472535725367253772538725397254072541725427254372544725457254672547725487254972550725517255272553725547255572556725577255872559725607256172562725637256472565725667256772568725697257072571725727257372574725757257672577725787257972580725817258272583725847258572586725877258872589725907259172592725937259472595725967259772598725997260072601726027260372604726057260672607726087260972610726117261272613726147261572616726177261872619726207262172622726237262472625726267262772628726297263072631726327263372634726357263672637726387263972640726417264272643726447264572646726477264872649726507265172652726537265472655726567265772658726597266072661726627266372664726657266672667726687266972670726717267272673726747267572676726777267872679726807268172682726837268472685726867268772688726897269072691726927269372694726957269672697726987269972700727017270272703727047270572706727077270872709727107271172712727137271472715727167271772718727197272072721727227272372724727257272672727727287272972730727317273272733727347273572736727377273872739727407274172742727437274472745727467274772748727497275072751727527275372754727557275672757727587275972760727617276272763727647276572766727677276872769727707277172772727737277472775727767277772778727797278072781727827278372784727857278672787727887278972790727917279272793727947279572796727977279872799728007280172802728037280472805728067280772808728097281072811728127281372814728157281672817728187281972820728217282272823728247282572826728277282872829728307283172832728337283472835728367283772838728397284072841728427284372844728457284672847728487284972850728517285272853728547285572856728577285872859728607286172862728637286472865728667286772868728697287072871728727287372874728757287672877728787287972880728817288272883728847288572886728877288872889728907289172892728937289472895728967289772898728997290072901729027290372904729057290672907729087290972910729117291272913729147291572916729177291872919729207292172922729237292472925729267292772928729297293072931729327293372934729357293672937729387293972940729417294272943729447294572946729477294872949729507295172952729537295472955729567295772958729597296072961729627296372964729657296672967729687296972970729717297272973729747297572976729777297872979729807298172982729837298472985729867298772988729897299072991729927299372994729957299672997729987299973000730017300273003730047300573006730077300873009730107301173012730137301473015730167301773018730197302073021730227302373024730257302673027730287302973030730317303273033730347303573036730377303873039730407304173042730437304473045730467304773048730497305073051730527305373054730557305673057730587305973060730617306273063730647306573066730677306873069730707307173072730737307473075730767307773078730797308073081730827308373084730857308673087730887308973090730917309273093730947309573096730977309873099731007310173102731037310473105731067310773108731097311073111731127311373114731157311673117731187311973120731217312273123731247312573126731277312873129731307313173132731337313473135731367313773138731397314073141731427314373144731457314673147731487314973150731517315273153731547315573156731577315873159731607316173162731637316473165731667316773168731697317073171731727317373174731757317673177731787317973180731817318273183731847318573186731877318873189731907319173192731937319473195731967319773198731997320073201732027320373204732057320673207732087320973210732117321273213732147321573216732177321873219732207322173222732237322473225732267322773228732297323073231732327323373234732357323673237732387323973240732417324273243732447324573246732477324873249732507325173252732537325473255732567325773258732597326073261732627326373264732657326673267732687326973270732717327273273732747327573276732777327873279732807328173282732837328473285732867328773288732897329073291732927329373294732957329673297732987329973300733017330273303733047330573306733077330873309733107331173312733137331473315733167331773318733197332073321733227332373324733257332673327733287332973330733317333273333733347333573336733377333873339733407334173342733437334473345733467334773348733497335073351733527335373354733557335673357733587335973360733617336273363733647336573366733677336873369733707337173372733737337473375733767337773378733797338073381733827338373384733857338673387733887338973390733917339273393733947339573396733977339873399734007340173402734037340473405734067340773408734097341073411734127341373414734157341673417734187341973420734217342273423734247342573426734277342873429734307343173432734337343473435734367343773438734397344073441734427344373444734457344673447734487344973450734517345273453734547345573456734577345873459734607346173462734637346473465734667346773468734697347073471734727347373474734757347673477734787347973480734817348273483734847348573486734877348873489734907349173492734937349473495734967349773498734997350073501735027350373504735057350673507735087350973510735117351273513735147351573516735177351873519735207352173522735237352473525735267352773528735297353073531735327353373534735357353673537735387353973540735417354273543735447354573546735477354873549735507355173552735537355473555735567355773558735597356073561735627356373564735657356673567735687356973570735717357273573735747357573576735777357873579735807358173582735837358473585735867358773588735897359073591735927359373594735957359673597735987359973600736017360273603736047360573606736077360873609736107361173612736137361473615736167361773618736197362073621736227362373624736257362673627736287362973630736317363273633736347363573636736377363873639736407364173642736437364473645736467364773648736497365073651736527365373654736557365673657736587365973660736617366273663736647366573666736677366873669736707367173672736737367473675736767367773678736797368073681736827368373684736857368673687736887368973690736917369273693736947369573696736977369873699737007370173702737037370473705737067370773708737097371073711737127371373714737157371673717737187371973720737217372273723737247372573726737277372873729737307373173732737337373473735737367373773738737397374073741737427374373744737457374673747737487374973750737517375273753737547375573756737577375873759737607376173762737637376473765737667376773768737697377073771737727377373774737757377673777737787377973780737817378273783737847378573786737877378873789737907379173792737937379473795737967379773798737997380073801738027380373804738057380673807738087380973810738117381273813738147381573816738177381873819738207382173822738237382473825738267382773828738297383073831738327383373834738357383673837738387383973840738417384273843738447384573846738477384873849738507385173852738537385473855738567385773858738597386073861738627386373864738657386673867738687386973870738717387273873738747387573876738777387873879738807388173882738837388473885738867388773888738897389073891738927389373894738957389673897738987389973900739017390273903739047390573906739077390873909739107391173912739137391473915739167391773918739197392073921739227392373924739257392673927739287392973930739317393273933739347393573936739377393873939739407394173942739437394473945739467394773948739497395073951739527395373954739557395673957739587395973960739617396273963739647396573966739677396873969739707397173972739737397473975739767397773978739797398073981739827398373984739857398673987739887398973990739917399273993739947399573996739977399873999740007400174002740037400474005740067400774008740097401074011740127401374014740157401674017740187401974020740217402274023740247402574026740277402874029740307403174032740337403474035740367403774038740397404074041740427404374044740457404674047740487404974050740517405274053740547405574056740577405874059740607406174062740637406474065740667406774068740697407074071740727407374074740757407674077740787407974080740817408274083740847408574086740877408874089740907409174092740937409474095740967409774098740997410074101741027410374104741057410674107741087410974110741117411274113741147411574116741177411874119741207412174122741237412474125741267412774128741297413074131741327413374134741357413674137741387413974140741417414274143741447414574146741477414874149741507415174152741537415474155741567415774158741597416074161741627416374164741657416674167741687416974170741717417274173741747417574176741777417874179741807418174182741837418474185741867418774188741897419074191741927419374194741957419674197741987419974200742017420274203742047420574206742077420874209742107421174212742137421474215742167421774218742197422074221742227422374224742257422674227742287422974230742317423274233742347423574236742377423874239742407424174242742437424474245742467424774248742497425074251742527425374254742557425674257742587425974260742617426274263742647426574266742677426874269742707427174272742737427474275742767427774278742797428074281742827428374284742857428674287742887428974290742917429274293742947429574296742977429874299743007430174302743037430474305743067430774308743097431074311743127431374314743157431674317743187431974320743217432274323743247432574326743277432874329743307433174332743337433474335743367433774338743397434074341743427434374344743457434674347743487434974350743517435274353743547435574356743577435874359743607436174362743637436474365743667436774368743697437074371743727437374374743757437674377743787437974380743817438274383743847438574386743877438874389743907439174392743937439474395743967439774398743997440074401744027440374404744057440674407744087440974410744117441274413744147441574416744177441874419744207442174422744237442474425744267442774428744297443074431744327443374434744357443674437744387443974440744417444274443744447444574446744477444874449744507445174452744537445474455744567445774458744597446074461744627446374464744657446674467744687446974470744717447274473744747447574476744777447874479744807448174482744837448474485744867448774488744897449074491744927449374494744957449674497744987449974500745017450274503745047450574506745077450874509745107451174512745137451474515745167451774518745197452074521745227452374524745257452674527745287452974530745317453274533745347453574536745377453874539745407454174542745437454474545745467454774548745497455074551745527455374554745557455674557745587455974560745617456274563745647456574566745677456874569745707457174572745737457474575745767457774578745797458074581745827458374584745857458674587745887458974590745917459274593745947459574596745977459874599746007460174602746037460474605746067460774608746097461074611746127461374614746157461674617746187461974620746217462274623746247462574626746277462874629746307463174632746337463474635746367463774638746397464074641746427464374644746457464674647746487464974650746517465274653746547465574656746577465874659746607466174662746637466474665746667466774668746697467074671746727467374674746757467674677746787467974680746817468274683746847468574686746877468874689746907469174692746937469474695746967469774698746997470074701747027470374704747057470674707747087470974710747117471274713747147471574716747177471874719747207472174722747237472474725747267472774728747297473074731747327473374734747357473674737747387473974740747417474274743747447474574746747477474874749747507475174752747537475474755747567475774758747597476074761747627476374764747657476674767747687476974770747717477274773747747477574776747777477874779747807478174782747837478474785747867478774788747897479074791747927479374794747957479674797747987479974800748017480274803748047480574806748077480874809748107481174812748137481474815748167481774818748197482074821748227482374824748257482674827748287482974830748317483274833748347483574836748377483874839748407484174842748437484474845748467484774848748497485074851748527485374854748557485674857748587485974860748617486274863748647486574866748677486874869748707487174872748737487474875748767487774878748797488074881748827488374884748857488674887748887488974890748917489274893748947489574896748977489874899749007490174902749037490474905749067490774908749097491074911749127491374914749157491674917749187491974920749217492274923749247492574926749277492874929749307493174932749337493474935749367493774938749397494074941749427494374944749457494674947749487494974950749517495274953749547495574956749577495874959749607496174962749637496474965749667496774968749697497074971749727497374974749757497674977749787497974980749817498274983749847498574986749877498874989749907499174992749937499474995749967499774998749997500075001750027500375004750057500675007750087500975010750117501275013750147501575016750177501875019750207502175022750237502475025750267502775028750297503075031750327503375034750357503675037750387503975040750417504275043750447504575046750477504875049750507505175052750537505475055750567505775058750597506075061750627506375064750657506675067750687506975070750717507275073750747507575076750777507875079750807508175082750837508475085750867508775088750897509075091750927509375094750957509675097750987509975100751017510275103751047510575106751077510875109751107511175112751137511475115751167511775118751197512075121751227512375124751257512675127751287512975130751317513275133751347513575136751377513875139751407514175142751437514475145751467514775148751497515075151751527515375154751557515675157751587515975160751617516275163751647516575166751677516875169751707517175172751737517475175751767517775178751797518075181751827518375184751857518675187751887518975190751917519275193751947519575196751977519875199752007520175202752037520475205752067520775208752097521075211752127521375214752157521675217752187521975220752217522275223752247522575226752277522875229752307523175232752337523475235752367523775238752397524075241752427524375244752457524675247752487524975250752517525275253752547525575256752577525875259752607526175262752637526475265752667526775268752697527075271752727527375274752757527675277752787527975280752817528275283752847528575286752877528875289752907529175292752937529475295752967529775298752997530075301753027530375304753057530675307753087530975310753117531275313753147531575316753177531875319753207532175322753237532475325753267532775328753297533075331753327533375334753357533675337753387533975340753417534275343753447534575346753477534875349753507535175352753537535475355753567535775358753597536075361753627536375364753657536675367753687536975370753717537275373753747537575376753777537875379753807538175382753837538475385753867538775388753897539075391753927539375394753957539675397753987539975400754017540275403754047540575406754077540875409754107541175412754137541475415754167541775418754197542075421754227542375424754257542675427754287542975430754317543275433754347543575436754377543875439754407544175442754437544475445754467544775448754497545075451754527545375454754557545675457754587545975460754617546275463754647546575466754677546875469754707547175472754737547475475754767547775478754797548075481754827548375484754857548675487754887548975490754917549275493754947549575496754977549875499755007550175502755037550475505755067550775508755097551075511755127551375514755157551675517755187551975520755217552275523755247552575526755277552875529755307553175532755337553475535755367553775538755397554075541755427554375544755457554675547755487554975550755517555275553755547555575556755577555875559755607556175562755637556475565755667556775568755697557075571755727557375574755757557675577755787557975580755817558275583755847558575586755877558875589755907559175592755937559475595755967559775598755997560075601756027560375604756057560675607756087560975610756117561275613756147561575616756177561875619756207562175622756237562475625756267562775628756297563075631756327563375634756357563675637756387563975640756417564275643756447564575646756477564875649756507565175652756537565475655756567565775658756597566075661756627566375664756657566675667756687566975670756717567275673756747567575676756777567875679756807568175682756837568475685756867568775688756897569075691756927569375694756957569675697756987569975700757017570275703757047570575706757077570875709757107571175712757137571475715757167571775718757197572075721757227572375724757257572675727757287572975730757317573275733757347573575736757377573875739757407574175742757437574475745757467574775748757497575075751757527575375754757557575675757757587575975760757617576275763757647576575766757677576875769757707577175772757737577475775757767577775778757797578075781757827578375784757857578675787757887578975790757917579275793757947579575796757977579875799758007580175802758037580475805758067580775808758097581075811758127581375814758157581675817758187581975820758217582275823758247582575826758277582875829758307583175832758337583475835758367583775838758397584075841758427584375844758457584675847758487584975850758517585275853758547585575856758577585875859758607586175862758637586475865758667586775868758697587075871758727587375874758757587675877758787587975880758817588275883758847588575886758877588875889758907589175892758937589475895758967589775898758997590075901759027590375904759057590675907759087590975910759117591275913759147591575916759177591875919759207592175922759237592475925759267592775928759297593075931759327593375934759357593675937759387593975940759417594275943759447594575946759477594875949759507595175952759537595475955759567595775958759597596075961759627596375964759657596675967759687596975970759717597275973759747597575976759777597875979759807598175982759837598475985759867598775988759897599075991759927599375994759957599675997759987599976000760017600276003760047600576006760077600876009760107601176012760137601476015760167601776018760197602076021760227602376024760257602676027760287602976030760317603276033760347603576036760377603876039760407604176042760437604476045760467604776048760497605076051760527605376054760557605676057760587605976060760617606276063760647606576066760677606876069760707607176072760737607476075760767607776078760797608076081760827608376084760857608676087760887608976090760917609276093760947609576096760977609876099761007610176102761037610476105761067610776108761097611076111761127611376114761157611676117761187611976120761217612276123761247612576126761277612876129761307613176132761337613476135761367613776138761397614076141761427614376144761457614676147761487614976150761517615276153761547615576156761577615876159761607616176162761637616476165761667616776168761697617076171761727617376174761757617676177761787617976180761817618276183761847618576186761877618876189761907619176192761937619476195761967619776198761997620076201762027620376204762057620676207762087620976210762117621276213762147621576216762177621876219762207622176222762237622476225762267622776228762297623076231762327623376234762357623676237762387623976240762417624276243762447624576246762477624876249762507625176252762537625476255762567625776258762597626076261762627626376264762657626676267762687626976270762717627276273762747627576276762777627876279762807628176282762837628476285762867628776288762897629076291762927629376294762957629676297762987629976300763017630276303763047630576306763077630876309763107631176312763137631476315763167631776318763197632076321763227632376324763257632676327763287632976330763317633276333763347633576336763377633876339763407634176342763437634476345763467634776348763497635076351763527635376354763557635676357763587635976360763617636276363763647636576366763677636876369763707637176372763737637476375763767637776378763797638076381763827638376384763857638676387763887638976390763917639276393763947639576396763977639876399764007640176402764037640476405764067640776408764097641076411764127641376414764157641676417764187641976420764217642276423764247642576426764277642876429764307643176432764337643476435764367643776438764397644076441764427644376444764457644676447764487644976450764517645276453764547645576456764577645876459764607646176462764637646476465764667646776468764697647076471764727647376474764757647676477764787647976480764817648276483764847648576486764877648876489764907649176492764937649476495764967649776498764997650076501765027650376504765057650676507765087650976510765117651276513765147651576516765177651876519765207652176522765237652476525765267652776528765297653076531765327653376534765357653676537765387653976540765417654276543765447654576546765477654876549765507655176552765537655476555765567655776558765597656076561765627656376564765657656676567765687656976570765717657276573765747657576576765777657876579765807658176582765837658476585765867658776588765897659076591765927659376594765957659676597765987659976600766017660276603766047660576606766077660876609766107661176612766137661476615766167661776618766197662076621766227662376624766257662676627766287662976630766317663276633766347663576636766377663876639766407664176642766437664476645766467664776648766497665076651766527665376654766557665676657766587665976660766617666276663766647666576666766677666876669766707667176672766737667476675766767667776678766797668076681766827668376684766857668676687766887668976690766917669276693766947669576696766977669876699767007670176702767037670476705767067670776708767097671076711767127671376714767157671676717767187671976720767217672276723767247672576726767277672876729767307673176732767337673476735767367673776738767397674076741767427674376744767457674676747767487674976750767517675276753767547675576756767577675876759767607676176762767637676476765767667676776768767697677076771767727677376774767757677676777767787677976780767817678276783767847678576786767877678876789767907679176792767937679476795767967679776798767997680076801768027680376804768057680676807768087680976810768117681276813768147681576816768177681876819768207682176822768237682476825768267682776828768297683076831768327683376834768357683676837768387683976840768417684276843768447684576846768477684876849768507685176852768537685476855768567685776858768597686076861768627686376864768657686676867768687686976870768717687276873768747687576876768777687876879768807688176882768837688476885768867688776888768897689076891768927689376894768957689676897768987689976900769017690276903769047690576906769077690876909769107691176912769137691476915769167691776918769197692076921769227692376924769257692676927769287692976930769317693276933769347693576936769377693876939769407694176942769437694476945769467694776948769497695076951769527695376954769557695676957769587695976960769617696276963769647696576966769677696876969769707697176972769737697476975769767697776978769797698076981769827698376984769857698676987769887698976990769917699276993769947699576996769977699876999770007700177002770037700477005770067700777008770097701077011770127701377014770157701677017770187701977020770217702277023770247702577026770277702877029770307703177032770337703477035770367703777038770397704077041770427704377044770457704677047770487704977050770517705277053770547705577056770577705877059770607706177062770637706477065770667706777068770697707077071770727707377074770757707677077770787707977080770817708277083770847708577086770877708877089770907709177092770937709477095770967709777098770997710077101771027710377104771057710677107771087710977110771117711277113771147711577116771177711877119771207712177122771237712477125771267712777128771297713077131771327713377134771357713677137771387713977140771417714277143771447714577146771477714877149771507715177152771537715477155771567715777158771597716077161771627716377164771657716677167771687716977170771717717277173771747717577176771777717877179771807718177182771837718477185771867718777188771897719077191771927719377194771957719677197771987719977200772017720277203772047720577206772077720877209772107721177212772137721477215772167721777218772197722077221772227722377224772257722677227772287722977230772317723277233772347723577236772377723877239772407724177242772437724477245772467724777248772497725077251772527725377254772557725677257772587725977260772617726277263772647726577266772677726877269772707727177272772737727477275772767727777278772797728077281772827728377284772857728677287772887728977290772917729277293772947729577296772977729877299773007730177302773037730477305773067730777308773097731077311773127731377314773157731677317773187731977320773217732277323773247732577326773277732877329773307733177332773337733477335773367733777338773397734077341773427734377344773457734677347773487734977350773517735277353773547735577356773577735877359773607736177362773637736477365773667736777368773697737077371773727737377374773757737677377773787737977380773817738277383773847738577386773877738877389773907739177392773937739477395773967739777398773997740077401774027740377404774057740677407774087740977410774117741277413774147741577416774177741877419774207742177422774237742477425774267742777428774297743077431774327743377434774357743677437774387743977440774417744277443774447744577446774477744877449774507745177452774537745477455774567745777458774597746077461774627746377464774657746677467774687746977470774717747277473774747747577476774777747877479774807748177482774837748477485774867748777488774897749077491774927749377494774957749677497774987749977500775017750277503775047750577506775077750877509775107751177512775137751477515775167751777518775197752077521775227752377524775257752677527775287752977530775317753277533775347753577536775377753877539775407754177542775437754477545775467754777548775497755077551775527755377554775557755677557775587755977560775617756277563775647756577566775677756877569775707757177572775737757477575775767757777578775797758077581775827758377584775857758677587775887758977590775917759277593775947759577596775977759877599776007760177602776037760477605776067760777608776097761077611776127761377614776157761677617776187761977620776217762277623776247762577626776277762877629776307763177632776337763477635776367763777638776397764077641776427764377644776457764677647776487764977650776517765277653776547765577656776577765877659776607766177662776637766477665776667766777668776697767077671776727767377674776757767677677776787767977680776817768277683776847768577686776877768877689776907769177692776937769477695776967769777698776997770077701777027770377704777057770677707777087770977710777117771277713777147771577716777177771877719777207772177722777237772477725777267772777728777297773077731777327773377734777357773677737777387773977740777417774277743777447774577746777477774877749777507775177752777537775477755777567775777758777597776077761777627776377764777657776677767777687776977770777717777277773777747777577776777777777877779777807778177782777837778477785777867778777788777897779077791777927779377794777957779677797777987779977800778017780277803778047780577806778077780877809778107781177812778137781477815778167781777818778197782077821778227782377824778257782677827778287782977830778317783277833778347783577836778377783877839778407784177842778437784477845778467784777848778497785077851778527785377854778557785677857778587785977860778617786277863778647786577866778677786877869778707787177872778737787477875778767787777878778797788077881778827788377884778857788677887778887788977890778917789277893778947789577896778977789877899779007790177902779037790477905779067790777908779097791077911779127791377914779157791677917779187791977920779217792277923779247792577926779277792877929779307793177932779337793477935779367793777938779397794077941779427794377944779457794677947779487794977950779517795277953779547795577956779577795877959779607796177962779637796477965779667796777968779697797077971779727797377974779757797677977779787797977980779817798277983779847798577986779877798877989779907799177992779937799477995779967799777998779997800078001780027800378004780057800678007780087800978010780117801278013780147801578016780177801878019780207802178022780237802478025780267802778028780297803078031780327803378034780357803678037780387803978040780417804278043780447804578046780477804878049780507805178052780537805478055780567805778058780597806078061780627806378064780657806678067780687806978070780717807278073780747807578076780777807878079780807808178082780837808478085780867808778088780897809078091780927809378094780957809678097780987809978100781017810278103781047810578106781077810878109781107811178112781137811478115781167811778118781197812078121781227812378124781257812678127781287812978130781317813278133781347813578136781377813878139781407814178142781437814478145781467814778148781497815078151781527815378154781557815678157781587815978160781617816278163781647816578166781677816878169781707817178172781737817478175781767817778178781797818078181781827818378184781857818678187781887818978190781917819278193781947819578196781977819878199782007820178202782037820478205782067820778208782097821078211782127821378214782157821678217782187821978220782217822278223782247822578226782277822878229782307823178232782337823478235782367823778238782397824078241782427824378244782457824678247782487824978250782517825278253782547825578256782577825878259782607826178262782637826478265782667826778268782697827078271782727827378274782757827678277782787827978280782817828278283782847828578286782877828878289782907829178292782937829478295782967829778298782997830078301783027830378304783057830678307783087830978310783117831278313783147831578316783177831878319783207832178322783237832478325783267832778328783297833078331783327833378334783357833678337783387833978340783417834278343783447834578346783477834878349783507835178352783537835478355783567835778358783597836078361783627836378364783657836678367783687836978370783717837278373783747837578376783777837878379783807838178382783837838478385783867838778388783897839078391783927839378394783957839678397783987839978400784017840278403784047840578406784077840878409784107841178412784137841478415784167841778418784197842078421784227842378424784257842678427784287842978430784317843278433784347843578436784377843878439784407844178442784437844478445784467844778448784497845078451784527845378454784557845678457784587845978460784617846278463784647846578466784677846878469784707847178472784737847478475784767847778478784797848078481784827848378484784857848678487784887848978490784917849278493784947849578496784977849878499785007850178502785037850478505785067850778508785097851078511785127851378514785157851678517785187851978520785217852278523785247852578526785277852878529785307853178532785337853478535785367853778538785397854078541785427854378544785457854678547785487854978550785517855278553785547855578556785577855878559785607856178562785637856478565785667856778568785697857078571785727857378574785757857678577785787857978580785817858278583785847858578586785877858878589785907859178592785937859478595785967859778598785997860078601786027860378604786057860678607786087860978610786117861278613786147861578616786177861878619786207862178622786237862478625786267862778628786297863078631786327863378634786357863678637786387863978640786417864278643786447864578646786477864878649786507865178652786537865478655786567865778658786597866078661786627866378664786657866678667786687866978670786717867278673786747867578676786777867878679786807868178682786837868478685786867868778688786897869078691786927869378694786957869678697786987869978700787017870278703787047870578706787077870878709787107871178712787137871478715787167871778718787197872078721787227872378724787257872678727787287872978730787317873278733787347873578736787377873878739787407874178742787437874478745787467874778748787497875078751787527875378754787557875678757787587875978760787617876278763787647876578766787677876878769787707877178772787737877478775787767877778778787797878078781787827878378784787857878678787787887878978790787917879278793787947879578796787977879878799788007880178802788037880478805788067880778808788097881078811788127881378814788157881678817788187881978820788217882278823788247882578826788277882878829788307883178832788337883478835788367883778838788397884078841788427884378844788457884678847788487884978850788517885278853788547885578856788577885878859788607886178862788637886478865788667886778868788697887078871788727887378874788757887678877788787887978880788817888278883788847888578886788877888878889788907889178892788937889478895788967889778898788997890078901789027890378904789057890678907789087890978910789117891278913789147891578916789177891878919789207892178922789237892478925789267892778928789297893078931789327893378934789357893678937789387893978940789417894278943789447894578946789477894878949789507895178952789537895478955789567895778958789597896078961789627896378964789657896678967789687896978970789717897278973789747897578976789777897878979789807898178982789837898478985789867898778988789897899078991789927899378994789957899678997789987899979000790017900279003790047900579006790077900879009790107901179012790137901479015790167901779018790197902079021790227902379024790257902679027790287902979030790317903279033790347903579036790377903879039790407904179042790437904479045790467904779048790497905079051790527905379054790557905679057790587905979060790617906279063790647906579066790677906879069790707907179072790737907479075790767907779078790797908079081790827908379084790857908679087790887908979090790917909279093790947909579096790977909879099791007910179102791037910479105791067910779108791097911079111791127911379114791157911679117791187911979120791217912279123791247912579126791277912879129791307913179132791337913479135791367913779138791397914079141791427914379144791457914679147791487914979150791517915279153791547915579156791577915879159791607916179162791637916479165791667916779168791697917079171791727917379174791757917679177791787917979180791817918279183791847918579186791877918879189791907919179192791937919479195791967919779198791997920079201792027920379204792057920679207792087920979210792117921279213792147921579216792177921879219792207922179222792237922479225792267922779228792297923079231792327923379234792357923679237792387923979240792417924279243792447924579246792477924879249792507925179252792537925479255792567925779258792597926079261792627926379264792657926679267792687926979270792717927279273792747927579276792777927879279792807928179282792837928479285792867928779288792897929079291792927929379294792957929679297792987929979300793017930279303793047930579306793077930879309793107931179312793137931479315793167931779318793197932079321793227932379324793257932679327793287932979330793317933279333793347933579336793377933879339793407934179342793437934479345793467934779348793497935079351793527935379354793557935679357793587935979360793617936279363793647936579366793677936879369793707937179372793737937479375793767937779378793797938079381793827938379384793857938679387793887938979390793917939279393793947939579396793977939879399794007940179402794037940479405794067940779408794097941079411794127941379414794157941679417794187941979420794217942279423794247942579426794277942879429794307943179432794337943479435794367943779438794397944079441794427944379444794457944679447794487944979450794517945279453794547945579456794577945879459794607946179462794637946479465794667946779468794697947079471794727947379474794757947679477794787947979480794817948279483794847948579486794877948879489794907949179492794937949479495794967949779498794997950079501795027950379504795057950679507795087950979510795117951279513795147951579516795177951879519795207952179522795237952479525795267952779528795297953079531795327953379534795357953679537795387953979540795417954279543795447954579546795477954879549795507955179552795537955479555795567955779558795597956079561795627956379564795657956679567795687956979570795717957279573795747957579576795777957879579795807958179582795837958479585795867958779588795897959079591795927959379594795957959679597795987959979600796017960279603796047960579606796077960879609796107961179612796137961479615796167961779618796197962079621796227962379624796257962679627796287962979630796317963279633796347963579636796377963879639796407964179642796437964479645796467964779648796497965079651796527965379654796557965679657796587965979660796617966279663796647966579666796677966879669796707967179672796737967479675796767967779678796797968079681796827968379684796857968679687796887968979690796917969279693796947969579696796977969879699797007970179702797037970479705797067970779708797097971079711797127971379714797157971679717797187971979720797217972279723797247972579726797277972879729797307973179732797337973479735797367973779738797397974079741797427974379744797457974679747797487974979750797517975279753797547975579756797577975879759797607976179762797637976479765797667976779768797697977079771797727977379774797757977679777797787977979780797817978279783797847978579786797877978879789797907979179792797937979479795797967979779798797997980079801798027980379804798057980679807798087980979810798117981279813798147981579816798177981879819798207982179822798237982479825798267982779828798297983079831798327983379834798357983679837798387983979840798417984279843798447984579846798477984879849798507985179852798537985479855798567985779858798597986079861798627986379864798657986679867798687986979870798717987279873798747987579876798777987879879798807988179882798837988479885798867988779888798897989079891798927989379894798957989679897798987989979900799017990279903799047990579906799077990879909799107991179912799137991479915799167991779918799197992079921799227992379924799257992679927799287992979930799317993279933799347993579936799377993879939799407994179942799437994479945799467994779948799497995079951799527995379954799557995679957799587995979960799617996279963799647996579966799677996879969799707997179972799737997479975799767997779978799797998079981799827998379984799857998679987799887998979990799917999279993799947999579996799977999879999800008000180002800038000480005800068000780008800098001080011800128001380014800158001680017800188001980020800218002280023800248002580026800278002880029800308003180032800338003480035800368003780038800398004080041800428004380044800458004680047800488004980050800518005280053800548005580056800578005880059800608006180062800638006480065800668006780068800698007080071800728007380074800758007680077800788007980080800818008280083800848008580086800878008880089800908009180092800938009480095800968009780098800998010080101801028010380104801058010680107801088010980110801118011280113801148011580116801178011880119801208012180122801238012480125801268012780128801298013080131801328013380134801358013680137801388013980140801418014280143801448014580146801478014880149801508015180152801538015480155801568015780158801598016080161801628016380164801658016680167801688016980170801718017280173801748017580176801778017880179801808018180182801838018480185801868018780188801898019080191801928019380194801958019680197801988019980200802018020280203802048020580206802078020880209802108021180212802138021480215802168021780218802198022080221802228022380224802258022680227802288022980230802318023280233802348023580236802378023880239802408024180242802438024480245802468024780248802498025080251802528025380254802558025680257802588025980260802618026280263802648026580266802678026880269802708027180272802738027480275802768027780278802798028080281802828028380284802858028680287802888028980290802918029280293802948029580296802978029880299803008030180302803038030480305803068030780308803098031080311803128031380314803158031680317803188031980320803218032280323803248032580326803278032880329803308033180332803338033480335803368033780338803398034080341803428034380344803458034680347803488034980350803518035280353803548035580356803578035880359803608036180362803638036480365803668036780368803698037080371803728037380374803758037680377803788037980380803818038280383803848038580386803878038880389803908039180392803938039480395803968039780398803998040080401804028040380404804058040680407804088040980410804118041280413804148041580416804178041880419804208042180422804238042480425804268042780428804298043080431804328043380434804358043680437804388043980440804418044280443804448044580446804478044880449804508045180452804538045480455804568045780458804598046080461804628046380464804658046680467804688046980470804718047280473804748047580476804778047880479804808048180482804838048480485804868048780488804898049080491804928049380494804958049680497804988049980500805018050280503805048050580506805078050880509805108051180512805138051480515805168051780518805198052080521805228052380524805258052680527805288052980530805318053280533805348053580536805378053880539805408054180542805438054480545805468054780548805498055080551805528055380554805558055680557805588055980560805618056280563805648056580566805678056880569805708057180572805738057480575805768057780578805798058080581805828058380584805858058680587805888058980590805918059280593805948059580596805978059880599806008060180602806038060480605806068060780608806098061080611806128061380614806158061680617806188061980620806218062280623806248062580626806278062880629806308063180632806338063480635806368063780638806398064080641806428064380644806458064680647806488064980650806518065280653806548065580656806578065880659806608066180662806638066480665806668066780668806698067080671806728067380674806758067680677806788067980680806818068280683806848068580686806878068880689806908069180692806938069480695806968069780698806998070080701807028070380704807058070680707807088070980710807118071280713807148071580716807178071880719807208072180722807238072480725807268072780728807298073080731807328073380734807358073680737807388073980740807418074280743807448074580746807478074880749807508075180752807538075480755807568075780758807598076080761807628076380764807658076680767807688076980770807718077280773807748077580776807778077880779807808078180782807838078480785807868078780788807898079080791807928079380794807958079680797807988079980800808018080280803808048080580806808078080880809808108081180812808138081480815808168081780818808198082080821808228082380824808258082680827808288082980830808318083280833808348083580836808378083880839808408084180842808438084480845808468084780848808498085080851808528085380854808558085680857808588085980860808618086280863808648086580866808678086880869808708087180872808738087480875808768087780878808798088080881808828088380884808858088680887808888088980890808918089280893808948089580896808978089880899809008090180902809038090480905809068090780908809098091080911809128091380914809158091680917809188091980920809218092280923809248092580926809278092880929809308093180932809338093480935809368093780938809398094080941809428094380944809458094680947809488094980950809518095280953809548095580956809578095880959809608096180962809638096480965809668096780968809698097080971809728097380974809758097680977809788097980980809818098280983809848098580986809878098880989809908099180992809938099480995809968099780998809998100081001810028100381004810058100681007810088100981010810118101281013810148101581016810178101881019810208102181022810238102481025810268102781028810298103081031810328103381034810358103681037810388103981040810418104281043810448104581046810478104881049810508105181052810538105481055810568105781058810598106081061810628106381064810658106681067810688106981070810718107281073810748107581076810778107881079810808108181082810838108481085810868108781088810898109081091810928109381094810958109681097810988109981100811018110281103811048110581106811078110881109811108111181112811138111481115811168111781118811198112081121811228112381124811258112681127811288112981130811318113281133811348113581136811378113881139811408114181142811438114481145811468114781148811498115081151811528115381154811558115681157811588115981160811618116281163811648116581166811678116881169811708117181172811738117481175811768117781178811798118081181811828118381184811858118681187811888118981190811918119281193811948119581196811978119881199812008120181202812038120481205812068120781208812098121081211812128121381214812158121681217812188121981220812218122281223812248122581226812278122881229812308123181232812338123481235812368123781238812398124081241812428124381244812458124681247812488124981250812518125281253812548125581256812578125881259812608126181262812638126481265812668126781268812698127081271812728127381274812758127681277812788127981280812818128281283812848128581286812878128881289812908129181292812938129481295812968129781298812998130081301813028130381304813058130681307813088130981310813118131281313813148131581316813178131881319813208132181322813238132481325813268132781328813298133081331813328133381334813358133681337813388133981340813418134281343813448134581346813478134881349813508135181352813538135481355813568135781358813598136081361813628136381364813658136681367813688136981370813718137281373813748137581376813778137881379813808138181382813838138481385813868138781388813898139081391813928139381394813958139681397813988139981400814018140281403814048140581406814078140881409814108141181412814138141481415814168141781418814198142081421814228142381424814258142681427814288142981430814318143281433814348143581436814378143881439814408144181442814438144481445814468144781448814498145081451814528145381454814558145681457814588145981460814618146281463814648146581466814678146881469814708147181472814738147481475814768147781478814798148081481814828148381484814858148681487814888148981490814918149281493814948149581496814978149881499815008150181502815038150481505815068150781508815098151081511815128151381514815158151681517815188151981520815218152281523815248152581526815278152881529815308153181532815338153481535815368153781538815398154081541815428154381544815458154681547815488154981550815518155281553815548155581556815578155881559815608156181562815638156481565815668156781568815698157081571815728157381574815758157681577815788157981580815818158281583815848158581586815878158881589815908159181592815938159481595815968159781598815998160081601816028160381604816058160681607816088160981610816118161281613816148161581616816178161881619816208162181622816238162481625816268162781628816298163081631816328163381634816358163681637816388163981640816418164281643816448164581646816478164881649816508165181652816538165481655816568165781658816598166081661816628166381664816658166681667816688166981670816718167281673816748167581676816778167881679816808168181682816838168481685816868168781688816898169081691816928169381694816958169681697816988169981700817018170281703817048170581706817078170881709817108171181712817138171481715817168171781718817198172081721817228172381724817258172681727817288172981730817318173281733817348173581736817378173881739817408174181742817438174481745817468174781748817498175081751817528175381754817558175681757817588175981760817618176281763817648176581766817678176881769817708177181772817738177481775817768177781778817798178081781817828178381784817858178681787817888178981790817918179281793817948179581796817978179881799818008180181802818038180481805818068180781808818098181081811818128181381814818158181681817818188181981820818218182281823818248182581826818278182881829818308183181832818338183481835818368183781838818398184081841818428184381844818458184681847818488184981850818518185281853818548185581856818578185881859818608186181862818638186481865818668186781868818698187081871818728187381874818758187681877818788187981880818818188281883818848188581886818878188881889818908189181892818938189481895818968189781898818998190081901819028190381904819058190681907819088190981910819118191281913819148191581916819178191881919819208192181922819238192481925819268192781928819298193081931819328193381934819358193681937819388193981940819418194281943819448194581946819478194881949819508195181952819538195481955819568195781958819598196081961819628196381964819658196681967819688196981970819718197281973819748197581976819778197881979819808198181982819838198481985819868198781988819898199081991819928199381994819958199681997819988199982000820018200282003820048200582006820078200882009820108201182012820138201482015820168201782018820198202082021820228202382024820258202682027820288202982030820318203282033820348203582036820378203882039820408204182042820438204482045820468204782048820498205082051820528205382054820558205682057820588205982060820618206282063820648206582066820678206882069820708207182072820738207482075820768207782078820798208082081820828208382084820858208682087820888208982090820918209282093820948209582096820978209882099821008210182102821038210482105821068210782108821098211082111821128211382114821158211682117821188211982120821218212282123821248212582126821278212882129821308213182132821338213482135821368213782138821398214082141821428214382144821458214682147821488214982150821518215282153821548215582156821578215882159821608216182162821638216482165821668216782168821698217082171821728217382174821758217682177821788217982180821818218282183821848218582186821878218882189821908219182192821938219482195821968219782198821998220082201822028220382204822058220682207822088220982210822118221282213822148221582216822178221882219822208222182222822238222482225822268222782228822298223082231822328223382234822358223682237822388223982240822418224282243822448224582246822478224882249822508225182252822538225482255822568225782258822598226082261822628226382264822658226682267822688226982270822718227282273822748227582276822778227882279822808228182282822838228482285822868228782288822898229082291822928229382294822958229682297822988229982300823018230282303823048230582306823078230882309823108231182312823138231482315823168231782318823198232082321823228232382324823258232682327823288232982330823318233282333823348233582336823378233882339823408234182342823438234482345823468234782348823498235082351823528235382354823558235682357823588235982360823618236282363823648236582366823678236882369823708237182372823738237482375823768237782378823798238082381823828238382384823858238682387823888238982390823918239282393823948239582396823978239882399824008240182402824038240482405824068240782408824098241082411824128241382414824158241682417824188241982420824218242282423824248242582426824278242882429824308243182432824338243482435824368243782438824398244082441824428244382444824458244682447824488244982450824518245282453824548245582456824578245882459824608246182462824638246482465824668246782468824698247082471824728247382474824758247682477824788247982480824818248282483824848248582486824878248882489824908249182492824938249482495824968249782498824998250082501825028250382504825058250682507825088250982510825118251282513825148251582516825178251882519825208252182522825238252482525825268252782528825298253082531825328253382534825358253682537825388253982540825418254282543825448254582546825478254882549825508255182552825538255482555825568255782558825598256082561825628256382564825658256682567825688256982570825718257282573825748257582576825778257882579825808258182582825838258482585825868258782588825898259082591825928259382594825958259682597825988259982600826018260282603826048260582606826078260882609826108261182612826138261482615826168261782618826198262082621826228262382624826258262682627826288262982630826318263282633826348263582636826378263882639826408264182642826438264482645826468264782648826498265082651826528265382654826558265682657826588265982660826618266282663826648266582666826678266882669826708267182672826738267482675826768267782678826798268082681826828268382684826858268682687826888268982690826918269282693826948269582696826978269882699827008270182702827038270482705827068270782708827098271082711827128271382714827158271682717827188271982720827218272282723827248272582726827278272882729827308273182732827338273482735827368273782738827398274082741827428274382744827458274682747827488274982750827518275282753827548275582756827578275882759827608276182762827638276482765827668276782768827698277082771827728277382774827758277682777827788277982780827818278282783827848278582786827878278882789827908279182792827938279482795827968279782798827998280082801828028280382804828058280682807828088280982810828118281282813828148281582816828178281882819828208282182822828238282482825828268282782828828298283082831828328283382834828358283682837828388283982840828418284282843828448284582846828478284882849828508285182852828538285482855828568285782858828598286082861828628286382864828658286682867828688286982870828718287282873828748287582876828778287882879828808288182882828838288482885828868288782888828898289082891828928289382894828958289682897828988289982900829018290282903829048290582906829078290882909829108291182912829138291482915829168291782918829198292082921829228292382924829258292682927829288292982930829318293282933829348293582936829378293882939829408294182942829438294482945829468294782948829498295082951829528295382954829558295682957829588295982960829618296282963829648296582966829678296882969829708297182972829738297482975829768297782978829798298082981829828298382984829858298682987829888298982990829918299282993829948299582996829978299882999830008300183002830038300483005830068300783008830098301083011830128301383014830158301683017830188301983020830218302283023830248302583026830278302883029830308303183032830338303483035830368303783038830398304083041830428304383044830458304683047830488304983050830518305283053830548305583056830578305883059830608306183062830638306483065830668306783068830698307083071830728307383074830758307683077830788307983080830818308283083830848308583086830878308883089830908309183092830938309483095830968309783098830998310083101831028310383104831058310683107831088310983110831118311283113831148311583116831178311883119831208312183122831238312483125831268312783128831298313083131831328313383134831358313683137831388313983140831418314283143831448314583146831478314883149831508315183152831538315483155831568315783158831598316083161831628316383164831658316683167831688316983170831718317283173831748317583176831778317883179831808318183182831838318483185831868318783188831898319083191831928319383194831958319683197831988319983200832018320283203832048320583206832078320883209832108321183212832138321483215832168321783218832198322083221832228322383224832258322683227832288322983230832318323283233832348323583236832378323883239832408324183242832438324483245832468324783248832498325083251832528325383254832558325683257832588325983260832618326283263832648326583266832678326883269832708327183272832738327483275832768327783278832798328083281832828328383284832858328683287832888328983290832918329283293832948329583296832978329883299833008330183302833038330483305833068330783308833098331083311833128331383314833158331683317833188331983320833218332283323833248332583326833278332883329833308333183332833338333483335833368333783338833398334083341833428334383344833458334683347833488334983350833518335283353833548335583356833578335883359833608336183362833638336483365833668336783368833698337083371833728337383374833758337683377833788337983380833818338283383833848338583386833878338883389833908339183392833938339483395833968339783398833998340083401834028340383404834058340683407834088340983410834118341283413834148341583416834178341883419834208342183422834238342483425834268342783428834298343083431834328343383434834358343683437834388343983440834418344283443834448344583446834478344883449834508345183452834538345483455834568345783458834598346083461834628346383464834658346683467834688346983470834718347283473834748347583476834778347883479834808348183482834838348483485834868348783488834898349083491834928349383494834958349683497834988349983500835018350283503835048350583506835078350883509835108351183512835138351483515835168351783518835198352083521835228352383524835258352683527835288352983530835318353283533835348353583536835378353883539835408354183542835438354483545835468354783548835498355083551835528355383554835558355683557835588355983560835618356283563835648356583566835678356883569835708357183572835738357483575835768357783578835798358083581835828358383584835858358683587835888358983590835918359283593835948359583596835978359883599836008360183602836038360483605836068360783608836098361083611836128361383614836158361683617836188361983620836218362283623836248362583626836278362883629836308363183632836338363483635836368363783638836398364083641836428364383644836458364683647836488364983650836518365283653836548365583656836578365883659836608366183662836638366483665836668366783668836698367083671836728367383674836758367683677836788367983680836818368283683836848368583686836878368883689836908369183692836938369483695836968369783698836998370083701837028370383704837058370683707837088370983710837118371283713837148371583716837178371883719837208372183722837238372483725837268372783728837298373083731837328373383734837358373683737837388373983740837418374283743837448374583746837478374883749837508375183752837538375483755837568375783758837598376083761837628376383764837658376683767837688376983770837718377283773837748377583776837778377883779837808378183782837838378483785837868378783788837898379083791837928379383794837958379683797837988379983800838018380283803838048380583806838078380883809838108381183812838138381483815838168381783818838198382083821838228382383824838258382683827838288382983830838318383283833838348383583836838378383883839838408384183842838438384483845838468384783848838498385083851838528385383854838558385683857838588385983860838618386283863838648386583866838678386883869838708387183872838738387483875838768387783878838798388083881838828388383884838858388683887838888388983890838918389283893838948389583896838978389883899839008390183902839038390483905839068390783908839098391083911839128391383914839158391683917839188391983920839218392283923839248392583926839278392883929839308393183932839338393483935839368393783938839398394083941839428394383944839458394683947839488394983950839518395283953839548395583956839578395883959839608396183962839638396483965839668396783968839698397083971839728397383974839758397683977839788397983980839818398283983839848398583986839878398883989839908399183992839938399483995839968399783998839998400084001840028400384004840058400684007840088400984010840118401284013840148401584016840178401884019840208402184022840238402484025840268402784028840298403084031840328403384034840358403684037840388403984040840418404284043840448404584046840478404884049840508405184052840538405484055840568405784058840598406084061840628406384064840658406684067840688406984070840718407284073840748407584076840778407884079840808408184082840838408484085840868408784088840898409084091840928409384094840958409684097840988409984100841018410284103841048410584106841078410884109841108411184112841138411484115841168411784118841198412084121841228412384124841258412684127841288412984130841318413284133841348413584136841378413884139841408414184142841438414484145841468414784148841498415084151841528415384154841558415684157841588415984160841618416284163841648416584166841678416884169841708417184172841738417484175841768417784178841798418084181841828418384184841858418684187841888418984190841918419284193841948419584196841978419884199842008420184202842038420484205842068420784208842098421084211842128421384214842158421684217842188421984220842218422284223842248422584226842278422884229842308423184232842338423484235842368423784238842398424084241842428424384244842458424684247842488424984250842518425284253842548425584256842578425884259842608426184262842638426484265842668426784268842698427084271842728427384274842758427684277842788427984280842818428284283842848428584286842878428884289842908429184292842938429484295842968429784298842998430084301843028430384304843058430684307843088430984310843118431284313843148431584316843178431884319843208432184322843238432484325843268432784328843298433084331843328433384334843358433684337843388433984340843418434284343843448434584346843478434884349843508435184352843538435484355843568435784358843598436084361843628436384364843658436684367843688436984370843718437284373843748437584376843778437884379843808438184382843838438484385843868438784388843898439084391843928439384394843958439684397843988439984400844018440284403844048440584406844078440884409844108441184412844138441484415844168441784418844198442084421844228442384424844258442684427844288442984430844318443284433844348443584436844378443884439844408444184442844438444484445844468444784448844498445084451844528445384454844558445684457844588445984460844618446284463844648446584466844678446884469844708447184472844738447484475844768447784478844798448084481844828448384484844858448684487844888448984490844918449284493844948449584496844978449884499845008450184502845038450484505845068450784508845098451084511845128451384514845158451684517845188451984520845218452284523845248452584526845278452884529845308453184532845338453484535845368453784538845398454084541845428454384544845458454684547845488454984550845518455284553845548455584556845578455884559845608456184562845638456484565845668456784568845698457084571845728457384574845758457684577845788457984580845818458284583845848458584586845878458884589845908459184592845938459484595845968459784598845998460084601846028460384604846058460684607846088460984610846118461284613846148461584616846178461884619846208462184622846238462484625846268462784628846298463084631846328463384634846358463684637846388463984640846418464284643846448464584646846478464884649846508465184652846538465484655846568465784658846598466084661846628466384664846658466684667846688466984670846718467284673846748467584676846778467884679846808468184682846838468484685846868468784688846898469084691846928469384694846958469684697846988469984700847018470284703847048470584706847078470884709847108471184712847138471484715847168471784718847198472084721847228472384724847258472684727847288472984730847318473284733847348473584736847378473884739847408474184742847438474484745847468474784748847498475084751847528475384754847558475684757847588475984760847618476284763847648476584766847678476884769847708477184772847738477484775847768477784778847798478084781847828478384784847858478684787847888478984790847918479284793847948479584796847978479884799848008480184802848038480484805848068480784808848098481084811848128481384814848158481684817848188481984820848218482284823848248482584826848278482884829848308483184832848338483484835848368483784838848398484084841848428484384844848458484684847848488484984850848518485284853848548485584856848578485884859848608486184862848638486484865848668486784868848698487084871848728487384874848758487684877848788487984880848818488284883848848488584886848878488884889848908489184892848938489484895848968489784898848998490084901849028490384904849058490684907849088490984910849118491284913849148491584916849178491884919849208492184922849238492484925849268492784928849298493084931849328493384934849358493684937849388493984940849418494284943849448494584946849478494884949849508495184952849538495484955849568495784958849598496084961849628496384964849658496684967849688496984970849718497284973849748497584976849778497884979849808498184982849838498484985849868498784988849898499084991849928499384994849958499684997849988499985000850018500285003850048500585006850078500885009850108501185012850138501485015850168501785018850198502085021850228502385024850258502685027850288502985030850318503285033850348503585036850378503885039850408504185042850438504485045850468504785048850498505085051850528505385054850558505685057850588505985060850618506285063850648506585066850678506885069850708507185072850738507485075850768507785078850798508085081850828508385084850858508685087850888508985090850918509285093850948509585096850978509885099851008510185102851038510485105851068510785108851098511085111851128511385114851158511685117851188511985120851218512285123851248512585126851278512885129851308513185132851338513485135851368513785138851398514085141851428514385144851458514685147851488514985150851518515285153851548515585156851578515885159851608516185162851638516485165851668516785168851698517085171851728517385174851758517685177851788517985180851818518285183851848518585186851878518885189851908519185192851938519485195851968519785198851998520085201852028520385204852058520685207852088520985210852118521285213852148521585216852178521885219852208522185222852238522485225852268522785228852298523085231852328523385234852358523685237852388523985240852418524285243852448524585246852478524885249852508525185252852538525485255852568525785258852598526085261852628526385264852658526685267852688526985270852718527285273852748527585276852778527885279852808528185282852838528485285852868528785288852898529085291852928529385294852958529685297852988529985300853018530285303853048530585306853078530885309853108531185312853138531485315853168531785318853198532085321853228532385324853258532685327853288532985330853318533285333853348533585336853378533885339853408534185342853438534485345853468534785348853498535085351853528535385354853558535685357853588535985360853618536285363853648536585366853678536885369853708537185372853738537485375853768537785378853798538085381853828538385384853858538685387853888538985390853918539285393853948539585396853978539885399854008540185402854038540485405854068540785408854098541085411854128541385414854158541685417854188541985420854218542285423854248542585426854278542885429854308543185432854338543485435854368543785438854398544085441854428544385444854458544685447854488544985450854518545285453854548545585456854578545885459854608546185462854638546485465854668546785468854698547085471854728547385474854758547685477854788547985480854818548285483854848548585486854878548885489854908549185492854938549485495854968549785498854998550085501855028550385504855058550685507855088550985510855118551285513855148551585516855178551885519855208552185522855238552485525855268552785528855298553085531855328553385534855358553685537855388553985540855418554285543855448554585546855478554885549855508555185552855538555485555855568555785558855598556085561855628556385564855658556685567855688556985570855718557285573855748557585576855778557885579855808558185582855838558485585855868558785588855898559085591855928559385594855958559685597855988559985600856018560285603856048560585606856078560885609856108561185612856138561485615856168561785618856198562085621856228562385624856258562685627856288562985630856318563285633856348563585636856378563885639856408564185642856438564485645856468564785648856498565085651856528565385654856558565685657856588565985660856618566285663856648566585666856678566885669856708567185672856738567485675856768567785678856798568085681856828568385684856858568685687856888568985690856918569285693856948569585696856978569885699857008570185702857038570485705857068570785708857098571085711857128571385714857158571685717857188571985720857218572285723857248572585726857278572885729857308573185732857338573485735857368573785738857398574085741857428574385744857458574685747857488574985750857518575285753857548575585756857578575885759857608576185762857638576485765857668576785768857698577085771857728577385774857758577685777857788577985780857818578285783857848578585786857878578885789857908579185792857938579485795857968579785798857998580085801858028580385804858058580685807858088580985810858118581285813858148581585816858178581885819858208582185822858238582485825858268582785828858298583085831858328583385834858358583685837858388583985840858418584285843858448584585846858478584885849858508585185852858538585485855858568585785858858598586085861858628586385864858658586685867858688586985870858718587285873858748587585876858778587885879858808588185882858838588485885858868588785888858898589085891858928589385894858958589685897858988589985900859018590285903859048590585906859078590885909859108591185912859138591485915859168591785918859198592085921859228592385924859258592685927859288592985930859318593285933859348593585936859378593885939859408594185942859438594485945859468594785948859498595085951859528595385954859558595685957859588595985960859618596285963859648596585966859678596885969859708597185972859738597485975859768597785978859798598085981859828598385984859858598685987859888598985990859918599285993859948599585996859978599885999860008600186002860038600486005860068600786008860098601086011860128601386014860158601686017860188601986020860218602286023860248602586026860278602886029860308603186032860338603486035860368603786038860398604086041860428604386044860458604686047860488604986050860518605286053860548605586056860578605886059860608606186062860638606486065860668606786068860698607086071860728607386074860758607686077860788607986080860818608286083860848608586086860878608886089860908609186092860938609486095860968609786098860998610086101861028610386104861058610686107861088610986110861118611286113861148611586116861178611886119861208612186122861238612486125861268612786128861298613086131861328613386134861358613686137861388613986140861418614286143861448614586146861478614886149861508615186152861538615486155861568615786158861598616086161861628616386164861658616686167861688616986170861718617286173861748617586176861778617886179861808618186182861838618486185861868618786188861898619086191861928619386194861958619686197861988619986200862018620286203862048620586206862078620886209862108621186212862138621486215862168621786218862198622086221862228622386224862258622686227862288622986230862318623286233862348623586236862378623886239862408624186242862438624486245862468624786248862498625086251862528625386254862558625686257862588625986260862618626286263862648626586266862678626886269862708627186272862738627486275862768627786278862798628086281862828628386284862858628686287862888628986290862918629286293862948629586296862978629886299863008630186302863038630486305863068630786308863098631086311863128631386314863158631686317863188631986320863218632286323863248632586326863278632886329863308633186332863338633486335863368633786338863398634086341863428634386344863458634686347863488634986350863518635286353863548635586356863578635886359863608636186362863638636486365863668636786368863698637086371863728637386374863758637686377863788637986380863818638286383863848638586386863878638886389863908639186392863938639486395863968639786398863998640086401864028640386404864058640686407864088640986410864118641286413864148641586416864178641886419864208642186422864238642486425864268642786428864298643086431864328643386434864358643686437864388643986440864418644286443864448644586446864478644886449864508645186452864538645486455864568645786458864598646086461864628646386464864658646686467864688646986470864718647286473864748647586476864778647886479864808648186482864838648486485864868648786488864898649086491864928649386494864958649686497864988649986500865018650286503865048650586506865078650886509865108651186512865138651486515865168651786518865198652086521865228652386524865258652686527865288652986530865318653286533865348653586536865378653886539865408654186542865438654486545865468654786548865498655086551865528655386554865558655686557865588655986560865618656286563865648656586566865678656886569865708657186572865738657486575865768657786578865798658086581865828658386584865858658686587865888658986590865918659286593865948659586596865978659886599866008660186602866038660486605866068660786608866098661086611866128661386614866158661686617866188661986620866218662286623866248662586626866278662886629866308663186632866338663486635866368663786638866398664086641866428664386644866458664686647866488664986650866518665286653866548665586656866578665886659866608666186662866638666486665866668666786668866698667086671866728667386674866758667686677866788667986680866818668286683866848668586686866878668886689866908669186692866938669486695866968669786698866998670086701867028670386704867058670686707867088670986710867118671286713867148671586716867178671886719867208672186722867238672486725867268672786728867298673086731867328673386734867358673686737867388673986740867418674286743867448674586746867478674886749867508675186752867538675486755867568675786758867598676086761867628676386764867658676686767867688676986770867718677286773867748677586776867778677886779867808678186782867838678486785867868678786788867898679086791867928679386794867958679686797867988679986800868018680286803868048680586806868078680886809868108681186812868138681486815868168681786818868198682086821868228682386824868258682686827868288682986830868318683286833868348683586836868378683886839868408684186842868438684486845868468684786848868498685086851868528685386854868558685686857868588685986860868618686286863868648686586866868678686886869868708687186872868738687486875868768687786878868798688086881868828688386884868858688686887868888688986890868918689286893868948689586896868978689886899869008690186902869038690486905869068690786908869098691086911869128691386914869158691686917869188691986920869218692286923869248692586926869278692886929869308693186932869338693486935869368693786938869398694086941869428694386944869458694686947869488694986950869518695286953869548695586956869578695886959869608696186962869638696486965869668696786968869698697086971869728697386974869758697686977869788697986980869818698286983869848698586986869878698886989869908699186992869938699486995869968699786998869998700087001870028700387004870058700687007870088700987010870118701287013870148701587016870178701887019870208702187022870238702487025870268702787028870298703087031870328703387034870358703687037870388703987040870418704287043870448704587046870478704887049870508705187052870538705487055870568705787058870598706087061870628706387064870658706687067870688706987070870718707287073870748707587076870778707887079870808708187082870838708487085870868708787088870898709087091870928709387094870958709687097870988709987100871018710287103871048710587106871078710887109871108711187112871138711487115871168711787118871198712087121871228712387124871258712687127871288712987130871318713287133871348713587136871378713887139871408714187142871438714487145871468714787148871498715087151871528715387154871558715687157871588715987160871618716287163871648716587166871678716887169871708717187172871738717487175871768717787178871798718087181871828718387184871858718687187871888718987190871918719287193871948719587196871978719887199872008720187202872038720487205872068720787208872098721087211872128721387214872158721687217872188721987220872218722287223872248722587226872278722887229872308723187232872338723487235872368723787238872398724087241872428724387244872458724687247872488724987250872518725287253872548725587256872578725887259872608726187262872638726487265872668726787268872698727087271872728727387274872758727687277872788727987280872818728287283872848728587286872878728887289872908729187292872938729487295872968729787298872998730087301873028730387304873058730687307873088730987310873118731287313873148731587316873178731887319873208732187322873238732487325873268732787328873298733087331873328733387334873358733687337873388733987340873418734287343873448734587346873478734887349873508735187352873538735487355873568735787358873598736087361873628736387364873658736687367873688736987370873718737287373873748737587376873778737887379873808738187382873838738487385873868738787388873898739087391873928739387394873958739687397873988739987400874018740287403874048740587406874078740887409874108741187412874138741487415874168741787418874198742087421874228742387424874258742687427874288742987430874318743287433874348743587436874378743887439874408744187442874438744487445874468744787448874498745087451874528745387454874558745687457874588745987460874618746287463874648746587466874678746887469874708747187472874738747487475874768747787478874798748087481874828748387484874858748687487874888748987490874918749287493874948749587496874978749887499875008750187502875038750487505875068750787508875098751087511875128751387514875158751687517875188751987520875218752287523875248752587526875278752887529875308753187532875338753487535875368753787538875398754087541875428754387544875458754687547875488754987550875518755287553875548755587556875578755887559875608756187562875638756487565875668756787568875698757087571875728757387574875758757687577875788757987580875818758287583875848758587586875878758887589875908759187592875938759487595875968759787598875998760087601876028760387604876058760687607876088760987610876118761287613876148761587616876178761887619876208762187622876238762487625876268762787628876298763087631876328763387634876358763687637876388763987640876418764287643876448764587646876478764887649876508765187652876538765487655876568765787658876598766087661876628766387664876658766687667876688766987670876718767287673876748767587676876778767887679876808768187682876838768487685876868768787688876898769087691876928769387694876958769687697876988769987700877018770287703877048770587706877078770887709877108771187712877138771487715877168771787718877198772087721877228772387724877258772687727877288772987730877318773287733877348773587736877378773887739877408774187742877438774487745877468774787748877498775087751877528775387754877558775687757877588775987760877618776287763877648776587766877678776887769877708777187772877738777487775877768777787778877798778087781877828778387784877858778687787877888778987790877918779287793877948779587796877978779887799878008780187802878038780487805878068780787808878098781087811878128781387814878158781687817878188781987820878218782287823878248782587826878278782887829878308783187832878338783487835878368783787838878398784087841878428784387844878458784687847878488784987850878518785287853878548785587856878578785887859878608786187862878638786487865878668786787868878698787087871878728787387874878758787687877878788787987880878818788287883878848788587886878878788887889878908789187892878938789487895878968789787898878998790087901879028790387904879058790687907879088790987910879118791287913879148791587916879178791887919879208792187922879238792487925879268792787928879298793087931879328793387934879358793687937879388793987940879418794287943879448794587946879478794887949879508795187952879538795487955879568795787958879598796087961879628796387964879658796687967879688796987970879718797287973879748797587976879778797887979879808798187982879838798487985879868798787988879898799087991879928799387994879958799687997879988799988000880018800288003880048800588006880078800888009880108801188012880138801488015880168801788018880198802088021880228802388024880258802688027880288802988030880318803288033880348803588036880378803888039880408804188042880438804488045880468804788048880498805088051880528805388054880558805688057880588805988060880618806288063880648806588066880678806888069880708807188072880738807488075880768807788078880798808088081880828808388084880858808688087880888808988090880918809288093880948809588096880978809888099881008810188102881038810488105881068810788108881098811088111881128811388114881158811688117881188811988120881218812288123881248812588126881278812888129881308813188132881338813488135881368813788138881398814088141881428814388144881458814688147881488814988150881518815288153881548815588156881578815888159881608816188162881638816488165881668816788168881698817088171881728817388174881758817688177881788817988180881818818288183881848818588186881878818888189881908819188192881938819488195881968819788198881998820088201882028820388204882058820688207882088820988210882118821288213882148821588216882178821888219882208822188222882238822488225882268822788228882298823088231882328823388234882358823688237882388823988240882418824288243882448824588246882478824888249882508825188252882538825488255882568825788258882598826088261882628826388264882658826688267882688826988270882718827288273882748827588276882778827888279882808828188282882838828488285882868828788288882898829088291882928829388294882958829688297882988829988300883018830288303883048830588306883078830888309883108831188312883138831488315883168831788318883198832088321883228832388324883258832688327883288832988330883318833288333883348833588336883378833888339883408834188342883438834488345883468834788348883498835088351883528835388354883558835688357883588835988360883618836288363883648836588366883678836888369883708837188372883738837488375883768837788378883798838088381883828838388384883858838688387883888838988390883918839288393883948839588396883978839888399884008840188402884038840488405884068840788408884098841088411884128841388414884158841688417884188841988420884218842288423884248842588426884278842888429884308843188432884338843488435884368843788438884398844088441884428844388444884458844688447884488844988450884518845288453884548845588456884578845888459884608846188462884638846488465884668846788468884698847088471884728847388474884758847688477884788847988480884818848288483884848848588486884878848888489884908849188492884938849488495884968849788498884998850088501885028850388504885058850688507885088850988510885118851288513885148851588516885178851888519885208852188522885238852488525885268852788528885298853088531885328853388534885358853688537885388853988540885418854288543885448854588546885478854888549885508855188552885538855488555885568855788558885598856088561885628856388564885658856688567885688856988570885718857288573885748857588576885778857888579885808858188582885838858488585885868858788588885898859088591885928859388594885958859688597885988859988600886018860288603886048860588606886078860888609886108861188612886138861488615886168861788618886198862088621886228862388624886258862688627886288862988630886318863288633886348863588636886378863888639886408864188642886438864488645886468864788648886498865088651886528865388654886558865688657886588865988660886618866288663886648866588666886678866888669886708867188672886738867488675886768867788678886798868088681886828868388684886858868688687886888868988690886918869288693886948869588696886978869888699887008870188702887038870488705887068870788708887098871088711887128871388714887158871688717887188871988720887218872288723887248872588726887278872888729887308873188732887338873488735887368873788738887398874088741887428874388744887458874688747887488874988750887518875288753887548875588756887578875888759887608876188762887638876488765887668876788768887698877088771887728877388774887758877688777887788877988780887818878288783887848878588786887878878888789887908879188792887938879488795887968879788798887998880088801888028880388804888058880688807888088880988810888118881288813888148881588816888178881888819888208882188822888238882488825888268882788828888298883088831888328883388834888358883688837888388883988840888418884288843888448884588846888478884888849888508885188852888538885488855888568885788858888598886088861888628886388864888658886688867888688886988870888718887288873888748887588876888778887888879888808888188882888838888488885888868888788888888898889088891888928889388894888958889688897888988889988900889018890288903889048890588906889078890888909889108891188912889138891488915889168891788918889198892088921889228892388924889258892688927889288892988930889318893288933889348893588936889378893888939889408894188942889438894488945889468894788948889498895088951889528895388954889558895688957889588895988960889618896288963889648896588966889678896888969889708897188972889738897488975889768897788978889798898088981889828898388984889858898688987889888898988990889918899288993889948899588996889978899888999890008900189002890038900489005890068900789008890098901089011890128901389014890158901689017890188901989020890218902289023890248902589026890278902889029890308903189032890338903489035890368903789038890398904089041890428904389044890458904689047890488904989050890518905289053890548905589056890578905889059890608906189062890638906489065890668906789068890698907089071890728907389074890758907689077890788907989080890818908289083890848908589086890878908889089890908909189092890938909489095890968909789098890998910089101891028910389104891058910689107891088910989110891118911289113891148911589116891178911889119891208912189122891238912489125891268912789128891298913089131891328913389134891358913689137891388913989140891418914289143891448914589146891478914889149891508915189152891538915489155891568915789158891598916089161891628916389164891658916689167891688916989170891718917289173891748917589176891778917889179891808918189182891838918489185891868918789188891898919089191891928919389194891958919689197891988919989200892018920289203892048920589206892078920889209892108921189212892138921489215892168921789218892198922089221892228922389224892258922689227892288922989230892318923289233892348923589236892378923889239892408924189242892438924489245892468924789248892498925089251892528925389254892558925689257892588925989260892618926289263892648926589266892678926889269892708927189272892738927489275892768927789278892798928089281892828928389284892858928689287892888928989290892918929289293892948929589296892978929889299893008930189302893038930489305893068930789308893098931089311893128931389314893158931689317893188931989320893218932289323893248932589326893278932889329893308933189332893338933489335893368933789338893398934089341893428934389344893458934689347893488934989350893518935289353893548935589356893578935889359893608936189362893638936489365893668936789368893698937089371893728937389374893758937689377893788937989380893818938289383893848938589386893878938889389893908939189392893938939489395893968939789398893998940089401894028940389404894058940689407894088940989410894118941289413894148941589416894178941889419894208942189422894238942489425894268942789428894298943089431894328943389434894358943689437894388943989440894418944289443894448944589446894478944889449894508945189452894538945489455894568945789458894598946089461894628946389464894658946689467894688946989470894718947289473894748947589476894778947889479894808948189482894838948489485894868948789488894898949089491894928949389494894958949689497894988949989500895018950289503895048950589506895078950889509895108951189512895138951489515895168951789518895198952089521895228952389524895258952689527895288952989530895318953289533895348953589536895378953889539895408954189542895438954489545895468954789548895498955089551895528955389554895558955689557895588955989560895618956289563895648956589566895678956889569895708957189572895738957489575895768957789578895798958089581895828958389584895858958689587895888958989590895918959289593895948959589596895978959889599896008960189602896038960489605896068960789608896098961089611896128961389614896158961689617896188961989620896218962289623896248962589626896278962889629896308963189632896338963489635896368963789638896398964089641896428964389644896458964689647896488964989650896518965289653896548965589656896578965889659896608966189662896638966489665896668966789668896698967089671896728967389674896758967689677896788967989680896818968289683896848968589686896878968889689896908969189692896938969489695896968969789698896998970089701897028970389704897058970689707897088970989710897118971289713897148971589716897178971889719897208972189722897238972489725897268972789728897298973089731897328973389734897358973689737897388973989740897418974289743897448974589746897478974889749897508975189752897538975489755897568975789758897598976089761897628976389764897658976689767897688976989770897718977289773897748977589776897778977889779897808978189782897838978489785897868978789788897898979089791897928979389794897958979689797897988979989800898018980289803898048980589806898078980889809898108981189812898138981489815898168981789818898198982089821898228982389824898258982689827898288982989830898318983289833898348983589836898378983889839898408984189842898438984489845898468984789848898498985089851898528985389854898558985689857898588985989860898618986289863898648986589866898678986889869898708987189872898738987489875898768987789878898798988089881898828988389884898858988689887898888988989890898918989289893898948989589896898978989889899899008990189902899038990489905899068990789908899098991089911899128991389914899158991689917899188991989920899218992289923899248992589926899278992889929899308993189932899338993489935899368993789938899398994089941899428994389944899458994689947899488994989950899518995289953899548995589956899578995889959899608996189962899638996489965899668996789968899698997089971899728997389974899758997689977899788997989980899818998289983899848998589986899878998889989899908999189992899938999489995899968999789998899999000090001900029000390004900059000690007900089000990010900119001290013900149001590016900179001890019900209002190022900239002490025900269002790028900299003090031900329003390034900359003690037900389003990040900419004290043900449004590046900479004890049900509005190052900539005490055900569005790058900599006090061900629006390064900659006690067900689006990070900719007290073900749007590076900779007890079900809008190082900839008490085900869008790088900899009090091900929009390094900959009690097900989009990100901019010290103901049010590106901079010890109901109011190112901139011490115901169011790118901199012090121901229012390124901259012690127901289012990130901319013290133901349013590136901379013890139901409014190142901439014490145901469014790148901499015090151901529015390154901559015690157901589015990160901619016290163901649016590166901679016890169901709017190172901739017490175901769017790178901799018090181901829018390184901859018690187901889018990190901919019290193901949019590196901979019890199902009020190202902039020490205902069020790208902099021090211902129021390214902159021690217902189021990220902219022290223902249022590226902279022890229902309023190232902339023490235902369023790238902399024090241902429024390244902459024690247902489024990250902519025290253902549025590256902579025890259902609026190262902639026490265902669026790268902699027090271902729027390274902759027690277902789027990280902819028290283902849028590286902879028890289902909029190292902939029490295902969029790298902999030090301903029030390304903059030690307903089030990310903119031290313903149031590316903179031890319903209032190322903239032490325903269032790328903299033090331903329033390334903359033690337903389033990340903419034290343903449034590346903479034890349903509035190352903539035490355903569035790358903599036090361903629036390364903659036690367903689036990370903719037290373903749037590376903779037890379903809038190382903839038490385903869038790388903899039090391903929039390394903959039690397903989039990400904019040290403904049040590406904079040890409904109041190412904139041490415904169041790418904199042090421904229042390424904259042690427904289042990430904319043290433904349043590436904379043890439904409044190442904439044490445904469044790448904499045090451904529045390454904559045690457904589045990460904619046290463904649046590466904679046890469904709047190472904739047490475904769047790478904799048090481904829048390484904859048690487904889048990490904919049290493904949049590496904979049890499905009050190502905039050490505905069050790508905099051090511905129051390514905159051690517905189051990520905219052290523905249052590526905279052890529905309053190532905339053490535905369053790538905399054090541905429054390544905459054690547905489054990550905519055290553905549055590556905579055890559905609056190562905639056490565905669056790568905699057090571905729057390574905759057690577905789057990580905819058290583905849058590586905879058890589905909059190592905939059490595905969059790598905999060090601906029060390604906059060690607906089060990610906119061290613906149061590616906179061890619906209062190622906239062490625906269062790628906299063090631906329063390634906359063690637906389063990640906419064290643906449064590646906479064890649906509065190652906539065490655906569065790658906599066090661906629066390664906659066690667906689066990670906719067290673906749067590676906779067890679906809068190682906839068490685906869068790688906899069090691906929069390694906959069690697906989069990700907019070290703907049070590706907079070890709907109071190712907139071490715907169071790718907199072090721907229072390724907259072690727907289072990730907319073290733907349073590736907379073890739907409074190742907439074490745907469074790748907499075090751907529075390754907559075690757907589075990760907619076290763907649076590766907679076890769907709077190772907739077490775907769077790778907799078090781907829078390784907859078690787907889078990790907919079290793907949079590796907979079890799908009080190802908039080490805908069080790808908099081090811908129081390814908159081690817908189081990820908219082290823908249082590826908279082890829908309083190832908339083490835908369083790838908399084090841908429084390844908459084690847908489084990850908519085290853908549085590856908579085890859908609086190862908639086490865908669086790868908699087090871908729087390874908759087690877908789087990880908819088290883908849088590886908879088890889908909089190892908939089490895908969089790898908999090090901909029090390904909059090690907909089090990910909119091290913909149091590916909179091890919909209092190922909239092490925909269092790928909299093090931
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * JavaScript code in this page
  4. *
  5. * Copyright 2022 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. (function webpackUniversalModuleDefinition(root, factory) {
  23. if (typeof exports === "object" && typeof module === "object")
  24. module.exports = factory();
  25. else if (typeof define === "function" && define.amd)
  26. define("pdfjs-dist/build/pdf.worker", [], factory);
  27. else if (typeof exports === "object")
  28. exports["pdfjs-dist/build/pdf.worker"] = factory();
  29. else root["pdfjs-dist/build/pdf.worker"] = root.pdfjsWorker = factory();
  30. })(globalThis, () => {
  31. return /******/ (() => {
  32. // webpackBootstrap
  33. /******/ "use strict";
  34. /******/ var __webpack_modules__ = [
  35. ,
  36. /* 0 */ /* 1 */
  37. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38. Object.defineProperty(exports, "__esModule", {
  39. value: true,
  40. });
  41. exports.WorkerTask = exports.WorkerMessageHandler = void 0;
  42. var _util = __w_pdfjs_require__(2);
  43. var _primitives = __w_pdfjs_require__(5);
  44. var _core_utils = __w_pdfjs_require__(6);
  45. var _pdf_manager = __w_pdfjs_require__(8);
  46. var _cleanup_helper = __w_pdfjs_require__(71);
  47. var _writer = __w_pdfjs_require__(65);
  48. var _is_node = __w_pdfjs_require__(4);
  49. var _message_handler = __w_pdfjs_require__(102);
  50. var _worker_stream = __w_pdfjs_require__(103);
  51. class WorkerTask {
  52. constructor(name) {
  53. this.name = name;
  54. this.terminated = false;
  55. this._capability = (0, _util.createPromiseCapability)();
  56. }
  57. get finished() {
  58. return this._capability.promise;
  59. }
  60. finish() {
  61. this._capability.resolve();
  62. }
  63. terminate() {
  64. this.terminated = true;
  65. }
  66. ensureNotTerminated() {
  67. if (this.terminated) {
  68. throw new Error("Worker task was terminated");
  69. }
  70. }
  71. }
  72. exports.WorkerTask = WorkerTask;
  73. class WorkerMessageHandler {
  74. static setup(handler, port) {
  75. let testMessageProcessed = false;
  76. handler.on("test", function wphSetupTest(data) {
  77. if (testMessageProcessed) {
  78. return;
  79. }
  80. testMessageProcessed = true;
  81. handler.send("test", data instanceof Uint8Array);
  82. });
  83. handler.on("configure", function wphConfigure(data) {
  84. (0, _util.setVerbosityLevel)(data.verbosity);
  85. });
  86. handler.on("GetDocRequest", function wphSetupDoc(data) {
  87. return WorkerMessageHandler.createDocumentHandler(data, port);
  88. });
  89. }
  90. static createDocumentHandler(docParams, port) {
  91. let pdfManager;
  92. let terminated = false;
  93. let cancelXHRs = null;
  94. const WorkerTasks = [];
  95. const verbosity = (0, _util.getVerbosityLevel)();
  96. const apiVersion = docParams.apiVersion;
  97. const workerVersion = "2.16.105";
  98. if (apiVersion !== workerVersion) {
  99. throw new Error(
  100. `The API version "${apiVersion}" does not match ` +
  101. `the Worker version "${workerVersion}".`
  102. );
  103. }
  104. const enumerableProperties = [];
  105. for (const property in []) {
  106. enumerableProperties.push(property);
  107. }
  108. if (enumerableProperties.length) {
  109. throw new Error(
  110. "The `Array.prototype` contains unexpected enumerable properties: " +
  111. enumerableProperties.join(", ") +
  112. "; thus breaking e.g. `for...in` iteration of `Array`s."
  113. );
  114. }
  115. if (typeof ReadableStream === "undefined") {
  116. const partialMsg =
  117. "The browser/environment lacks native support for critical " +
  118. "functionality used by the PDF.js library (e.g. `ReadableStream`); ";
  119. if (_is_node.isNodeJS) {
  120. throw new Error(
  121. partialMsg + "please use a `legacy`-build instead."
  122. );
  123. }
  124. throw new Error(
  125. partialMsg + "please update to a supported browser."
  126. );
  127. }
  128. const docId = docParams.docId;
  129. const docBaseUrl = docParams.docBaseUrl;
  130. const workerHandlerName = docParams.docId + "_worker";
  131. let handler = new _message_handler.MessageHandler(
  132. workerHandlerName,
  133. docId,
  134. port
  135. );
  136. function ensureNotTerminated() {
  137. if (terminated) {
  138. throw new Error("Worker was terminated");
  139. }
  140. }
  141. function startWorkerTask(task) {
  142. WorkerTasks.push(task);
  143. }
  144. function finishWorkerTask(task) {
  145. task.finish();
  146. const i = WorkerTasks.indexOf(task);
  147. WorkerTasks.splice(i, 1);
  148. }
  149. async function loadDocument(recoveryMode) {
  150. await pdfManager.ensureDoc("checkHeader");
  151. await pdfManager.ensureDoc("parseStartXRef");
  152. await pdfManager.ensureDoc("parse", [recoveryMode]);
  153. await pdfManager.ensureDoc("checkFirstPage", [recoveryMode]);
  154. await pdfManager.ensureDoc("checkLastPage", [recoveryMode]);
  155. const isPureXfa = await pdfManager.ensureDoc("isPureXfa");
  156. if (isPureXfa) {
  157. const task = new WorkerTask("loadXfaFonts");
  158. startWorkerTask(task);
  159. await Promise.all([
  160. pdfManager
  161. .loadXfaFonts(handler, task)
  162. .catch((reason) => {})
  163. .then(() => finishWorkerTask(task)),
  164. pdfManager.loadXfaImages(),
  165. ]);
  166. }
  167. const [numPages, fingerprints] = await Promise.all([
  168. pdfManager.ensureDoc("numPages"),
  169. pdfManager.ensureDoc("fingerprints"),
  170. ]);
  171. const htmlForXfa = isPureXfa
  172. ? await pdfManager.ensureDoc("htmlForXfa")
  173. : null;
  174. return {
  175. numPages,
  176. fingerprints,
  177. htmlForXfa,
  178. };
  179. }
  180. function getPdfManager(data, evaluatorOptions, enableXfa) {
  181. const pdfManagerCapability = (0, _util.createPromiseCapability)();
  182. let newPdfManager;
  183. const source = data.source;
  184. if (source.data) {
  185. try {
  186. newPdfManager = new _pdf_manager.LocalPdfManager(
  187. docId,
  188. source.data,
  189. source.password,
  190. handler,
  191. evaluatorOptions,
  192. enableXfa,
  193. docBaseUrl
  194. );
  195. pdfManagerCapability.resolve(newPdfManager);
  196. } catch (ex) {
  197. pdfManagerCapability.reject(ex);
  198. }
  199. return pdfManagerCapability.promise;
  200. }
  201. let pdfStream,
  202. cachedChunks = [];
  203. try {
  204. pdfStream = new _worker_stream.PDFWorkerStream(handler);
  205. } catch (ex) {
  206. pdfManagerCapability.reject(ex);
  207. return pdfManagerCapability.promise;
  208. }
  209. const fullRequest = pdfStream.getFullReader();
  210. fullRequest.headersReady
  211. .then(function () {
  212. if (!fullRequest.isRangeSupported) {
  213. return;
  214. }
  215. const disableAutoFetch =
  216. source.disableAutoFetch || fullRequest.isStreamingSupported;
  217. newPdfManager = new _pdf_manager.NetworkPdfManager(
  218. docId,
  219. pdfStream,
  220. {
  221. msgHandler: handler,
  222. password: source.password,
  223. length: fullRequest.contentLength,
  224. disableAutoFetch,
  225. rangeChunkSize: source.rangeChunkSize,
  226. },
  227. evaluatorOptions,
  228. enableXfa,
  229. docBaseUrl
  230. );
  231. for (const chunk of cachedChunks) {
  232. newPdfManager.sendProgressiveData(chunk);
  233. }
  234. cachedChunks = [];
  235. pdfManagerCapability.resolve(newPdfManager);
  236. cancelXHRs = null;
  237. })
  238. .catch(function (reason) {
  239. pdfManagerCapability.reject(reason);
  240. cancelXHRs = null;
  241. });
  242. let loaded = 0;
  243. const flushChunks = function () {
  244. const pdfFile = (0, _util.arraysToBytes)(cachedChunks);
  245. if (source.length && pdfFile.length !== source.length) {
  246. (0, _util.warn)(
  247. "reported HTTP length is different from actual"
  248. );
  249. }
  250. try {
  251. newPdfManager = new _pdf_manager.LocalPdfManager(
  252. docId,
  253. pdfFile,
  254. source.password,
  255. handler,
  256. evaluatorOptions,
  257. enableXfa,
  258. docBaseUrl
  259. );
  260. pdfManagerCapability.resolve(newPdfManager);
  261. } catch (ex) {
  262. pdfManagerCapability.reject(ex);
  263. }
  264. cachedChunks = [];
  265. };
  266. const readPromise = new Promise(function (resolve, reject) {
  267. const readChunk = function ({ value, done }) {
  268. try {
  269. ensureNotTerminated();
  270. if (done) {
  271. if (!newPdfManager) {
  272. flushChunks();
  273. }
  274. cancelXHRs = null;
  275. return;
  276. }
  277. loaded += (0, _util.arrayByteLength)(value);
  278. if (!fullRequest.isStreamingSupported) {
  279. handler.send("DocProgress", {
  280. loaded,
  281. total: Math.max(loaded, fullRequest.contentLength || 0),
  282. });
  283. }
  284. if (newPdfManager) {
  285. newPdfManager.sendProgressiveData(value);
  286. } else {
  287. cachedChunks.push(value);
  288. }
  289. fullRequest.read().then(readChunk, reject);
  290. } catch (e) {
  291. reject(e);
  292. }
  293. };
  294. fullRequest.read().then(readChunk, reject);
  295. });
  296. readPromise.catch(function (e) {
  297. pdfManagerCapability.reject(e);
  298. cancelXHRs = null;
  299. });
  300. cancelXHRs = function (reason) {
  301. pdfStream.cancelAllRequests(reason);
  302. };
  303. return pdfManagerCapability.promise;
  304. }
  305. function setupDoc(data) {
  306. function onSuccess(doc) {
  307. ensureNotTerminated();
  308. handler.send("GetDoc", {
  309. pdfInfo: doc,
  310. });
  311. }
  312. function onFailure(ex) {
  313. ensureNotTerminated();
  314. if (ex instanceof _util.PasswordException) {
  315. const task = new WorkerTask(
  316. `PasswordException: response ${ex.code}`
  317. );
  318. startWorkerTask(task);
  319. handler
  320. .sendWithPromise("PasswordRequest", ex)
  321. .then(function ({ password }) {
  322. finishWorkerTask(task);
  323. pdfManager.updatePassword(password);
  324. pdfManagerReady();
  325. })
  326. .catch(function () {
  327. finishWorkerTask(task);
  328. handler.send("DocException", ex);
  329. });
  330. } else if (
  331. ex instanceof _util.InvalidPDFException ||
  332. ex instanceof _util.MissingPDFException ||
  333. ex instanceof _util.UnexpectedResponseException ||
  334. ex instanceof _util.UnknownErrorException
  335. ) {
  336. handler.send("DocException", ex);
  337. } else {
  338. handler.send(
  339. "DocException",
  340. new _util.UnknownErrorException(ex.message, ex.toString())
  341. );
  342. }
  343. }
  344. function pdfManagerReady() {
  345. ensureNotTerminated();
  346. loadDocument(false).then(onSuccess, function (reason) {
  347. ensureNotTerminated();
  348. if (!(reason instanceof _core_utils.XRefParseException)) {
  349. onFailure(reason);
  350. return;
  351. }
  352. pdfManager.requestLoadedStream();
  353. pdfManager.onLoadedStream().then(function () {
  354. ensureNotTerminated();
  355. loadDocument(true).then(onSuccess, onFailure);
  356. });
  357. });
  358. }
  359. ensureNotTerminated();
  360. const evaluatorOptions = {
  361. maxImageSize: data.maxImageSize,
  362. disableFontFace: data.disableFontFace,
  363. ignoreErrors: data.ignoreErrors,
  364. isEvalSupported: data.isEvalSupported,
  365. fontExtraProperties: data.fontExtraProperties,
  366. useSystemFonts: data.useSystemFonts,
  367. cMapUrl: data.cMapUrl,
  368. standardFontDataUrl: data.standardFontDataUrl,
  369. };
  370. getPdfManager(data, evaluatorOptions, data.enableXfa)
  371. .then(function (newPdfManager) {
  372. if (terminated) {
  373. newPdfManager.terminate(
  374. new _util.AbortException("Worker was terminated.")
  375. );
  376. throw new Error("Worker was terminated");
  377. }
  378. pdfManager = newPdfManager;
  379. pdfManager.onLoadedStream().then(function (stream) {
  380. handler.send("DataLoaded", {
  381. length: stream.bytes.byteLength,
  382. });
  383. });
  384. })
  385. .then(pdfManagerReady, onFailure);
  386. }
  387. handler.on("GetPage", function wphSetupGetPage(data) {
  388. return pdfManager.getPage(data.pageIndex).then(function (page) {
  389. return Promise.all([
  390. pdfManager.ensure(page, "rotate"),
  391. pdfManager.ensure(page, "ref"),
  392. pdfManager.ensure(page, "userUnit"),
  393. pdfManager.ensure(page, "view"),
  394. ]).then(function ([rotate, ref, userUnit, view]) {
  395. return {
  396. rotate,
  397. ref,
  398. userUnit,
  399. view,
  400. };
  401. });
  402. });
  403. });
  404. handler.on("GetPageIndex", function wphSetupGetPageIndex(data) {
  405. const pageRef = _primitives.Ref.get(data.num, data.gen);
  406. return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  407. });
  408. handler.on(
  409. "GetDestinations",
  410. function wphSetupGetDestinations(data) {
  411. return pdfManager.ensureCatalog("destinations");
  412. }
  413. );
  414. handler.on("GetDestination", function wphSetupGetDestination(data) {
  415. return pdfManager.ensureCatalog("getDestination", [data.id]);
  416. });
  417. handler.on("GetPageLabels", function wphSetupGetPageLabels(data) {
  418. return pdfManager.ensureCatalog("pageLabels");
  419. });
  420. handler.on("GetPageLayout", function wphSetupGetPageLayout(data) {
  421. return pdfManager.ensureCatalog("pageLayout");
  422. });
  423. handler.on("GetPageMode", function wphSetupGetPageMode(data) {
  424. return pdfManager.ensureCatalog("pageMode");
  425. });
  426. handler.on("GetViewerPreferences", function (data) {
  427. return pdfManager.ensureCatalog("viewerPreferences");
  428. });
  429. handler.on("GetOpenAction", function (data) {
  430. return pdfManager.ensureCatalog("openAction");
  431. });
  432. handler.on("GetAttachments", function wphSetupGetAttachments(data) {
  433. return pdfManager.ensureCatalog("attachments");
  434. });
  435. handler.on("GetJavaScript", function wphSetupGetJavaScript(data) {
  436. return pdfManager.ensureCatalog("javaScript");
  437. });
  438. handler.on(
  439. "GetDocJSActions",
  440. function wphSetupGetDocJSActions(data) {
  441. return pdfManager.ensureCatalog("jsActions");
  442. }
  443. );
  444. handler.on("GetPageJSActions", function ({ pageIndex }) {
  445. return pdfManager.getPage(pageIndex).then(function (page) {
  446. return pdfManager.ensure(page, "jsActions");
  447. });
  448. });
  449. handler.on("GetOutline", function wphSetupGetOutline(data) {
  450. return pdfManager.ensureCatalog("documentOutline");
  451. });
  452. handler.on("GetOptionalContentConfig", function (data) {
  453. return pdfManager.ensureCatalog("optionalContentConfig");
  454. });
  455. handler.on("GetPermissions", function (data) {
  456. return pdfManager.ensureCatalog("permissions");
  457. });
  458. handler.on("GetMetadata", function wphSetupGetMetadata(data) {
  459. return Promise.all([
  460. pdfManager.ensureDoc("documentInfo"),
  461. pdfManager.ensureCatalog("metadata"),
  462. ]);
  463. });
  464. handler.on("GetMarkInfo", function wphSetupGetMarkInfo(data) {
  465. return pdfManager.ensureCatalog("markInfo");
  466. });
  467. handler.on("GetData", function wphSetupGetData(data) {
  468. pdfManager.requestLoadedStream();
  469. return pdfManager.onLoadedStream().then(function (stream) {
  470. return stream.bytes;
  471. });
  472. });
  473. handler.on("GetAnnotations", function ({ pageIndex, intent }) {
  474. return pdfManager.getPage(pageIndex).then(function (page) {
  475. const task = new WorkerTask(
  476. `GetAnnotations: page ${pageIndex}`
  477. );
  478. startWorkerTask(task);
  479. return page.getAnnotationsData(handler, task, intent).then(
  480. (data) => {
  481. finishWorkerTask(task);
  482. return data;
  483. },
  484. (reason) => {
  485. finishWorkerTask(task);
  486. }
  487. );
  488. });
  489. });
  490. handler.on("GetFieldObjects", function (data) {
  491. return pdfManager.ensureDoc("fieldObjects");
  492. });
  493. handler.on("HasJSActions", function (data) {
  494. return pdfManager.ensureDoc("hasJSActions");
  495. });
  496. handler.on("GetCalculationOrderIds", function (data) {
  497. return pdfManager.ensureDoc("calculationOrderIds");
  498. });
  499. handler.on(
  500. "SaveDocument",
  501. function ({ isPureXfa, numPages, annotationStorage, filename }) {
  502. pdfManager.requestLoadedStream();
  503. const newAnnotationsByPage = !isPureXfa
  504. ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage)
  505. : null;
  506. const promises = [
  507. pdfManager.onLoadedStream(),
  508. pdfManager.ensureCatalog("acroForm"),
  509. pdfManager.ensureCatalog("acroFormRef"),
  510. pdfManager.ensureDoc("xref"),
  511. pdfManager.ensureDoc("startXRef"),
  512. ];
  513. if (newAnnotationsByPage) {
  514. for (const [pageIndex, annotations] of newAnnotationsByPage) {
  515. promises.push(
  516. pdfManager.getPage(pageIndex).then((page) => {
  517. const task = new WorkerTask(
  518. `Save (editor): page ${pageIndex}`
  519. );
  520. return page
  521. .saveNewAnnotations(handler, task, annotations)
  522. .finally(function () {
  523. finishWorkerTask(task);
  524. });
  525. })
  526. );
  527. }
  528. }
  529. if (isPureXfa) {
  530. promises.push(pdfManager.serializeXfaData(annotationStorage));
  531. } else {
  532. for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
  533. promises.push(
  534. pdfManager.getPage(pageIndex).then(function (page) {
  535. const task = new WorkerTask(`Save: page ${pageIndex}`);
  536. return page
  537. .save(handler, task, annotationStorage)
  538. .finally(function () {
  539. finishWorkerTask(task);
  540. });
  541. })
  542. );
  543. }
  544. }
  545. return Promise.all(promises).then(function ([
  546. stream,
  547. acroForm,
  548. acroFormRef,
  549. xref,
  550. startXRef,
  551. ...refs
  552. ]) {
  553. let newRefs = [];
  554. let xfaData = null;
  555. if (isPureXfa) {
  556. xfaData = refs[0];
  557. if (!xfaData) {
  558. return stream.bytes;
  559. }
  560. } else {
  561. newRefs = refs.flat(2);
  562. if (newRefs.length === 0) {
  563. return stream.bytes;
  564. }
  565. }
  566. const xfa =
  567. (acroForm instanceof _primitives.Dict &&
  568. acroForm.get("XFA")) ||
  569. null;
  570. let xfaDatasetsRef = null;
  571. let hasXfaDatasetsEntry = false;
  572. if (Array.isArray(xfa)) {
  573. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  574. if (xfa[i] === "datasets") {
  575. xfaDatasetsRef = xfa[i + 1];
  576. acroFormRef = null;
  577. hasXfaDatasetsEntry = true;
  578. }
  579. }
  580. if (xfaDatasetsRef === null) {
  581. xfaDatasetsRef = xref.getNewRef();
  582. }
  583. } else if (xfa) {
  584. acroFormRef = null;
  585. (0, _util.warn)("Unsupported XFA type.");
  586. }
  587. let newXrefInfo = Object.create(null);
  588. if (xref.trailer) {
  589. const infoObj = Object.create(null);
  590. const xrefInfo = xref.trailer.get("Info") || null;
  591. if (xrefInfo instanceof _primitives.Dict) {
  592. xrefInfo.forEach((key, value) => {
  593. if (typeof value === "string") {
  594. infoObj[key] = (0, _util.stringToPDFString)(value);
  595. }
  596. });
  597. }
  598. newXrefInfo = {
  599. rootRef: xref.trailer.getRaw("Root") || null,
  600. encryptRef: xref.trailer.getRaw("Encrypt") || null,
  601. newRef: xref.getNewRef(),
  602. infoRef: xref.trailer.getRaw("Info") || null,
  603. info: infoObj,
  604. fileIds: xref.trailer.get("ID") || null,
  605. startXRef,
  606. filename,
  607. };
  608. }
  609. xref.resetNewRef();
  610. return (0, _writer.incrementalUpdate)({
  611. originalData: stream.bytes,
  612. xrefInfo: newXrefInfo,
  613. newRefs,
  614. xref,
  615. hasXfa: !!xfa,
  616. xfaDatasetsRef,
  617. hasXfaDatasetsEntry,
  618. acroFormRef,
  619. acroForm,
  620. xfaData,
  621. });
  622. });
  623. }
  624. );
  625. handler.on(
  626. "GetOperatorList",
  627. function wphSetupRenderPage(data, sink) {
  628. const pageIndex = data.pageIndex;
  629. pdfManager.getPage(pageIndex).then(function (page) {
  630. const task = new WorkerTask(
  631. `GetOperatorList: page ${pageIndex}`
  632. );
  633. startWorkerTask(task);
  634. const start =
  635. verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  636. page
  637. .getOperatorList({
  638. handler,
  639. sink,
  640. task,
  641. intent: data.intent,
  642. cacheKey: data.cacheKey,
  643. annotationStorage: data.annotationStorage,
  644. })
  645. .then(
  646. function (operatorListInfo) {
  647. finishWorkerTask(task);
  648. if (start) {
  649. (0, _util.info)(
  650. `page=${pageIndex + 1} - getOperatorList: time=` +
  651. `${Date.now() - start}ms, len=${
  652. operatorListInfo.length
  653. }`
  654. );
  655. }
  656. sink.close();
  657. },
  658. function (reason) {
  659. finishWorkerTask(task);
  660. if (task.terminated) {
  661. return;
  662. }
  663. handler.send("UnsupportedFeature", {
  664. featureId:
  665. _util.UNSUPPORTED_FEATURES.errorOperatorList,
  666. });
  667. sink.error(reason);
  668. }
  669. );
  670. });
  671. }
  672. );
  673. handler.on("GetTextContent", function wphExtractText(data, sink) {
  674. const pageIndex = data.pageIndex;
  675. pdfManager.getPage(pageIndex).then(function (page) {
  676. const task = new WorkerTask(
  677. "GetTextContent: page " + pageIndex
  678. );
  679. startWorkerTask(task);
  680. const start =
  681. verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  682. page
  683. .extractTextContent({
  684. handler,
  685. task,
  686. sink,
  687. includeMarkedContent: data.includeMarkedContent,
  688. combineTextItems: data.combineTextItems,
  689. })
  690. .then(
  691. function () {
  692. finishWorkerTask(task);
  693. if (start) {
  694. (0, _util.info)(
  695. `page=${pageIndex + 1} - getTextContent: time=` +
  696. `${Date.now() - start}ms`
  697. );
  698. }
  699. sink.close();
  700. },
  701. function (reason) {
  702. finishWorkerTask(task);
  703. if (task.terminated) {
  704. return;
  705. }
  706. sink.error(reason);
  707. }
  708. );
  709. });
  710. });
  711. handler.on("GetStructTree", function wphGetStructTree(data) {
  712. return pdfManager.getPage(data.pageIndex).then(function (page) {
  713. return pdfManager.ensure(page, "getStructTree");
  714. });
  715. });
  716. handler.on("FontFallback", function (data) {
  717. return pdfManager.fontFallback(data.id, handler);
  718. });
  719. handler.on("Cleanup", function wphCleanup(data) {
  720. return pdfManager.cleanup(true);
  721. });
  722. handler.on("Terminate", function wphTerminate(data) {
  723. terminated = true;
  724. const waitOn = [];
  725. if (pdfManager) {
  726. pdfManager.terminate(
  727. new _util.AbortException("Worker was terminated.")
  728. );
  729. const cleanupPromise = pdfManager.cleanup();
  730. waitOn.push(cleanupPromise);
  731. pdfManager = null;
  732. } else {
  733. (0, _cleanup_helper.clearGlobalCaches)();
  734. }
  735. if (cancelXHRs) {
  736. cancelXHRs(new _util.AbortException("Worker was terminated."));
  737. }
  738. for (const task of WorkerTasks) {
  739. waitOn.push(task.finished);
  740. task.terminate();
  741. }
  742. return Promise.all(waitOn).then(function () {
  743. handler.destroy();
  744. handler = null;
  745. });
  746. });
  747. handler.on("Ready", function wphReady(data) {
  748. setupDoc(docParams);
  749. docParams = null;
  750. });
  751. return workerHandlerName;
  752. }
  753. static initializeFromPort(port) {
  754. const handler = new _message_handler.MessageHandler(
  755. "worker",
  756. "main",
  757. port
  758. );
  759. WorkerMessageHandler.setup(handler, port);
  760. handler.send("ready", null);
  761. }
  762. }
  763. exports.WorkerMessageHandler = WorkerMessageHandler;
  764. function isMessagePort(maybePort) {
  765. return (
  766. typeof maybePort.postMessage === "function" &&
  767. "onmessage" in maybePort
  768. );
  769. }
  770. if (
  771. typeof window === "undefined" &&
  772. !_is_node.isNodeJS &&
  773. typeof self !== "undefined" &&
  774. isMessagePort(self)
  775. ) {
  776. WorkerMessageHandler.initializeFromPort(self);
  777. }
  778. /***/
  779. },
  780. /* 2 */
  781. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  782. Object.defineProperty(exports, "__esModule", {
  783. value: true,
  784. });
  785. exports.VerbosityLevel =
  786. exports.Util =
  787. exports.UnknownErrorException =
  788. exports.UnexpectedResponseException =
  789. exports.UNSUPPORTED_FEATURES =
  790. exports.TextRenderingMode =
  791. exports.StreamType =
  792. exports.RenderingIntentFlag =
  793. exports.PermissionFlag =
  794. exports.PasswordResponses =
  795. exports.PasswordException =
  796. exports.PageActionEventType =
  797. exports.OPS =
  798. exports.MissingPDFException =
  799. exports.LINE_FACTOR =
  800. exports.LINE_DESCENT_FACTOR =
  801. exports.InvalidPDFException =
  802. exports.ImageKind =
  803. exports.IDENTITY_MATRIX =
  804. exports.FormatError =
  805. exports.FontType =
  806. exports.FeatureTest =
  807. exports.FONT_IDENTITY_MATRIX =
  808. exports.DocumentActionEventType =
  809. exports.CMapCompressionType =
  810. exports.BaseException =
  811. exports.AnnotationType =
  812. exports.AnnotationStateModelType =
  813. exports.AnnotationReviewState =
  814. exports.AnnotationReplyType =
  815. exports.AnnotationMode =
  816. exports.AnnotationMarkedState =
  817. exports.AnnotationFlag =
  818. exports.AnnotationFieldFlag =
  819. exports.AnnotationEditorType =
  820. exports.AnnotationEditorPrefix =
  821. exports.AnnotationEditorParamsType =
  822. exports.AnnotationBorderStyleType =
  823. exports.AnnotationActionEventType =
  824. exports.AbortException =
  825. void 0;
  826. exports.arrayByteLength = arrayByteLength;
  827. exports.arraysToBytes = arraysToBytes;
  828. exports.assert = assert;
  829. exports.bytesToString = bytesToString;
  830. exports.createPromiseCapability = createPromiseCapability;
  831. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  832. exports.escapeString = escapeString;
  833. exports.getModificationDate = getModificationDate;
  834. exports.getVerbosityLevel = getVerbosityLevel;
  835. exports.info = info;
  836. exports.isArrayBuffer = isArrayBuffer;
  837. exports.isArrayEqual = isArrayEqual;
  838. exports.isAscii = isAscii;
  839. exports.objectFromMap = objectFromMap;
  840. exports.objectSize = objectSize;
  841. exports.setVerbosityLevel = setVerbosityLevel;
  842. exports.shadow = shadow;
  843. exports.string32 = string32;
  844. exports.stringToBytes = stringToBytes;
  845. exports.stringToPDFString = stringToPDFString;
  846. exports.stringToUTF16BEString = stringToUTF16BEString;
  847. exports.stringToUTF8String = stringToUTF8String;
  848. exports.unreachable = unreachable;
  849. exports.utf8StringToString = utf8StringToString;
  850. exports.warn = warn;
  851. __w_pdfjs_require__(3);
  852. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  853. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  854. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  855. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  856. const LINE_FACTOR = 1.35;
  857. exports.LINE_FACTOR = LINE_FACTOR;
  858. const LINE_DESCENT_FACTOR = 0.35;
  859. exports.LINE_DESCENT_FACTOR = LINE_DESCENT_FACTOR;
  860. const RenderingIntentFlag = {
  861. ANY: 0x01,
  862. DISPLAY: 0x02,
  863. PRINT: 0x04,
  864. ANNOTATIONS_FORMS: 0x10,
  865. ANNOTATIONS_STORAGE: 0x20,
  866. ANNOTATIONS_DISABLE: 0x40,
  867. OPLIST: 0x100,
  868. };
  869. exports.RenderingIntentFlag = RenderingIntentFlag;
  870. const AnnotationMode = {
  871. DISABLE: 0,
  872. ENABLE: 1,
  873. ENABLE_FORMS: 2,
  874. ENABLE_STORAGE: 3,
  875. };
  876. exports.AnnotationMode = AnnotationMode;
  877. const AnnotationEditorPrefix = "pdfjs_internal_editor_";
  878. exports.AnnotationEditorPrefix = AnnotationEditorPrefix;
  879. const AnnotationEditorType = {
  880. DISABLE: -1,
  881. NONE: 0,
  882. FREETEXT: 3,
  883. INK: 15,
  884. };
  885. exports.AnnotationEditorType = AnnotationEditorType;
  886. const AnnotationEditorParamsType = {
  887. FREETEXT_SIZE: 1,
  888. FREETEXT_COLOR: 2,
  889. FREETEXT_OPACITY: 3,
  890. INK_COLOR: 11,
  891. INK_THICKNESS: 12,
  892. INK_OPACITY: 13,
  893. };
  894. exports.AnnotationEditorParamsType = AnnotationEditorParamsType;
  895. const PermissionFlag = {
  896. PRINT: 0x04,
  897. MODIFY_CONTENTS: 0x08,
  898. COPY: 0x10,
  899. MODIFY_ANNOTATIONS: 0x20,
  900. FILL_INTERACTIVE_FORMS: 0x100,
  901. COPY_FOR_ACCESSIBILITY: 0x200,
  902. ASSEMBLE: 0x400,
  903. PRINT_HIGH_QUALITY: 0x800,
  904. };
  905. exports.PermissionFlag = PermissionFlag;
  906. const TextRenderingMode = {
  907. FILL: 0,
  908. STROKE: 1,
  909. FILL_STROKE: 2,
  910. INVISIBLE: 3,
  911. FILL_ADD_TO_PATH: 4,
  912. STROKE_ADD_TO_PATH: 5,
  913. FILL_STROKE_ADD_TO_PATH: 6,
  914. ADD_TO_PATH: 7,
  915. FILL_STROKE_MASK: 3,
  916. ADD_TO_PATH_FLAG: 4,
  917. };
  918. exports.TextRenderingMode = TextRenderingMode;
  919. const ImageKind = {
  920. GRAYSCALE_1BPP: 1,
  921. RGB_24BPP: 2,
  922. RGBA_32BPP: 3,
  923. };
  924. exports.ImageKind = ImageKind;
  925. const AnnotationType = {
  926. TEXT: 1,
  927. LINK: 2,
  928. FREETEXT: 3,
  929. LINE: 4,
  930. SQUARE: 5,
  931. CIRCLE: 6,
  932. POLYGON: 7,
  933. POLYLINE: 8,
  934. HIGHLIGHT: 9,
  935. UNDERLINE: 10,
  936. SQUIGGLY: 11,
  937. STRIKEOUT: 12,
  938. STAMP: 13,
  939. CARET: 14,
  940. INK: 15,
  941. POPUP: 16,
  942. FILEATTACHMENT: 17,
  943. SOUND: 18,
  944. MOVIE: 19,
  945. WIDGET: 20,
  946. SCREEN: 21,
  947. PRINTERMARK: 22,
  948. TRAPNET: 23,
  949. WATERMARK: 24,
  950. THREED: 25,
  951. REDACT: 26,
  952. };
  953. exports.AnnotationType = AnnotationType;
  954. const AnnotationStateModelType = {
  955. MARKED: "Marked",
  956. REVIEW: "Review",
  957. };
  958. exports.AnnotationStateModelType = AnnotationStateModelType;
  959. const AnnotationMarkedState = {
  960. MARKED: "Marked",
  961. UNMARKED: "Unmarked",
  962. };
  963. exports.AnnotationMarkedState = AnnotationMarkedState;
  964. const AnnotationReviewState = {
  965. ACCEPTED: "Accepted",
  966. REJECTED: "Rejected",
  967. CANCELLED: "Cancelled",
  968. COMPLETED: "Completed",
  969. NONE: "None",
  970. };
  971. exports.AnnotationReviewState = AnnotationReviewState;
  972. const AnnotationReplyType = {
  973. GROUP: "Group",
  974. REPLY: "R",
  975. };
  976. exports.AnnotationReplyType = AnnotationReplyType;
  977. const AnnotationFlag = {
  978. INVISIBLE: 0x01,
  979. HIDDEN: 0x02,
  980. PRINT: 0x04,
  981. NOZOOM: 0x08,
  982. NOROTATE: 0x10,
  983. NOVIEW: 0x20,
  984. READONLY: 0x40,
  985. LOCKED: 0x80,
  986. TOGGLENOVIEW: 0x100,
  987. LOCKEDCONTENTS: 0x200,
  988. };
  989. exports.AnnotationFlag = AnnotationFlag;
  990. const AnnotationFieldFlag = {
  991. READONLY: 0x0000001,
  992. REQUIRED: 0x0000002,
  993. NOEXPORT: 0x0000004,
  994. MULTILINE: 0x0001000,
  995. PASSWORD: 0x0002000,
  996. NOTOGGLETOOFF: 0x0004000,
  997. RADIO: 0x0008000,
  998. PUSHBUTTON: 0x0010000,
  999. COMBO: 0x0020000,
  1000. EDIT: 0x0040000,
  1001. SORT: 0x0080000,
  1002. FILESELECT: 0x0100000,
  1003. MULTISELECT: 0x0200000,
  1004. DONOTSPELLCHECK: 0x0400000,
  1005. DONOTSCROLL: 0x0800000,
  1006. COMB: 0x1000000,
  1007. RICHTEXT: 0x2000000,
  1008. RADIOSINUNISON: 0x2000000,
  1009. COMMITONSELCHANGE: 0x4000000,
  1010. };
  1011. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  1012. const AnnotationBorderStyleType = {
  1013. SOLID: 1,
  1014. DASHED: 2,
  1015. BEVELED: 3,
  1016. INSET: 4,
  1017. UNDERLINE: 5,
  1018. };
  1019. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  1020. const AnnotationActionEventType = {
  1021. E: "Mouse Enter",
  1022. X: "Mouse Exit",
  1023. D: "Mouse Down",
  1024. U: "Mouse Up",
  1025. Fo: "Focus",
  1026. Bl: "Blur",
  1027. PO: "PageOpen",
  1028. PC: "PageClose",
  1029. PV: "PageVisible",
  1030. PI: "PageInvisible",
  1031. K: "Keystroke",
  1032. F: "Format",
  1033. V: "Validate",
  1034. C: "Calculate",
  1035. };
  1036. exports.AnnotationActionEventType = AnnotationActionEventType;
  1037. const DocumentActionEventType = {
  1038. WC: "WillClose",
  1039. WS: "WillSave",
  1040. DS: "DidSave",
  1041. WP: "WillPrint",
  1042. DP: "DidPrint",
  1043. };
  1044. exports.DocumentActionEventType = DocumentActionEventType;
  1045. const PageActionEventType = {
  1046. O: "PageOpen",
  1047. C: "PageClose",
  1048. };
  1049. exports.PageActionEventType = PageActionEventType;
  1050. const StreamType = {
  1051. UNKNOWN: "UNKNOWN",
  1052. FLATE: "FLATE",
  1053. LZW: "LZW",
  1054. DCT: "DCT",
  1055. JPX: "JPX",
  1056. JBIG: "JBIG",
  1057. A85: "A85",
  1058. AHX: "AHX",
  1059. CCF: "CCF",
  1060. RLX: "RLX",
  1061. };
  1062. exports.StreamType = StreamType;
  1063. const FontType = {
  1064. UNKNOWN: "UNKNOWN",
  1065. TYPE1: "TYPE1",
  1066. TYPE1STANDARD: "TYPE1STANDARD",
  1067. TYPE1C: "TYPE1C",
  1068. CIDFONTTYPE0: "CIDFONTTYPE0",
  1069. CIDFONTTYPE0C: "CIDFONTTYPE0C",
  1070. TRUETYPE: "TRUETYPE",
  1071. CIDFONTTYPE2: "CIDFONTTYPE2",
  1072. TYPE3: "TYPE3",
  1073. OPENTYPE: "OPENTYPE",
  1074. TYPE0: "TYPE0",
  1075. MMTYPE1: "MMTYPE1",
  1076. };
  1077. exports.FontType = FontType;
  1078. const VerbosityLevel = {
  1079. ERRORS: 0,
  1080. WARNINGS: 1,
  1081. INFOS: 5,
  1082. };
  1083. exports.VerbosityLevel = VerbosityLevel;
  1084. const CMapCompressionType = {
  1085. NONE: 0,
  1086. BINARY: 1,
  1087. STREAM: 2,
  1088. };
  1089. exports.CMapCompressionType = CMapCompressionType;
  1090. const OPS = {
  1091. dependency: 1,
  1092. setLineWidth: 2,
  1093. setLineCap: 3,
  1094. setLineJoin: 4,
  1095. setMiterLimit: 5,
  1096. setDash: 6,
  1097. setRenderingIntent: 7,
  1098. setFlatness: 8,
  1099. setGState: 9,
  1100. save: 10,
  1101. restore: 11,
  1102. transform: 12,
  1103. moveTo: 13,
  1104. lineTo: 14,
  1105. curveTo: 15,
  1106. curveTo2: 16,
  1107. curveTo3: 17,
  1108. closePath: 18,
  1109. rectangle: 19,
  1110. stroke: 20,
  1111. closeStroke: 21,
  1112. fill: 22,
  1113. eoFill: 23,
  1114. fillStroke: 24,
  1115. eoFillStroke: 25,
  1116. closeFillStroke: 26,
  1117. closeEOFillStroke: 27,
  1118. endPath: 28,
  1119. clip: 29,
  1120. eoClip: 30,
  1121. beginText: 31,
  1122. endText: 32,
  1123. setCharSpacing: 33,
  1124. setWordSpacing: 34,
  1125. setHScale: 35,
  1126. setLeading: 36,
  1127. setFont: 37,
  1128. setTextRenderingMode: 38,
  1129. setTextRise: 39,
  1130. moveText: 40,
  1131. setLeadingMoveText: 41,
  1132. setTextMatrix: 42,
  1133. nextLine: 43,
  1134. showText: 44,
  1135. showSpacedText: 45,
  1136. nextLineShowText: 46,
  1137. nextLineSetSpacingShowText: 47,
  1138. setCharWidth: 48,
  1139. setCharWidthAndBounds: 49,
  1140. setStrokeColorSpace: 50,
  1141. setFillColorSpace: 51,
  1142. setStrokeColor: 52,
  1143. setStrokeColorN: 53,
  1144. setFillColor: 54,
  1145. setFillColorN: 55,
  1146. setStrokeGray: 56,
  1147. setFillGray: 57,
  1148. setStrokeRGBColor: 58,
  1149. setFillRGBColor: 59,
  1150. setStrokeCMYKColor: 60,
  1151. setFillCMYKColor: 61,
  1152. shadingFill: 62,
  1153. beginInlineImage: 63,
  1154. beginImageData: 64,
  1155. endInlineImage: 65,
  1156. paintXObject: 66,
  1157. markPoint: 67,
  1158. markPointProps: 68,
  1159. beginMarkedContent: 69,
  1160. beginMarkedContentProps: 70,
  1161. endMarkedContent: 71,
  1162. beginCompat: 72,
  1163. endCompat: 73,
  1164. paintFormXObjectBegin: 74,
  1165. paintFormXObjectEnd: 75,
  1166. beginGroup: 76,
  1167. endGroup: 77,
  1168. beginAnnotations: 78,
  1169. endAnnotations: 79,
  1170. beginAnnotation: 80,
  1171. endAnnotation: 81,
  1172. paintJpegXObject: 82,
  1173. paintImageMaskXObject: 83,
  1174. paintImageMaskXObjectGroup: 84,
  1175. paintImageXObject: 85,
  1176. paintInlineImageXObject: 86,
  1177. paintInlineImageXObjectGroup: 87,
  1178. paintImageXObjectRepeat: 88,
  1179. paintImageMaskXObjectRepeat: 89,
  1180. paintSolidColorImageMask: 90,
  1181. constructPath: 91,
  1182. };
  1183. exports.OPS = OPS;
  1184. const UNSUPPORTED_FEATURES = {
  1185. unknown: "unknown",
  1186. forms: "forms",
  1187. javaScript: "javaScript",
  1188. signatures: "signatures",
  1189. smask: "smask",
  1190. shadingPattern: "shadingPattern",
  1191. font: "font",
  1192. errorTilingPattern: "errorTilingPattern",
  1193. errorExtGState: "errorExtGState",
  1194. errorXObject: "errorXObject",
  1195. errorFontLoadType3: "errorFontLoadType3",
  1196. errorFontState: "errorFontState",
  1197. errorFontMissing: "errorFontMissing",
  1198. errorFontTranslate: "errorFontTranslate",
  1199. errorColorSpace: "errorColorSpace",
  1200. errorOperatorList: "errorOperatorList",
  1201. errorFontToUnicode: "errorFontToUnicode",
  1202. errorFontLoadNative: "errorFontLoadNative",
  1203. errorFontBuildPath: "errorFontBuildPath",
  1204. errorFontGetPath: "errorFontGetPath",
  1205. errorMarkedContent: "errorMarkedContent",
  1206. errorContentSubStream: "errorContentSubStream",
  1207. };
  1208. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  1209. const PasswordResponses = {
  1210. NEED_PASSWORD: 1,
  1211. INCORRECT_PASSWORD: 2,
  1212. };
  1213. exports.PasswordResponses = PasswordResponses;
  1214. let verbosity = VerbosityLevel.WARNINGS;
  1215. function setVerbosityLevel(level) {
  1216. if (Number.isInteger(level)) {
  1217. verbosity = level;
  1218. }
  1219. }
  1220. function getVerbosityLevel() {
  1221. return verbosity;
  1222. }
  1223. function info(msg) {
  1224. if (verbosity >= VerbosityLevel.INFOS) {
  1225. console.log(`Info: ${msg}`);
  1226. }
  1227. }
  1228. function warn(msg) {
  1229. if (verbosity >= VerbosityLevel.WARNINGS) {
  1230. console.log(`Warning: ${msg}`);
  1231. }
  1232. }
  1233. function unreachable(msg) {
  1234. throw new Error(msg);
  1235. }
  1236. function assert(cond, msg) {
  1237. if (!cond) {
  1238. unreachable(msg);
  1239. }
  1240. }
  1241. function _isValidProtocol(url) {
  1242. if (!url) {
  1243. return false;
  1244. }
  1245. switch (url.protocol) {
  1246. case "http:":
  1247. case "https:":
  1248. case "ftp:":
  1249. case "mailto:":
  1250. case "tel:":
  1251. return true;
  1252. default:
  1253. return false;
  1254. }
  1255. }
  1256. function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
  1257. if (!url) {
  1258. return null;
  1259. }
  1260. try {
  1261. if (options && typeof url === "string") {
  1262. if (options.addDefaultProtocol && url.startsWith("www.")) {
  1263. const dots = url.match(/\./g);
  1264. if (dots && dots.length >= 2) {
  1265. url = `http://${url}`;
  1266. }
  1267. }
  1268. if (options.tryConvertEncoding) {
  1269. try {
  1270. url = stringToUTF8String(url);
  1271. } catch (ex) {}
  1272. }
  1273. }
  1274. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  1275. if (_isValidProtocol(absoluteUrl)) {
  1276. return absoluteUrl;
  1277. }
  1278. } catch (ex) {}
  1279. return null;
  1280. }
  1281. function shadow(obj, prop, value) {
  1282. Object.defineProperty(obj, prop, {
  1283. value,
  1284. enumerable: true,
  1285. configurable: true,
  1286. writable: false,
  1287. });
  1288. return value;
  1289. }
  1290. const BaseException = (function BaseExceptionClosure() {
  1291. function BaseException(message, name) {
  1292. if (this.constructor === BaseException) {
  1293. unreachable("Cannot initialize BaseException.");
  1294. }
  1295. this.message = message;
  1296. this.name = name;
  1297. }
  1298. BaseException.prototype = new Error();
  1299. BaseException.constructor = BaseException;
  1300. return BaseException;
  1301. })();
  1302. exports.BaseException = BaseException;
  1303. class PasswordException extends BaseException {
  1304. constructor(msg, code) {
  1305. super(msg, "PasswordException");
  1306. this.code = code;
  1307. }
  1308. }
  1309. exports.PasswordException = PasswordException;
  1310. class UnknownErrorException extends BaseException {
  1311. constructor(msg, details) {
  1312. super(msg, "UnknownErrorException");
  1313. this.details = details;
  1314. }
  1315. }
  1316. exports.UnknownErrorException = UnknownErrorException;
  1317. class InvalidPDFException extends BaseException {
  1318. constructor(msg) {
  1319. super(msg, "InvalidPDFException");
  1320. }
  1321. }
  1322. exports.InvalidPDFException = InvalidPDFException;
  1323. class MissingPDFException extends BaseException {
  1324. constructor(msg) {
  1325. super(msg, "MissingPDFException");
  1326. }
  1327. }
  1328. exports.MissingPDFException = MissingPDFException;
  1329. class UnexpectedResponseException extends BaseException {
  1330. constructor(msg, status) {
  1331. super(msg, "UnexpectedResponseException");
  1332. this.status = status;
  1333. }
  1334. }
  1335. exports.UnexpectedResponseException = UnexpectedResponseException;
  1336. class FormatError extends BaseException {
  1337. constructor(msg) {
  1338. super(msg, "FormatError");
  1339. }
  1340. }
  1341. exports.FormatError = FormatError;
  1342. class AbortException extends BaseException {
  1343. constructor(msg) {
  1344. super(msg, "AbortException");
  1345. }
  1346. }
  1347. exports.AbortException = AbortException;
  1348. function bytesToString(bytes) {
  1349. if (
  1350. typeof bytes !== "object" ||
  1351. bytes === null ||
  1352. bytes.length === undefined
  1353. ) {
  1354. unreachable("Invalid argument for bytesToString");
  1355. }
  1356. const length = bytes.length;
  1357. const MAX_ARGUMENT_COUNT = 8192;
  1358. if (length < MAX_ARGUMENT_COUNT) {
  1359. return String.fromCharCode.apply(null, bytes);
  1360. }
  1361. const strBuf = [];
  1362. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  1363. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  1364. const chunk = bytes.subarray(i, chunkEnd);
  1365. strBuf.push(String.fromCharCode.apply(null, chunk));
  1366. }
  1367. return strBuf.join("");
  1368. }
  1369. function stringToBytes(str) {
  1370. if (typeof str !== "string") {
  1371. unreachable("Invalid argument for stringToBytes");
  1372. }
  1373. const length = str.length;
  1374. const bytes = new Uint8Array(length);
  1375. for (let i = 0; i < length; ++i) {
  1376. bytes[i] = str.charCodeAt(i) & 0xff;
  1377. }
  1378. return bytes;
  1379. }
  1380. function arrayByteLength(arr) {
  1381. if (arr.length !== undefined) {
  1382. return arr.length;
  1383. }
  1384. if (arr.byteLength !== undefined) {
  1385. return arr.byteLength;
  1386. }
  1387. unreachable("Invalid argument for arrayByteLength");
  1388. }
  1389. function arraysToBytes(arr) {
  1390. const length = arr.length;
  1391. if (length === 1 && arr[0] instanceof Uint8Array) {
  1392. return arr[0];
  1393. }
  1394. let resultLength = 0;
  1395. for (let i = 0; i < length; i++) {
  1396. resultLength += arrayByteLength(arr[i]);
  1397. }
  1398. let pos = 0;
  1399. const data = new Uint8Array(resultLength);
  1400. for (let i = 0; i < length; i++) {
  1401. let item = arr[i];
  1402. if (!(item instanceof Uint8Array)) {
  1403. if (typeof item === "string") {
  1404. item = stringToBytes(item);
  1405. } else {
  1406. item = new Uint8Array(item);
  1407. }
  1408. }
  1409. const itemLength = item.byteLength;
  1410. data.set(item, pos);
  1411. pos += itemLength;
  1412. }
  1413. return data;
  1414. }
  1415. function string32(value) {
  1416. return String.fromCharCode(
  1417. (value >> 24) & 0xff,
  1418. (value >> 16) & 0xff,
  1419. (value >> 8) & 0xff,
  1420. value & 0xff
  1421. );
  1422. }
  1423. function objectSize(obj) {
  1424. return Object.keys(obj).length;
  1425. }
  1426. function objectFromMap(map) {
  1427. const obj = Object.create(null);
  1428. for (const [key, value] of map) {
  1429. obj[key] = value;
  1430. }
  1431. return obj;
  1432. }
  1433. function isLittleEndian() {
  1434. const buffer8 = new Uint8Array(4);
  1435. buffer8[0] = 1;
  1436. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  1437. return view32[0] === 1;
  1438. }
  1439. function isEvalSupported() {
  1440. try {
  1441. new Function("");
  1442. return true;
  1443. } catch (e) {
  1444. return false;
  1445. }
  1446. }
  1447. class FeatureTest {
  1448. static get isLittleEndian() {
  1449. return shadow(this, "isLittleEndian", isLittleEndian());
  1450. }
  1451. static get isEvalSupported() {
  1452. return shadow(this, "isEvalSupported", isEvalSupported());
  1453. }
  1454. static get isOffscreenCanvasSupported() {
  1455. return shadow(
  1456. this,
  1457. "isOffscreenCanvasSupported",
  1458. typeof OffscreenCanvas !== "undefined"
  1459. );
  1460. }
  1461. }
  1462. exports.FeatureTest = FeatureTest;
  1463. const hexNumbers = [...Array(256).keys()].map((n) =>
  1464. n.toString(16).padStart(2, "0")
  1465. );
  1466. class Util {
  1467. static makeHexColor(r, g, b) {
  1468. return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
  1469. }
  1470. static scaleMinMax(transform, minMax) {
  1471. let temp;
  1472. if (transform[0]) {
  1473. if (transform[0] < 0) {
  1474. temp = minMax[0];
  1475. minMax[0] = minMax[1];
  1476. minMax[1] = temp;
  1477. }
  1478. minMax[0] *= transform[0];
  1479. minMax[1] *= transform[0];
  1480. if (transform[3] < 0) {
  1481. temp = minMax[2];
  1482. minMax[2] = minMax[3];
  1483. minMax[3] = temp;
  1484. }
  1485. minMax[2] *= transform[3];
  1486. minMax[3] *= transform[3];
  1487. } else {
  1488. temp = minMax[0];
  1489. minMax[0] = minMax[2];
  1490. minMax[2] = temp;
  1491. temp = minMax[1];
  1492. minMax[1] = minMax[3];
  1493. minMax[3] = temp;
  1494. if (transform[1] < 0) {
  1495. temp = minMax[2];
  1496. minMax[2] = minMax[3];
  1497. minMax[3] = temp;
  1498. }
  1499. minMax[2] *= transform[1];
  1500. minMax[3] *= transform[1];
  1501. if (transform[2] < 0) {
  1502. temp = minMax[0];
  1503. minMax[0] = minMax[1];
  1504. minMax[1] = temp;
  1505. }
  1506. minMax[0] *= transform[2];
  1507. minMax[1] *= transform[2];
  1508. }
  1509. minMax[0] += transform[4];
  1510. minMax[1] += transform[4];
  1511. minMax[2] += transform[5];
  1512. minMax[3] += transform[5];
  1513. }
  1514. static transform(m1, m2) {
  1515. return [
  1516. m1[0] * m2[0] + m1[2] * m2[1],
  1517. m1[1] * m2[0] + m1[3] * m2[1],
  1518. m1[0] * m2[2] + m1[2] * m2[3],
  1519. m1[1] * m2[2] + m1[3] * m2[3],
  1520. m1[0] * m2[4] + m1[2] * m2[5] + m1[4],
  1521. m1[1] * m2[4] + m1[3] * m2[5] + m1[5],
  1522. ];
  1523. }
  1524. static applyTransform(p, m) {
  1525. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  1526. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  1527. return [xt, yt];
  1528. }
  1529. static applyInverseTransform(p, m) {
  1530. const d = m[0] * m[3] - m[1] * m[2];
  1531. const xt =
  1532. (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  1533. const yt =
  1534. (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  1535. return [xt, yt];
  1536. }
  1537. static getAxialAlignedBoundingBox(r, m) {
  1538. const p1 = Util.applyTransform(r, m);
  1539. const p2 = Util.applyTransform(r.slice(2, 4), m);
  1540. const p3 = Util.applyTransform([r[0], r[3]], m);
  1541. const p4 = Util.applyTransform([r[2], r[1]], m);
  1542. return [
  1543. Math.min(p1[0], p2[0], p3[0], p4[0]),
  1544. Math.min(p1[1], p2[1], p3[1], p4[1]),
  1545. Math.max(p1[0], p2[0], p3[0], p4[0]),
  1546. Math.max(p1[1], p2[1], p3[1], p4[1]),
  1547. ];
  1548. }
  1549. static inverseTransform(m) {
  1550. const d = m[0] * m[3] - m[1] * m[2];
  1551. return [
  1552. m[3] / d,
  1553. -m[1] / d,
  1554. -m[2] / d,
  1555. m[0] / d,
  1556. (m[2] * m[5] - m[4] * m[3]) / d,
  1557. (m[4] * m[1] - m[5] * m[0]) / d,
  1558. ];
  1559. }
  1560. static apply3dTransform(m, v) {
  1561. return [
  1562. m[0] * v[0] + m[1] * v[1] + m[2] * v[2],
  1563. m[3] * v[0] + m[4] * v[1] + m[5] * v[2],
  1564. m[6] * v[0] + m[7] * v[1] + m[8] * v[2],
  1565. ];
  1566. }
  1567. static singularValueDecompose2dScale(m) {
  1568. const transpose = [m[0], m[2], m[1], m[3]];
  1569. const a = m[0] * transpose[0] + m[1] * transpose[2];
  1570. const b = m[0] * transpose[1] + m[1] * transpose[3];
  1571. const c = m[2] * transpose[0] + m[3] * transpose[2];
  1572. const d = m[2] * transpose[1] + m[3] * transpose[3];
  1573. const first = (a + d) / 2;
  1574. const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
  1575. const sx = first + second || 1;
  1576. const sy = first - second || 1;
  1577. return [Math.sqrt(sx), Math.sqrt(sy)];
  1578. }
  1579. static normalizeRect(rect) {
  1580. const r = rect.slice(0);
  1581. if (rect[0] > rect[2]) {
  1582. r[0] = rect[2];
  1583. r[2] = rect[0];
  1584. }
  1585. if (rect[1] > rect[3]) {
  1586. r[1] = rect[3];
  1587. r[3] = rect[1];
  1588. }
  1589. return r;
  1590. }
  1591. static intersect(rect1, rect2) {
  1592. const xLow = Math.max(
  1593. Math.min(rect1[0], rect1[2]),
  1594. Math.min(rect2[0], rect2[2])
  1595. );
  1596. const xHigh = Math.min(
  1597. Math.max(rect1[0], rect1[2]),
  1598. Math.max(rect2[0], rect2[2])
  1599. );
  1600. if (xLow > xHigh) {
  1601. return null;
  1602. }
  1603. const yLow = Math.max(
  1604. Math.min(rect1[1], rect1[3]),
  1605. Math.min(rect2[1], rect2[3])
  1606. );
  1607. const yHigh = Math.min(
  1608. Math.max(rect1[1], rect1[3]),
  1609. Math.max(rect2[1], rect2[3])
  1610. );
  1611. if (yLow > yHigh) {
  1612. return null;
  1613. }
  1614. return [xLow, yLow, xHigh, yHigh];
  1615. }
  1616. static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {
  1617. const tvalues = [],
  1618. bounds = [[], []];
  1619. let a, b, c, t, t1, t2, b2ac, sqrtb2ac;
  1620. for (let i = 0; i < 2; ++i) {
  1621. if (i === 0) {
  1622. b = 6 * x0 - 12 * x1 + 6 * x2;
  1623. a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
  1624. c = 3 * x1 - 3 * x0;
  1625. } else {
  1626. b = 6 * y0 - 12 * y1 + 6 * y2;
  1627. a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
  1628. c = 3 * y1 - 3 * y0;
  1629. }
  1630. if (Math.abs(a) < 1e-12) {
  1631. if (Math.abs(b) < 1e-12) {
  1632. continue;
  1633. }
  1634. t = -c / b;
  1635. if (0 < t && t < 1) {
  1636. tvalues.push(t);
  1637. }
  1638. continue;
  1639. }
  1640. b2ac = b * b - 4 * c * a;
  1641. sqrtb2ac = Math.sqrt(b2ac);
  1642. if (b2ac < 0) {
  1643. continue;
  1644. }
  1645. t1 = (-b + sqrtb2ac) / (2 * a);
  1646. if (0 < t1 && t1 < 1) {
  1647. tvalues.push(t1);
  1648. }
  1649. t2 = (-b - sqrtb2ac) / (2 * a);
  1650. if (0 < t2 && t2 < 1) {
  1651. tvalues.push(t2);
  1652. }
  1653. }
  1654. let j = tvalues.length,
  1655. mt;
  1656. const jlen = j;
  1657. while (j--) {
  1658. t = tvalues[j];
  1659. mt = 1 - t;
  1660. bounds[0][j] =
  1661. mt * mt * mt * x0 +
  1662. 3 * mt * mt * t * x1 +
  1663. 3 * mt * t * t * x2 +
  1664. t * t * t * x3;
  1665. bounds[1][j] =
  1666. mt * mt * mt * y0 +
  1667. 3 * mt * mt * t * y1 +
  1668. 3 * mt * t * t * y2 +
  1669. t * t * t * y3;
  1670. }
  1671. bounds[0][jlen] = x0;
  1672. bounds[1][jlen] = y0;
  1673. bounds[0][jlen + 1] = x3;
  1674. bounds[1][jlen + 1] = y3;
  1675. bounds[0].length = bounds[1].length = jlen + 2;
  1676. return [
  1677. Math.min(...bounds[0]),
  1678. Math.min(...bounds[1]),
  1679. Math.max(...bounds[0]),
  1680. Math.max(...bounds[1]),
  1681. ];
  1682. }
  1683. }
  1684. exports.Util = Util;
  1685. const PDFStringTranslateTable = [
  1686. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1687. 0, 0x2d8, 0x2c7, 0x2c6, 0x2d9, 0x2dd, 0x2db, 0x2da, 0x2dc, 0, 0, 0, 0,
  1688. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1689. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1690. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1691. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1692. 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039,
  1693. 0x203a, 0x2212, 0x2030, 0x201e, 0x201c, 0x201d, 0x2018, 0x2019,
  1694. 0x201a, 0x2122, 0xfb01, 0xfb02, 0x141, 0x152, 0x160, 0x178, 0x17d,
  1695. 0x131, 0x142, 0x153, 0x161, 0x17e, 0, 0x20ac,
  1696. ];
  1697. function stringToPDFString(str) {
  1698. if (str[0] >= "\xEF") {
  1699. let encoding;
  1700. if (str[0] === "\xFE" && str[1] === "\xFF") {
  1701. encoding = "utf-16be";
  1702. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  1703. encoding = "utf-16le";
  1704. } else if (
  1705. str[0] === "\xEF" &&
  1706. str[1] === "\xBB" &&
  1707. str[2] === "\xBF"
  1708. ) {
  1709. encoding = "utf-8";
  1710. }
  1711. if (encoding) {
  1712. try {
  1713. const decoder = new TextDecoder(encoding, {
  1714. fatal: true,
  1715. });
  1716. const buffer = stringToBytes(str);
  1717. return decoder.decode(buffer);
  1718. } catch (ex) {
  1719. warn(`stringToPDFString: "${ex}".`);
  1720. }
  1721. }
  1722. }
  1723. const strBuf = [];
  1724. for (let i = 0, ii = str.length; i < ii; i++) {
  1725. const code = PDFStringTranslateTable[str.charCodeAt(i)];
  1726. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1727. }
  1728. return strBuf.join("");
  1729. }
  1730. function escapeString(str) {
  1731. return str.replace(/([()\\\n\r])/g, (match) => {
  1732. if (match === "\n") {
  1733. return "\\n";
  1734. } else if (match === "\r") {
  1735. return "\\r";
  1736. }
  1737. return `\\${match}`;
  1738. });
  1739. }
  1740. function isAscii(str) {
  1741. return /^[\x00-\x7F]*$/.test(str);
  1742. }
  1743. function stringToUTF16BEString(str) {
  1744. const buf = ["\xFE\xFF"];
  1745. for (let i = 0, ii = str.length; i < ii; i++) {
  1746. const char = str.charCodeAt(i);
  1747. buf.push(
  1748. String.fromCharCode((char >> 8) & 0xff),
  1749. String.fromCharCode(char & 0xff)
  1750. );
  1751. }
  1752. return buf.join("");
  1753. }
  1754. function stringToUTF8String(str) {
  1755. return decodeURIComponent(escape(str));
  1756. }
  1757. function utf8StringToString(str) {
  1758. return unescape(encodeURIComponent(str));
  1759. }
  1760. function isArrayBuffer(v) {
  1761. return (
  1762. typeof v === "object" && v !== null && v.byteLength !== undefined
  1763. );
  1764. }
  1765. function isArrayEqual(arr1, arr2) {
  1766. if (arr1.length !== arr2.length) {
  1767. return false;
  1768. }
  1769. for (let i = 0, ii = arr1.length; i < ii; i++) {
  1770. if (arr1[i] !== arr2[i]) {
  1771. return false;
  1772. }
  1773. }
  1774. return true;
  1775. }
  1776. function getModificationDate(date = new Date()) {
  1777. const buffer = [
  1778. date.getUTCFullYear().toString(),
  1779. (date.getUTCMonth() + 1).toString().padStart(2, "0"),
  1780. date.getUTCDate().toString().padStart(2, "0"),
  1781. date.getUTCHours().toString().padStart(2, "0"),
  1782. date.getUTCMinutes().toString().padStart(2, "0"),
  1783. date.getUTCSeconds().toString().padStart(2, "0"),
  1784. ];
  1785. return buffer.join("");
  1786. }
  1787. function createPromiseCapability() {
  1788. const capability = Object.create(null);
  1789. let isSettled = false;
  1790. Object.defineProperty(capability, "settled", {
  1791. get() {
  1792. return isSettled;
  1793. },
  1794. });
  1795. capability.promise = new Promise(function (resolve, reject) {
  1796. capability.resolve = function (data) {
  1797. isSettled = true;
  1798. resolve(data);
  1799. };
  1800. capability.reject = function (reason) {
  1801. isSettled = true;
  1802. reject(reason);
  1803. };
  1804. });
  1805. return capability;
  1806. }
  1807. /***/
  1808. },
  1809. /* 3 */
  1810. /***/ (
  1811. __unused_webpack_module,
  1812. __unused_webpack_exports,
  1813. __w_pdfjs_require__
  1814. ) => {
  1815. var _is_node = __w_pdfjs_require__(4);
  1816. /***/
  1817. },
  1818. /* 4 */
  1819. /***/ (__unused_webpack_module, exports) => {
  1820. Object.defineProperty(exports, "__esModule", {
  1821. value: true,
  1822. });
  1823. exports.isNodeJS = void 0;
  1824. const isNodeJS =
  1825. typeof process === "object" &&
  1826. process + "" === "[object process]" &&
  1827. !process.versions.nw &&
  1828. !(
  1829. process.versions.electron &&
  1830. process.type &&
  1831. process.type !== "browser"
  1832. );
  1833. exports.isNodeJS = isNodeJS;
  1834. /***/
  1835. },
  1836. /* 5 */
  1837. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1838. Object.defineProperty(exports, "__esModule", {
  1839. value: true,
  1840. });
  1841. exports.RefSetCache =
  1842. exports.RefSet =
  1843. exports.Ref =
  1844. exports.Name =
  1845. exports.EOF =
  1846. exports.Dict =
  1847. exports.Cmd =
  1848. exports.CIRCULAR_REF =
  1849. void 0;
  1850. exports.clearPrimitiveCaches = clearPrimitiveCaches;
  1851. exports.isCmd = isCmd;
  1852. exports.isDict = isDict;
  1853. exports.isName = isName;
  1854. exports.isRefsEqual = isRefsEqual;
  1855. var _util = __w_pdfjs_require__(2);
  1856. const CIRCULAR_REF = Symbol("CIRCULAR_REF");
  1857. exports.CIRCULAR_REF = CIRCULAR_REF;
  1858. const EOF = Symbol("EOF");
  1859. exports.EOF = EOF;
  1860. const Name = (function NameClosure() {
  1861. let nameCache = Object.create(null);
  1862. class Name {
  1863. constructor(name) {
  1864. this.name = name;
  1865. }
  1866. static get(name) {
  1867. return nameCache[name] || (nameCache[name] = new Name(name));
  1868. }
  1869. static _clearCache() {
  1870. nameCache = Object.create(null);
  1871. }
  1872. }
  1873. return Name;
  1874. })();
  1875. exports.Name = Name;
  1876. const Cmd = (function CmdClosure() {
  1877. let cmdCache = Object.create(null);
  1878. class Cmd {
  1879. constructor(cmd) {
  1880. this.cmd = cmd;
  1881. }
  1882. static get(cmd) {
  1883. return cmdCache[cmd] || (cmdCache[cmd] = new Cmd(cmd));
  1884. }
  1885. static _clearCache() {
  1886. cmdCache = Object.create(null);
  1887. }
  1888. }
  1889. return Cmd;
  1890. })();
  1891. exports.Cmd = Cmd;
  1892. const nonSerializable = function nonSerializableClosure() {
  1893. return nonSerializable;
  1894. };
  1895. class Dict {
  1896. constructor(xref = null) {
  1897. this._map = Object.create(null);
  1898. this.xref = xref;
  1899. this.objId = null;
  1900. this.suppressEncryption = false;
  1901. this.__nonSerializable__ = nonSerializable;
  1902. }
  1903. assignXref(newXref) {
  1904. this.xref = newXref;
  1905. }
  1906. get size() {
  1907. return Object.keys(this._map).length;
  1908. }
  1909. get(key1, key2, key3) {
  1910. let value = this._map[key1];
  1911. if (value === undefined && key2 !== undefined) {
  1912. value = this._map[key2];
  1913. if (value === undefined && key3 !== undefined) {
  1914. value = this._map[key3];
  1915. }
  1916. }
  1917. if (value instanceof Ref && this.xref) {
  1918. return this.xref.fetch(value, this.suppressEncryption);
  1919. }
  1920. return value;
  1921. }
  1922. async getAsync(key1, key2, key3) {
  1923. let value = this._map[key1];
  1924. if (value === undefined && key2 !== undefined) {
  1925. value = this._map[key2];
  1926. if (value === undefined && key3 !== undefined) {
  1927. value = this._map[key3];
  1928. }
  1929. }
  1930. if (value instanceof Ref && this.xref) {
  1931. return this.xref.fetchAsync(value, this.suppressEncryption);
  1932. }
  1933. return value;
  1934. }
  1935. getArray(key1, key2, key3) {
  1936. let value = this._map[key1];
  1937. if (value === undefined && key2 !== undefined) {
  1938. value = this._map[key2];
  1939. if (value === undefined && key3 !== undefined) {
  1940. value = this._map[key3];
  1941. }
  1942. }
  1943. if (value instanceof Ref && this.xref) {
  1944. value = this.xref.fetch(value, this.suppressEncryption);
  1945. }
  1946. if (Array.isArray(value)) {
  1947. value = value.slice();
  1948. for (let i = 0, ii = value.length; i < ii; i++) {
  1949. if (value[i] instanceof Ref && this.xref) {
  1950. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  1951. }
  1952. }
  1953. }
  1954. return value;
  1955. }
  1956. getRaw(key) {
  1957. return this._map[key];
  1958. }
  1959. getKeys() {
  1960. return Object.keys(this._map);
  1961. }
  1962. getRawValues() {
  1963. return Object.values(this._map);
  1964. }
  1965. set(key, value) {
  1966. this._map[key] = value;
  1967. }
  1968. has(key) {
  1969. return this._map[key] !== undefined;
  1970. }
  1971. forEach(callback) {
  1972. for (const key in this._map) {
  1973. callback(key, this.get(key));
  1974. }
  1975. }
  1976. static get empty() {
  1977. const emptyDict = new Dict(null);
  1978. emptyDict.set = (key, value) => {
  1979. (0, _util.unreachable)(
  1980. "Should not call `set` on the empty dictionary."
  1981. );
  1982. };
  1983. return (0, _util.shadow)(this, "empty", emptyDict);
  1984. }
  1985. static merge({ xref, dictArray, mergeSubDicts = false }) {
  1986. const mergedDict = new Dict(xref),
  1987. properties = new Map();
  1988. for (const dict of dictArray) {
  1989. if (!(dict instanceof Dict)) {
  1990. continue;
  1991. }
  1992. for (const [key, value] of Object.entries(dict._map)) {
  1993. let property = properties.get(key);
  1994. if (property === undefined) {
  1995. property = [];
  1996. properties.set(key, property);
  1997. } else if (!mergeSubDicts || !(value instanceof Dict)) {
  1998. continue;
  1999. }
  2000. property.push(value);
  2001. }
  2002. }
  2003. for (const [name, values] of properties) {
  2004. if (values.length === 1 || !(values[0] instanceof Dict)) {
  2005. mergedDict._map[name] = values[0];
  2006. continue;
  2007. }
  2008. const subDict = new Dict(xref);
  2009. for (const dict of values) {
  2010. for (const [key, value] of Object.entries(dict._map)) {
  2011. if (subDict._map[key] === undefined) {
  2012. subDict._map[key] = value;
  2013. }
  2014. }
  2015. }
  2016. if (subDict.size > 0) {
  2017. mergedDict._map[name] = subDict;
  2018. }
  2019. }
  2020. properties.clear();
  2021. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  2022. }
  2023. }
  2024. exports.Dict = Dict;
  2025. const Ref = (function RefClosure() {
  2026. let refCache = Object.create(null);
  2027. class Ref {
  2028. constructor(num, gen) {
  2029. this.num = num;
  2030. this.gen = gen;
  2031. }
  2032. toString() {
  2033. if (this.gen === 0) {
  2034. return `${this.num}R`;
  2035. }
  2036. return `${this.num}R${this.gen}`;
  2037. }
  2038. static get(num, gen) {
  2039. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  2040. return refCache[key] || (refCache[key] = new Ref(num, gen));
  2041. }
  2042. static _clearCache() {
  2043. refCache = Object.create(null);
  2044. }
  2045. }
  2046. return Ref;
  2047. })();
  2048. exports.Ref = Ref;
  2049. class RefSet {
  2050. constructor(parent = null) {
  2051. this._set = new Set(parent && parent._set);
  2052. }
  2053. has(ref) {
  2054. return this._set.has(ref.toString());
  2055. }
  2056. put(ref) {
  2057. this._set.add(ref.toString());
  2058. }
  2059. remove(ref) {
  2060. this._set.delete(ref.toString());
  2061. }
  2062. [Symbol.iterator]() {
  2063. return this._set.values();
  2064. }
  2065. clear() {
  2066. this._set.clear();
  2067. }
  2068. }
  2069. exports.RefSet = RefSet;
  2070. class RefSetCache {
  2071. constructor() {
  2072. this._map = new Map();
  2073. }
  2074. get size() {
  2075. return this._map.size;
  2076. }
  2077. get(ref) {
  2078. return this._map.get(ref.toString());
  2079. }
  2080. has(ref) {
  2081. return this._map.has(ref.toString());
  2082. }
  2083. put(ref, obj) {
  2084. this._map.set(ref.toString(), obj);
  2085. }
  2086. putAlias(ref, aliasRef) {
  2087. this._map.set(ref.toString(), this.get(aliasRef));
  2088. }
  2089. [Symbol.iterator]() {
  2090. return this._map.values();
  2091. }
  2092. clear() {
  2093. this._map.clear();
  2094. }
  2095. }
  2096. exports.RefSetCache = RefSetCache;
  2097. function isName(v, name) {
  2098. return v instanceof Name && (name === undefined || v.name === name);
  2099. }
  2100. function isCmd(v, cmd) {
  2101. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  2102. }
  2103. function isDict(v, type) {
  2104. return (
  2105. v instanceof Dict &&
  2106. (type === undefined || isName(v.get("Type"), type))
  2107. );
  2108. }
  2109. function isRefsEqual(v1, v2) {
  2110. return v1.num === v2.num && v1.gen === v2.gen;
  2111. }
  2112. function clearPrimitiveCaches() {
  2113. Cmd._clearCache();
  2114. Name._clearCache();
  2115. Ref._clearCache();
  2116. }
  2117. /***/
  2118. },
  2119. /* 6 */
  2120. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2121. Object.defineProperty(exports, "__esModule", {
  2122. value: true,
  2123. });
  2124. exports.XRefParseException =
  2125. exports.XRefEntryException =
  2126. exports.ParserEOFException =
  2127. exports.MissingDataException =
  2128. exports.DocStats =
  2129. void 0;
  2130. exports.collectActions = collectActions;
  2131. exports.encodeToXmlString = encodeToXmlString;
  2132. exports.escapePDFName = escapePDFName;
  2133. exports.getArrayLookupTableFactory = getArrayLookupTableFactory;
  2134. exports.getInheritableProperty = getInheritableProperty;
  2135. exports.getLookupTableFactory = getLookupTableFactory;
  2136. exports.getNewAnnotationsMap = getNewAnnotationsMap;
  2137. exports.isWhiteSpace = isWhiteSpace;
  2138. exports.log2 = log2;
  2139. exports.numberToString = numberToString;
  2140. exports.parseXFAPath = parseXFAPath;
  2141. exports.readInt8 = readInt8;
  2142. exports.readUint16 = readUint16;
  2143. exports.readUint32 = readUint32;
  2144. exports.recoverJsURL = recoverJsURL;
  2145. exports.toRomanNumerals = toRomanNumerals;
  2146. exports.validateCSSFont = validateCSSFont;
  2147. var _util = __w_pdfjs_require__(2);
  2148. var _primitives = __w_pdfjs_require__(5);
  2149. var _base_stream = __w_pdfjs_require__(7);
  2150. function getLookupTableFactory(initializer) {
  2151. let lookup;
  2152. return function () {
  2153. if (initializer) {
  2154. lookup = Object.create(null);
  2155. initializer(lookup);
  2156. initializer = null;
  2157. }
  2158. return lookup;
  2159. };
  2160. }
  2161. function getArrayLookupTableFactory(initializer) {
  2162. let lookup;
  2163. return function () {
  2164. if (initializer) {
  2165. let arr = initializer();
  2166. initializer = null;
  2167. lookup = Object.create(null);
  2168. for (let i = 0, ii = arr.length; i < ii; i += 2) {
  2169. lookup[arr[i]] = arr[i + 1];
  2170. }
  2171. arr = null;
  2172. }
  2173. return lookup;
  2174. };
  2175. }
  2176. class MissingDataException extends _util.BaseException {
  2177. constructor(begin, end) {
  2178. super(`Missing data [${begin}, ${end})`, "MissingDataException");
  2179. this.begin = begin;
  2180. this.end = end;
  2181. }
  2182. }
  2183. exports.MissingDataException = MissingDataException;
  2184. class ParserEOFException extends _util.BaseException {
  2185. constructor(msg) {
  2186. super(msg, "ParserEOFException");
  2187. }
  2188. }
  2189. exports.ParserEOFException = ParserEOFException;
  2190. class XRefEntryException extends _util.BaseException {
  2191. constructor(msg) {
  2192. super(msg, "XRefEntryException");
  2193. }
  2194. }
  2195. exports.XRefEntryException = XRefEntryException;
  2196. class XRefParseException extends _util.BaseException {
  2197. constructor(msg) {
  2198. super(msg, "XRefParseException");
  2199. }
  2200. }
  2201. exports.XRefParseException = XRefParseException;
  2202. class DocStats {
  2203. constructor(handler) {
  2204. this._handler = handler;
  2205. this._streamTypes = new Set();
  2206. this._fontTypes = new Set();
  2207. }
  2208. _send() {
  2209. const streamTypes = Object.create(null),
  2210. fontTypes = Object.create(null);
  2211. for (const type of this._streamTypes) {
  2212. streamTypes[type] = true;
  2213. }
  2214. for (const type of this._fontTypes) {
  2215. fontTypes[type] = true;
  2216. }
  2217. this._handler.send("DocStats", {
  2218. streamTypes,
  2219. fontTypes,
  2220. });
  2221. }
  2222. addStreamType(type) {
  2223. if (this._streamTypes.has(type)) {
  2224. return;
  2225. }
  2226. this._streamTypes.add(type);
  2227. this._send();
  2228. }
  2229. addFontType(type) {
  2230. if (this._fontTypes.has(type)) {
  2231. return;
  2232. }
  2233. this._fontTypes.add(type);
  2234. this._send();
  2235. }
  2236. }
  2237. exports.DocStats = DocStats;
  2238. function getInheritableProperty({
  2239. dict,
  2240. key,
  2241. getArray = false,
  2242. stopWhenFound = true,
  2243. }) {
  2244. let values;
  2245. const visited = new _primitives.RefSet();
  2246. while (
  2247. dict instanceof _primitives.Dict &&
  2248. !(dict.objId && visited.has(dict.objId))
  2249. ) {
  2250. if (dict.objId) {
  2251. visited.put(dict.objId);
  2252. }
  2253. const value = getArray ? dict.getArray(key) : dict.get(key);
  2254. if (value !== undefined) {
  2255. if (stopWhenFound) {
  2256. return value;
  2257. }
  2258. if (!values) {
  2259. values = [];
  2260. }
  2261. values.push(value);
  2262. }
  2263. dict = dict.get("Parent");
  2264. }
  2265. return values;
  2266. }
  2267. const ROMAN_NUMBER_MAP = [
  2268. "",
  2269. "C",
  2270. "CC",
  2271. "CCC",
  2272. "CD",
  2273. "D",
  2274. "DC",
  2275. "DCC",
  2276. "DCCC",
  2277. "CM",
  2278. "",
  2279. "X",
  2280. "XX",
  2281. "XXX",
  2282. "XL",
  2283. "L",
  2284. "LX",
  2285. "LXX",
  2286. "LXXX",
  2287. "XC",
  2288. "",
  2289. "I",
  2290. "II",
  2291. "III",
  2292. "IV",
  2293. "V",
  2294. "VI",
  2295. "VII",
  2296. "VIII",
  2297. "IX",
  2298. ];
  2299. function toRomanNumerals(number, lowerCase = false) {
  2300. (0, _util.assert)(
  2301. Number.isInteger(number) && number > 0,
  2302. "The number should be a positive integer."
  2303. );
  2304. const romanBuf = [];
  2305. let pos;
  2306. while (number >= 1000) {
  2307. number -= 1000;
  2308. romanBuf.push("M");
  2309. }
  2310. pos = (number / 100) | 0;
  2311. number %= 100;
  2312. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  2313. pos = (number / 10) | 0;
  2314. number %= 10;
  2315. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  2316. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  2317. const romanStr = romanBuf.join("");
  2318. return lowerCase ? romanStr.toLowerCase() : romanStr;
  2319. }
  2320. function log2(x) {
  2321. if (x <= 0) {
  2322. return 0;
  2323. }
  2324. return Math.ceil(Math.log2(x));
  2325. }
  2326. function readInt8(data, offset) {
  2327. return (data[offset] << 24) >> 24;
  2328. }
  2329. function readUint16(data, offset) {
  2330. return (data[offset] << 8) | data[offset + 1];
  2331. }
  2332. function readUint32(data, offset) {
  2333. return (
  2334. ((data[offset] << 24) |
  2335. (data[offset + 1] << 16) |
  2336. (data[offset + 2] << 8) |
  2337. data[offset + 3]) >>>
  2338. 0
  2339. );
  2340. }
  2341. function isWhiteSpace(ch) {
  2342. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  2343. }
  2344. function parseXFAPath(path) {
  2345. const positionPattern = /(.+)\[(\d+)\]$/;
  2346. return path.split(".").map((component) => {
  2347. const m = component.match(positionPattern);
  2348. if (m) {
  2349. return {
  2350. name: m[1],
  2351. pos: parseInt(m[2], 10),
  2352. };
  2353. }
  2354. return {
  2355. name: component,
  2356. pos: 0,
  2357. };
  2358. });
  2359. }
  2360. function escapePDFName(str) {
  2361. const buffer = [];
  2362. let start = 0;
  2363. for (let i = 0, ii = str.length; i < ii; i++) {
  2364. const char = str.charCodeAt(i);
  2365. if (
  2366. char < 0x21 ||
  2367. char > 0x7e ||
  2368. char === 0x23 ||
  2369. char === 0x28 ||
  2370. char === 0x29 ||
  2371. char === 0x3c ||
  2372. char === 0x3e ||
  2373. char === 0x5b ||
  2374. char === 0x5d ||
  2375. char === 0x7b ||
  2376. char === 0x7d ||
  2377. char === 0x2f ||
  2378. char === 0x25
  2379. ) {
  2380. if (start < i) {
  2381. buffer.push(str.substring(start, i));
  2382. }
  2383. buffer.push(`#${char.toString(16)}`);
  2384. start = i + 1;
  2385. }
  2386. }
  2387. if (buffer.length === 0) {
  2388. return str;
  2389. }
  2390. if (start < str.length) {
  2391. buffer.push(str.substring(start, str.length));
  2392. }
  2393. return buffer.join("");
  2394. }
  2395. function _collectJS(entry, xref, list, parents) {
  2396. if (!entry) {
  2397. return;
  2398. }
  2399. let parent = null;
  2400. if (entry instanceof _primitives.Ref) {
  2401. if (parents.has(entry)) {
  2402. return;
  2403. }
  2404. parent = entry;
  2405. parents.put(parent);
  2406. entry = xref.fetch(entry);
  2407. }
  2408. if (Array.isArray(entry)) {
  2409. for (const element of entry) {
  2410. _collectJS(element, xref, list, parents);
  2411. }
  2412. } else if (entry instanceof _primitives.Dict) {
  2413. if ((0, _primitives.isName)(entry.get("S"), "JavaScript")) {
  2414. const js = entry.get("JS");
  2415. let code;
  2416. if (js instanceof _base_stream.BaseStream) {
  2417. code = js.getString();
  2418. } else if (typeof js === "string") {
  2419. code = js;
  2420. }
  2421. code =
  2422. code &&
  2423. (0, _util.stringToPDFString)(code).replace(/\u0000/g, "");
  2424. if (code) {
  2425. list.push(code);
  2426. }
  2427. }
  2428. _collectJS(entry.getRaw("Next"), xref, list, parents);
  2429. }
  2430. if (parent) {
  2431. parents.remove(parent);
  2432. }
  2433. }
  2434. function collectActions(xref, dict, eventType) {
  2435. const actions = Object.create(null);
  2436. const additionalActionsDicts = getInheritableProperty({
  2437. dict,
  2438. key: "AA",
  2439. stopWhenFound: false,
  2440. });
  2441. if (additionalActionsDicts) {
  2442. for (let i = additionalActionsDicts.length - 1; i >= 0; i--) {
  2443. const additionalActions = additionalActionsDicts[i];
  2444. if (!(additionalActions instanceof _primitives.Dict)) {
  2445. continue;
  2446. }
  2447. for (const key of additionalActions.getKeys()) {
  2448. const action = eventType[key];
  2449. if (!action) {
  2450. continue;
  2451. }
  2452. const actionDict = additionalActions.getRaw(key);
  2453. const parents = new _primitives.RefSet();
  2454. const list = [];
  2455. _collectJS(actionDict, xref, list, parents);
  2456. if (list.length > 0) {
  2457. actions[action] = list;
  2458. }
  2459. }
  2460. }
  2461. }
  2462. if (dict.has("A")) {
  2463. const actionDict = dict.get("A");
  2464. const parents = new _primitives.RefSet();
  2465. const list = [];
  2466. _collectJS(actionDict, xref, list, parents);
  2467. if (list.length > 0) {
  2468. actions.Action = list;
  2469. }
  2470. }
  2471. return (0, _util.objectSize)(actions) > 0 ? actions : null;
  2472. }
  2473. const XMLEntities = {
  2474. 0x3c: "&lt;",
  2475. 0x3e: "&gt;",
  2476. 0x26: "&amp;",
  2477. 0x22: "&quot;",
  2478. 0x27: "&apos;",
  2479. };
  2480. function encodeToXmlString(str) {
  2481. const buffer = [];
  2482. let start = 0;
  2483. for (let i = 0, ii = str.length; i < ii; i++) {
  2484. const char = str.codePointAt(i);
  2485. if (0x20 <= char && char <= 0x7e) {
  2486. const entity = XMLEntities[char];
  2487. if (entity) {
  2488. if (start < i) {
  2489. buffer.push(str.substring(start, i));
  2490. }
  2491. buffer.push(entity);
  2492. start = i + 1;
  2493. }
  2494. } else {
  2495. if (start < i) {
  2496. buffer.push(str.substring(start, i));
  2497. }
  2498. buffer.push(`&#x${char.toString(16).toUpperCase()};`);
  2499. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  2500. i++;
  2501. }
  2502. start = i + 1;
  2503. }
  2504. }
  2505. if (buffer.length === 0) {
  2506. return str;
  2507. }
  2508. if (start < str.length) {
  2509. buffer.push(str.substring(start, str.length));
  2510. }
  2511. return buffer.join("");
  2512. }
  2513. function validateCSSFont(cssFontInfo) {
  2514. const DEFAULT_CSS_FONT_OBLIQUE = "14";
  2515. const DEFAULT_CSS_FONT_WEIGHT = "400";
  2516. const CSS_FONT_WEIGHT_VALUES = new Set([
  2517. "100",
  2518. "200",
  2519. "300",
  2520. "400",
  2521. "500",
  2522. "600",
  2523. "700",
  2524. "800",
  2525. "900",
  2526. "1000",
  2527. "normal",
  2528. "bold",
  2529. "bolder",
  2530. "lighter",
  2531. ]);
  2532. const { fontFamily, fontWeight, italicAngle } = cssFontInfo;
  2533. if (/^".*"$/.test(fontFamily)) {
  2534. if (/[^\\]"/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2535. (0, _util.warn)(
  2536. `XFA - FontFamily contains some unescaped ": ${fontFamily}.`
  2537. );
  2538. return false;
  2539. }
  2540. } else if (/^'.*'$/.test(fontFamily)) {
  2541. if (/[^\\]'/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2542. (0, _util.warn)(
  2543. `XFA - FontFamily contains some unescaped ': ${fontFamily}.`
  2544. );
  2545. return false;
  2546. }
  2547. } else {
  2548. for (const ident of fontFamily.split(/[ \t]+/)) {
  2549. if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) {
  2550. (0, _util.warn)(
  2551. `XFA - FontFamily contains some invalid <custom-ident>: ${fontFamily}.`
  2552. );
  2553. return false;
  2554. }
  2555. }
  2556. }
  2557. const weight = fontWeight ? fontWeight.toString() : "";
  2558. cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight)
  2559. ? weight
  2560. : DEFAULT_CSS_FONT_WEIGHT;
  2561. const angle = parseFloat(italicAngle);
  2562. cssFontInfo.italicAngle =
  2563. isNaN(angle) || angle < -90 || angle > 90
  2564. ? DEFAULT_CSS_FONT_OBLIQUE
  2565. : italicAngle.toString();
  2566. return true;
  2567. }
  2568. function recoverJsURL(str) {
  2569. const URL_OPEN_METHODS = [
  2570. "app.launchURL",
  2571. "window.open",
  2572. "xfa.host.gotoURL",
  2573. ];
  2574. const regex = new RegExp(
  2575. "^\\s*(" +
  2576. URL_OPEN_METHODS.join("|").split(".").join("\\.") +
  2577. ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))",
  2578. "i"
  2579. );
  2580. const jsUrl = regex.exec(str);
  2581. if (jsUrl && jsUrl[2]) {
  2582. const url = jsUrl[2];
  2583. let newWindow = false;
  2584. if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
  2585. newWindow = true;
  2586. }
  2587. return {
  2588. url,
  2589. newWindow,
  2590. };
  2591. }
  2592. return null;
  2593. }
  2594. function numberToString(value) {
  2595. if (Number.isInteger(value)) {
  2596. return value.toString();
  2597. }
  2598. const roundedValue = Math.round(value * 100);
  2599. if (roundedValue % 100 === 0) {
  2600. return (roundedValue / 100).toString();
  2601. }
  2602. if (roundedValue % 10 === 0) {
  2603. return value.toFixed(1);
  2604. }
  2605. return value.toFixed(2);
  2606. }
  2607. function getNewAnnotationsMap(annotationStorage) {
  2608. if (!annotationStorage) {
  2609. return null;
  2610. }
  2611. const newAnnotationsByPage = new Map();
  2612. for (const [key, value] of annotationStorage) {
  2613. if (!key.startsWith(_util.AnnotationEditorPrefix)) {
  2614. continue;
  2615. }
  2616. let annotations = newAnnotationsByPage.get(value.pageIndex);
  2617. if (!annotations) {
  2618. annotations = [];
  2619. newAnnotationsByPage.set(value.pageIndex, annotations);
  2620. }
  2621. annotations.push(value);
  2622. }
  2623. return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null;
  2624. }
  2625. /***/
  2626. },
  2627. /* 7 */
  2628. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2629. Object.defineProperty(exports, "__esModule", {
  2630. value: true,
  2631. });
  2632. exports.BaseStream = void 0;
  2633. var _util = __w_pdfjs_require__(2);
  2634. class BaseStream {
  2635. constructor() {
  2636. if (this.constructor === BaseStream) {
  2637. (0, _util.unreachable)("Cannot initialize BaseStream.");
  2638. }
  2639. }
  2640. get length() {
  2641. (0, _util.unreachable)("Abstract getter `length` accessed");
  2642. }
  2643. get isEmpty() {
  2644. (0, _util.unreachable)("Abstract getter `isEmpty` accessed");
  2645. }
  2646. get isDataLoaded() {
  2647. return (0, _util.shadow)(this, "isDataLoaded", true);
  2648. }
  2649. getByte() {
  2650. (0, _util.unreachable)("Abstract method `getByte` called");
  2651. }
  2652. getBytes(length) {
  2653. (0, _util.unreachable)("Abstract method `getBytes` called");
  2654. }
  2655. peekByte() {
  2656. const peekedByte = this.getByte();
  2657. if (peekedByte !== -1) {
  2658. this.pos--;
  2659. }
  2660. return peekedByte;
  2661. }
  2662. peekBytes(length) {
  2663. const bytes = this.getBytes(length);
  2664. this.pos -= bytes.length;
  2665. return bytes;
  2666. }
  2667. getUint16() {
  2668. const b0 = this.getByte();
  2669. const b1 = this.getByte();
  2670. if (b0 === -1 || b1 === -1) {
  2671. return -1;
  2672. }
  2673. return (b0 << 8) + b1;
  2674. }
  2675. getInt32() {
  2676. const b0 = this.getByte();
  2677. const b1 = this.getByte();
  2678. const b2 = this.getByte();
  2679. const b3 = this.getByte();
  2680. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  2681. }
  2682. getByteRange(begin, end) {
  2683. (0, _util.unreachable)("Abstract method `getByteRange` called");
  2684. }
  2685. getString(length) {
  2686. return (0, _util.bytesToString)(this.getBytes(length));
  2687. }
  2688. skip(n) {
  2689. this.pos += n || 1;
  2690. }
  2691. reset() {
  2692. (0, _util.unreachable)("Abstract method `reset` called");
  2693. }
  2694. moveStart() {
  2695. (0, _util.unreachable)("Abstract method `moveStart` called");
  2696. }
  2697. makeSubStream(start, length, dict = null) {
  2698. (0, _util.unreachable)("Abstract method `makeSubStream` called");
  2699. }
  2700. getBaseStreams() {
  2701. return null;
  2702. }
  2703. }
  2704. exports.BaseStream = BaseStream;
  2705. /***/
  2706. },
  2707. /* 8 */
  2708. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2709. Object.defineProperty(exports, "__esModule", {
  2710. value: true,
  2711. });
  2712. exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
  2713. var _util = __w_pdfjs_require__(2);
  2714. var _chunked_stream = __w_pdfjs_require__(9);
  2715. var _core_utils = __w_pdfjs_require__(6);
  2716. var _document = __w_pdfjs_require__(11);
  2717. var _stream = __w_pdfjs_require__(10);
  2718. function parseDocBaseUrl(url) {
  2719. if (url) {
  2720. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url);
  2721. if (absoluteUrl) {
  2722. return absoluteUrl.href;
  2723. }
  2724. (0, _util.warn)(`Invalid absolute docBaseUrl: "${url}".`);
  2725. }
  2726. return null;
  2727. }
  2728. class BasePdfManager {
  2729. constructor() {
  2730. if (this.constructor === BasePdfManager) {
  2731. (0, _util.unreachable)("Cannot initialize BasePdfManager.");
  2732. }
  2733. }
  2734. get docId() {
  2735. return this._docId;
  2736. }
  2737. get password() {
  2738. return this._password;
  2739. }
  2740. get docBaseUrl() {
  2741. const catalog = this.pdfDocument.catalog;
  2742. return (0, _util.shadow)(
  2743. this,
  2744. "docBaseUrl",
  2745. catalog.baseUrl || this._docBaseUrl
  2746. );
  2747. }
  2748. onLoadedStream() {
  2749. (0, _util.unreachable)("Abstract method `onLoadedStream` called");
  2750. }
  2751. ensureDoc(prop, args) {
  2752. return this.ensure(this.pdfDocument, prop, args);
  2753. }
  2754. ensureXRef(prop, args) {
  2755. return this.ensure(this.pdfDocument.xref, prop, args);
  2756. }
  2757. ensureCatalog(prop, args) {
  2758. return this.ensure(this.pdfDocument.catalog, prop, args);
  2759. }
  2760. getPage(pageIndex) {
  2761. return this.pdfDocument.getPage(pageIndex);
  2762. }
  2763. fontFallback(id, handler) {
  2764. return this.pdfDocument.fontFallback(id, handler);
  2765. }
  2766. loadXfaFonts(handler, task) {
  2767. return this.pdfDocument.loadXfaFonts(handler, task);
  2768. }
  2769. loadXfaImages() {
  2770. return this.pdfDocument.loadXfaImages();
  2771. }
  2772. serializeXfaData(annotationStorage) {
  2773. return this.pdfDocument.serializeXfaData(annotationStorage);
  2774. }
  2775. cleanup(manuallyTriggered = false) {
  2776. return this.pdfDocument.cleanup(manuallyTriggered);
  2777. }
  2778. async ensure(obj, prop, args) {
  2779. (0, _util.unreachable)("Abstract method `ensure` called");
  2780. }
  2781. requestRange(begin, end) {
  2782. (0, _util.unreachable)("Abstract method `requestRange` called");
  2783. }
  2784. requestLoadedStream() {
  2785. (0, _util.unreachable)(
  2786. "Abstract method `requestLoadedStream` called"
  2787. );
  2788. }
  2789. sendProgressiveData(chunk) {
  2790. (0, _util.unreachable)(
  2791. "Abstract method `sendProgressiveData` called"
  2792. );
  2793. }
  2794. updatePassword(password) {
  2795. this._password = password;
  2796. }
  2797. terminate(reason) {
  2798. (0, _util.unreachable)("Abstract method `terminate` called");
  2799. }
  2800. }
  2801. class LocalPdfManager extends BasePdfManager {
  2802. constructor(
  2803. docId,
  2804. data,
  2805. password,
  2806. msgHandler,
  2807. evaluatorOptions,
  2808. enableXfa,
  2809. docBaseUrl
  2810. ) {
  2811. super();
  2812. this._docId = docId;
  2813. this._password = password;
  2814. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  2815. this.msgHandler = msgHandler;
  2816. this.evaluatorOptions = evaluatorOptions;
  2817. this.enableXfa = enableXfa;
  2818. const stream = new _stream.Stream(data);
  2819. this.pdfDocument = new _document.PDFDocument(this, stream);
  2820. this._loadedStreamPromise = Promise.resolve(stream);
  2821. }
  2822. async ensure(obj, prop, args) {
  2823. const value = obj[prop];
  2824. if (typeof value === "function") {
  2825. return value.apply(obj, args);
  2826. }
  2827. return value;
  2828. }
  2829. requestRange(begin, end) {
  2830. return Promise.resolve();
  2831. }
  2832. requestLoadedStream() {}
  2833. onLoadedStream() {
  2834. return this._loadedStreamPromise;
  2835. }
  2836. terminate(reason) {}
  2837. }
  2838. exports.LocalPdfManager = LocalPdfManager;
  2839. class NetworkPdfManager extends BasePdfManager {
  2840. constructor(
  2841. docId,
  2842. pdfNetworkStream,
  2843. args,
  2844. evaluatorOptions,
  2845. enableXfa,
  2846. docBaseUrl
  2847. ) {
  2848. super();
  2849. this._docId = docId;
  2850. this._password = args.password;
  2851. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  2852. this.msgHandler = args.msgHandler;
  2853. this.evaluatorOptions = evaluatorOptions;
  2854. this.enableXfa = enableXfa;
  2855. this.streamManager = new _chunked_stream.ChunkedStreamManager(
  2856. pdfNetworkStream,
  2857. {
  2858. msgHandler: args.msgHandler,
  2859. length: args.length,
  2860. disableAutoFetch: args.disableAutoFetch,
  2861. rangeChunkSize: args.rangeChunkSize,
  2862. }
  2863. );
  2864. this.pdfDocument = new _document.PDFDocument(
  2865. this,
  2866. this.streamManager.getStream()
  2867. );
  2868. }
  2869. async ensure(obj, prop, args) {
  2870. try {
  2871. const value = obj[prop];
  2872. if (typeof value === "function") {
  2873. return value.apply(obj, args);
  2874. }
  2875. return value;
  2876. } catch (ex) {
  2877. if (!(ex instanceof _core_utils.MissingDataException)) {
  2878. throw ex;
  2879. }
  2880. await this.requestRange(ex.begin, ex.end);
  2881. return this.ensure(obj, prop, args);
  2882. }
  2883. }
  2884. requestRange(begin, end) {
  2885. return this.streamManager.requestRange(begin, end);
  2886. }
  2887. requestLoadedStream() {
  2888. this.streamManager.requestAllChunks();
  2889. }
  2890. sendProgressiveData(chunk) {
  2891. this.streamManager.onReceiveData({
  2892. chunk,
  2893. });
  2894. }
  2895. onLoadedStream() {
  2896. return this.streamManager.onLoadedStream();
  2897. }
  2898. terminate(reason) {
  2899. this.streamManager.abort(reason);
  2900. }
  2901. }
  2902. exports.NetworkPdfManager = NetworkPdfManager;
  2903. /***/
  2904. },
  2905. /* 9 */
  2906. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2907. Object.defineProperty(exports, "__esModule", {
  2908. value: true,
  2909. });
  2910. exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
  2911. var _util = __w_pdfjs_require__(2);
  2912. var _core_utils = __w_pdfjs_require__(6);
  2913. var _stream = __w_pdfjs_require__(10);
  2914. class ChunkedStream extends _stream.Stream {
  2915. constructor(length, chunkSize, manager) {
  2916. super(new Uint8Array(length), 0, length, null);
  2917. this.chunkSize = chunkSize;
  2918. this._loadedChunks = new Set();
  2919. this.numChunks = Math.ceil(length / chunkSize);
  2920. this.manager = manager;
  2921. this.progressiveDataLength = 0;
  2922. this.lastSuccessfulEnsureByteChunk = -1;
  2923. }
  2924. getMissingChunks() {
  2925. const chunks = [];
  2926. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  2927. if (!this._loadedChunks.has(chunk)) {
  2928. chunks.push(chunk);
  2929. }
  2930. }
  2931. return chunks;
  2932. }
  2933. get numChunksLoaded() {
  2934. return this._loadedChunks.size;
  2935. }
  2936. get isDataLoaded() {
  2937. return this.numChunksLoaded === this.numChunks;
  2938. }
  2939. onReceiveData(begin, chunk) {
  2940. const chunkSize = this.chunkSize;
  2941. if (begin % chunkSize !== 0) {
  2942. throw new Error(`Bad begin offset: ${begin}`);
  2943. }
  2944. const end = begin + chunk.byteLength;
  2945. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  2946. throw new Error(`Bad end offset: ${end}`);
  2947. }
  2948. this.bytes.set(new Uint8Array(chunk), begin);
  2949. const beginChunk = Math.floor(begin / chunkSize);
  2950. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  2951. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2952. this._loadedChunks.add(curChunk);
  2953. }
  2954. }
  2955. onReceiveProgressiveData(data) {
  2956. let position = this.progressiveDataLength;
  2957. const beginChunk = Math.floor(position / this.chunkSize);
  2958. this.bytes.set(new Uint8Array(data), position);
  2959. position += data.byteLength;
  2960. this.progressiveDataLength = position;
  2961. const endChunk =
  2962. position >= this.end
  2963. ? this.numChunks
  2964. : Math.floor(position / this.chunkSize);
  2965. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2966. this._loadedChunks.add(curChunk);
  2967. }
  2968. }
  2969. ensureByte(pos) {
  2970. if (pos < this.progressiveDataLength) {
  2971. return;
  2972. }
  2973. const chunk = Math.floor(pos / this.chunkSize);
  2974. if (chunk > this.numChunks) {
  2975. return;
  2976. }
  2977. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  2978. return;
  2979. }
  2980. if (!this._loadedChunks.has(chunk)) {
  2981. throw new _core_utils.MissingDataException(pos, pos + 1);
  2982. }
  2983. this.lastSuccessfulEnsureByteChunk = chunk;
  2984. }
  2985. ensureRange(begin, end) {
  2986. if (begin >= end) {
  2987. return;
  2988. }
  2989. if (end <= this.progressiveDataLength) {
  2990. return;
  2991. }
  2992. const beginChunk = Math.floor(begin / this.chunkSize);
  2993. if (beginChunk > this.numChunks) {
  2994. return;
  2995. }
  2996. const endChunk = Math.min(
  2997. Math.floor((end - 1) / this.chunkSize) + 1,
  2998. this.numChunks
  2999. );
  3000. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  3001. if (!this._loadedChunks.has(chunk)) {
  3002. throw new _core_utils.MissingDataException(begin, end);
  3003. }
  3004. }
  3005. }
  3006. nextEmptyChunk(beginChunk) {
  3007. const numChunks = this.numChunks;
  3008. for (let i = 0; i < numChunks; ++i) {
  3009. const chunk = (beginChunk + i) % numChunks;
  3010. if (!this._loadedChunks.has(chunk)) {
  3011. return chunk;
  3012. }
  3013. }
  3014. return null;
  3015. }
  3016. hasChunk(chunk) {
  3017. return this._loadedChunks.has(chunk);
  3018. }
  3019. getByte() {
  3020. const pos = this.pos;
  3021. if (pos >= this.end) {
  3022. return -1;
  3023. }
  3024. if (pos >= this.progressiveDataLength) {
  3025. this.ensureByte(pos);
  3026. }
  3027. return this.bytes[this.pos++];
  3028. }
  3029. getBytes(length) {
  3030. const bytes = this.bytes;
  3031. const pos = this.pos;
  3032. const strEnd = this.end;
  3033. if (!length) {
  3034. if (strEnd > this.progressiveDataLength) {
  3035. this.ensureRange(pos, strEnd);
  3036. }
  3037. return bytes.subarray(pos, strEnd);
  3038. }
  3039. let end = pos + length;
  3040. if (end > strEnd) {
  3041. end = strEnd;
  3042. }
  3043. if (end > this.progressiveDataLength) {
  3044. this.ensureRange(pos, end);
  3045. }
  3046. this.pos = end;
  3047. return bytes.subarray(pos, end);
  3048. }
  3049. getByteRange(begin, end) {
  3050. if (begin < 0) {
  3051. begin = 0;
  3052. }
  3053. if (end > this.end) {
  3054. end = this.end;
  3055. }
  3056. if (end > this.progressiveDataLength) {
  3057. this.ensureRange(begin, end);
  3058. }
  3059. return this.bytes.subarray(begin, end);
  3060. }
  3061. makeSubStream(start, length, dict = null) {
  3062. if (length) {
  3063. if (start + length > this.progressiveDataLength) {
  3064. this.ensureRange(start, start + length);
  3065. }
  3066. } else {
  3067. if (start >= this.progressiveDataLength) {
  3068. this.ensureByte(start);
  3069. }
  3070. }
  3071. function ChunkedStreamSubstream() {}
  3072. ChunkedStreamSubstream.prototype = Object.create(this);
  3073. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  3074. const chunkSize = this.chunkSize;
  3075. const beginChunk = Math.floor(this.start / chunkSize);
  3076. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  3077. const missingChunks = [];
  3078. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  3079. if (!this._loadedChunks.has(chunk)) {
  3080. missingChunks.push(chunk);
  3081. }
  3082. }
  3083. return missingChunks;
  3084. };
  3085. Object.defineProperty(
  3086. ChunkedStreamSubstream.prototype,
  3087. "isDataLoaded",
  3088. {
  3089. get() {
  3090. if (this.numChunksLoaded === this.numChunks) {
  3091. return true;
  3092. }
  3093. return this.getMissingChunks().length === 0;
  3094. },
  3095. configurable: true,
  3096. }
  3097. );
  3098. const subStream = new ChunkedStreamSubstream();
  3099. subStream.pos = subStream.start = start;
  3100. subStream.end = start + length || this.end;
  3101. subStream.dict = dict;
  3102. return subStream;
  3103. }
  3104. getBaseStreams() {
  3105. return [this];
  3106. }
  3107. }
  3108. exports.ChunkedStream = ChunkedStream;
  3109. class ChunkedStreamManager {
  3110. constructor(pdfNetworkStream, args) {
  3111. this.length = args.length;
  3112. this.chunkSize = args.rangeChunkSize;
  3113. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  3114. this.pdfNetworkStream = pdfNetworkStream;
  3115. this.disableAutoFetch = args.disableAutoFetch;
  3116. this.msgHandler = args.msgHandler;
  3117. this.currRequestId = 0;
  3118. this._chunksNeededByRequest = new Map();
  3119. this._requestsByChunk = new Map();
  3120. this._promisesByRequest = new Map();
  3121. this.progressiveDataLength = 0;
  3122. this.aborted = false;
  3123. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  3124. }
  3125. onLoadedStream() {
  3126. return this._loadedStreamCapability.promise;
  3127. }
  3128. sendRequest(begin, end) {
  3129. const rangeReader = this.pdfNetworkStream.getRangeReader(
  3130. begin,
  3131. end
  3132. );
  3133. if (!rangeReader.isStreamingSupported) {
  3134. rangeReader.onProgress = this.onProgress.bind(this);
  3135. }
  3136. let chunks = [],
  3137. loaded = 0;
  3138. return new Promise((resolve, reject) => {
  3139. const readChunk = (chunk) => {
  3140. try {
  3141. if (!chunk.done) {
  3142. const data = chunk.value;
  3143. chunks.push(data);
  3144. loaded += (0, _util.arrayByteLength)(data);
  3145. if (rangeReader.isStreamingSupported) {
  3146. this.onProgress({
  3147. loaded,
  3148. });
  3149. }
  3150. rangeReader.read().then(readChunk, reject);
  3151. return;
  3152. }
  3153. const chunkData = (0, _util.arraysToBytes)(chunks);
  3154. chunks = null;
  3155. resolve(chunkData);
  3156. } catch (e) {
  3157. reject(e);
  3158. }
  3159. };
  3160. rangeReader.read().then(readChunk, reject);
  3161. }).then((data) => {
  3162. if (this.aborted) {
  3163. return;
  3164. }
  3165. this.onReceiveData({
  3166. chunk: data,
  3167. begin,
  3168. });
  3169. });
  3170. }
  3171. requestAllChunks() {
  3172. const missingChunks = this.stream.getMissingChunks();
  3173. this._requestChunks(missingChunks);
  3174. return this._loadedStreamCapability.promise;
  3175. }
  3176. _requestChunks(chunks) {
  3177. const requestId = this.currRequestId++;
  3178. const chunksNeeded = new Set();
  3179. this._chunksNeededByRequest.set(requestId, chunksNeeded);
  3180. for (const chunk of chunks) {
  3181. if (!this.stream.hasChunk(chunk)) {
  3182. chunksNeeded.add(chunk);
  3183. }
  3184. }
  3185. if (chunksNeeded.size === 0) {
  3186. return Promise.resolve();
  3187. }
  3188. const capability = (0, _util.createPromiseCapability)();
  3189. this._promisesByRequest.set(requestId, capability);
  3190. const chunksToRequest = [];
  3191. for (const chunk of chunksNeeded) {
  3192. let requestIds = this._requestsByChunk.get(chunk);
  3193. if (!requestIds) {
  3194. requestIds = [];
  3195. this._requestsByChunk.set(chunk, requestIds);
  3196. chunksToRequest.push(chunk);
  3197. }
  3198. requestIds.push(requestId);
  3199. }
  3200. if (chunksToRequest.length > 0) {
  3201. const groupedChunksToRequest = this.groupChunks(chunksToRequest);
  3202. for (const groupedChunk of groupedChunksToRequest) {
  3203. const begin = groupedChunk.beginChunk * this.chunkSize;
  3204. const end = Math.min(
  3205. groupedChunk.endChunk * this.chunkSize,
  3206. this.length
  3207. );
  3208. this.sendRequest(begin, end).catch(capability.reject);
  3209. }
  3210. }
  3211. return capability.promise.catch((reason) => {
  3212. if (this.aborted) {
  3213. return;
  3214. }
  3215. throw reason;
  3216. });
  3217. }
  3218. getStream() {
  3219. return this.stream;
  3220. }
  3221. requestRange(begin, end) {
  3222. end = Math.min(end, this.length);
  3223. const beginChunk = this.getBeginChunk(begin);
  3224. const endChunk = this.getEndChunk(end);
  3225. const chunks = [];
  3226. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  3227. chunks.push(chunk);
  3228. }
  3229. return this._requestChunks(chunks);
  3230. }
  3231. requestRanges(ranges = []) {
  3232. const chunksToRequest = [];
  3233. for (const range of ranges) {
  3234. const beginChunk = this.getBeginChunk(range.begin);
  3235. const endChunk = this.getEndChunk(range.end);
  3236. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  3237. if (!chunksToRequest.includes(chunk)) {
  3238. chunksToRequest.push(chunk);
  3239. }
  3240. }
  3241. }
  3242. chunksToRequest.sort(function (a, b) {
  3243. return a - b;
  3244. });
  3245. return this._requestChunks(chunksToRequest);
  3246. }
  3247. groupChunks(chunks) {
  3248. const groupedChunks = [];
  3249. let beginChunk = -1;
  3250. let prevChunk = -1;
  3251. for (let i = 0, ii = chunks.length; i < ii; ++i) {
  3252. const chunk = chunks[i];
  3253. if (beginChunk < 0) {
  3254. beginChunk = chunk;
  3255. }
  3256. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  3257. groupedChunks.push({
  3258. beginChunk,
  3259. endChunk: prevChunk + 1,
  3260. });
  3261. beginChunk = chunk;
  3262. }
  3263. if (i + 1 === chunks.length) {
  3264. groupedChunks.push({
  3265. beginChunk,
  3266. endChunk: chunk + 1,
  3267. });
  3268. }
  3269. prevChunk = chunk;
  3270. }
  3271. return groupedChunks;
  3272. }
  3273. onProgress(args) {
  3274. this.msgHandler.send("DocProgress", {
  3275. loaded:
  3276. this.stream.numChunksLoaded * this.chunkSize + args.loaded,
  3277. total: this.length,
  3278. });
  3279. }
  3280. onReceiveData(args) {
  3281. const chunk = args.chunk;
  3282. const isProgressive = args.begin === undefined;
  3283. const begin = isProgressive
  3284. ? this.progressiveDataLength
  3285. : args.begin;
  3286. const end = begin + chunk.byteLength;
  3287. const beginChunk = Math.floor(begin / this.chunkSize);
  3288. const endChunk =
  3289. end < this.length
  3290. ? Math.floor(end / this.chunkSize)
  3291. : Math.ceil(end / this.chunkSize);
  3292. if (isProgressive) {
  3293. this.stream.onReceiveProgressiveData(chunk);
  3294. this.progressiveDataLength = end;
  3295. } else {
  3296. this.stream.onReceiveData(begin, chunk);
  3297. }
  3298. if (this.stream.isDataLoaded) {
  3299. this._loadedStreamCapability.resolve(this.stream);
  3300. }
  3301. const loadedRequests = [];
  3302. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  3303. const requestIds = this._requestsByChunk.get(curChunk);
  3304. if (!requestIds) {
  3305. continue;
  3306. }
  3307. this._requestsByChunk.delete(curChunk);
  3308. for (const requestId of requestIds) {
  3309. const chunksNeeded = this._chunksNeededByRequest.get(requestId);
  3310. if (chunksNeeded.has(curChunk)) {
  3311. chunksNeeded.delete(curChunk);
  3312. }
  3313. if (chunksNeeded.size > 0) {
  3314. continue;
  3315. }
  3316. loadedRequests.push(requestId);
  3317. }
  3318. }
  3319. if (!this.disableAutoFetch && this._requestsByChunk.size === 0) {
  3320. let nextEmptyChunk;
  3321. if (this.stream.numChunksLoaded === 1) {
  3322. const lastChunk = this.stream.numChunks - 1;
  3323. if (!this.stream.hasChunk(lastChunk)) {
  3324. nextEmptyChunk = lastChunk;
  3325. }
  3326. } else {
  3327. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  3328. }
  3329. if (Number.isInteger(nextEmptyChunk)) {
  3330. this._requestChunks([nextEmptyChunk]);
  3331. }
  3332. }
  3333. for (const requestId of loadedRequests) {
  3334. const capability = this._promisesByRequest.get(requestId);
  3335. this._promisesByRequest.delete(requestId);
  3336. capability.resolve();
  3337. }
  3338. this.msgHandler.send("DocProgress", {
  3339. loaded: this.stream.numChunksLoaded * this.chunkSize,
  3340. total: this.length,
  3341. });
  3342. }
  3343. onError(err) {
  3344. this._loadedStreamCapability.reject(err);
  3345. }
  3346. getBeginChunk(begin) {
  3347. return Math.floor(begin / this.chunkSize);
  3348. }
  3349. getEndChunk(end) {
  3350. return Math.floor((end - 1) / this.chunkSize) + 1;
  3351. }
  3352. abort(reason) {
  3353. this.aborted = true;
  3354. if (this.pdfNetworkStream) {
  3355. this.pdfNetworkStream.cancelAllRequests(reason);
  3356. }
  3357. for (const capability of this._promisesByRequest.values()) {
  3358. capability.reject(reason);
  3359. }
  3360. }
  3361. }
  3362. exports.ChunkedStreamManager = ChunkedStreamManager;
  3363. /***/
  3364. },
  3365. /* 10 */
  3366. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  3367. Object.defineProperty(exports, "__esModule", {
  3368. value: true,
  3369. });
  3370. exports.StringStream = exports.Stream = exports.NullStream = void 0;
  3371. var _base_stream = __w_pdfjs_require__(7);
  3372. var _util = __w_pdfjs_require__(2);
  3373. class Stream extends _base_stream.BaseStream {
  3374. constructor(arrayBuffer, start, length, dict) {
  3375. super();
  3376. this.bytes =
  3377. arrayBuffer instanceof Uint8Array
  3378. ? arrayBuffer
  3379. : new Uint8Array(arrayBuffer);
  3380. this.start = start || 0;
  3381. this.pos = this.start;
  3382. this.end = start + length || this.bytes.length;
  3383. this.dict = dict;
  3384. }
  3385. get length() {
  3386. return this.end - this.start;
  3387. }
  3388. get isEmpty() {
  3389. return this.length === 0;
  3390. }
  3391. getByte() {
  3392. if (this.pos >= this.end) {
  3393. return -1;
  3394. }
  3395. return this.bytes[this.pos++];
  3396. }
  3397. getBytes(length) {
  3398. const bytes = this.bytes;
  3399. const pos = this.pos;
  3400. const strEnd = this.end;
  3401. if (!length) {
  3402. return bytes.subarray(pos, strEnd);
  3403. }
  3404. let end = pos + length;
  3405. if (end > strEnd) {
  3406. end = strEnd;
  3407. }
  3408. this.pos = end;
  3409. return bytes.subarray(pos, end);
  3410. }
  3411. getByteRange(begin, end) {
  3412. if (begin < 0) {
  3413. begin = 0;
  3414. }
  3415. if (end > this.end) {
  3416. end = this.end;
  3417. }
  3418. return this.bytes.subarray(begin, end);
  3419. }
  3420. reset() {
  3421. this.pos = this.start;
  3422. }
  3423. moveStart() {
  3424. this.start = this.pos;
  3425. }
  3426. makeSubStream(start, length, dict = null) {
  3427. return new Stream(this.bytes.buffer, start, length, dict);
  3428. }
  3429. }
  3430. exports.Stream = Stream;
  3431. class StringStream extends Stream {
  3432. constructor(str) {
  3433. super((0, _util.stringToBytes)(str));
  3434. }
  3435. }
  3436. exports.StringStream = StringStream;
  3437. class NullStream extends Stream {
  3438. constructor() {
  3439. super(new Uint8Array(0));
  3440. }
  3441. }
  3442. exports.NullStream = NullStream;
  3443. /***/
  3444. },
  3445. /* 11 */
  3446. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  3447. Object.defineProperty(exports, "__esModule", {
  3448. value: true,
  3449. });
  3450. exports.Page = exports.PDFDocument = void 0;
  3451. var _annotation = __w_pdfjs_require__(12);
  3452. var _util = __w_pdfjs_require__(2);
  3453. var _core_utils = __w_pdfjs_require__(6);
  3454. var _primitives = __w_pdfjs_require__(5);
  3455. var _xfa_fonts = __w_pdfjs_require__(51);
  3456. var _base_stream = __w_pdfjs_require__(7);
  3457. var _crypto = __w_pdfjs_require__(67);
  3458. var _catalog = __w_pdfjs_require__(69);
  3459. var _cleanup_helper = __w_pdfjs_require__(71);
  3460. var _dataset_reader = __w_pdfjs_require__(100);
  3461. var _parser = __w_pdfjs_require__(17);
  3462. var _stream = __w_pdfjs_require__(10);
  3463. var _object_loader = __w_pdfjs_require__(75);
  3464. var _operator_list = __w_pdfjs_require__(62);
  3465. var _evaluator = __w_pdfjs_require__(15);
  3466. var _decode_stream = __w_pdfjs_require__(19);
  3467. var _struct_tree = __w_pdfjs_require__(74);
  3468. var _writer = __w_pdfjs_require__(65);
  3469. var _factory = __w_pdfjs_require__(76);
  3470. var _xref = __w_pdfjs_require__(101);
  3471. const DEFAULT_USER_UNIT = 1.0;
  3472. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  3473. class Page {
  3474. constructor({
  3475. pdfManager,
  3476. xref,
  3477. pageIndex,
  3478. pageDict,
  3479. ref,
  3480. globalIdFactory,
  3481. fontCache,
  3482. builtInCMapCache,
  3483. standardFontDataCache,
  3484. globalImageCache,
  3485. nonBlendModesSet,
  3486. xfaFactory,
  3487. }) {
  3488. this.pdfManager = pdfManager;
  3489. this.pageIndex = pageIndex;
  3490. this.pageDict = pageDict;
  3491. this.xref = xref;
  3492. this.ref = ref;
  3493. this.fontCache = fontCache;
  3494. this.builtInCMapCache = builtInCMapCache;
  3495. this.standardFontDataCache = standardFontDataCache;
  3496. this.globalImageCache = globalImageCache;
  3497. this.nonBlendModesSet = nonBlendModesSet;
  3498. this.evaluatorOptions = pdfManager.evaluatorOptions;
  3499. this.resourcesPromise = null;
  3500. this.xfaFactory = xfaFactory;
  3501. const idCounters = {
  3502. obj: 0,
  3503. };
  3504. this._localIdFactory = class extends globalIdFactory {
  3505. static createObjId() {
  3506. return `p${pageIndex}_${++idCounters.obj}`;
  3507. }
  3508. static getPageObjId() {
  3509. return `page${ref.toString()}`;
  3510. }
  3511. };
  3512. }
  3513. _getInheritableProperty(key, getArray = false) {
  3514. const value = (0, _core_utils.getInheritableProperty)({
  3515. dict: this.pageDict,
  3516. key,
  3517. getArray,
  3518. stopWhenFound: false,
  3519. });
  3520. if (!Array.isArray(value)) {
  3521. return value;
  3522. }
  3523. if (value.length === 1 || !(value[0] instanceof _primitives.Dict)) {
  3524. return value[0];
  3525. }
  3526. return _primitives.Dict.merge({
  3527. xref: this.xref,
  3528. dictArray: value,
  3529. });
  3530. }
  3531. get content() {
  3532. return this.pageDict.getArray("Contents");
  3533. }
  3534. get resources() {
  3535. const resources = this._getInheritableProperty("Resources");
  3536. return (0, _util.shadow)(
  3537. this,
  3538. "resources",
  3539. resources instanceof _primitives.Dict
  3540. ? resources
  3541. : _primitives.Dict.empty
  3542. );
  3543. }
  3544. _getBoundingBox(name) {
  3545. if (this.xfaData) {
  3546. return this.xfaData.bbox;
  3547. }
  3548. const box = this._getInheritableProperty(name, true);
  3549. if (Array.isArray(box) && box.length === 4) {
  3550. if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  3551. return box;
  3552. }
  3553. (0, _util.warn)(`Empty /${name} entry.`);
  3554. }
  3555. return null;
  3556. }
  3557. get mediaBox() {
  3558. return (0, _util.shadow)(
  3559. this,
  3560. "mediaBox",
  3561. this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX
  3562. );
  3563. }
  3564. get cropBox() {
  3565. return (0, _util.shadow)(
  3566. this,
  3567. "cropBox",
  3568. this._getBoundingBox("CropBox") || this.mediaBox
  3569. );
  3570. }
  3571. get userUnit() {
  3572. let obj = this.pageDict.get("UserUnit");
  3573. if (typeof obj !== "number" || obj <= 0) {
  3574. obj = DEFAULT_USER_UNIT;
  3575. }
  3576. return (0, _util.shadow)(this, "userUnit", obj);
  3577. }
  3578. get view() {
  3579. const { cropBox, mediaBox } = this;
  3580. let view;
  3581. if (
  3582. cropBox === mediaBox ||
  3583. (0, _util.isArrayEqual)(cropBox, mediaBox)
  3584. ) {
  3585. view = mediaBox;
  3586. } else {
  3587. const box = _util.Util.intersect(cropBox, mediaBox);
  3588. if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  3589. view = box;
  3590. } else {
  3591. (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
  3592. }
  3593. }
  3594. return (0, _util.shadow)(this, "view", view || mediaBox);
  3595. }
  3596. get rotate() {
  3597. let rotate = this._getInheritableProperty("Rotate") || 0;
  3598. if (rotate % 90 !== 0) {
  3599. rotate = 0;
  3600. } else if (rotate >= 360) {
  3601. rotate %= 360;
  3602. } else if (rotate < 0) {
  3603. rotate = ((rotate % 360) + 360) % 360;
  3604. }
  3605. return (0, _util.shadow)(this, "rotate", rotate);
  3606. }
  3607. _onSubStreamError(handler, reason, objId) {
  3608. if (this.evaluatorOptions.ignoreErrors) {
  3609. handler.send("UnsupportedFeature", {
  3610. featureId: _util.UNSUPPORTED_FEATURES.errorContentSubStream,
  3611. });
  3612. (0, _util.warn)(
  3613. `getContentStream - ignoring sub-stream (${objId}): "${reason}".`
  3614. );
  3615. return;
  3616. }
  3617. throw reason;
  3618. }
  3619. getContentStream(handler) {
  3620. return this.pdfManager.ensure(this, "content").then((content) => {
  3621. if (content instanceof _base_stream.BaseStream) {
  3622. return content;
  3623. }
  3624. if (Array.isArray(content)) {
  3625. return new _decode_stream.StreamsSequenceStream(
  3626. content,
  3627. this._onSubStreamError.bind(this, handler)
  3628. );
  3629. }
  3630. return new _stream.NullStream();
  3631. });
  3632. }
  3633. get xfaData() {
  3634. return (0, _util.shadow)(
  3635. this,
  3636. "xfaData",
  3637. this.xfaFactory
  3638. ? {
  3639. bbox: this.xfaFactory.getBoundingBox(this.pageIndex),
  3640. }
  3641. : null
  3642. );
  3643. }
  3644. async saveNewAnnotations(handler, task, annotations) {
  3645. if (this.xfaFactory) {
  3646. throw new Error("XFA: Cannot save new annotations.");
  3647. }
  3648. const partialEvaluator = new _evaluator.PartialEvaluator({
  3649. xref: this.xref,
  3650. handler,
  3651. pageIndex: this.pageIndex,
  3652. idFactory: this._localIdFactory,
  3653. fontCache: this.fontCache,
  3654. builtInCMapCache: this.builtInCMapCache,
  3655. standardFontDataCache: this.standardFontDataCache,
  3656. globalImageCache: this.globalImageCache,
  3657. options: this.evaluatorOptions,
  3658. });
  3659. const pageDict = this.pageDict;
  3660. const annotationsArray = this.annotations.slice();
  3661. const newData =
  3662. await _annotation.AnnotationFactory.saveNewAnnotations(
  3663. partialEvaluator,
  3664. task,
  3665. annotations
  3666. );
  3667. for (const { ref } of newData.annotations) {
  3668. annotationsArray.push(ref);
  3669. }
  3670. const savedDict = pageDict.get("Annots");
  3671. pageDict.set("Annots", annotationsArray);
  3672. const buffer = [];
  3673. let transform = null;
  3674. if (this.xref.encrypt) {
  3675. transform = this.xref.encrypt.createCipherTransform(
  3676. this.ref.num,
  3677. this.ref.gen
  3678. );
  3679. }
  3680. (0, _writer.writeObject)(this.ref, pageDict, buffer, transform);
  3681. if (savedDict) {
  3682. pageDict.set("Annots", savedDict);
  3683. }
  3684. const objects = newData.dependencies;
  3685. objects.push(
  3686. {
  3687. ref: this.ref,
  3688. data: buffer.join(""),
  3689. },
  3690. ...newData.annotations
  3691. );
  3692. return objects;
  3693. }
  3694. save(handler, task, annotationStorage) {
  3695. const partialEvaluator = new _evaluator.PartialEvaluator({
  3696. xref: this.xref,
  3697. handler,
  3698. pageIndex: this.pageIndex,
  3699. idFactory: this._localIdFactory,
  3700. fontCache: this.fontCache,
  3701. builtInCMapCache: this.builtInCMapCache,
  3702. standardFontDataCache: this.standardFontDataCache,
  3703. globalImageCache: this.globalImageCache,
  3704. options: this.evaluatorOptions,
  3705. });
  3706. return this._parsedAnnotations.then(function (annotations) {
  3707. const newRefsPromises = [];
  3708. for (const annotation of annotations) {
  3709. if (!annotation.mustBePrinted(annotationStorage)) {
  3710. continue;
  3711. }
  3712. newRefsPromises.push(
  3713. annotation
  3714. .save(partialEvaluator, task, annotationStorage)
  3715. .catch(function (reason) {
  3716. (0,
  3717. _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3718. return null;
  3719. })
  3720. );
  3721. }
  3722. return Promise.all(newRefsPromises).then(function (newRefs) {
  3723. return newRefs.filter((newRef) => !!newRef);
  3724. });
  3725. });
  3726. }
  3727. loadResources(keys) {
  3728. if (!this.resourcesPromise) {
  3729. this.resourcesPromise = this.pdfManager.ensure(this, "resources");
  3730. }
  3731. return this.resourcesPromise.then(() => {
  3732. const objectLoader = new _object_loader.ObjectLoader(
  3733. this.resources,
  3734. keys,
  3735. this.xref
  3736. );
  3737. return objectLoader.load();
  3738. });
  3739. }
  3740. getOperatorList({
  3741. handler,
  3742. sink,
  3743. task,
  3744. intent,
  3745. cacheKey,
  3746. annotationStorage = null,
  3747. }) {
  3748. const contentStreamPromise = this.getContentStream(handler);
  3749. const resourcesPromise = this.loadResources([
  3750. "ColorSpace",
  3751. "ExtGState",
  3752. "Font",
  3753. "Pattern",
  3754. "Properties",
  3755. "Shading",
  3756. "XObject",
  3757. ]);
  3758. const partialEvaluator = new _evaluator.PartialEvaluator({
  3759. xref: this.xref,
  3760. handler,
  3761. pageIndex: this.pageIndex,
  3762. idFactory: this._localIdFactory,
  3763. fontCache: this.fontCache,
  3764. builtInCMapCache: this.builtInCMapCache,
  3765. standardFontDataCache: this.standardFontDataCache,
  3766. globalImageCache: this.globalImageCache,
  3767. options: this.evaluatorOptions,
  3768. });
  3769. const newAnnotationsByPage = !this.xfaFactory
  3770. ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage)
  3771. : null;
  3772. let newAnnotationsPromise = Promise.resolve(null);
  3773. if (newAnnotationsByPage) {
  3774. const newAnnotations = newAnnotationsByPage.get(this.pageIndex);
  3775. if (newAnnotations) {
  3776. newAnnotationsPromise =
  3777. _annotation.AnnotationFactory.printNewAnnotations(
  3778. partialEvaluator,
  3779. task,
  3780. newAnnotations
  3781. );
  3782. }
  3783. }
  3784. const dataPromises = Promise.all([
  3785. contentStreamPromise,
  3786. resourcesPromise,
  3787. ]);
  3788. const pageListPromise = dataPromises.then(([contentStream]) => {
  3789. const opList = new _operator_list.OperatorList(intent, sink);
  3790. handler.send("StartRenderPage", {
  3791. transparency: partialEvaluator.hasBlendModes(
  3792. this.resources,
  3793. this.nonBlendModesSet
  3794. ),
  3795. pageIndex: this.pageIndex,
  3796. cacheKey,
  3797. });
  3798. return partialEvaluator
  3799. .getOperatorList({
  3800. stream: contentStream,
  3801. task,
  3802. resources: this.resources,
  3803. operatorList: opList,
  3804. })
  3805. .then(function () {
  3806. return opList;
  3807. });
  3808. });
  3809. return Promise.all([
  3810. pageListPromise,
  3811. this._parsedAnnotations,
  3812. newAnnotationsPromise,
  3813. ]).then(function ([pageOpList, annotations, newAnnotations]) {
  3814. if (newAnnotations) {
  3815. annotations = annotations.concat(newAnnotations);
  3816. }
  3817. if (
  3818. annotations.length === 0 ||
  3819. intent & _util.RenderingIntentFlag.ANNOTATIONS_DISABLE
  3820. ) {
  3821. pageOpList.flush(true);
  3822. return {
  3823. length: pageOpList.totalLength,
  3824. };
  3825. }
  3826. const renderForms = !!(
  3827. intent & _util.RenderingIntentFlag.ANNOTATIONS_FORMS
  3828. ),
  3829. intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  3830. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  3831. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  3832. const opListPromises = [];
  3833. for (const annotation of annotations) {
  3834. if (
  3835. intentAny ||
  3836. (intentDisplay &&
  3837. annotation.mustBeViewed(annotationStorage)) ||
  3838. (intentPrint && annotation.mustBePrinted(annotationStorage))
  3839. ) {
  3840. opListPromises.push(
  3841. annotation
  3842. .getOperatorList(
  3843. partialEvaluator,
  3844. task,
  3845. intent,
  3846. renderForms,
  3847. annotationStorage
  3848. )
  3849. .catch(function (reason) {
  3850. (0,
  3851. _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3852. return null;
  3853. })
  3854. );
  3855. }
  3856. }
  3857. return Promise.all(opListPromises).then(function (opLists) {
  3858. let form = false,
  3859. canvas = false;
  3860. for (const {
  3861. opList,
  3862. separateForm,
  3863. separateCanvas,
  3864. } of opLists) {
  3865. pageOpList.addOpList(opList);
  3866. if (separateForm) {
  3867. form = separateForm;
  3868. }
  3869. if (separateCanvas) {
  3870. canvas = separateCanvas;
  3871. }
  3872. }
  3873. pageOpList.flush(true, {
  3874. form,
  3875. canvas,
  3876. });
  3877. return {
  3878. length: pageOpList.totalLength,
  3879. };
  3880. });
  3881. });
  3882. }
  3883. extractTextContent({
  3884. handler,
  3885. task,
  3886. includeMarkedContent,
  3887. sink,
  3888. combineTextItems,
  3889. }) {
  3890. const contentStreamPromise = this.getContentStream(handler);
  3891. const resourcesPromise = this.loadResources([
  3892. "ExtGState",
  3893. "Font",
  3894. "Properties",
  3895. "XObject",
  3896. ]);
  3897. const dataPromises = Promise.all([
  3898. contentStreamPromise,
  3899. resourcesPromise,
  3900. ]);
  3901. return dataPromises.then(([contentStream]) => {
  3902. const partialEvaluator = new _evaluator.PartialEvaluator({
  3903. xref: this.xref,
  3904. handler,
  3905. pageIndex: this.pageIndex,
  3906. idFactory: this._localIdFactory,
  3907. fontCache: this.fontCache,
  3908. builtInCMapCache: this.builtInCMapCache,
  3909. standardFontDataCache: this.standardFontDataCache,
  3910. globalImageCache: this.globalImageCache,
  3911. options: this.evaluatorOptions,
  3912. });
  3913. return partialEvaluator.getTextContent({
  3914. stream: contentStream,
  3915. task,
  3916. resources: this.resources,
  3917. includeMarkedContent,
  3918. combineTextItems,
  3919. sink,
  3920. viewBox: this.view,
  3921. });
  3922. });
  3923. }
  3924. async getStructTree() {
  3925. const structTreeRoot = await this.pdfManager.ensureCatalog(
  3926. "structTreeRoot"
  3927. );
  3928. if (!structTreeRoot) {
  3929. return null;
  3930. }
  3931. const structTree = await this.pdfManager.ensure(
  3932. this,
  3933. "_parseStructTree",
  3934. [structTreeRoot]
  3935. );
  3936. return structTree.serializable;
  3937. }
  3938. _parseStructTree(structTreeRoot) {
  3939. const tree = new _struct_tree.StructTreePage(
  3940. structTreeRoot,
  3941. this.pageDict
  3942. );
  3943. tree.parse();
  3944. return tree;
  3945. }
  3946. async getAnnotationsData(handler, task, intent) {
  3947. const annotations = await this._parsedAnnotations;
  3948. if (annotations.length === 0) {
  3949. return [];
  3950. }
  3951. const textContentPromises = [];
  3952. const annotationsData = [];
  3953. let partialEvaluator;
  3954. const intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  3955. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  3956. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  3957. for (const annotation of annotations) {
  3958. const isVisible =
  3959. intentAny || (intentDisplay && annotation.viewable);
  3960. if (isVisible || (intentPrint && annotation.printable)) {
  3961. annotationsData.push(annotation.data);
  3962. }
  3963. if (annotation.hasTextContent && isVisible) {
  3964. if (!partialEvaluator) {
  3965. partialEvaluator = new _evaluator.PartialEvaluator({
  3966. xref: this.xref,
  3967. handler,
  3968. pageIndex: this.pageIndex,
  3969. idFactory: this._localIdFactory,
  3970. fontCache: this.fontCache,
  3971. builtInCMapCache: this.builtInCMapCache,
  3972. standardFontDataCache: this.standardFontDataCache,
  3973. globalImageCache: this.globalImageCache,
  3974. options: this.evaluatorOptions,
  3975. });
  3976. }
  3977. textContentPromises.push(
  3978. annotation
  3979. .extractTextContent(partialEvaluator, task, this.view)
  3980. .catch(function (reason) {
  3981. (0,
  3982. _util.warn)(`getAnnotationsData - ignoring textContent during "${task.name}" task: "${reason}".`);
  3983. })
  3984. );
  3985. }
  3986. }
  3987. await Promise.all(textContentPromises);
  3988. return annotationsData;
  3989. }
  3990. get annotations() {
  3991. const annots = this._getInheritableProperty("Annots");
  3992. return (0, _util.shadow)(
  3993. this,
  3994. "annotations",
  3995. Array.isArray(annots) ? annots : []
  3996. );
  3997. }
  3998. get _parsedAnnotations() {
  3999. const parsedAnnotations = this.pdfManager
  4000. .ensure(this, "annotations")
  4001. .then(() => {
  4002. const annotationPromises = [];
  4003. for (const annotationRef of this.annotations) {
  4004. annotationPromises.push(
  4005. _annotation.AnnotationFactory.create(
  4006. this.xref,
  4007. annotationRef,
  4008. this.pdfManager,
  4009. this._localIdFactory,
  4010. false
  4011. ).catch(function (reason) {
  4012. (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
  4013. return null;
  4014. })
  4015. );
  4016. }
  4017. return Promise.all(annotationPromises).then(function (
  4018. annotations
  4019. ) {
  4020. if (annotations.length === 0) {
  4021. return annotations;
  4022. }
  4023. const sortedAnnotations = [];
  4024. let popupAnnotations;
  4025. for (const annotation of annotations) {
  4026. if (!annotation) {
  4027. continue;
  4028. }
  4029. if (annotation instanceof _annotation.PopupAnnotation) {
  4030. if (!popupAnnotations) {
  4031. popupAnnotations = [];
  4032. }
  4033. popupAnnotations.push(annotation);
  4034. continue;
  4035. }
  4036. sortedAnnotations.push(annotation);
  4037. }
  4038. if (popupAnnotations) {
  4039. sortedAnnotations.push(...popupAnnotations);
  4040. }
  4041. return sortedAnnotations;
  4042. });
  4043. });
  4044. return (0, _util.shadow)(
  4045. this,
  4046. "_parsedAnnotations",
  4047. parsedAnnotations
  4048. );
  4049. }
  4050. get jsActions() {
  4051. const actions = (0, _core_utils.collectActions)(
  4052. this.xref,
  4053. this.pageDict,
  4054. _util.PageActionEventType
  4055. );
  4056. return (0, _util.shadow)(this, "jsActions", actions);
  4057. }
  4058. }
  4059. exports.Page = Page;
  4060. const PDF_HEADER_SIGNATURE = new Uint8Array([
  4061. 0x25, 0x50, 0x44, 0x46, 0x2d,
  4062. ]);
  4063. const STARTXREF_SIGNATURE = new Uint8Array([
  4064. 0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66,
  4065. ]);
  4066. const ENDOBJ_SIGNATURE = new Uint8Array([
  4067. 0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a,
  4068. ]);
  4069. const FINGERPRINT_FIRST_BYTES = 1024;
  4070. const EMPTY_FINGERPRINT =
  4071. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  4072. const PDF_HEADER_VERSION_REGEXP = /^[1-9]\.\d$/;
  4073. function find(stream, signature, limit = 1024, backwards = false) {
  4074. const signatureLength = signature.length;
  4075. const scanBytes = stream.peekBytes(limit);
  4076. const scanLength = scanBytes.length - signatureLength;
  4077. if (scanLength <= 0) {
  4078. return false;
  4079. }
  4080. if (backwards) {
  4081. const signatureEnd = signatureLength - 1;
  4082. let pos = scanBytes.length - 1;
  4083. while (pos >= signatureEnd) {
  4084. let j = 0;
  4085. while (
  4086. j < signatureLength &&
  4087. scanBytes[pos - j] === signature[signatureEnd - j]
  4088. ) {
  4089. j++;
  4090. }
  4091. if (j >= signatureLength) {
  4092. stream.pos += pos - signatureEnd;
  4093. return true;
  4094. }
  4095. pos--;
  4096. }
  4097. } else {
  4098. let pos = 0;
  4099. while (pos <= scanLength) {
  4100. let j = 0;
  4101. while (
  4102. j < signatureLength &&
  4103. scanBytes[pos + j] === signature[j]
  4104. ) {
  4105. j++;
  4106. }
  4107. if (j >= signatureLength) {
  4108. stream.pos += pos;
  4109. return true;
  4110. }
  4111. pos++;
  4112. }
  4113. }
  4114. return false;
  4115. }
  4116. class PDFDocument {
  4117. constructor(pdfManager, stream) {
  4118. if (stream.length <= 0) {
  4119. throw new _util.InvalidPDFException(
  4120. "The PDF file is empty, i.e. its size is zero bytes."
  4121. );
  4122. }
  4123. this.pdfManager = pdfManager;
  4124. this.stream = stream;
  4125. this.xref = new _xref.XRef(stream, pdfManager);
  4126. this._pagePromises = new Map();
  4127. this._version = null;
  4128. const idCounters = {
  4129. font: 0,
  4130. };
  4131. this._globalIdFactory = class {
  4132. static getDocId() {
  4133. return `g_${pdfManager.docId}`;
  4134. }
  4135. static createFontId() {
  4136. return `f${++idCounters.font}`;
  4137. }
  4138. static createObjId() {
  4139. (0, _util.unreachable)("Abstract method `createObjId` called.");
  4140. }
  4141. static getPageObjId() {
  4142. (0, _util.unreachable)(
  4143. "Abstract method `getPageObjId` called."
  4144. );
  4145. }
  4146. };
  4147. }
  4148. parse(recoveryMode) {
  4149. this.xref.parse(recoveryMode);
  4150. this.catalog = new _catalog.Catalog(this.pdfManager, this.xref);
  4151. if (this.catalog.version) {
  4152. this._version = this.catalog.version;
  4153. }
  4154. }
  4155. get linearization() {
  4156. let linearization = null;
  4157. try {
  4158. linearization = _parser.Linearization.create(this.stream);
  4159. } catch (err) {
  4160. if (err instanceof _core_utils.MissingDataException) {
  4161. throw err;
  4162. }
  4163. (0, _util.info)(err);
  4164. }
  4165. return (0, _util.shadow)(this, "linearization", linearization);
  4166. }
  4167. get startXRef() {
  4168. const stream = this.stream;
  4169. let startXRef = 0;
  4170. if (this.linearization) {
  4171. stream.reset();
  4172. if (find(stream, ENDOBJ_SIGNATURE)) {
  4173. startXRef = stream.pos + 6 - stream.start;
  4174. }
  4175. } else {
  4176. const step = 1024;
  4177. const startXRefLength = STARTXREF_SIGNATURE.length;
  4178. let found = false,
  4179. pos = stream.end;
  4180. while (!found && pos > 0) {
  4181. pos -= step - startXRefLength;
  4182. if (pos < 0) {
  4183. pos = 0;
  4184. }
  4185. stream.pos = pos;
  4186. found = find(stream, STARTXREF_SIGNATURE, step, true);
  4187. }
  4188. if (found) {
  4189. stream.skip(9);
  4190. let ch;
  4191. do {
  4192. ch = stream.getByte();
  4193. } while ((0, _core_utils.isWhiteSpace)(ch));
  4194. let str = "";
  4195. while (ch >= 0x20 && ch <= 0x39) {
  4196. str += String.fromCharCode(ch);
  4197. ch = stream.getByte();
  4198. }
  4199. startXRef = parseInt(str, 10);
  4200. if (isNaN(startXRef)) {
  4201. startXRef = 0;
  4202. }
  4203. }
  4204. }
  4205. return (0, _util.shadow)(this, "startXRef", startXRef);
  4206. }
  4207. checkHeader() {
  4208. const stream = this.stream;
  4209. stream.reset();
  4210. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  4211. return;
  4212. }
  4213. stream.moveStart();
  4214. const MAX_PDF_VERSION_LENGTH = 12;
  4215. let version = "",
  4216. ch;
  4217. while ((ch = stream.getByte()) > 0x20) {
  4218. if (version.length >= MAX_PDF_VERSION_LENGTH) {
  4219. break;
  4220. }
  4221. version += String.fromCharCode(ch);
  4222. }
  4223. if (!this._version) {
  4224. this._version = version.substring(5);
  4225. }
  4226. }
  4227. parseStartXRef() {
  4228. this.xref.setStartXRef(this.startXRef);
  4229. }
  4230. get numPages() {
  4231. let num = 0;
  4232. if (this.catalog.hasActualNumPages) {
  4233. num = this.catalog.numPages;
  4234. } else if (this.xfaFactory) {
  4235. num = this.xfaFactory.getNumPages();
  4236. } else if (this.linearization) {
  4237. num = this.linearization.numPages;
  4238. } else {
  4239. num = this.catalog.numPages;
  4240. }
  4241. return (0, _util.shadow)(this, "numPages", num);
  4242. }
  4243. _hasOnlyDocumentSignatures(fields, recursionDepth = 0) {
  4244. const RECURSION_LIMIT = 10;
  4245. if (!Array.isArray(fields)) {
  4246. return false;
  4247. }
  4248. return fields.every((field) => {
  4249. field = this.xref.fetchIfRef(field);
  4250. if (!(field instanceof _primitives.Dict)) {
  4251. return false;
  4252. }
  4253. if (field.has("Kids")) {
  4254. if (++recursionDepth > RECURSION_LIMIT) {
  4255. (0, _util.warn)(
  4256. "_hasOnlyDocumentSignatures: maximum recursion depth reached"
  4257. );
  4258. return false;
  4259. }
  4260. return this._hasOnlyDocumentSignatures(
  4261. field.get("Kids"),
  4262. recursionDepth
  4263. );
  4264. }
  4265. const isSignature = (0, _primitives.isName)(
  4266. field.get("FT"),
  4267. "Sig"
  4268. );
  4269. const rectangle = field.get("Rect");
  4270. const isInvisible =
  4271. Array.isArray(rectangle) &&
  4272. rectangle.every((value) => value === 0);
  4273. return isSignature && isInvisible;
  4274. });
  4275. }
  4276. get _xfaStreams() {
  4277. const acroForm = this.catalog.acroForm;
  4278. if (!acroForm) {
  4279. return null;
  4280. }
  4281. const xfa = acroForm.get("XFA");
  4282. const entries = {
  4283. "xdp:xdp": "",
  4284. template: "",
  4285. datasets: "",
  4286. config: "",
  4287. connectionSet: "",
  4288. localeSet: "",
  4289. stylesheet: "",
  4290. "/xdp:xdp": "",
  4291. };
  4292. if (xfa instanceof _base_stream.BaseStream && !xfa.isEmpty) {
  4293. entries["xdp:xdp"] = xfa;
  4294. return entries;
  4295. }
  4296. if (!Array.isArray(xfa) || xfa.length === 0) {
  4297. return null;
  4298. }
  4299. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  4300. let name;
  4301. if (i === 0) {
  4302. name = "xdp:xdp";
  4303. } else if (i === ii - 2) {
  4304. name = "/xdp:xdp";
  4305. } else {
  4306. name = xfa[i];
  4307. }
  4308. if (!entries.hasOwnProperty(name)) {
  4309. continue;
  4310. }
  4311. const data = this.xref.fetchIfRef(xfa[i + 1]);
  4312. if (!(data instanceof _base_stream.BaseStream) || data.isEmpty) {
  4313. continue;
  4314. }
  4315. entries[name] = data;
  4316. }
  4317. return entries;
  4318. }
  4319. get xfaDatasets() {
  4320. const streams = this._xfaStreams;
  4321. if (!streams) {
  4322. return (0, _util.shadow)(this, "xfaDatasets", null);
  4323. }
  4324. for (const key of ["datasets", "xdp:xdp"]) {
  4325. const stream = streams[key];
  4326. if (!stream) {
  4327. continue;
  4328. }
  4329. try {
  4330. const str = (0, _util.stringToUTF8String)(stream.getString());
  4331. const data = {
  4332. [key]: str,
  4333. };
  4334. return (0, _util.shadow)(
  4335. this,
  4336. "xfaDatasets",
  4337. new _dataset_reader.DatasetReader(data)
  4338. );
  4339. } catch (_) {
  4340. (0, _util.warn)("XFA - Invalid utf-8 string.");
  4341. break;
  4342. }
  4343. }
  4344. return (0, _util.shadow)(this, "xfaDatasets", null);
  4345. }
  4346. get xfaData() {
  4347. const streams = this._xfaStreams;
  4348. if (!streams) {
  4349. return null;
  4350. }
  4351. const data = Object.create(null);
  4352. for (const [key, stream] of Object.entries(streams)) {
  4353. if (!stream) {
  4354. continue;
  4355. }
  4356. try {
  4357. data[key] = (0, _util.stringToUTF8String)(stream.getString());
  4358. } catch (_) {
  4359. (0, _util.warn)("XFA - Invalid utf-8 string.");
  4360. return null;
  4361. }
  4362. }
  4363. return data;
  4364. }
  4365. get xfaFactory() {
  4366. let data;
  4367. if (
  4368. this.pdfManager.enableXfa &&
  4369. this.catalog.needsRendering &&
  4370. this.formInfo.hasXfa &&
  4371. !this.formInfo.hasAcroForm
  4372. ) {
  4373. data = this.xfaData;
  4374. }
  4375. return (0, _util.shadow)(
  4376. this,
  4377. "xfaFactory",
  4378. data ? new _factory.XFAFactory(data) : null
  4379. );
  4380. }
  4381. get isPureXfa() {
  4382. return this.xfaFactory ? this.xfaFactory.isValid() : false;
  4383. }
  4384. get htmlForXfa() {
  4385. return this.xfaFactory ? this.xfaFactory.getPages() : null;
  4386. }
  4387. async loadXfaImages() {
  4388. const xfaImagesDict = await this.pdfManager.ensureCatalog(
  4389. "xfaImages"
  4390. );
  4391. if (!xfaImagesDict) {
  4392. return;
  4393. }
  4394. const keys = xfaImagesDict.getKeys();
  4395. const objectLoader = new _object_loader.ObjectLoader(
  4396. xfaImagesDict,
  4397. keys,
  4398. this.xref
  4399. );
  4400. await objectLoader.load();
  4401. const xfaImages = new Map();
  4402. for (const key of keys) {
  4403. const stream = xfaImagesDict.get(key);
  4404. if (stream instanceof _base_stream.BaseStream) {
  4405. xfaImages.set(key, stream.getBytes());
  4406. }
  4407. }
  4408. this.xfaFactory.setImages(xfaImages);
  4409. }
  4410. async loadXfaFonts(handler, task) {
  4411. const acroForm = await this.pdfManager.ensureCatalog("acroForm");
  4412. if (!acroForm) {
  4413. return;
  4414. }
  4415. const resources = await acroForm.getAsync("DR");
  4416. if (!(resources instanceof _primitives.Dict)) {
  4417. return;
  4418. }
  4419. const objectLoader = new _object_loader.ObjectLoader(
  4420. resources,
  4421. ["Font"],
  4422. this.xref
  4423. );
  4424. await objectLoader.load();
  4425. const fontRes = resources.get("Font");
  4426. if (!(fontRes instanceof _primitives.Dict)) {
  4427. return;
  4428. }
  4429. const options = Object.assign(
  4430. Object.create(null),
  4431. this.pdfManager.evaluatorOptions
  4432. );
  4433. options.useSystemFonts = false;
  4434. const partialEvaluator = new _evaluator.PartialEvaluator({
  4435. xref: this.xref,
  4436. handler,
  4437. pageIndex: -1,
  4438. idFactory: this._globalIdFactory,
  4439. fontCache: this.catalog.fontCache,
  4440. builtInCMapCache: this.catalog.builtInCMapCache,
  4441. standardFontDataCache: this.catalog.standardFontDataCache,
  4442. options,
  4443. });
  4444. const operatorList = new _operator_list.OperatorList();
  4445. const pdfFonts = [];
  4446. const initialState = {
  4447. get font() {
  4448. return pdfFonts.at(-1);
  4449. },
  4450. set font(font) {
  4451. pdfFonts.push(font);
  4452. },
  4453. clone() {
  4454. return this;
  4455. },
  4456. };
  4457. const fonts = new Map();
  4458. fontRes.forEach((fontName, font) => {
  4459. fonts.set(fontName, font);
  4460. });
  4461. const promises = [];
  4462. for (const [fontName, font] of fonts) {
  4463. const descriptor = font.get("FontDescriptor");
  4464. if (!(descriptor instanceof _primitives.Dict)) {
  4465. continue;
  4466. }
  4467. let fontFamily = descriptor.get("FontFamily");
  4468. fontFamily = fontFamily.replace(/[ ]+(\d)/g, "$1");
  4469. const fontWeight = descriptor.get("FontWeight");
  4470. const italicAngle = -descriptor.get("ItalicAngle");
  4471. const cssFontInfo = {
  4472. fontFamily,
  4473. fontWeight,
  4474. italicAngle,
  4475. };
  4476. if (!(0, _core_utils.validateCSSFont)(cssFontInfo)) {
  4477. continue;
  4478. }
  4479. promises.push(
  4480. partialEvaluator
  4481. .handleSetFont(
  4482. resources,
  4483. [_primitives.Name.get(fontName), 1],
  4484. null,
  4485. operatorList,
  4486. task,
  4487. initialState,
  4488. null,
  4489. cssFontInfo
  4490. )
  4491. .catch(function (reason) {
  4492. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  4493. return null;
  4494. })
  4495. );
  4496. }
  4497. await Promise.all(promises);
  4498. const missingFonts = this.xfaFactory.setFonts(pdfFonts);
  4499. if (!missingFonts) {
  4500. return;
  4501. }
  4502. options.ignoreErrors = true;
  4503. promises.length = 0;
  4504. pdfFonts.length = 0;
  4505. const reallyMissingFonts = new Set();
  4506. for (const missing of missingFonts) {
  4507. if (!(0, _xfa_fonts.getXfaFontName)(`${missing}-Regular`)) {
  4508. reallyMissingFonts.add(missing);
  4509. }
  4510. }
  4511. if (reallyMissingFonts.size) {
  4512. missingFonts.push("PdfJS-Fallback");
  4513. }
  4514. for (const missing of missingFonts) {
  4515. if (reallyMissingFonts.has(missing)) {
  4516. continue;
  4517. }
  4518. for (const fontInfo of [
  4519. {
  4520. name: "Regular",
  4521. fontWeight: 400,
  4522. italicAngle: 0,
  4523. },
  4524. {
  4525. name: "Bold",
  4526. fontWeight: 700,
  4527. italicAngle: 0,
  4528. },
  4529. {
  4530. name: "Italic",
  4531. fontWeight: 400,
  4532. italicAngle: 12,
  4533. },
  4534. {
  4535. name: "BoldItalic",
  4536. fontWeight: 700,
  4537. italicAngle: 12,
  4538. },
  4539. ]) {
  4540. const name = `${missing}-${fontInfo.name}`;
  4541. const dict = (0, _xfa_fonts.getXfaFontDict)(name);
  4542. promises.push(
  4543. partialEvaluator
  4544. .handleSetFont(
  4545. resources,
  4546. [_primitives.Name.get(name), 1],
  4547. null,
  4548. operatorList,
  4549. task,
  4550. initialState,
  4551. dict,
  4552. {
  4553. fontFamily: missing,
  4554. fontWeight: fontInfo.fontWeight,
  4555. italicAngle: fontInfo.italicAngle,
  4556. }
  4557. )
  4558. .catch(function (reason) {
  4559. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  4560. return null;
  4561. })
  4562. );
  4563. }
  4564. }
  4565. await Promise.all(promises);
  4566. this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts);
  4567. }
  4568. async serializeXfaData(annotationStorage) {
  4569. return this.xfaFactory
  4570. ? this.xfaFactory.serializeData(annotationStorage)
  4571. : null;
  4572. }
  4573. get formInfo() {
  4574. const formInfo = {
  4575. hasFields: false,
  4576. hasAcroForm: false,
  4577. hasXfa: false,
  4578. hasSignatures: false,
  4579. };
  4580. const acroForm = this.catalog.acroForm;
  4581. if (!acroForm) {
  4582. return (0, _util.shadow)(this, "formInfo", formInfo);
  4583. }
  4584. try {
  4585. const fields = acroForm.get("Fields");
  4586. const hasFields = Array.isArray(fields) && fields.length > 0;
  4587. formInfo.hasFields = hasFields;
  4588. const xfa = acroForm.get("XFA");
  4589. formInfo.hasXfa =
  4590. (Array.isArray(xfa) && xfa.length > 0) ||
  4591. (xfa instanceof _base_stream.BaseStream && !xfa.isEmpty);
  4592. const sigFlags = acroForm.get("SigFlags");
  4593. const hasSignatures = !!(sigFlags & 0x1);
  4594. const hasOnlyDocumentSignatures =
  4595. hasSignatures && this._hasOnlyDocumentSignatures(fields);
  4596. formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
  4597. formInfo.hasSignatures = hasSignatures;
  4598. } catch (ex) {
  4599. if (ex instanceof _core_utils.MissingDataException) {
  4600. throw ex;
  4601. }
  4602. (0, _util.warn)(`Cannot fetch form information: "${ex}".`);
  4603. }
  4604. return (0, _util.shadow)(this, "formInfo", formInfo);
  4605. }
  4606. get documentInfo() {
  4607. let version = this._version;
  4608. if (
  4609. typeof version !== "string" ||
  4610. !PDF_HEADER_VERSION_REGEXP.test(version)
  4611. ) {
  4612. (0, _util.warn)(`Invalid PDF header version number: ${version}`);
  4613. version = null;
  4614. }
  4615. const docInfo = {
  4616. PDFFormatVersion: version,
  4617. Language: this.catalog.lang,
  4618. EncryptFilterName: this.xref.encrypt
  4619. ? this.xref.encrypt.filterName
  4620. : null,
  4621. IsLinearized: !!this.linearization,
  4622. IsAcroFormPresent: this.formInfo.hasAcroForm,
  4623. IsXFAPresent: this.formInfo.hasXfa,
  4624. IsCollectionPresent: !!this.catalog.collection,
  4625. IsSignaturesPresent: this.formInfo.hasSignatures,
  4626. };
  4627. let infoDict;
  4628. try {
  4629. infoDict = this.xref.trailer.get("Info");
  4630. } catch (err) {
  4631. if (err instanceof _core_utils.MissingDataException) {
  4632. throw err;
  4633. }
  4634. (0, _util.info)(
  4635. "The document information dictionary is invalid."
  4636. );
  4637. }
  4638. if (!(infoDict instanceof _primitives.Dict)) {
  4639. return (0, _util.shadow)(this, "documentInfo", docInfo);
  4640. }
  4641. for (const key of infoDict.getKeys()) {
  4642. const value = infoDict.get(key);
  4643. switch (key) {
  4644. case "Title":
  4645. case "Author":
  4646. case "Subject":
  4647. case "Keywords":
  4648. case "Creator":
  4649. case "Producer":
  4650. case "CreationDate":
  4651. case "ModDate":
  4652. if (typeof value === "string") {
  4653. docInfo[key] = (0, _util.stringToPDFString)(value);
  4654. continue;
  4655. }
  4656. break;
  4657. case "Trapped":
  4658. if (value instanceof _primitives.Name) {
  4659. docInfo[key] = value;
  4660. continue;
  4661. }
  4662. break;
  4663. default:
  4664. let customValue;
  4665. switch (typeof value) {
  4666. case "string":
  4667. customValue = (0, _util.stringToPDFString)(value);
  4668. break;
  4669. case "number":
  4670. case "boolean":
  4671. customValue = value;
  4672. break;
  4673. default:
  4674. if (value instanceof _primitives.Name) {
  4675. customValue = value;
  4676. }
  4677. break;
  4678. }
  4679. if (customValue === undefined) {
  4680. (0, _util.warn)(
  4681. `Bad value, for custom key "${key}", in Info: ${value}.`
  4682. );
  4683. continue;
  4684. }
  4685. if (!docInfo.Custom) {
  4686. docInfo.Custom = Object.create(null);
  4687. }
  4688. docInfo.Custom[key] = customValue;
  4689. continue;
  4690. }
  4691. (0, _util.warn)(
  4692. `Bad value, for key "${key}", in Info: ${value}.`
  4693. );
  4694. }
  4695. return (0, _util.shadow)(this, "documentInfo", docInfo);
  4696. }
  4697. get fingerprints() {
  4698. function validate(data) {
  4699. return (
  4700. typeof data === "string" &&
  4701. data.length > 0 &&
  4702. data !== EMPTY_FINGERPRINT
  4703. );
  4704. }
  4705. function hexString(hash) {
  4706. const buf = [];
  4707. for (let i = 0, ii = hash.length; i < ii; i++) {
  4708. const hex = hash[i].toString(16);
  4709. buf.push(hex.padStart(2, "0"));
  4710. }
  4711. return buf.join("");
  4712. }
  4713. const idArray = this.xref.trailer.get("ID");
  4714. let hashOriginal, hashModified;
  4715. if (Array.isArray(idArray) && validate(idArray[0])) {
  4716. hashOriginal = (0, _util.stringToBytes)(idArray[0]);
  4717. if (idArray[1] !== idArray[0] && validate(idArray[1])) {
  4718. hashModified = (0, _util.stringToBytes)(idArray[1]);
  4719. }
  4720. } else {
  4721. hashOriginal = (0, _crypto.calculateMD5)(
  4722. this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES),
  4723. 0,
  4724. FINGERPRINT_FIRST_BYTES
  4725. );
  4726. }
  4727. return (0, _util.shadow)(this, "fingerprints", [
  4728. hexString(hashOriginal),
  4729. hashModified ? hexString(hashModified) : null,
  4730. ]);
  4731. }
  4732. async _getLinearizationPage(pageIndex) {
  4733. const { catalog, linearization, xref } = this;
  4734. const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
  4735. try {
  4736. const obj = await xref.fetchAsync(ref);
  4737. if (obj instanceof _primitives.Dict) {
  4738. let type = obj.getRaw("Type");
  4739. if (type instanceof _primitives.Ref) {
  4740. type = await xref.fetchAsync(type);
  4741. }
  4742. if (
  4743. (0, _primitives.isName)(type, "Page") ||
  4744. (!obj.has("Type") && !obj.has("Kids"))
  4745. ) {
  4746. if (!catalog.pageKidsCountCache.has(ref)) {
  4747. catalog.pageKidsCountCache.put(ref, 1);
  4748. }
  4749. if (!catalog.pageIndexCache.has(ref)) {
  4750. catalog.pageIndexCache.put(ref, 0);
  4751. }
  4752. return [obj, ref];
  4753. }
  4754. }
  4755. throw new _util.FormatError(
  4756. "The Linearization dictionary doesn't point to a valid Page dictionary."
  4757. );
  4758. } catch (reason) {
  4759. (0, _util.warn)(`_getLinearizationPage: "${reason.message}".`);
  4760. return catalog.getPageDict(pageIndex);
  4761. }
  4762. }
  4763. getPage(pageIndex) {
  4764. const cachedPromise = this._pagePromises.get(pageIndex);
  4765. if (cachedPromise) {
  4766. return cachedPromise;
  4767. }
  4768. const { catalog, linearization, xfaFactory } = this;
  4769. let promise;
  4770. if (xfaFactory) {
  4771. promise = Promise.resolve([_primitives.Dict.empty, null]);
  4772. } else if (linearization && linearization.pageFirst === pageIndex) {
  4773. promise = this._getLinearizationPage(pageIndex);
  4774. } else {
  4775. promise = catalog.getPageDict(pageIndex);
  4776. }
  4777. promise = promise.then(([pageDict, ref]) => {
  4778. return new Page({
  4779. pdfManager: this.pdfManager,
  4780. xref: this.xref,
  4781. pageIndex,
  4782. pageDict,
  4783. ref,
  4784. globalIdFactory: this._globalIdFactory,
  4785. fontCache: catalog.fontCache,
  4786. builtInCMapCache: catalog.builtInCMapCache,
  4787. standardFontDataCache: catalog.standardFontDataCache,
  4788. globalImageCache: catalog.globalImageCache,
  4789. nonBlendModesSet: catalog.nonBlendModesSet,
  4790. xfaFactory,
  4791. });
  4792. });
  4793. this._pagePromises.set(pageIndex, promise);
  4794. return promise;
  4795. }
  4796. async checkFirstPage(recoveryMode = false) {
  4797. if (recoveryMode) {
  4798. return;
  4799. }
  4800. try {
  4801. await this.getPage(0);
  4802. } catch (reason) {
  4803. if (reason instanceof _core_utils.XRefEntryException) {
  4804. this._pagePromises.delete(0);
  4805. await this.cleanup();
  4806. throw new _core_utils.XRefParseException();
  4807. }
  4808. }
  4809. }
  4810. async checkLastPage(recoveryMode = false) {
  4811. const { catalog, pdfManager } = this;
  4812. catalog.setActualNumPages();
  4813. let numPages;
  4814. try {
  4815. await Promise.all([
  4816. pdfManager.ensureDoc("xfaFactory"),
  4817. pdfManager.ensureDoc("linearization"),
  4818. pdfManager.ensureCatalog("numPages"),
  4819. ]);
  4820. if (this.xfaFactory) {
  4821. return;
  4822. } else if (this.linearization) {
  4823. numPages = this.linearization.numPages;
  4824. } else {
  4825. numPages = catalog.numPages;
  4826. }
  4827. if (!Number.isInteger(numPages)) {
  4828. throw new _util.FormatError("Page count is not an integer.");
  4829. } else if (numPages <= 1) {
  4830. return;
  4831. }
  4832. await this.getPage(numPages - 1);
  4833. } catch (reason) {
  4834. this._pagePromises.delete(numPages - 1);
  4835. await this.cleanup();
  4836. if (
  4837. reason instanceof _core_utils.XRefEntryException &&
  4838. !recoveryMode
  4839. ) {
  4840. throw new _core_utils.XRefParseException();
  4841. }
  4842. (0, _util.warn)(
  4843. `checkLastPage - invalid /Pages tree /Count: ${numPages}.`
  4844. );
  4845. let pagesTree;
  4846. try {
  4847. pagesTree = await catalog.getAllPageDicts(recoveryMode);
  4848. } catch (reasonAll) {
  4849. if (
  4850. reasonAll instanceof _core_utils.XRefEntryException &&
  4851. !recoveryMode
  4852. ) {
  4853. throw new _core_utils.XRefParseException();
  4854. }
  4855. catalog.setActualNumPages(1);
  4856. return;
  4857. }
  4858. for (const [pageIndex, [pageDict, ref]] of pagesTree) {
  4859. let promise;
  4860. if (pageDict instanceof Error) {
  4861. promise = Promise.reject(pageDict);
  4862. promise.catch(() => {});
  4863. } else {
  4864. promise = Promise.resolve(
  4865. new Page({
  4866. pdfManager,
  4867. xref: this.xref,
  4868. pageIndex,
  4869. pageDict,
  4870. ref,
  4871. globalIdFactory: this._globalIdFactory,
  4872. fontCache: catalog.fontCache,
  4873. builtInCMapCache: catalog.builtInCMapCache,
  4874. standardFontDataCache: catalog.standardFontDataCache,
  4875. globalImageCache: catalog.globalImageCache,
  4876. nonBlendModesSet: catalog.nonBlendModesSet,
  4877. xfaFactory: null,
  4878. })
  4879. );
  4880. }
  4881. this._pagePromises.set(pageIndex, promise);
  4882. }
  4883. catalog.setActualNumPages(pagesTree.size);
  4884. }
  4885. }
  4886. fontFallback(id, handler) {
  4887. return this.catalog.fontFallback(id, handler);
  4888. }
  4889. async cleanup(manuallyTriggered = false) {
  4890. return this.catalog
  4891. ? this.catalog.cleanup(manuallyTriggered)
  4892. : (0, _cleanup_helper.clearGlobalCaches)();
  4893. }
  4894. _collectFieldObjects(name, fieldRef, promises) {
  4895. const field = this.xref.fetchIfRef(fieldRef);
  4896. if (field.has("T")) {
  4897. const partName = (0, _util.stringToPDFString)(field.get("T"));
  4898. if (name === "") {
  4899. name = partName;
  4900. } else {
  4901. name = `${name}.${partName}`;
  4902. }
  4903. }
  4904. if (!promises.has(name)) {
  4905. promises.set(name, []);
  4906. }
  4907. promises.get(name).push(
  4908. _annotation.AnnotationFactory.create(
  4909. this.xref,
  4910. fieldRef,
  4911. this.pdfManager,
  4912. this._localIdFactory,
  4913. true
  4914. )
  4915. .then((annotation) => annotation && annotation.getFieldObject())
  4916. .catch(function (reason) {
  4917. (0, _util.warn)(`_collectFieldObjects: "${reason}".`);
  4918. return null;
  4919. })
  4920. );
  4921. if (field.has("Kids")) {
  4922. const kids = field.get("Kids");
  4923. for (const kid of kids) {
  4924. this._collectFieldObjects(name, kid, promises);
  4925. }
  4926. }
  4927. }
  4928. get fieldObjects() {
  4929. if (!this.formInfo.hasFields) {
  4930. return (0, _util.shadow)(
  4931. this,
  4932. "fieldObjects",
  4933. Promise.resolve(null)
  4934. );
  4935. }
  4936. const allFields = Object.create(null);
  4937. const fieldPromises = new Map();
  4938. for (const fieldRef of this.catalog.acroForm.get("Fields")) {
  4939. this._collectFieldObjects("", fieldRef, fieldPromises);
  4940. }
  4941. const allPromises = [];
  4942. for (const [name, promises] of fieldPromises) {
  4943. allPromises.push(
  4944. Promise.all(promises).then((fields) => {
  4945. fields = fields.filter((field) => !!field);
  4946. if (fields.length > 0) {
  4947. allFields[name] = fields;
  4948. }
  4949. })
  4950. );
  4951. }
  4952. return (0, _util.shadow)(
  4953. this,
  4954. "fieldObjects",
  4955. Promise.all(allPromises).then(() => allFields)
  4956. );
  4957. }
  4958. get hasJSActions() {
  4959. const promise = this.pdfManager.ensureDoc("_parseHasJSActions");
  4960. return (0, _util.shadow)(this, "hasJSActions", promise);
  4961. }
  4962. async _parseHasJSActions() {
  4963. const [catalogJsActions, fieldObjects] = await Promise.all([
  4964. this.pdfManager.ensureCatalog("jsActions"),
  4965. this.pdfManager.ensureDoc("fieldObjects"),
  4966. ]);
  4967. if (catalogJsActions) {
  4968. return true;
  4969. }
  4970. if (fieldObjects) {
  4971. return Object.values(fieldObjects).some((fieldObject) =>
  4972. fieldObject.some((object) => object.actions !== null)
  4973. );
  4974. }
  4975. return false;
  4976. }
  4977. get calculationOrderIds() {
  4978. const acroForm = this.catalog.acroForm;
  4979. if (!acroForm || !acroForm.has("CO")) {
  4980. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4981. }
  4982. const calculationOrder = acroForm.get("CO");
  4983. if (
  4984. !Array.isArray(calculationOrder) ||
  4985. calculationOrder.length === 0
  4986. ) {
  4987. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4988. }
  4989. const ids = [];
  4990. for (const id of calculationOrder) {
  4991. if (id instanceof _primitives.Ref) {
  4992. ids.push(id.toString());
  4993. }
  4994. }
  4995. if (ids.length === 0) {
  4996. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4997. }
  4998. return (0, _util.shadow)(this, "calculationOrderIds", ids);
  4999. }
  5000. }
  5001. exports.PDFDocument = PDFDocument;
  5002. /***/
  5003. },
  5004. /* 12 */
  5005. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5006. Object.defineProperty(exports, "__esModule", {
  5007. value: true,
  5008. });
  5009. exports.PopupAnnotation =
  5010. exports.MarkupAnnotation =
  5011. exports.AnnotationFactory =
  5012. exports.AnnotationBorderStyle =
  5013. exports.Annotation =
  5014. void 0;
  5015. exports.getQuadPoints = getQuadPoints;
  5016. var _util = __w_pdfjs_require__(2);
  5017. var _core_utils = __w_pdfjs_require__(6);
  5018. var _default_appearance = __w_pdfjs_require__(13);
  5019. var _primitives = __w_pdfjs_require__(5);
  5020. var _writer = __w_pdfjs_require__(65);
  5021. var _base_stream = __w_pdfjs_require__(7);
  5022. var _bidi = __w_pdfjs_require__(60);
  5023. var _catalog = __w_pdfjs_require__(69);
  5024. var _colorspace = __w_pdfjs_require__(14);
  5025. var _file_spec = __w_pdfjs_require__(72);
  5026. var _object_loader = __w_pdfjs_require__(75);
  5027. var _operator_list = __w_pdfjs_require__(62);
  5028. var _stream = __w_pdfjs_require__(10);
  5029. var _factory = __w_pdfjs_require__(76);
  5030. class AnnotationFactory {
  5031. static create(xref, ref, pdfManager, idFactory, collectFields) {
  5032. return Promise.all([
  5033. pdfManager.ensureCatalog("acroForm"),
  5034. pdfManager.ensureCatalog("baseUrl"),
  5035. pdfManager.ensureDoc("xfaDatasets"),
  5036. collectFields ? this._getPageIndex(xref, ref, pdfManager) : -1,
  5037. ]).then(([acroForm, baseUrl, xfaDatasets, pageIndex]) =>
  5038. pdfManager.ensure(this, "_create", [
  5039. xref,
  5040. ref,
  5041. pdfManager,
  5042. idFactory,
  5043. acroForm,
  5044. xfaDatasets,
  5045. collectFields,
  5046. pageIndex,
  5047. ])
  5048. );
  5049. }
  5050. static _create(
  5051. xref,
  5052. ref,
  5053. pdfManager,
  5054. idFactory,
  5055. acroForm,
  5056. xfaDatasets,
  5057. collectFields,
  5058. pageIndex = -1
  5059. ) {
  5060. const dict = xref.fetchIfRef(ref);
  5061. if (!(dict instanceof _primitives.Dict)) {
  5062. return undefined;
  5063. }
  5064. const id =
  5065. ref instanceof _primitives.Ref
  5066. ? ref.toString()
  5067. : `annot_${idFactory.createObjId()}`;
  5068. let subtype = dict.get("Subtype");
  5069. subtype = subtype instanceof _primitives.Name ? subtype.name : null;
  5070. const parameters = {
  5071. xref,
  5072. ref,
  5073. dict,
  5074. subtype,
  5075. id,
  5076. pdfManager,
  5077. acroForm:
  5078. acroForm instanceof _primitives.Dict
  5079. ? acroForm
  5080. : _primitives.Dict.empty,
  5081. xfaDatasets,
  5082. collectFields,
  5083. pageIndex,
  5084. };
  5085. switch (subtype) {
  5086. case "Link":
  5087. return new LinkAnnotation(parameters);
  5088. case "Text":
  5089. return new TextAnnotation(parameters);
  5090. case "Widget":
  5091. let fieldType = (0, _core_utils.getInheritableProperty)({
  5092. dict,
  5093. key: "FT",
  5094. });
  5095. fieldType =
  5096. fieldType instanceof _primitives.Name ? fieldType.name : null;
  5097. switch (fieldType) {
  5098. case "Tx":
  5099. return new TextWidgetAnnotation(parameters);
  5100. case "Btn":
  5101. return new ButtonWidgetAnnotation(parameters);
  5102. case "Ch":
  5103. return new ChoiceWidgetAnnotation(parameters);
  5104. case "Sig":
  5105. return new SignatureWidgetAnnotation(parameters);
  5106. }
  5107. (0, _util.warn)(
  5108. `Unimplemented widget field type "${fieldType}", ` +
  5109. "falling back to base field type."
  5110. );
  5111. return new WidgetAnnotation(parameters);
  5112. case "Popup":
  5113. return new PopupAnnotation(parameters);
  5114. case "FreeText":
  5115. return new FreeTextAnnotation(parameters);
  5116. case "Line":
  5117. return new LineAnnotation(parameters);
  5118. case "Square":
  5119. return new SquareAnnotation(parameters);
  5120. case "Circle":
  5121. return new CircleAnnotation(parameters);
  5122. case "PolyLine":
  5123. return new PolylineAnnotation(parameters);
  5124. case "Polygon":
  5125. return new PolygonAnnotation(parameters);
  5126. case "Caret":
  5127. return new CaretAnnotation(parameters);
  5128. case "Ink":
  5129. return new InkAnnotation(parameters);
  5130. case "Highlight":
  5131. return new HighlightAnnotation(parameters);
  5132. case "Underline":
  5133. return new UnderlineAnnotation(parameters);
  5134. case "Squiggly":
  5135. return new SquigglyAnnotation(parameters);
  5136. case "StrikeOut":
  5137. return new StrikeOutAnnotation(parameters);
  5138. case "Stamp":
  5139. return new StampAnnotation(parameters);
  5140. case "FileAttachment":
  5141. return new FileAttachmentAnnotation(parameters);
  5142. default:
  5143. if (!collectFields) {
  5144. if (!subtype) {
  5145. (0, _util.warn)(
  5146. "Annotation is missing the required /Subtype."
  5147. );
  5148. } else {
  5149. (0, _util.warn)(
  5150. `Unimplemented annotation type "${subtype}", ` +
  5151. "falling back to base annotation."
  5152. );
  5153. }
  5154. }
  5155. return new Annotation(parameters);
  5156. }
  5157. }
  5158. static async _getPageIndex(xref, ref, pdfManager) {
  5159. try {
  5160. const annotDict = await xref.fetchIfRefAsync(ref);
  5161. if (!(annotDict instanceof _primitives.Dict)) {
  5162. return -1;
  5163. }
  5164. const pageRef = annotDict.getRaw("P");
  5165. if (!(pageRef instanceof _primitives.Ref)) {
  5166. return -1;
  5167. }
  5168. const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [
  5169. pageRef,
  5170. ]);
  5171. return pageIndex;
  5172. } catch (ex) {
  5173. (0, _util.warn)(`_getPageIndex: "${ex}".`);
  5174. return -1;
  5175. }
  5176. }
  5177. static async saveNewAnnotations(evaluator, task, annotations) {
  5178. const xref = evaluator.xref;
  5179. let baseFontRef;
  5180. const dependencies = [];
  5181. const promises = [];
  5182. for (const annotation of annotations) {
  5183. switch (annotation.annotationType) {
  5184. case _util.AnnotationEditorType.FREETEXT:
  5185. if (!baseFontRef) {
  5186. const baseFont = new _primitives.Dict(xref);
  5187. baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
  5188. baseFont.set("Type", _primitives.Name.get("Font"));
  5189. baseFont.set("Subtype", _primitives.Name.get("Type1"));
  5190. baseFont.set(
  5191. "Encoding",
  5192. _primitives.Name.get("WinAnsiEncoding")
  5193. );
  5194. const buffer = [];
  5195. baseFontRef = xref.getNewRef();
  5196. (0, _writer.writeObject)(
  5197. baseFontRef,
  5198. baseFont,
  5199. buffer,
  5200. null
  5201. );
  5202. dependencies.push({
  5203. ref: baseFontRef,
  5204. data: buffer.join(""),
  5205. });
  5206. }
  5207. promises.push(
  5208. FreeTextAnnotation.createNewAnnotation(
  5209. xref,
  5210. annotation,
  5211. dependencies,
  5212. {
  5213. evaluator,
  5214. task,
  5215. baseFontRef,
  5216. }
  5217. )
  5218. );
  5219. break;
  5220. case _util.AnnotationEditorType.INK:
  5221. promises.push(
  5222. InkAnnotation.createNewAnnotation(
  5223. xref,
  5224. annotation,
  5225. dependencies
  5226. )
  5227. );
  5228. }
  5229. }
  5230. return {
  5231. annotations: await Promise.all(promises),
  5232. dependencies,
  5233. };
  5234. }
  5235. static async printNewAnnotations(evaluator, task, annotations) {
  5236. if (!annotations) {
  5237. return null;
  5238. }
  5239. const xref = evaluator.xref;
  5240. const promises = [];
  5241. for (const annotation of annotations) {
  5242. switch (annotation.annotationType) {
  5243. case _util.AnnotationEditorType.FREETEXT:
  5244. promises.push(
  5245. FreeTextAnnotation.createNewPrintAnnotation(
  5246. xref,
  5247. annotation,
  5248. {
  5249. evaluator,
  5250. task,
  5251. }
  5252. )
  5253. );
  5254. break;
  5255. case _util.AnnotationEditorType.INK:
  5256. promises.push(
  5257. InkAnnotation.createNewPrintAnnotation(xref, annotation)
  5258. );
  5259. break;
  5260. }
  5261. }
  5262. return Promise.all(promises);
  5263. }
  5264. }
  5265. exports.AnnotationFactory = AnnotationFactory;
  5266. function getRgbColor(color, defaultColor = new Uint8ClampedArray(3)) {
  5267. if (!Array.isArray(color)) {
  5268. return defaultColor;
  5269. }
  5270. const rgbColor = defaultColor || new Uint8ClampedArray(3);
  5271. switch (color.length) {
  5272. case 0:
  5273. return null;
  5274. case 1:
  5275. _colorspace.ColorSpace.singletons.gray.getRgbItem(
  5276. color,
  5277. 0,
  5278. rgbColor,
  5279. 0
  5280. );
  5281. return rgbColor;
  5282. case 3:
  5283. _colorspace.ColorSpace.singletons.rgb.getRgbItem(
  5284. color,
  5285. 0,
  5286. rgbColor,
  5287. 0
  5288. );
  5289. return rgbColor;
  5290. case 4:
  5291. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(
  5292. color,
  5293. 0,
  5294. rgbColor,
  5295. 0
  5296. );
  5297. return rgbColor;
  5298. default:
  5299. return defaultColor;
  5300. }
  5301. }
  5302. function getQuadPoints(dict, rect) {
  5303. if (!dict.has("QuadPoints")) {
  5304. return null;
  5305. }
  5306. const quadPoints = dict.getArray("QuadPoints");
  5307. if (
  5308. !Array.isArray(quadPoints) ||
  5309. quadPoints.length === 0 ||
  5310. quadPoints.length % 8 > 0
  5311. ) {
  5312. return null;
  5313. }
  5314. const quadPointsLists = [];
  5315. for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
  5316. quadPointsLists.push([]);
  5317. for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
  5318. const x = quadPoints[j];
  5319. const y = quadPoints[j + 1];
  5320. if (
  5321. rect !== null &&
  5322. (x < rect[0] || x > rect[2] || y < rect[1] || y > rect[3])
  5323. ) {
  5324. return null;
  5325. }
  5326. quadPointsLists[i].push({
  5327. x,
  5328. y,
  5329. });
  5330. }
  5331. }
  5332. return quadPointsLists.map((quadPointsList) => {
  5333. const [minX, maxX, minY, maxY] = quadPointsList.reduce(
  5334. ([mX, MX, mY, MY], quadPoint) => [
  5335. Math.min(mX, quadPoint.x),
  5336. Math.max(MX, quadPoint.x),
  5337. Math.min(mY, quadPoint.y),
  5338. Math.max(MY, quadPoint.y),
  5339. ],
  5340. [
  5341. Number.MAX_VALUE,
  5342. Number.MIN_VALUE,
  5343. Number.MAX_VALUE,
  5344. Number.MIN_VALUE,
  5345. ]
  5346. );
  5347. return [
  5348. {
  5349. x: minX,
  5350. y: maxY,
  5351. },
  5352. {
  5353. x: maxX,
  5354. y: maxY,
  5355. },
  5356. {
  5357. x: minX,
  5358. y: minY,
  5359. },
  5360. {
  5361. x: maxX,
  5362. y: minY,
  5363. },
  5364. ];
  5365. });
  5366. }
  5367. function getTransformMatrix(rect, bbox, matrix) {
  5368. const [minX, minY, maxX, maxY] =
  5369. _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
  5370. if (minX === maxX || minY === maxY) {
  5371. return [1, 0, 0, 1, rect[0], rect[1]];
  5372. }
  5373. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  5374. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  5375. return [
  5376. xRatio,
  5377. 0,
  5378. 0,
  5379. yRatio,
  5380. rect[0] - minX * xRatio,
  5381. rect[1] - minY * yRatio,
  5382. ];
  5383. }
  5384. class Annotation {
  5385. constructor(params) {
  5386. const dict = params.dict;
  5387. this.setTitle(dict.get("T"));
  5388. this.setContents(dict.get("Contents"));
  5389. this.setModificationDate(dict.get("M"));
  5390. this.setFlags(dict.get("F"));
  5391. this.setRectangle(dict.getArray("Rect"));
  5392. this.setColor(dict.getArray("C"));
  5393. this.setBorderStyle(dict);
  5394. this.setAppearance(dict);
  5395. this.setOptionalContent(dict);
  5396. const MK = dict.get("MK");
  5397. this.setBorderAndBackgroundColors(MK);
  5398. this.setRotation(MK);
  5399. this._streams = [];
  5400. if (this.appearance) {
  5401. this._streams.push(this.appearance);
  5402. }
  5403. this.data = {
  5404. annotationFlags: this.flags,
  5405. borderStyle: this.borderStyle,
  5406. color: this.color,
  5407. backgroundColor: this.backgroundColor,
  5408. borderColor: this.borderColor,
  5409. rotation: this.rotation,
  5410. contentsObj: this._contents,
  5411. hasAppearance: !!this.appearance,
  5412. id: params.id,
  5413. modificationDate: this.modificationDate,
  5414. rect: this.rectangle,
  5415. subtype: params.subtype,
  5416. hasOwnCanvas: false,
  5417. };
  5418. if (params.collectFields) {
  5419. const kids = dict.get("Kids");
  5420. if (Array.isArray(kids)) {
  5421. const kidIds = [];
  5422. for (const kid of kids) {
  5423. if (kid instanceof _primitives.Ref) {
  5424. kidIds.push(kid.toString());
  5425. }
  5426. }
  5427. if (kidIds.length !== 0) {
  5428. this.data.kidIds = kidIds;
  5429. }
  5430. }
  5431. this.data.actions = (0, _core_utils.collectActions)(
  5432. params.xref,
  5433. dict,
  5434. _util.AnnotationActionEventType
  5435. );
  5436. this.data.fieldName = this._constructFieldName(dict);
  5437. this.data.pageIndex = params.pageIndex;
  5438. }
  5439. this._fallbackFontDict = null;
  5440. }
  5441. _hasFlag(flags, flag) {
  5442. return !!(flags & flag);
  5443. }
  5444. _isViewable(flags) {
  5445. return (
  5446. !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) &&
  5447. !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW)
  5448. );
  5449. }
  5450. _isPrintable(flags) {
  5451. return (
  5452. this._hasFlag(flags, _util.AnnotationFlag.PRINT) &&
  5453. !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE)
  5454. );
  5455. }
  5456. mustBeViewed(annotationStorage) {
  5457. const storageEntry =
  5458. annotationStorage && annotationStorage.get(this.data.id);
  5459. if (storageEntry && storageEntry.hidden !== undefined) {
  5460. return !storageEntry.hidden;
  5461. }
  5462. return (
  5463. this.viewable &&
  5464. !this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN)
  5465. );
  5466. }
  5467. mustBePrinted(annotationStorage) {
  5468. const storageEntry =
  5469. annotationStorage && annotationStorage.get(this.data.id);
  5470. if (storageEntry && storageEntry.print !== undefined) {
  5471. return storageEntry.print;
  5472. }
  5473. return this.printable;
  5474. }
  5475. get viewable() {
  5476. if (this.data.quadPoints === null) {
  5477. return false;
  5478. }
  5479. if (this.flags === 0) {
  5480. return true;
  5481. }
  5482. return this._isViewable(this.flags);
  5483. }
  5484. get printable() {
  5485. if (this.data.quadPoints === null) {
  5486. return false;
  5487. }
  5488. if (this.flags === 0) {
  5489. return false;
  5490. }
  5491. return this._isPrintable(this.flags);
  5492. }
  5493. _parseStringHelper(data) {
  5494. const str =
  5495. typeof data === "string"
  5496. ? (0, _util.stringToPDFString)(data)
  5497. : "";
  5498. const dir =
  5499. str && (0, _bidi.bidi)(str).dir === "rtl" ? "rtl" : "ltr";
  5500. return {
  5501. str,
  5502. dir,
  5503. };
  5504. }
  5505. setTitle(title) {
  5506. this._title = this._parseStringHelper(title);
  5507. }
  5508. setContents(contents) {
  5509. this._contents = this._parseStringHelper(contents);
  5510. }
  5511. setModificationDate(modificationDate) {
  5512. this.modificationDate =
  5513. typeof modificationDate === "string" ? modificationDate : null;
  5514. }
  5515. setFlags(flags) {
  5516. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  5517. }
  5518. hasFlag(flag) {
  5519. return this._hasFlag(this.flags, flag);
  5520. }
  5521. setRectangle(rectangle) {
  5522. if (Array.isArray(rectangle) && rectangle.length === 4) {
  5523. this.rectangle = _util.Util.normalizeRect(rectangle);
  5524. } else {
  5525. this.rectangle = [0, 0, 0, 0];
  5526. }
  5527. }
  5528. setColor(color) {
  5529. this.color = getRgbColor(color);
  5530. }
  5531. setLineEndings(lineEndings) {
  5532. this.lineEndings = ["None", "None"];
  5533. if (Array.isArray(lineEndings) && lineEndings.length === 2) {
  5534. for (let i = 0; i < 2; i++) {
  5535. const obj = lineEndings[i];
  5536. if (obj instanceof _primitives.Name) {
  5537. switch (obj.name) {
  5538. case "None":
  5539. continue;
  5540. case "Square":
  5541. case "Circle":
  5542. case "Diamond":
  5543. case "OpenArrow":
  5544. case "ClosedArrow":
  5545. case "Butt":
  5546. case "ROpenArrow":
  5547. case "RClosedArrow":
  5548. case "Slash":
  5549. this.lineEndings[i] = obj.name;
  5550. continue;
  5551. }
  5552. }
  5553. (0, _util.warn)(`Ignoring invalid lineEnding: ${obj}`);
  5554. }
  5555. }
  5556. }
  5557. setRotation(mk) {
  5558. this.rotation = 0;
  5559. if (mk instanceof _primitives.Dict) {
  5560. let angle = mk.get("R") || 0;
  5561. if (Number.isInteger(angle) && angle !== 0) {
  5562. angle %= 360;
  5563. if (angle < 0) {
  5564. angle += 360;
  5565. }
  5566. if (angle % 90 === 0) {
  5567. this.rotation = angle;
  5568. }
  5569. }
  5570. }
  5571. }
  5572. setBorderAndBackgroundColors(mk) {
  5573. if (mk instanceof _primitives.Dict) {
  5574. this.borderColor = getRgbColor(mk.getArray("BC"), null);
  5575. this.backgroundColor = getRgbColor(mk.getArray("BG"), null);
  5576. } else {
  5577. this.borderColor = this.backgroundColor = null;
  5578. }
  5579. }
  5580. setBorderStyle(borderStyle) {
  5581. this.borderStyle = new AnnotationBorderStyle();
  5582. if (!(borderStyle instanceof _primitives.Dict)) {
  5583. return;
  5584. }
  5585. if (borderStyle.has("BS")) {
  5586. const dict = borderStyle.get("BS");
  5587. const dictType = dict.get("Type");
  5588. if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
  5589. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  5590. this.borderStyle.setStyle(dict.get("S"));
  5591. this.borderStyle.setDashArray(dict.getArray("D"));
  5592. }
  5593. } else if (borderStyle.has("Border")) {
  5594. const array = borderStyle.getArray("Border");
  5595. if (Array.isArray(array) && array.length >= 3) {
  5596. this.borderStyle.setHorizontalCornerRadius(array[0]);
  5597. this.borderStyle.setVerticalCornerRadius(array[1]);
  5598. this.borderStyle.setWidth(array[2], this.rectangle);
  5599. if (array.length === 4) {
  5600. this.borderStyle.setDashArray(array[3], true);
  5601. }
  5602. }
  5603. } else {
  5604. this.borderStyle.setWidth(0);
  5605. }
  5606. }
  5607. setAppearance(dict) {
  5608. this.appearance = null;
  5609. const appearanceStates = dict.get("AP");
  5610. if (!(appearanceStates instanceof _primitives.Dict)) {
  5611. return;
  5612. }
  5613. const normalAppearanceState = appearanceStates.get("N");
  5614. if (normalAppearanceState instanceof _base_stream.BaseStream) {
  5615. this.appearance = normalAppearanceState;
  5616. return;
  5617. }
  5618. if (!(normalAppearanceState instanceof _primitives.Dict)) {
  5619. return;
  5620. }
  5621. const as = dict.get("AS");
  5622. if (
  5623. !(as instanceof _primitives.Name) ||
  5624. !normalAppearanceState.has(as.name)
  5625. ) {
  5626. return;
  5627. }
  5628. this.appearance = normalAppearanceState.get(as.name);
  5629. }
  5630. setOptionalContent(dict) {
  5631. this.oc = null;
  5632. const oc = dict.get("OC");
  5633. if (oc instanceof _primitives.Name) {
  5634. (0, _util.warn)(
  5635. "setOptionalContent: Support for /Name-entry is not implemented."
  5636. );
  5637. } else if (oc instanceof _primitives.Dict) {
  5638. this.oc = oc;
  5639. }
  5640. }
  5641. loadResources(keys, appearance) {
  5642. return appearance.dict.getAsync("Resources").then((resources) => {
  5643. if (!resources) {
  5644. return undefined;
  5645. }
  5646. const objectLoader = new _object_loader.ObjectLoader(
  5647. resources,
  5648. keys,
  5649. resources.xref
  5650. );
  5651. return objectLoader.load().then(function () {
  5652. return resources;
  5653. });
  5654. });
  5655. }
  5656. async getOperatorList(
  5657. evaluator,
  5658. task,
  5659. intent,
  5660. renderForms,
  5661. annotationStorage
  5662. ) {
  5663. const data = this.data;
  5664. let appearance = this.appearance;
  5665. const isUsingOwnCanvas = !!(
  5666. this.data.hasOwnCanvas &&
  5667. intent & _util.RenderingIntentFlag.DISPLAY
  5668. );
  5669. if (!appearance) {
  5670. if (!isUsingOwnCanvas) {
  5671. return {
  5672. opList: new _operator_list.OperatorList(),
  5673. separateForm: false,
  5674. separateCanvas: false,
  5675. };
  5676. }
  5677. appearance = new _stream.StringStream("");
  5678. appearance.dict = new _primitives.Dict();
  5679. }
  5680. const appearanceDict = appearance.dict;
  5681. const resources = await this.loadResources(
  5682. [
  5683. "ExtGState",
  5684. "ColorSpace",
  5685. "Pattern",
  5686. "Shading",
  5687. "XObject",
  5688. "Font",
  5689. ],
  5690. appearance
  5691. );
  5692. const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
  5693. const matrix = appearanceDict.getArray("Matrix") || [
  5694. 1, 0, 0, 1, 0, 0,
  5695. ];
  5696. const transform = getTransformMatrix(data.rect, bbox, matrix);
  5697. const opList = new _operator_list.OperatorList();
  5698. let optionalContent;
  5699. if (this.oc) {
  5700. optionalContent = await evaluator.parseMarkedContentProps(
  5701. this.oc,
  5702. null
  5703. );
  5704. }
  5705. if (optionalContent !== undefined) {
  5706. opList.addOp(_util.OPS.beginMarkedContentProps, [
  5707. "OC",
  5708. optionalContent,
  5709. ]);
  5710. }
  5711. opList.addOp(_util.OPS.beginAnnotation, [
  5712. data.id,
  5713. data.rect,
  5714. transform,
  5715. matrix,
  5716. isUsingOwnCanvas,
  5717. ]);
  5718. await evaluator.getOperatorList({
  5719. stream: appearance,
  5720. task,
  5721. resources,
  5722. operatorList: opList,
  5723. fallbackFontDict: this._fallbackFontDict,
  5724. });
  5725. opList.addOp(_util.OPS.endAnnotation, []);
  5726. if (optionalContent !== undefined) {
  5727. opList.addOp(_util.OPS.endMarkedContent, []);
  5728. }
  5729. this.reset();
  5730. return {
  5731. opList,
  5732. separateForm: false,
  5733. separateCanvas: isUsingOwnCanvas,
  5734. };
  5735. }
  5736. async save(evaluator, task, annotationStorage) {
  5737. return null;
  5738. }
  5739. get hasTextContent() {
  5740. return false;
  5741. }
  5742. async extractTextContent(evaluator, task, viewBox) {
  5743. if (!this.appearance) {
  5744. return;
  5745. }
  5746. const resources = await this.loadResources(
  5747. ["ExtGState", "Font", "Properties", "XObject"],
  5748. this.appearance
  5749. );
  5750. const text = [];
  5751. const buffer = [];
  5752. const sink = {
  5753. desiredSize: Math.Infinity,
  5754. ready: true,
  5755. enqueue(chunk, size) {
  5756. for (const item of chunk.items) {
  5757. buffer.push(item.str);
  5758. if (item.hasEOL) {
  5759. text.push(buffer.join(""));
  5760. buffer.length = 0;
  5761. }
  5762. }
  5763. },
  5764. };
  5765. await evaluator.getTextContent({
  5766. stream: this.appearance,
  5767. task,
  5768. resources,
  5769. includeMarkedContent: true,
  5770. combineTextItems: true,
  5771. sink,
  5772. viewBox,
  5773. });
  5774. this.reset();
  5775. if (buffer.length) {
  5776. text.push(buffer.join(""));
  5777. }
  5778. if (text.length > 0) {
  5779. this.data.textContent = text;
  5780. }
  5781. }
  5782. getFieldObject() {
  5783. if (this.data.kidIds) {
  5784. return {
  5785. id: this.data.id,
  5786. actions: this.data.actions,
  5787. name: this.data.fieldName,
  5788. strokeColor: this.data.borderColor,
  5789. fillColor: this.data.backgroundColor,
  5790. type: "",
  5791. kidIds: this.data.kidIds,
  5792. page: this.data.pageIndex,
  5793. rotation: this.rotation,
  5794. };
  5795. }
  5796. return null;
  5797. }
  5798. reset() {
  5799. for (const stream of this._streams) {
  5800. stream.reset();
  5801. }
  5802. }
  5803. _constructFieldName(dict) {
  5804. if (!dict.has("T") && !dict.has("Parent")) {
  5805. (0, _util.warn)(
  5806. "Unknown field name, falling back to empty field name."
  5807. );
  5808. return "";
  5809. }
  5810. if (!dict.has("Parent")) {
  5811. return (0, _util.stringToPDFString)(dict.get("T"));
  5812. }
  5813. const fieldName = [];
  5814. if (dict.has("T")) {
  5815. fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
  5816. }
  5817. let loopDict = dict;
  5818. const visited = new _primitives.RefSet();
  5819. if (dict.objId) {
  5820. visited.put(dict.objId);
  5821. }
  5822. while (loopDict.has("Parent")) {
  5823. loopDict = loopDict.get("Parent");
  5824. if (
  5825. !(loopDict instanceof _primitives.Dict) ||
  5826. (loopDict.objId && visited.has(loopDict.objId))
  5827. ) {
  5828. break;
  5829. }
  5830. if (loopDict.objId) {
  5831. visited.put(loopDict.objId);
  5832. }
  5833. if (loopDict.has("T")) {
  5834. fieldName.unshift(
  5835. (0, _util.stringToPDFString)(loopDict.get("T"))
  5836. );
  5837. }
  5838. }
  5839. return fieldName.join(".");
  5840. }
  5841. }
  5842. exports.Annotation = Annotation;
  5843. class AnnotationBorderStyle {
  5844. constructor() {
  5845. this.width = 1;
  5846. this.style = _util.AnnotationBorderStyleType.SOLID;
  5847. this.dashArray = [3];
  5848. this.horizontalCornerRadius = 0;
  5849. this.verticalCornerRadius = 0;
  5850. }
  5851. setWidth(width, rect = [0, 0, 0, 0]) {
  5852. if (width instanceof _primitives.Name) {
  5853. this.width = 0;
  5854. return;
  5855. }
  5856. if (typeof width === "number") {
  5857. if (width > 0) {
  5858. const maxWidth = (rect[2] - rect[0]) / 2;
  5859. const maxHeight = (rect[3] - rect[1]) / 2;
  5860. if (
  5861. maxWidth > 0 &&
  5862. maxHeight > 0 &&
  5863. (width > maxWidth || width > maxHeight)
  5864. ) {
  5865. (0, _util.warn)(
  5866. `AnnotationBorderStyle.setWidth - ignoring width: ${width}`
  5867. );
  5868. width = 1;
  5869. }
  5870. }
  5871. this.width = width;
  5872. }
  5873. }
  5874. setStyle(style) {
  5875. if (!(style instanceof _primitives.Name)) {
  5876. return;
  5877. }
  5878. switch (style.name) {
  5879. case "S":
  5880. this.style = _util.AnnotationBorderStyleType.SOLID;
  5881. break;
  5882. case "D":
  5883. this.style = _util.AnnotationBorderStyleType.DASHED;
  5884. break;
  5885. case "B":
  5886. this.style = _util.AnnotationBorderStyleType.BEVELED;
  5887. break;
  5888. case "I":
  5889. this.style = _util.AnnotationBorderStyleType.INSET;
  5890. break;
  5891. case "U":
  5892. this.style = _util.AnnotationBorderStyleType.UNDERLINE;
  5893. break;
  5894. default:
  5895. break;
  5896. }
  5897. }
  5898. setDashArray(dashArray, forceStyle = false) {
  5899. if (Array.isArray(dashArray) && dashArray.length > 0) {
  5900. let isValid = true;
  5901. let allZeros = true;
  5902. for (const element of dashArray) {
  5903. const validNumber = +element >= 0;
  5904. if (!validNumber) {
  5905. isValid = false;
  5906. break;
  5907. } else if (element > 0) {
  5908. allZeros = false;
  5909. }
  5910. }
  5911. if (isValid && !allZeros) {
  5912. this.dashArray = dashArray;
  5913. if (forceStyle) {
  5914. this.setStyle(_primitives.Name.get("D"));
  5915. }
  5916. } else {
  5917. this.width = 0;
  5918. }
  5919. } else if (dashArray) {
  5920. this.width = 0;
  5921. }
  5922. }
  5923. setHorizontalCornerRadius(radius) {
  5924. if (Number.isInteger(radius)) {
  5925. this.horizontalCornerRadius = radius;
  5926. }
  5927. }
  5928. setVerticalCornerRadius(radius) {
  5929. if (Number.isInteger(radius)) {
  5930. this.verticalCornerRadius = radius;
  5931. }
  5932. }
  5933. }
  5934. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  5935. class MarkupAnnotation extends Annotation {
  5936. constructor(parameters) {
  5937. super(parameters);
  5938. const dict = parameters.dict;
  5939. if (dict.has("IRT")) {
  5940. const rawIRT = dict.getRaw("IRT");
  5941. this.data.inReplyTo =
  5942. rawIRT instanceof _primitives.Ref ? rawIRT.toString() : null;
  5943. const rt = dict.get("RT");
  5944. this.data.replyType =
  5945. rt instanceof _primitives.Name
  5946. ? rt.name
  5947. : _util.AnnotationReplyType.REPLY;
  5948. }
  5949. if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
  5950. const parent = dict.get("IRT");
  5951. this.setTitle(parent.get("T"));
  5952. this.data.titleObj = this._title;
  5953. this.setContents(parent.get("Contents"));
  5954. this.data.contentsObj = this._contents;
  5955. if (!parent.has("CreationDate")) {
  5956. this.data.creationDate = null;
  5957. } else {
  5958. this.setCreationDate(parent.get("CreationDate"));
  5959. this.data.creationDate = this.creationDate;
  5960. }
  5961. if (!parent.has("M")) {
  5962. this.data.modificationDate = null;
  5963. } else {
  5964. this.setModificationDate(parent.get("M"));
  5965. this.data.modificationDate = this.modificationDate;
  5966. }
  5967. this.data.hasPopup = parent.has("Popup");
  5968. if (!parent.has("C")) {
  5969. this.data.color = null;
  5970. } else {
  5971. this.setColor(parent.getArray("C"));
  5972. this.data.color = this.color;
  5973. }
  5974. } else {
  5975. this.data.titleObj = this._title;
  5976. this.setCreationDate(dict.get("CreationDate"));
  5977. this.data.creationDate = this.creationDate;
  5978. this.data.hasPopup = dict.has("Popup");
  5979. if (!dict.has("C")) {
  5980. this.data.color = null;
  5981. }
  5982. }
  5983. if (dict.has("RC")) {
  5984. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(
  5985. dict.get("RC")
  5986. );
  5987. }
  5988. }
  5989. setCreationDate(creationDate) {
  5990. this.creationDate =
  5991. typeof creationDate === "string" ? creationDate : null;
  5992. }
  5993. _setDefaultAppearance({
  5994. xref,
  5995. extra,
  5996. strokeColor,
  5997. fillColor,
  5998. blendMode,
  5999. strokeAlpha,
  6000. fillAlpha,
  6001. pointsCallback,
  6002. }) {
  6003. let minX = Number.MAX_VALUE;
  6004. let minY = Number.MAX_VALUE;
  6005. let maxX = Number.MIN_VALUE;
  6006. let maxY = Number.MIN_VALUE;
  6007. const buffer = ["q"];
  6008. if (extra) {
  6009. buffer.push(extra);
  6010. }
  6011. if (strokeColor) {
  6012. buffer.push(
  6013. `${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`
  6014. );
  6015. }
  6016. if (fillColor) {
  6017. buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
  6018. }
  6019. let pointsArray = this.data.quadPoints;
  6020. if (!pointsArray) {
  6021. pointsArray = [
  6022. [
  6023. {
  6024. x: this.rectangle[0],
  6025. y: this.rectangle[3],
  6026. },
  6027. {
  6028. x: this.rectangle[2],
  6029. y: this.rectangle[3],
  6030. },
  6031. {
  6032. x: this.rectangle[0],
  6033. y: this.rectangle[1],
  6034. },
  6035. {
  6036. x: this.rectangle[2],
  6037. y: this.rectangle[1],
  6038. },
  6039. ],
  6040. ];
  6041. }
  6042. for (const points of pointsArray) {
  6043. const [mX, MX, mY, MY] = pointsCallback(buffer, points);
  6044. minX = Math.min(minX, mX);
  6045. maxX = Math.max(maxX, MX);
  6046. minY = Math.min(minY, mY);
  6047. maxY = Math.max(maxY, MY);
  6048. }
  6049. buffer.push("Q");
  6050. const formDict = new _primitives.Dict(xref);
  6051. const appearanceStreamDict = new _primitives.Dict(xref);
  6052. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  6053. const appearanceStream = new _stream.StringStream(buffer.join(" "));
  6054. appearanceStream.dict = appearanceStreamDict;
  6055. formDict.set("Fm0", appearanceStream);
  6056. const gsDict = new _primitives.Dict(xref);
  6057. if (blendMode) {
  6058. gsDict.set("BM", _primitives.Name.get(blendMode));
  6059. }
  6060. if (typeof strokeAlpha === "number") {
  6061. gsDict.set("CA", strokeAlpha);
  6062. }
  6063. if (typeof fillAlpha === "number") {
  6064. gsDict.set("ca", fillAlpha);
  6065. }
  6066. const stateDict = new _primitives.Dict(xref);
  6067. stateDict.set("GS0", gsDict);
  6068. const resources = new _primitives.Dict(xref);
  6069. resources.set("ExtGState", stateDict);
  6070. resources.set("XObject", formDict);
  6071. const appearanceDict = new _primitives.Dict(xref);
  6072. appearanceDict.set("Resources", resources);
  6073. const bbox = (this.data.rect = [minX, minY, maxX, maxY]);
  6074. appearanceDict.set("BBox", bbox);
  6075. this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do");
  6076. this.appearance.dict = appearanceDict;
  6077. this._streams.push(this.appearance, appearanceStream);
  6078. }
  6079. static async createNewAnnotation(
  6080. xref,
  6081. annotation,
  6082. dependencies,
  6083. params
  6084. ) {
  6085. const annotationRef = xref.getNewRef();
  6086. const apRef = xref.getNewRef();
  6087. const annotationDict = this.createNewDict(annotation, xref, {
  6088. apRef,
  6089. });
  6090. const ap = await this.createNewAppearanceStream(
  6091. annotation,
  6092. xref,
  6093. params
  6094. );
  6095. const buffer = [];
  6096. let transform = xref.encrypt
  6097. ? xref.encrypt.createCipherTransform(apRef.num, apRef.gen)
  6098. : null;
  6099. (0, _writer.writeObject)(apRef, ap, buffer, transform);
  6100. dependencies.push({
  6101. ref: apRef,
  6102. data: buffer.join(""),
  6103. });
  6104. buffer.length = 0;
  6105. transform = xref.encrypt
  6106. ? xref.encrypt.createCipherTransform(
  6107. annotationRef.num,
  6108. annotationRef.gen
  6109. )
  6110. : null;
  6111. (0, _writer.writeObject)(
  6112. annotationRef,
  6113. annotationDict,
  6114. buffer,
  6115. transform
  6116. );
  6117. return {
  6118. ref: annotationRef,
  6119. data: buffer.join(""),
  6120. };
  6121. }
  6122. static async createNewPrintAnnotation(xref, annotation, params) {
  6123. const ap = await this.createNewAppearanceStream(
  6124. annotation,
  6125. xref,
  6126. params
  6127. );
  6128. const annotationDict = this.createNewDict(annotation, xref, {
  6129. ap,
  6130. });
  6131. return new this.prototype.constructor({
  6132. dict: annotationDict,
  6133. xref,
  6134. });
  6135. }
  6136. }
  6137. exports.MarkupAnnotation = MarkupAnnotation;
  6138. class WidgetAnnotation extends Annotation {
  6139. constructor(params) {
  6140. super(params);
  6141. const dict = params.dict;
  6142. const data = this.data;
  6143. this.ref = params.ref;
  6144. data.annotationType = _util.AnnotationType.WIDGET;
  6145. if (data.fieldName === undefined) {
  6146. data.fieldName = this._constructFieldName(dict);
  6147. }
  6148. if (data.actions === undefined) {
  6149. data.actions = (0, _core_utils.collectActions)(
  6150. params.xref,
  6151. dict,
  6152. _util.AnnotationActionEventType
  6153. );
  6154. }
  6155. let fieldValue = (0, _core_utils.getInheritableProperty)({
  6156. dict,
  6157. key: "V",
  6158. getArray: true,
  6159. });
  6160. data.fieldValue = this._decodeFormValue(fieldValue);
  6161. const defaultFieldValue = (0, _core_utils.getInheritableProperty)({
  6162. dict,
  6163. key: "DV",
  6164. getArray: true,
  6165. });
  6166. data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
  6167. if (fieldValue === undefined && params.xfaDatasets) {
  6168. const path = this._title.str;
  6169. if (path) {
  6170. this._hasValueFromXFA = true;
  6171. data.fieldValue = fieldValue =
  6172. params.xfaDatasets.getValue(path);
  6173. }
  6174. }
  6175. if (fieldValue === undefined && data.defaultFieldValue !== null) {
  6176. data.fieldValue = data.defaultFieldValue;
  6177. }
  6178. data.alternativeText = (0, _util.stringToPDFString)(
  6179. dict.get("TU") || ""
  6180. );
  6181. const defaultAppearance =
  6182. (0, _core_utils.getInheritableProperty)({
  6183. dict,
  6184. key: "DA",
  6185. }) || params.acroForm.get("DA");
  6186. this._defaultAppearance =
  6187. typeof defaultAppearance === "string" ? defaultAppearance : "";
  6188. data.defaultAppearanceData = (0,
  6189. _default_appearance.parseDefaultAppearance)(
  6190. this._defaultAppearance
  6191. );
  6192. const fieldType = (0, _core_utils.getInheritableProperty)({
  6193. dict,
  6194. key: "FT",
  6195. });
  6196. data.fieldType =
  6197. fieldType instanceof _primitives.Name ? fieldType.name : null;
  6198. const localResources = (0, _core_utils.getInheritableProperty)({
  6199. dict,
  6200. key: "DR",
  6201. });
  6202. const acroFormResources = params.acroForm.get("DR");
  6203. const appearanceResources =
  6204. this.appearance && this.appearance.dict.get("Resources");
  6205. this._fieldResources = {
  6206. localResources,
  6207. acroFormResources,
  6208. appearanceResources,
  6209. mergedResources: _primitives.Dict.merge({
  6210. xref: params.xref,
  6211. dictArray: [
  6212. localResources,
  6213. appearanceResources,
  6214. acroFormResources,
  6215. ],
  6216. mergeSubDicts: true,
  6217. }),
  6218. };
  6219. data.fieldFlags = (0, _core_utils.getInheritableProperty)({
  6220. dict,
  6221. key: "Ff",
  6222. });
  6223. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  6224. data.fieldFlags = 0;
  6225. }
  6226. data.readOnly = this.hasFieldFlag(
  6227. _util.AnnotationFieldFlag.READONLY
  6228. );
  6229. data.required = this.hasFieldFlag(
  6230. _util.AnnotationFieldFlag.REQUIRED
  6231. );
  6232. data.hidden = this._hasFlag(
  6233. data.annotationFlags,
  6234. _util.AnnotationFlag.HIDDEN
  6235. );
  6236. }
  6237. _decodeFormValue(formValue) {
  6238. if (Array.isArray(formValue)) {
  6239. return formValue
  6240. .filter((item) => typeof item === "string")
  6241. .map((item) => (0, _util.stringToPDFString)(item));
  6242. } else if (formValue instanceof _primitives.Name) {
  6243. return (0, _util.stringToPDFString)(formValue.name);
  6244. } else if (typeof formValue === "string") {
  6245. return (0, _util.stringToPDFString)(formValue);
  6246. }
  6247. return null;
  6248. }
  6249. hasFieldFlag(flag) {
  6250. return !!(this.data.fieldFlags & flag);
  6251. }
  6252. static _getRotationMatrix(rotation, width, height) {
  6253. switch (rotation) {
  6254. case 90:
  6255. return [0, 1, -1, 0, width, 0];
  6256. case 180:
  6257. return [-1, 0, 0, -1, width, height];
  6258. case 270:
  6259. return [0, -1, 1, 0, 0, height];
  6260. default:
  6261. throw new Error("Invalid rotation");
  6262. }
  6263. }
  6264. getRotationMatrix(annotationStorage) {
  6265. const storageEntry = annotationStorage
  6266. ? annotationStorage.get(this.data.id)
  6267. : undefined;
  6268. let rotation = storageEntry && storageEntry.rotation;
  6269. if (rotation === undefined) {
  6270. rotation = this.rotation;
  6271. }
  6272. if (rotation === 0) {
  6273. return _util.IDENTITY_MATRIX;
  6274. }
  6275. const width = this.data.rect[2] - this.data.rect[0];
  6276. const height = this.data.rect[3] - this.data.rect[1];
  6277. return WidgetAnnotation._getRotationMatrix(rotation, width, height);
  6278. }
  6279. getBorderAndBackgroundAppearances(annotationStorage) {
  6280. const storageEntry = annotationStorage
  6281. ? annotationStorage.get(this.data.id)
  6282. : undefined;
  6283. let rotation = storageEntry && storageEntry.rotation;
  6284. if (rotation === undefined) {
  6285. rotation = this.rotation;
  6286. }
  6287. if (!this.backgroundColor && !this.borderColor) {
  6288. return "";
  6289. }
  6290. const width = this.data.rect[2] - this.data.rect[0];
  6291. const height = this.data.rect[3] - this.data.rect[1];
  6292. const rect =
  6293. rotation === 0 || rotation === 180
  6294. ? `0 0 ${width} ${height} re`
  6295. : `0 0 ${height} ${width} re`;
  6296. let str = "";
  6297. if (this.backgroundColor) {
  6298. str = `${(0, _default_appearance.getPdfColor)(
  6299. this.backgroundColor,
  6300. true
  6301. )} ${rect} f `;
  6302. }
  6303. if (this.borderColor) {
  6304. const borderWidth = this.borderStyle.width || 1;
  6305. str += `${borderWidth} w ${(0, _default_appearance.getPdfColor)(
  6306. this.borderColor,
  6307. false
  6308. )} ${rect} S `;
  6309. }
  6310. return str;
  6311. }
  6312. async getOperatorList(
  6313. evaluator,
  6314. task,
  6315. intent,
  6316. renderForms,
  6317. annotationStorage
  6318. ) {
  6319. if (renderForms && !(this instanceof SignatureWidgetAnnotation)) {
  6320. return {
  6321. opList: new _operator_list.OperatorList(),
  6322. separateForm: true,
  6323. separateCanvas: false,
  6324. };
  6325. }
  6326. if (!this._hasText) {
  6327. return super.getOperatorList(
  6328. evaluator,
  6329. task,
  6330. intent,
  6331. renderForms,
  6332. annotationStorage
  6333. );
  6334. }
  6335. const content = await this._getAppearance(
  6336. evaluator,
  6337. task,
  6338. annotationStorage
  6339. );
  6340. if (this.appearance && content === null) {
  6341. return super.getOperatorList(
  6342. evaluator,
  6343. task,
  6344. intent,
  6345. renderForms,
  6346. annotationStorage
  6347. );
  6348. }
  6349. const opList = new _operator_list.OperatorList();
  6350. if (!this._defaultAppearance || content === null) {
  6351. return {
  6352. opList,
  6353. separateForm: false,
  6354. separateCanvas: false,
  6355. };
  6356. }
  6357. const matrix = [1, 0, 0, 1, 0, 0];
  6358. const bbox = [
  6359. 0,
  6360. 0,
  6361. this.data.rect[2] - this.data.rect[0],
  6362. this.data.rect[3] - this.data.rect[1],
  6363. ];
  6364. const transform = getTransformMatrix(this.data.rect, bbox, matrix);
  6365. let optionalContent;
  6366. if (this.oc) {
  6367. optionalContent = await evaluator.parseMarkedContentProps(
  6368. this.oc,
  6369. null
  6370. );
  6371. }
  6372. if (optionalContent !== undefined) {
  6373. opList.addOp(_util.OPS.beginMarkedContentProps, [
  6374. "OC",
  6375. optionalContent,
  6376. ]);
  6377. }
  6378. opList.addOp(_util.OPS.beginAnnotation, [
  6379. this.data.id,
  6380. this.data.rect,
  6381. transform,
  6382. this.getRotationMatrix(annotationStorage),
  6383. false,
  6384. ]);
  6385. const stream = new _stream.StringStream(content);
  6386. await evaluator.getOperatorList({
  6387. stream,
  6388. task,
  6389. resources: this._fieldResources.mergedResources,
  6390. operatorList: opList,
  6391. });
  6392. opList.addOp(_util.OPS.endAnnotation, []);
  6393. if (optionalContent !== undefined) {
  6394. opList.addOp(_util.OPS.endMarkedContent, []);
  6395. }
  6396. return {
  6397. opList,
  6398. separateForm: false,
  6399. separateCanvas: false,
  6400. };
  6401. }
  6402. _getMKDict(rotation) {
  6403. const mk = new _primitives.Dict(null);
  6404. if (rotation) {
  6405. mk.set("R", rotation);
  6406. }
  6407. if (this.borderColor) {
  6408. mk.set(
  6409. "BC",
  6410. Array.from(this.borderColor).map((c) => c / 255)
  6411. );
  6412. }
  6413. if (this.backgroundColor) {
  6414. mk.set(
  6415. "BG",
  6416. Array.from(this.backgroundColor).map((c) => c / 255)
  6417. );
  6418. }
  6419. return mk.size > 0 ? mk : null;
  6420. }
  6421. async save(evaluator, task, annotationStorage) {
  6422. const storageEntry = annotationStorage
  6423. ? annotationStorage.get(this.data.id)
  6424. : undefined;
  6425. let value = storageEntry && storageEntry.value;
  6426. let rotation = storageEntry && storageEntry.rotation;
  6427. if (value === this.data.fieldValue || value === undefined) {
  6428. if (!this._hasValueFromXFA && rotation === undefined) {
  6429. return null;
  6430. }
  6431. value = value || this.data.fieldValue;
  6432. }
  6433. if (
  6434. rotation === undefined &&
  6435. !this._hasValueFromXFA &&
  6436. Array.isArray(value) &&
  6437. Array.isArray(this.data.fieldValue) &&
  6438. value.length === this.data.fieldValue.length &&
  6439. value.every((x, i) => x === this.data.fieldValue[i])
  6440. ) {
  6441. return null;
  6442. }
  6443. if (rotation === undefined) {
  6444. rotation = this.rotation;
  6445. }
  6446. let appearance = await this._getAppearance(
  6447. evaluator,
  6448. task,
  6449. annotationStorage
  6450. );
  6451. if (appearance === null) {
  6452. return null;
  6453. }
  6454. const { xref } = evaluator;
  6455. const dict = xref.fetchIfRef(this.ref);
  6456. if (!(dict instanceof _primitives.Dict)) {
  6457. return null;
  6458. }
  6459. const bbox = [
  6460. 0,
  6461. 0,
  6462. this.data.rect[2] - this.data.rect[0],
  6463. this.data.rect[3] - this.data.rect[1],
  6464. ];
  6465. const xfa = {
  6466. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  6467. value,
  6468. };
  6469. const newRef = xref.getNewRef();
  6470. const AP = new _primitives.Dict(xref);
  6471. AP.set("N", newRef);
  6472. const encrypt = xref.encrypt;
  6473. let originalTransform = null;
  6474. let newTransform = null;
  6475. if (encrypt) {
  6476. originalTransform = encrypt.createCipherTransform(
  6477. this.ref.num,
  6478. this.ref.gen
  6479. );
  6480. newTransform = encrypt.createCipherTransform(
  6481. newRef.num,
  6482. newRef.gen
  6483. );
  6484. appearance = newTransform.encryptString(appearance);
  6485. }
  6486. const encoder = (val) =>
  6487. (0, _util.isAscii)(val)
  6488. ? val
  6489. : (0, _util.stringToUTF16BEString)(val);
  6490. dict.set(
  6491. "V",
  6492. Array.isArray(value) ? value.map(encoder) : encoder(value)
  6493. );
  6494. dict.set("AP", AP);
  6495. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  6496. const maybeMK = this._getMKDict(rotation);
  6497. if (maybeMK) {
  6498. dict.set("MK", maybeMK);
  6499. }
  6500. const appearanceDict = new _primitives.Dict(xref);
  6501. appearanceDict.set("Length", appearance.length);
  6502. appearanceDict.set("Subtype", _primitives.Name.get("Form"));
  6503. appearanceDict.set("Resources", this._getSaveFieldResources(xref));
  6504. appearanceDict.set("BBox", bbox);
  6505. const rotationMatrix = this.getRotationMatrix(annotationStorage);
  6506. if (rotationMatrix !== _util.IDENTITY_MATRIX) {
  6507. appearanceDict.set("Matrix", rotationMatrix);
  6508. }
  6509. const bufferOriginal = [`${this.ref.num} ${this.ref.gen} obj\n`];
  6510. (0, _writer.writeDict)(dict, bufferOriginal, originalTransform);
  6511. bufferOriginal.push("\nendobj\n");
  6512. const bufferNew = [`${newRef.num} ${newRef.gen} obj\n`];
  6513. (0, _writer.writeDict)(appearanceDict, bufferNew, newTransform);
  6514. bufferNew.push(" stream\n", appearance, "\nendstream\nendobj\n");
  6515. return [
  6516. {
  6517. ref: this.ref,
  6518. data: bufferOriginal.join(""),
  6519. xfa,
  6520. },
  6521. {
  6522. ref: newRef,
  6523. data: bufferNew.join(""),
  6524. xfa: null,
  6525. },
  6526. ];
  6527. }
  6528. async _getAppearance(evaluator, task, annotationStorage) {
  6529. const isPassword = this.hasFieldFlag(
  6530. _util.AnnotationFieldFlag.PASSWORD
  6531. );
  6532. if (isPassword) {
  6533. return null;
  6534. }
  6535. const storageEntry = annotationStorage
  6536. ? annotationStorage.get(this.data.id)
  6537. : undefined;
  6538. let value, rotation;
  6539. if (storageEntry) {
  6540. value = storageEntry.formattedValue || storageEntry.value;
  6541. rotation = storageEntry.rotation;
  6542. }
  6543. if (rotation === undefined && value === undefined) {
  6544. if (!this._hasValueFromXFA || this.appearance) {
  6545. return null;
  6546. }
  6547. }
  6548. if (value === undefined) {
  6549. value = this.data.fieldValue;
  6550. if (!value) {
  6551. return "";
  6552. }
  6553. }
  6554. if (Array.isArray(value) && value.length === 1) {
  6555. value = value[0];
  6556. }
  6557. (0, _util.assert)(
  6558. typeof value === "string",
  6559. "Expected `value` to be a string."
  6560. );
  6561. value = value.trim();
  6562. if (value === "") {
  6563. return "";
  6564. }
  6565. if (rotation === undefined) {
  6566. rotation = this.rotation;
  6567. }
  6568. let lineCount = -1;
  6569. if (this.data.multiLine) {
  6570. lineCount = value.split(/\r\n|\r|\n/).length;
  6571. }
  6572. const defaultPadding = 2;
  6573. const hPadding = defaultPadding;
  6574. let totalHeight = this.data.rect[3] - this.data.rect[1];
  6575. let totalWidth = this.data.rect[2] - this.data.rect[0];
  6576. if (rotation === 90 || rotation === 270) {
  6577. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  6578. }
  6579. if (!this._defaultAppearance) {
  6580. this.data.defaultAppearanceData = (0,
  6581. _default_appearance.parseDefaultAppearance)(
  6582. (this._defaultAppearance = "/Helvetica 0 Tf 0 g")
  6583. );
  6584. }
  6585. const font = await WidgetAnnotation._getFontData(
  6586. evaluator,
  6587. task,
  6588. this.data.defaultAppearanceData,
  6589. this._fieldResources.mergedResources
  6590. );
  6591. const [defaultAppearance, fontSize] = this._computeFontSize(
  6592. totalHeight - defaultPadding,
  6593. totalWidth - 2 * hPadding,
  6594. value,
  6595. font,
  6596. lineCount
  6597. );
  6598. let descent = font.descent;
  6599. if (isNaN(descent)) {
  6600. descent = 0;
  6601. }
  6602. const defaultVPadding = Math.min(
  6603. Math.floor((totalHeight - fontSize) / 2),
  6604. defaultPadding
  6605. );
  6606. const vPadding = defaultVPadding + Math.abs(descent) * fontSize;
  6607. const alignment = this.data.textAlignment;
  6608. if (this.data.multiLine) {
  6609. return this._getMultilineAppearance(
  6610. defaultAppearance,
  6611. value,
  6612. font,
  6613. fontSize,
  6614. totalWidth,
  6615. totalHeight,
  6616. alignment,
  6617. hPadding,
  6618. vPadding,
  6619. annotationStorage
  6620. );
  6621. }
  6622. const encodedString = font.encodeString(value).join("");
  6623. if (this.data.comb) {
  6624. return this._getCombAppearance(
  6625. defaultAppearance,
  6626. font,
  6627. encodedString,
  6628. totalWidth,
  6629. hPadding,
  6630. vPadding,
  6631. annotationStorage
  6632. );
  6633. }
  6634. const colors =
  6635. this.getBorderAndBackgroundAppearances(annotationStorage);
  6636. if (alignment === 0 || alignment > 2) {
  6637. return (
  6638. `/Tx BMC q ${colors}BT ` +
  6639. defaultAppearance +
  6640. ` 1 0 0 1 ${hPadding} ${vPadding} Tm (${(0, _util.escapeString)(
  6641. encodedString
  6642. )}) Tj` +
  6643. " ET Q EMC"
  6644. );
  6645. }
  6646. const renderedText = this._renderText(
  6647. encodedString,
  6648. font,
  6649. fontSize,
  6650. totalWidth,
  6651. alignment,
  6652. hPadding,
  6653. vPadding
  6654. );
  6655. return (
  6656. `/Tx BMC q ${colors}BT ` +
  6657. defaultAppearance +
  6658. ` 1 0 0 1 0 0 Tm ${renderedText}` +
  6659. " ET Q EMC"
  6660. );
  6661. }
  6662. static async _getFontData(
  6663. evaluator,
  6664. task,
  6665. appearanceData,
  6666. resources
  6667. ) {
  6668. const operatorList = new _operator_list.OperatorList();
  6669. const initialState = {
  6670. font: null,
  6671. clone() {
  6672. return this;
  6673. },
  6674. };
  6675. const { fontName, fontSize } = appearanceData;
  6676. await evaluator.handleSetFont(
  6677. resources,
  6678. [fontName && _primitives.Name.get(fontName), fontSize],
  6679. null,
  6680. operatorList,
  6681. task,
  6682. initialState,
  6683. null
  6684. );
  6685. return initialState.font;
  6686. }
  6687. _getTextWidth(text, font) {
  6688. return (
  6689. font
  6690. .charsToGlyphs(text)
  6691. .reduce((width, glyph) => width + glyph.width, 0) / 1000
  6692. );
  6693. }
  6694. _computeFontSize(height, width, text, font, lineCount) {
  6695. let { fontSize } = this.data.defaultAppearanceData;
  6696. if (!fontSize) {
  6697. const roundWithTwoDigits = (x) => Math.floor(x * 100) / 100;
  6698. if (lineCount === -1) {
  6699. const textWidth = this._getTextWidth(text, font);
  6700. fontSize = roundWithTwoDigits(
  6701. Math.min(height / _util.LINE_FACTOR, width / textWidth)
  6702. );
  6703. } else {
  6704. const lines = text.split(/\r\n?|\n/);
  6705. const cachedLines = [];
  6706. for (const line of lines) {
  6707. const encoded = font.encodeString(line).join("");
  6708. const glyphs = font.charsToGlyphs(encoded);
  6709. const positions = font.getCharPositions(encoded);
  6710. cachedLines.push({
  6711. line: encoded,
  6712. glyphs,
  6713. positions,
  6714. });
  6715. }
  6716. const isTooBig = (fsize) => {
  6717. let totalHeight = 0;
  6718. for (const cache of cachedLines) {
  6719. const chunks = this._splitLine(
  6720. null,
  6721. font,
  6722. fsize,
  6723. width,
  6724. cache
  6725. );
  6726. totalHeight += chunks.length * fsize;
  6727. if (totalHeight > height) {
  6728. return true;
  6729. }
  6730. }
  6731. return false;
  6732. };
  6733. fontSize = 12;
  6734. let lineHeight = fontSize * _util.LINE_FACTOR;
  6735. let numberOfLines = Math.round(height / lineHeight);
  6736. numberOfLines = Math.max(numberOfLines, lineCount);
  6737. while (true) {
  6738. lineHeight = height / numberOfLines;
  6739. fontSize = roundWithTwoDigits(lineHeight / _util.LINE_FACTOR);
  6740. if (isTooBig(fontSize)) {
  6741. numberOfLines++;
  6742. continue;
  6743. }
  6744. break;
  6745. }
  6746. }
  6747. const { fontName, fontColor } = this.data.defaultAppearanceData;
  6748. this._defaultAppearance = (0,
  6749. _default_appearance.createDefaultAppearance)({
  6750. fontSize,
  6751. fontName,
  6752. fontColor,
  6753. });
  6754. }
  6755. return [this._defaultAppearance, fontSize];
  6756. }
  6757. _renderText(
  6758. text,
  6759. font,
  6760. fontSize,
  6761. totalWidth,
  6762. alignment,
  6763. hPadding,
  6764. vPadding
  6765. ) {
  6766. let shift;
  6767. if (alignment === 1) {
  6768. const width = this._getTextWidth(text, font) * fontSize;
  6769. shift = (totalWidth - width) / 2;
  6770. } else if (alignment === 2) {
  6771. const width = this._getTextWidth(text, font) * fontSize;
  6772. shift = totalWidth - width - hPadding;
  6773. } else {
  6774. shift = hPadding;
  6775. }
  6776. shift = (0, _core_utils.numberToString)(shift);
  6777. vPadding = (0, _core_utils.numberToString)(vPadding);
  6778. return `${shift} ${vPadding} Td (${(0, _util.escapeString)(
  6779. text
  6780. )}) Tj`;
  6781. }
  6782. _getSaveFieldResources(xref) {
  6783. const { localResources, appearanceResources, acroFormResources } =
  6784. this._fieldResources;
  6785. const fontName =
  6786. this.data.defaultAppearanceData &&
  6787. this.data.defaultAppearanceData.fontName;
  6788. if (!fontName) {
  6789. return localResources || _primitives.Dict.empty;
  6790. }
  6791. for (const resources of [localResources, appearanceResources]) {
  6792. if (resources instanceof _primitives.Dict) {
  6793. const localFont = resources.get("Font");
  6794. if (
  6795. localFont instanceof _primitives.Dict &&
  6796. localFont.has(fontName)
  6797. ) {
  6798. return resources;
  6799. }
  6800. }
  6801. }
  6802. if (acroFormResources instanceof _primitives.Dict) {
  6803. const acroFormFont = acroFormResources.get("Font");
  6804. if (
  6805. acroFormFont instanceof _primitives.Dict &&
  6806. acroFormFont.has(fontName)
  6807. ) {
  6808. const subFontDict = new _primitives.Dict(xref);
  6809. subFontDict.set(fontName, acroFormFont.getRaw(fontName));
  6810. const subResourcesDict = new _primitives.Dict(xref);
  6811. subResourcesDict.set("Font", subFontDict);
  6812. return _primitives.Dict.merge({
  6813. xref,
  6814. dictArray: [subResourcesDict, localResources],
  6815. mergeSubDicts: true,
  6816. });
  6817. }
  6818. }
  6819. return localResources || _primitives.Dict.empty;
  6820. }
  6821. getFieldObject() {
  6822. return null;
  6823. }
  6824. }
  6825. class TextWidgetAnnotation extends WidgetAnnotation {
  6826. constructor(params) {
  6827. super(params);
  6828. this._hasText = true;
  6829. const dict = params.dict;
  6830. if (typeof this.data.fieldValue !== "string") {
  6831. this.data.fieldValue = "";
  6832. }
  6833. let alignment = (0, _core_utils.getInheritableProperty)({
  6834. dict,
  6835. key: "Q",
  6836. });
  6837. if (
  6838. !Number.isInteger(alignment) ||
  6839. alignment < 0 ||
  6840. alignment > 2
  6841. ) {
  6842. alignment = null;
  6843. }
  6844. this.data.textAlignment = alignment;
  6845. let maximumLength = (0, _core_utils.getInheritableProperty)({
  6846. dict,
  6847. key: "MaxLen",
  6848. });
  6849. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  6850. maximumLength = 0;
  6851. }
  6852. this.data.maxLen = maximumLength;
  6853. this.data.multiLine = this.hasFieldFlag(
  6854. _util.AnnotationFieldFlag.MULTILINE
  6855. );
  6856. this.data.comb =
  6857. this.hasFieldFlag(_util.AnnotationFieldFlag.COMB) &&
  6858. !this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE) &&
  6859. !this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD) &&
  6860. !this.hasFieldFlag(_util.AnnotationFieldFlag.FILESELECT) &&
  6861. this.data.maxLen !== 0;
  6862. this.data.doNotScroll = this.hasFieldFlag(
  6863. _util.AnnotationFieldFlag.DONOTSCROLL
  6864. );
  6865. }
  6866. _getCombAppearance(
  6867. defaultAppearance,
  6868. font,
  6869. text,
  6870. width,
  6871. hPadding,
  6872. vPadding,
  6873. annotationStorage
  6874. ) {
  6875. const combWidth = (0, _core_utils.numberToString)(
  6876. width / this.data.maxLen
  6877. );
  6878. const buf = [];
  6879. const positions = font.getCharPositions(text);
  6880. for (const [start, end] of positions) {
  6881. buf.push(
  6882. `(${(0, _util.escapeString)(text.substring(start, end))}) Tj`
  6883. );
  6884. }
  6885. const colors =
  6886. this.getBorderAndBackgroundAppearances(annotationStorage);
  6887. const renderedComb = buf.join(` ${combWidth} 0 Td `);
  6888. return (
  6889. `/Tx BMC q ${colors}BT ` +
  6890. defaultAppearance +
  6891. ` 1 0 0 1 ${hPadding} ${vPadding} Tm ${renderedComb}` +
  6892. " ET Q EMC"
  6893. );
  6894. }
  6895. _getMultilineAppearance(
  6896. defaultAppearance,
  6897. text,
  6898. font,
  6899. fontSize,
  6900. width,
  6901. height,
  6902. alignment,
  6903. hPadding,
  6904. vPadding,
  6905. annotationStorage
  6906. ) {
  6907. const lines = text.split(/\r\n?|\n/);
  6908. const buf = [];
  6909. const totalWidth = width - 2 * hPadding;
  6910. for (const line of lines) {
  6911. const chunks = this._splitLine(line, font, fontSize, totalWidth);
  6912. for (const chunk of chunks) {
  6913. const padding = buf.length === 0 ? hPadding : 0;
  6914. buf.push(
  6915. this._renderText(
  6916. chunk,
  6917. font,
  6918. fontSize,
  6919. width,
  6920. alignment,
  6921. padding,
  6922. -fontSize
  6923. )
  6924. );
  6925. }
  6926. }
  6927. const renderedText = buf.join("\n");
  6928. const colors =
  6929. this.getBorderAndBackgroundAppearances(annotationStorage);
  6930. return (
  6931. `/Tx BMC q ${colors}BT ` +
  6932. defaultAppearance +
  6933. ` 1 0 0 1 0 ${height} Tm ${renderedText}` +
  6934. " ET Q EMC"
  6935. );
  6936. }
  6937. _splitLine(line, font, fontSize, width, cache = {}) {
  6938. line = cache.line || font.encodeString(line).join("");
  6939. const glyphs = cache.glyphs || font.charsToGlyphs(line);
  6940. if (glyphs.length <= 1) {
  6941. return [line];
  6942. }
  6943. const positions = cache.positions || font.getCharPositions(line);
  6944. const scale = fontSize / 1000;
  6945. const chunks = [];
  6946. let lastSpacePosInStringStart = -1,
  6947. lastSpacePosInStringEnd = -1,
  6948. lastSpacePos = -1,
  6949. startChunk = 0,
  6950. currentWidth = 0;
  6951. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  6952. const [start, end] = positions[i];
  6953. const glyph = glyphs[i];
  6954. const glyphWidth = glyph.width * scale;
  6955. if (glyph.unicode === " ") {
  6956. if (currentWidth + glyphWidth > width) {
  6957. chunks.push(line.substring(startChunk, start));
  6958. startChunk = start;
  6959. currentWidth = glyphWidth;
  6960. lastSpacePosInStringStart = -1;
  6961. lastSpacePos = -1;
  6962. } else {
  6963. currentWidth += glyphWidth;
  6964. lastSpacePosInStringStart = start;
  6965. lastSpacePosInStringEnd = end;
  6966. lastSpacePos = i;
  6967. }
  6968. } else {
  6969. if (currentWidth + glyphWidth > width) {
  6970. if (lastSpacePosInStringStart !== -1) {
  6971. chunks.push(
  6972. line.substring(startChunk, lastSpacePosInStringEnd)
  6973. );
  6974. startChunk = lastSpacePosInStringEnd;
  6975. i = lastSpacePos + 1;
  6976. lastSpacePosInStringStart = -1;
  6977. currentWidth = 0;
  6978. } else {
  6979. chunks.push(line.substring(startChunk, start));
  6980. startChunk = start;
  6981. currentWidth = glyphWidth;
  6982. }
  6983. } else {
  6984. currentWidth += glyphWidth;
  6985. }
  6986. }
  6987. }
  6988. if (startChunk < line.length) {
  6989. chunks.push(line.substring(startChunk, line.length));
  6990. }
  6991. return chunks;
  6992. }
  6993. getFieldObject() {
  6994. return {
  6995. id: this.data.id,
  6996. value: this.data.fieldValue,
  6997. defaultValue: this.data.defaultFieldValue || "",
  6998. multiline: this.data.multiLine,
  6999. password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD),
  7000. charLimit: this.data.maxLen,
  7001. comb: this.data.comb,
  7002. editable: !this.data.readOnly,
  7003. hidden: this.data.hidden,
  7004. name: this.data.fieldName,
  7005. rect: this.data.rect,
  7006. actions: this.data.actions,
  7007. page: this.data.pageIndex,
  7008. strokeColor: this.data.borderColor,
  7009. fillColor: this.data.backgroundColor,
  7010. rotation: this.rotation,
  7011. type: "text",
  7012. };
  7013. }
  7014. }
  7015. class ButtonWidgetAnnotation extends WidgetAnnotation {
  7016. constructor(params) {
  7017. super(params);
  7018. this.checkedAppearance = null;
  7019. this.uncheckedAppearance = null;
  7020. this.data.checkBox =
  7021. !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) &&
  7022. !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  7023. this.data.radioButton =
  7024. this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) &&
  7025. !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  7026. this.data.pushButton = this.hasFieldFlag(
  7027. _util.AnnotationFieldFlag.PUSHBUTTON
  7028. );
  7029. this.data.isTooltipOnly = false;
  7030. if (this.data.checkBox) {
  7031. this._processCheckBox(params);
  7032. } else if (this.data.radioButton) {
  7033. this._processRadioButton(params);
  7034. } else if (this.data.pushButton) {
  7035. this.data.hasOwnCanvas = true;
  7036. this._processPushButton(params);
  7037. } else {
  7038. (0, _util.warn)(
  7039. "Invalid field flags for button widget annotation"
  7040. );
  7041. }
  7042. }
  7043. async getOperatorList(
  7044. evaluator,
  7045. task,
  7046. intent,
  7047. renderForms,
  7048. annotationStorage
  7049. ) {
  7050. if (this.data.pushButton) {
  7051. return super.getOperatorList(
  7052. evaluator,
  7053. task,
  7054. intent,
  7055. false,
  7056. annotationStorage
  7057. );
  7058. }
  7059. let value = null;
  7060. let rotation = null;
  7061. if (annotationStorage) {
  7062. const storageEntry = annotationStorage.get(this.data.id);
  7063. value = storageEntry ? storageEntry.value : null;
  7064. rotation = storageEntry ? storageEntry.rotation : null;
  7065. }
  7066. if (value === null && this.appearance) {
  7067. return super.getOperatorList(
  7068. evaluator,
  7069. task,
  7070. intent,
  7071. renderForms,
  7072. annotationStorage
  7073. );
  7074. }
  7075. if (value === null || value === undefined) {
  7076. if (this.data.checkBox) {
  7077. value = this.data.fieldValue === this.data.exportValue;
  7078. } else {
  7079. value = this.data.fieldValue === this.data.buttonValue;
  7080. }
  7081. }
  7082. const appearance = value
  7083. ? this.checkedAppearance
  7084. : this.uncheckedAppearance;
  7085. if (appearance) {
  7086. const savedAppearance = this.appearance;
  7087. const savedMatrix =
  7088. appearance.dict.getArray("Matrix") || _util.IDENTITY_MATRIX;
  7089. if (rotation) {
  7090. appearance.dict.set(
  7091. "Matrix",
  7092. this.getRotationMatrix(annotationStorage)
  7093. );
  7094. }
  7095. this.appearance = appearance;
  7096. const operatorList = super.getOperatorList(
  7097. evaluator,
  7098. task,
  7099. intent,
  7100. renderForms,
  7101. annotationStorage
  7102. );
  7103. this.appearance = savedAppearance;
  7104. appearance.dict.set("Matrix", savedMatrix);
  7105. return operatorList;
  7106. }
  7107. return {
  7108. opList: new _operator_list.OperatorList(),
  7109. separateForm: false,
  7110. separateCanvas: false,
  7111. };
  7112. }
  7113. async save(evaluator, task, annotationStorage) {
  7114. if (this.data.checkBox) {
  7115. return this._saveCheckbox(evaluator, task, annotationStorage);
  7116. }
  7117. if (this.data.radioButton) {
  7118. return this._saveRadioButton(evaluator, task, annotationStorage);
  7119. }
  7120. return null;
  7121. }
  7122. async _saveCheckbox(evaluator, task, annotationStorage) {
  7123. if (!annotationStorage) {
  7124. return null;
  7125. }
  7126. const storageEntry = annotationStorage.get(this.data.id);
  7127. let rotation = storageEntry && storageEntry.rotation;
  7128. let value = storageEntry && storageEntry.value;
  7129. if (rotation === undefined) {
  7130. if (value === undefined) {
  7131. return null;
  7132. }
  7133. const defaultValue =
  7134. this.data.fieldValue === this.data.exportValue;
  7135. if (defaultValue === value) {
  7136. return null;
  7137. }
  7138. }
  7139. const dict = evaluator.xref.fetchIfRef(this.ref);
  7140. if (!(dict instanceof _primitives.Dict)) {
  7141. return null;
  7142. }
  7143. if (rotation === undefined) {
  7144. rotation = this.rotation;
  7145. }
  7146. if (value === undefined) {
  7147. value = this.data.fieldValue === this.data.exportValue;
  7148. }
  7149. const xfa = {
  7150. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  7151. value: value ? this.data.exportValue : "",
  7152. };
  7153. const name = _primitives.Name.get(
  7154. value ? this.data.exportValue : "Off"
  7155. );
  7156. dict.set("V", name);
  7157. dict.set("AS", name);
  7158. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  7159. const maybeMK = this._getMKDict(rotation);
  7160. if (maybeMK) {
  7161. dict.set("MK", maybeMK);
  7162. }
  7163. const encrypt = evaluator.xref.encrypt;
  7164. let originalTransform = null;
  7165. if (encrypt) {
  7166. originalTransform = encrypt.createCipherTransform(
  7167. this.ref.num,
  7168. this.ref.gen
  7169. );
  7170. }
  7171. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  7172. (0, _writer.writeDict)(dict, buffer, originalTransform);
  7173. buffer.push("\nendobj\n");
  7174. return [
  7175. {
  7176. ref: this.ref,
  7177. data: buffer.join(""),
  7178. xfa,
  7179. },
  7180. ];
  7181. }
  7182. async _saveRadioButton(evaluator, task, annotationStorage) {
  7183. if (!annotationStorage) {
  7184. return null;
  7185. }
  7186. const storageEntry = annotationStorage.get(this.data.id);
  7187. let rotation = storageEntry && storageEntry.rotation;
  7188. let value = storageEntry && storageEntry.value;
  7189. if (rotation === undefined) {
  7190. if (value === undefined) {
  7191. return null;
  7192. }
  7193. const defaultValue =
  7194. this.data.fieldValue === this.data.buttonValue;
  7195. if (defaultValue === value) {
  7196. return null;
  7197. }
  7198. }
  7199. const dict = evaluator.xref.fetchIfRef(this.ref);
  7200. if (!(dict instanceof _primitives.Dict)) {
  7201. return null;
  7202. }
  7203. if (value === undefined) {
  7204. value = this.data.fieldValue === this.data.buttonValue;
  7205. }
  7206. if (rotation === undefined) {
  7207. rotation = this.rotation;
  7208. }
  7209. const xfa = {
  7210. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  7211. value: value ? this.data.buttonValue : "",
  7212. };
  7213. const name = _primitives.Name.get(
  7214. value ? this.data.buttonValue : "Off"
  7215. );
  7216. let parentBuffer = null;
  7217. const encrypt = evaluator.xref.encrypt;
  7218. if (value) {
  7219. if (this.parent instanceof _primitives.Ref) {
  7220. const parent = evaluator.xref.fetch(this.parent);
  7221. let parentTransform = null;
  7222. if (encrypt) {
  7223. parentTransform = encrypt.createCipherTransform(
  7224. this.parent.num,
  7225. this.parent.gen
  7226. );
  7227. }
  7228. parent.set("V", name);
  7229. parentBuffer = [`${this.parent.num} ${this.parent.gen} obj\n`];
  7230. (0, _writer.writeDict)(parent, parentBuffer, parentTransform);
  7231. parentBuffer.push("\nendobj\n");
  7232. } else if (this.parent instanceof _primitives.Dict) {
  7233. this.parent.set("V", name);
  7234. }
  7235. }
  7236. dict.set("AS", name);
  7237. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  7238. const maybeMK = this._getMKDict(rotation);
  7239. if (maybeMK) {
  7240. dict.set("MK", maybeMK);
  7241. }
  7242. let originalTransform = null;
  7243. if (encrypt) {
  7244. originalTransform = encrypt.createCipherTransform(
  7245. this.ref.num,
  7246. this.ref.gen
  7247. );
  7248. }
  7249. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  7250. (0, _writer.writeDict)(dict, buffer, originalTransform);
  7251. buffer.push("\nendobj\n");
  7252. const newRefs = [
  7253. {
  7254. ref: this.ref,
  7255. data: buffer.join(""),
  7256. xfa,
  7257. },
  7258. ];
  7259. if (parentBuffer !== null) {
  7260. newRefs.push({
  7261. ref: this.parent,
  7262. data: parentBuffer.join(""),
  7263. xfa: null,
  7264. });
  7265. }
  7266. return newRefs;
  7267. }
  7268. _getDefaultCheckedAppearance(params, type) {
  7269. const width = this.data.rect[2] - this.data.rect[0];
  7270. const height = this.data.rect[3] - this.data.rect[1];
  7271. const bbox = [0, 0, width, height];
  7272. const FONT_RATIO = 0.8;
  7273. const fontSize = Math.min(width, height) * FONT_RATIO;
  7274. let metrics, char;
  7275. if (type === "check") {
  7276. metrics = {
  7277. width: 0.755 * fontSize,
  7278. height: 0.705 * fontSize,
  7279. };
  7280. char = "\x33";
  7281. } else if (type === "disc") {
  7282. metrics = {
  7283. width: 0.791 * fontSize,
  7284. height: 0.705 * fontSize,
  7285. };
  7286. char = "\x6C";
  7287. } else {
  7288. (0, _util.unreachable)(
  7289. `_getDefaultCheckedAppearance - unsupported type: ${type}`
  7290. );
  7291. }
  7292. const xShift = (0, _core_utils.numberToString)(
  7293. (width - metrics.width) / 2
  7294. );
  7295. const yShift = (0, _core_utils.numberToString)(
  7296. (height - metrics.height) / 2
  7297. );
  7298. const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`;
  7299. const appearanceStreamDict = new _primitives.Dict(params.xref);
  7300. appearanceStreamDict.set("FormType", 1);
  7301. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  7302. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  7303. appearanceStreamDict.set("BBox", bbox);
  7304. appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]);
  7305. appearanceStreamDict.set("Length", appearance.length);
  7306. const resources = new _primitives.Dict(params.xref);
  7307. const font = new _primitives.Dict(params.xref);
  7308. font.set("PdfJsZaDb", this.fallbackFontDict);
  7309. resources.set("Font", font);
  7310. appearanceStreamDict.set("Resources", resources);
  7311. this.checkedAppearance = new _stream.StringStream(appearance);
  7312. this.checkedAppearance.dict = appearanceStreamDict;
  7313. this._streams.push(this.checkedAppearance);
  7314. }
  7315. _processCheckBox(params) {
  7316. const customAppearance = params.dict.get("AP");
  7317. if (!(customAppearance instanceof _primitives.Dict)) {
  7318. return;
  7319. }
  7320. const normalAppearance = customAppearance.get("N");
  7321. if (!(normalAppearance instanceof _primitives.Dict)) {
  7322. return;
  7323. }
  7324. const asValue = this._decodeFormValue(params.dict.get("AS"));
  7325. if (typeof asValue === "string") {
  7326. this.data.fieldValue = asValue;
  7327. }
  7328. const yes =
  7329. this.data.fieldValue !== null && this.data.fieldValue !== "Off"
  7330. ? this.data.fieldValue
  7331. : "Yes";
  7332. const exportValues = normalAppearance.getKeys();
  7333. if (exportValues.length === 0) {
  7334. exportValues.push("Off", yes);
  7335. } else if (exportValues.length === 1) {
  7336. if (exportValues[0] === "Off") {
  7337. exportValues.push(yes);
  7338. } else {
  7339. exportValues.unshift("Off");
  7340. }
  7341. } else if (exportValues.includes(yes)) {
  7342. exportValues.length = 0;
  7343. exportValues.push("Off", yes);
  7344. } else {
  7345. const otherYes = exportValues.find((v) => v !== "Off");
  7346. exportValues.length = 0;
  7347. exportValues.push("Off", otherYes);
  7348. }
  7349. if (!exportValues.includes(this.data.fieldValue)) {
  7350. this.data.fieldValue = "Off";
  7351. }
  7352. this.data.exportValue = exportValues[1];
  7353. this.checkedAppearance =
  7354. normalAppearance.get(this.data.exportValue) || null;
  7355. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  7356. if (this.checkedAppearance) {
  7357. this._streams.push(this.checkedAppearance);
  7358. } else {
  7359. this._getDefaultCheckedAppearance(params, "check");
  7360. }
  7361. if (this.uncheckedAppearance) {
  7362. this._streams.push(this.uncheckedAppearance);
  7363. }
  7364. this._fallbackFontDict = this.fallbackFontDict;
  7365. }
  7366. _processRadioButton(params) {
  7367. this.data.fieldValue = this.data.buttonValue = null;
  7368. const fieldParent = params.dict.get("Parent");
  7369. if (fieldParent instanceof _primitives.Dict) {
  7370. this.parent = params.dict.getRaw("Parent");
  7371. const fieldParentValue = fieldParent.get("V");
  7372. if (fieldParentValue instanceof _primitives.Name) {
  7373. this.data.fieldValue = this._decodeFormValue(fieldParentValue);
  7374. }
  7375. }
  7376. const appearanceStates = params.dict.get("AP");
  7377. if (!(appearanceStates instanceof _primitives.Dict)) {
  7378. return;
  7379. }
  7380. const normalAppearance = appearanceStates.get("N");
  7381. if (!(normalAppearance instanceof _primitives.Dict)) {
  7382. return;
  7383. }
  7384. for (const key of normalAppearance.getKeys()) {
  7385. if (key !== "Off") {
  7386. this.data.buttonValue = this._decodeFormValue(key);
  7387. break;
  7388. }
  7389. }
  7390. this.checkedAppearance =
  7391. normalAppearance.get(this.data.buttonValue) || null;
  7392. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  7393. if (this.checkedAppearance) {
  7394. this._streams.push(this.checkedAppearance);
  7395. } else {
  7396. this._getDefaultCheckedAppearance(params, "disc");
  7397. }
  7398. if (this.uncheckedAppearance) {
  7399. this._streams.push(this.uncheckedAppearance);
  7400. }
  7401. this._fallbackFontDict = this.fallbackFontDict;
  7402. }
  7403. _processPushButton(params) {
  7404. if (
  7405. !params.dict.has("A") &&
  7406. !params.dict.has("AA") &&
  7407. !this.data.alternativeText
  7408. ) {
  7409. (0, _util.warn)(
  7410. "Push buttons without action dictionaries are not supported"
  7411. );
  7412. return;
  7413. }
  7414. this.data.isTooltipOnly =
  7415. !params.dict.has("A") && !params.dict.has("AA");
  7416. _catalog.Catalog.parseDestDictionary({
  7417. destDict: params.dict,
  7418. resultObj: this.data,
  7419. docBaseUrl: params.pdfManager.docBaseUrl,
  7420. });
  7421. }
  7422. getFieldObject() {
  7423. let type = "button";
  7424. let exportValues;
  7425. if (this.data.checkBox) {
  7426. type = "checkbox";
  7427. exportValues = this.data.exportValue;
  7428. } else if (this.data.radioButton) {
  7429. type = "radiobutton";
  7430. exportValues = this.data.buttonValue;
  7431. }
  7432. return {
  7433. id: this.data.id,
  7434. value: this.data.fieldValue || "Off",
  7435. defaultValue: this.data.defaultFieldValue,
  7436. exportValues,
  7437. editable: !this.data.readOnly,
  7438. name: this.data.fieldName,
  7439. rect: this.data.rect,
  7440. hidden: this.data.hidden,
  7441. actions: this.data.actions,
  7442. page: this.data.pageIndex,
  7443. strokeColor: this.data.borderColor,
  7444. fillColor: this.data.backgroundColor,
  7445. rotation: this.rotation,
  7446. type,
  7447. };
  7448. }
  7449. get fallbackFontDict() {
  7450. const dict = new _primitives.Dict();
  7451. dict.set("BaseFont", _primitives.Name.get("ZapfDingbats"));
  7452. dict.set("Type", _primitives.Name.get("FallbackType"));
  7453. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  7454. dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding"));
  7455. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  7456. }
  7457. }
  7458. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  7459. constructor(params) {
  7460. super(params);
  7461. this.data.options = [];
  7462. const options = (0, _core_utils.getInheritableProperty)({
  7463. dict: params.dict,
  7464. key: "Opt",
  7465. });
  7466. if (Array.isArray(options)) {
  7467. const xref = params.xref;
  7468. for (let i = 0, ii = options.length; i < ii; i++) {
  7469. const option = xref.fetchIfRef(options[i]);
  7470. const isOptionArray = Array.isArray(option);
  7471. this.data.options[i] = {
  7472. exportValue: this._decodeFormValue(
  7473. isOptionArray ? xref.fetchIfRef(option[0]) : option
  7474. ),
  7475. displayValue: this._decodeFormValue(
  7476. isOptionArray ? xref.fetchIfRef(option[1]) : option
  7477. ),
  7478. };
  7479. }
  7480. }
  7481. if (typeof this.data.fieldValue === "string") {
  7482. this.data.fieldValue = [this.data.fieldValue];
  7483. } else if (!this.data.fieldValue) {
  7484. this.data.fieldValue = [];
  7485. }
  7486. this.data.combo = this.hasFieldFlag(
  7487. _util.AnnotationFieldFlag.COMBO
  7488. );
  7489. this.data.multiSelect = this.hasFieldFlag(
  7490. _util.AnnotationFieldFlag.MULTISELECT
  7491. );
  7492. this._hasText = true;
  7493. }
  7494. getFieldObject() {
  7495. const type = this.data.combo ? "combobox" : "listbox";
  7496. const value =
  7497. this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
  7498. return {
  7499. id: this.data.id,
  7500. value,
  7501. defaultValue: this.data.defaultFieldValue,
  7502. editable: !this.data.readOnly,
  7503. name: this.data.fieldName,
  7504. rect: this.data.rect,
  7505. numItems: this.data.fieldValue.length,
  7506. multipleSelection: this.data.multiSelect,
  7507. hidden: this.data.hidden,
  7508. actions: this.data.actions,
  7509. items: this.data.options,
  7510. page: this.data.pageIndex,
  7511. strokeColor: this.data.borderColor,
  7512. fillColor: this.data.backgroundColor,
  7513. rotation: this.rotation,
  7514. type,
  7515. };
  7516. }
  7517. async _getAppearance(evaluator, task, annotationStorage) {
  7518. if (this.data.combo) {
  7519. return super._getAppearance(evaluator, task, annotationStorage);
  7520. }
  7521. if (!annotationStorage) {
  7522. return null;
  7523. }
  7524. const storageEntry = annotationStorage.get(this.data.id);
  7525. if (!storageEntry) {
  7526. return null;
  7527. }
  7528. const rotation = storageEntry.rotation;
  7529. let exportedValue = storageEntry.value;
  7530. if (rotation === undefined && exportedValue === undefined) {
  7531. return null;
  7532. }
  7533. if (exportedValue === undefined) {
  7534. exportedValue = this.data.fieldValue;
  7535. } else if (!Array.isArray(exportedValue)) {
  7536. exportedValue = [exportedValue];
  7537. }
  7538. const defaultPadding = 2;
  7539. const hPadding = defaultPadding;
  7540. let totalHeight = this.data.rect[3] - this.data.rect[1];
  7541. let totalWidth = this.data.rect[2] - this.data.rect[0];
  7542. if (rotation === 90 || rotation === 270) {
  7543. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  7544. }
  7545. const lineCount = this.data.options.length;
  7546. const valueIndices = [];
  7547. for (let i = 0; i < lineCount; i++) {
  7548. const { exportValue } = this.data.options[i];
  7549. if (exportedValue.includes(exportValue)) {
  7550. valueIndices.push(i);
  7551. }
  7552. }
  7553. if (!this._defaultAppearance) {
  7554. this.data.defaultAppearanceData = (0,
  7555. _default_appearance.parseDefaultAppearance)(
  7556. (this._defaultAppearance = "/Helvetica 0 Tf 0 g")
  7557. );
  7558. }
  7559. const font = await WidgetAnnotation._getFontData(
  7560. evaluator,
  7561. task,
  7562. this.data.defaultAppearanceData,
  7563. this._fieldResources.mergedResources
  7564. );
  7565. let defaultAppearance;
  7566. let { fontSize } = this.data.defaultAppearanceData;
  7567. if (!fontSize) {
  7568. const lineHeight = (totalHeight - defaultPadding) / lineCount;
  7569. let lineWidth = -1;
  7570. let value;
  7571. for (const { displayValue } of this.data.options) {
  7572. const width = this._getTextWidth(displayValue, font);
  7573. if (width > lineWidth) {
  7574. lineWidth = width;
  7575. value = displayValue;
  7576. }
  7577. }
  7578. [defaultAppearance, fontSize] = this._computeFontSize(
  7579. lineHeight,
  7580. totalWidth - 2 * hPadding,
  7581. value,
  7582. font,
  7583. -1
  7584. );
  7585. } else {
  7586. defaultAppearance = this._defaultAppearance;
  7587. }
  7588. const lineHeight = fontSize * _util.LINE_FACTOR;
  7589. const vPadding = (lineHeight - fontSize) / 2;
  7590. const numberOfVisibleLines = Math.floor(totalHeight / lineHeight);
  7591. let firstIndex;
  7592. if (valueIndices.length === 1) {
  7593. const valuePosition = valueIndices[0];
  7594. const indexInPage = valuePosition % numberOfVisibleLines;
  7595. firstIndex = valuePosition - indexInPage;
  7596. } else {
  7597. firstIndex = valueIndices.length ? valueIndices[0] : 0;
  7598. }
  7599. const end = Math.min(
  7600. firstIndex + numberOfVisibleLines + 1,
  7601. lineCount
  7602. );
  7603. const buf = [
  7604. "/Tx BMC q",
  7605. `1 1 ${totalWidth} ${totalHeight} re W n`,
  7606. ];
  7607. if (valueIndices.length) {
  7608. buf.push("0.600006 0.756866 0.854904 rg");
  7609. for (const index of valueIndices) {
  7610. if (firstIndex <= index && index < end) {
  7611. buf.push(
  7612. `1 ${
  7613. totalHeight - (index - firstIndex + 1) * lineHeight
  7614. } ${totalWidth} ${lineHeight} re f`
  7615. );
  7616. }
  7617. }
  7618. }
  7619. buf.push("BT", defaultAppearance, `1 0 0 1 0 ${totalHeight} Tm`);
  7620. for (let i = firstIndex; i < end; i++) {
  7621. const { displayValue } = this.data.options[i];
  7622. const hpadding = i === firstIndex ? hPadding : 0;
  7623. const vpadding = i === firstIndex ? vPadding : 0;
  7624. buf.push(
  7625. this._renderText(
  7626. displayValue,
  7627. font,
  7628. fontSize,
  7629. totalWidth,
  7630. 0,
  7631. hpadding,
  7632. -lineHeight + vpadding
  7633. )
  7634. );
  7635. }
  7636. buf.push("ET Q EMC");
  7637. return buf.join("\n");
  7638. }
  7639. }
  7640. class SignatureWidgetAnnotation extends WidgetAnnotation {
  7641. constructor(params) {
  7642. super(params);
  7643. this.data.fieldValue = null;
  7644. }
  7645. getFieldObject() {
  7646. return {
  7647. id: this.data.id,
  7648. value: null,
  7649. page: this.data.pageIndex,
  7650. type: "signature",
  7651. };
  7652. }
  7653. }
  7654. class TextAnnotation extends MarkupAnnotation {
  7655. constructor(parameters) {
  7656. const DEFAULT_ICON_SIZE = 22;
  7657. super(parameters);
  7658. const dict = parameters.dict;
  7659. this.data.annotationType = _util.AnnotationType.TEXT;
  7660. if (this.data.hasAppearance) {
  7661. this.data.name = "NoIcon";
  7662. } else {
  7663. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  7664. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  7665. this.data.name = dict.has("Name")
  7666. ? dict.get("Name").name
  7667. : "Note";
  7668. }
  7669. if (dict.has("State")) {
  7670. this.data.state = dict.get("State") || null;
  7671. this.data.stateModel = dict.get("StateModel") || null;
  7672. } else {
  7673. this.data.state = null;
  7674. this.data.stateModel = null;
  7675. }
  7676. }
  7677. }
  7678. class LinkAnnotation extends Annotation {
  7679. constructor(params) {
  7680. super(params);
  7681. this.data.annotationType = _util.AnnotationType.LINK;
  7682. const quadPoints = getQuadPoints(params.dict, this.rectangle);
  7683. if (quadPoints) {
  7684. this.data.quadPoints = quadPoints;
  7685. }
  7686. this.data.borderColor = this.data.borderColor || this.data.color;
  7687. _catalog.Catalog.parseDestDictionary({
  7688. destDict: params.dict,
  7689. resultObj: this.data,
  7690. docBaseUrl: params.pdfManager.docBaseUrl,
  7691. });
  7692. }
  7693. }
  7694. class PopupAnnotation extends Annotation {
  7695. constructor(parameters) {
  7696. super(parameters);
  7697. this.data.annotationType = _util.AnnotationType.POPUP;
  7698. let parentItem = parameters.dict.get("Parent");
  7699. if (!parentItem) {
  7700. (0, _util.warn)(
  7701. "Popup annotation has a missing or invalid parent annotation."
  7702. );
  7703. return;
  7704. }
  7705. const parentSubtype = parentItem.get("Subtype");
  7706. this.data.parentType =
  7707. parentSubtype instanceof _primitives.Name
  7708. ? parentSubtype.name
  7709. : null;
  7710. const rawParent = parameters.dict.getRaw("Parent");
  7711. this.data.parentId =
  7712. rawParent instanceof _primitives.Ref
  7713. ? rawParent.toString()
  7714. : null;
  7715. const parentRect = parentItem.getArray("Rect");
  7716. if (Array.isArray(parentRect) && parentRect.length === 4) {
  7717. this.data.parentRect = _util.Util.normalizeRect(parentRect);
  7718. } else {
  7719. this.data.parentRect = [0, 0, 0, 0];
  7720. }
  7721. const rt = parentItem.get("RT");
  7722. if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
  7723. parentItem = parentItem.get("IRT");
  7724. }
  7725. if (!parentItem.has("M")) {
  7726. this.data.modificationDate = null;
  7727. } else {
  7728. this.setModificationDate(parentItem.get("M"));
  7729. this.data.modificationDate = this.modificationDate;
  7730. }
  7731. if (!parentItem.has("C")) {
  7732. this.data.color = null;
  7733. } else {
  7734. this.setColor(parentItem.getArray("C"));
  7735. this.data.color = this.color;
  7736. }
  7737. if (!this.viewable) {
  7738. const parentFlags = parentItem.get("F");
  7739. if (this._isViewable(parentFlags)) {
  7740. this.setFlags(parentFlags);
  7741. }
  7742. }
  7743. this.setTitle(parentItem.get("T"));
  7744. this.data.titleObj = this._title;
  7745. this.setContents(parentItem.get("Contents"));
  7746. this.data.contentsObj = this._contents;
  7747. if (parentItem.has("RC")) {
  7748. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(
  7749. parentItem.get("RC")
  7750. );
  7751. }
  7752. }
  7753. }
  7754. exports.PopupAnnotation = PopupAnnotation;
  7755. class FreeTextAnnotation extends MarkupAnnotation {
  7756. constructor(parameters) {
  7757. super(parameters);
  7758. this.data.annotationType = _util.AnnotationType.FREETEXT;
  7759. }
  7760. get hasTextContent() {
  7761. return !!this.appearance;
  7762. }
  7763. static createNewDict(annotation, xref, { apRef, ap }) {
  7764. const { color, fontSize, rect, rotation, user, value } = annotation;
  7765. const freetext = new _primitives.Dict(xref);
  7766. freetext.set("Type", _primitives.Name.get("Annot"));
  7767. freetext.set("Subtype", _primitives.Name.get("FreeText"));
  7768. freetext.set(
  7769. "CreationDate",
  7770. `D:${(0, _util.getModificationDate)()}`
  7771. );
  7772. freetext.set("Rect", rect);
  7773. const da = `/Helv ${fontSize} Tf ${(0,
  7774. _default_appearance.getPdfColor)(color, true)}`;
  7775. freetext.set("DA", da);
  7776. freetext.set("Contents", value);
  7777. freetext.set("F", 4);
  7778. freetext.set("Border", [0, 0, 0]);
  7779. freetext.set("Rotate", rotation);
  7780. if (user) {
  7781. freetext.set("T", (0, _util.stringToUTF8String)(user));
  7782. }
  7783. const n = new _primitives.Dict(xref);
  7784. freetext.set("AP", n);
  7785. if (apRef) {
  7786. n.set("N", apRef);
  7787. } else {
  7788. n.set("N", ap);
  7789. }
  7790. return freetext;
  7791. }
  7792. static async createNewAppearanceStream(annotation, xref, params) {
  7793. const { baseFontRef, evaluator, task } = params;
  7794. const { color, fontSize, rect, rotation, value } = annotation;
  7795. const resources = new _primitives.Dict(xref);
  7796. const font = new _primitives.Dict(xref);
  7797. if (baseFontRef) {
  7798. font.set("Helv", baseFontRef);
  7799. } else {
  7800. const baseFont = new _primitives.Dict(xref);
  7801. baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
  7802. baseFont.set("Type", _primitives.Name.get("Font"));
  7803. baseFont.set("Subtype", _primitives.Name.get("Type1"));
  7804. baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  7805. font.set("Helv", baseFont);
  7806. }
  7807. resources.set("Font", font);
  7808. const helv = await WidgetAnnotation._getFontData(
  7809. evaluator,
  7810. task,
  7811. {
  7812. fontName: "Helvetica",
  7813. fontSize,
  7814. },
  7815. resources
  7816. );
  7817. const [x1, y1, x2, y2] = rect;
  7818. let w = x2 - x1;
  7819. let h = y2 - y1;
  7820. if (rotation % 180 !== 0) {
  7821. [w, h] = [h, w];
  7822. }
  7823. const lines = value.split("\n");
  7824. const scale = fontSize / 1000;
  7825. let totalWidth = -Infinity;
  7826. const encodedLines = [];
  7827. for (let line of lines) {
  7828. line = helv.encodeString(line).join("");
  7829. encodedLines.push(line);
  7830. let lineWidth = 0;
  7831. const glyphs = helv.charsToGlyphs(line);
  7832. for (const glyph of glyphs) {
  7833. lineWidth += glyph.width * scale;
  7834. }
  7835. totalWidth = Math.max(totalWidth, lineWidth);
  7836. }
  7837. let hscale = 1;
  7838. if (totalWidth > w) {
  7839. hscale = w / totalWidth;
  7840. }
  7841. let vscale = 1;
  7842. const lineHeight = _util.LINE_FACTOR * fontSize;
  7843. const lineDescent = _util.LINE_DESCENT_FACTOR * fontSize;
  7844. const totalHeight = lineHeight * lines.length;
  7845. if (totalHeight > h) {
  7846. vscale = h / totalHeight;
  7847. }
  7848. const fscale = Math.min(hscale, vscale);
  7849. const newFontSize = fontSize * fscale;
  7850. const buffer = [
  7851. "q",
  7852. `0 0 ${(0, _core_utils.numberToString)(w)} ${(0,
  7853. _core_utils.numberToString)(h)} re W n`,
  7854. `BT`,
  7855. `1 0 0 1 0 ${(0, _core_utils.numberToString)(
  7856. h + lineDescent
  7857. )} Tm 0 Tc ${(0, _default_appearance.getPdfColor)(color, true)}`,
  7858. `/Helv ${(0, _core_utils.numberToString)(newFontSize)} Tf`,
  7859. ];
  7860. const vShift = (0, _core_utils.numberToString)(lineHeight);
  7861. for (const line of encodedLines) {
  7862. buffer.push(
  7863. `0 -${vShift} Td (${(0, _util.escapeString)(line)}) Tj`
  7864. );
  7865. }
  7866. buffer.push("ET", "Q");
  7867. const appearance = buffer.join("\n");
  7868. const appearanceStreamDict = new _primitives.Dict(xref);
  7869. appearanceStreamDict.set("FormType", 1);
  7870. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  7871. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  7872. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  7873. appearanceStreamDict.set("Length", appearance.length);
  7874. appearanceStreamDict.set("Resources", resources);
  7875. if (rotation) {
  7876. const matrix = WidgetAnnotation._getRotationMatrix(
  7877. rotation,
  7878. w,
  7879. h
  7880. );
  7881. appearanceStreamDict.set("Matrix", matrix);
  7882. }
  7883. const ap = new _stream.StringStream(appearance);
  7884. ap.dict = appearanceStreamDict;
  7885. return ap;
  7886. }
  7887. }
  7888. class LineAnnotation extends MarkupAnnotation {
  7889. constructor(parameters) {
  7890. super(parameters);
  7891. const { dict } = parameters;
  7892. this.data.annotationType = _util.AnnotationType.LINE;
  7893. const lineCoordinates = dict.getArray("L");
  7894. this.data.lineCoordinates =
  7895. _util.Util.normalizeRect(lineCoordinates);
  7896. this.setLineEndings(dict.getArray("LE"));
  7897. this.data.lineEndings = this.lineEndings;
  7898. if (!this.appearance) {
  7899. const strokeColor = this.color
  7900. ? Array.from(this.color).map((c) => c / 255)
  7901. : [0, 0, 0];
  7902. const strokeAlpha = dict.get("CA");
  7903. let fillColor = null,
  7904. interiorColor = dict.getArray("IC");
  7905. if (interiorColor) {
  7906. interiorColor = getRgbColor(interiorColor, null);
  7907. fillColor = interiorColor
  7908. ? Array.from(interiorColor).map((c) => c / 255)
  7909. : null;
  7910. }
  7911. const fillAlpha = fillColor ? strokeAlpha : null;
  7912. const borderWidth = this.borderStyle.width || 1,
  7913. borderAdjust = 2 * borderWidth;
  7914. const bbox = [
  7915. this.data.lineCoordinates[0] - borderAdjust,
  7916. this.data.lineCoordinates[1] - borderAdjust,
  7917. this.data.lineCoordinates[2] + borderAdjust,
  7918. this.data.lineCoordinates[3] + borderAdjust,
  7919. ];
  7920. if (!_util.Util.intersect(this.rectangle, bbox)) {
  7921. this.rectangle = bbox;
  7922. }
  7923. this._setDefaultAppearance({
  7924. xref: parameters.xref,
  7925. extra: `${borderWidth} w`,
  7926. strokeColor,
  7927. fillColor,
  7928. strokeAlpha,
  7929. fillAlpha,
  7930. pointsCallback: (buffer, points) => {
  7931. buffer.push(
  7932. `${lineCoordinates[0]} ${lineCoordinates[1]} m`,
  7933. `${lineCoordinates[2]} ${lineCoordinates[3]} l`,
  7934. "S"
  7935. );
  7936. return [
  7937. points[0].x - borderWidth,
  7938. points[1].x + borderWidth,
  7939. points[3].y - borderWidth,
  7940. points[1].y + borderWidth,
  7941. ];
  7942. },
  7943. });
  7944. }
  7945. }
  7946. }
  7947. class SquareAnnotation extends MarkupAnnotation {
  7948. constructor(parameters) {
  7949. super(parameters);
  7950. this.data.annotationType = _util.AnnotationType.SQUARE;
  7951. if (!this.appearance) {
  7952. const strokeColor = this.color
  7953. ? Array.from(this.color).map((c) => c / 255)
  7954. : [0, 0, 0];
  7955. const strokeAlpha = parameters.dict.get("CA");
  7956. let fillColor = null,
  7957. interiorColor = parameters.dict.getArray("IC");
  7958. if (interiorColor) {
  7959. interiorColor = getRgbColor(interiorColor, null);
  7960. fillColor = interiorColor
  7961. ? Array.from(interiorColor).map((c) => c / 255)
  7962. : null;
  7963. }
  7964. const fillAlpha = fillColor ? strokeAlpha : null;
  7965. if (this.borderStyle.width === 0 && !fillColor) {
  7966. return;
  7967. }
  7968. this._setDefaultAppearance({
  7969. xref: parameters.xref,
  7970. extra: `${this.borderStyle.width} w`,
  7971. strokeColor,
  7972. fillColor,
  7973. strokeAlpha,
  7974. fillAlpha,
  7975. pointsCallback: (buffer, points) => {
  7976. const x = points[2].x + this.borderStyle.width / 2;
  7977. const y = points[2].y + this.borderStyle.width / 2;
  7978. const width =
  7979. points[3].x - points[2].x - this.borderStyle.width;
  7980. const height =
  7981. points[1].y - points[3].y - this.borderStyle.width;
  7982. buffer.push(`${x} ${y} ${width} ${height} re`);
  7983. if (fillColor) {
  7984. buffer.push("B");
  7985. } else {
  7986. buffer.push("S");
  7987. }
  7988. return [points[0].x, points[1].x, points[3].y, points[1].y];
  7989. },
  7990. });
  7991. }
  7992. }
  7993. }
  7994. class CircleAnnotation extends MarkupAnnotation {
  7995. constructor(parameters) {
  7996. super(parameters);
  7997. this.data.annotationType = _util.AnnotationType.CIRCLE;
  7998. if (!this.appearance) {
  7999. const strokeColor = this.color
  8000. ? Array.from(this.color).map((c) => c / 255)
  8001. : [0, 0, 0];
  8002. const strokeAlpha = parameters.dict.get("CA");
  8003. let fillColor = null;
  8004. let interiorColor = parameters.dict.getArray("IC");
  8005. if (interiorColor) {
  8006. interiorColor = getRgbColor(interiorColor, null);
  8007. fillColor = interiorColor
  8008. ? Array.from(interiorColor).map((c) => c / 255)
  8009. : null;
  8010. }
  8011. const fillAlpha = fillColor ? strokeAlpha : null;
  8012. if (this.borderStyle.width === 0 && !fillColor) {
  8013. return;
  8014. }
  8015. const controlPointsDistance =
  8016. (4 / 3) * Math.tan(Math.PI / (2 * 4));
  8017. this._setDefaultAppearance({
  8018. xref: parameters.xref,
  8019. extra: `${this.borderStyle.width} w`,
  8020. strokeColor,
  8021. fillColor,
  8022. strokeAlpha,
  8023. fillAlpha,
  8024. pointsCallback: (buffer, points) => {
  8025. const x0 = points[0].x + this.borderStyle.width / 2;
  8026. const y0 = points[0].y - this.borderStyle.width / 2;
  8027. const x1 = points[3].x - this.borderStyle.width / 2;
  8028. const y1 = points[3].y + this.borderStyle.width / 2;
  8029. const xMid = x0 + (x1 - x0) / 2;
  8030. const yMid = y0 + (y1 - y0) / 2;
  8031. const xOffset = ((x1 - x0) / 2) * controlPointsDistance;
  8032. const yOffset = ((y1 - y0) / 2) * controlPointsDistance;
  8033. buffer.push(
  8034. `${xMid} ${y1} m`,
  8035. `${xMid + xOffset} ${y1} ${x1} ${
  8036. yMid + yOffset
  8037. } ${x1} ${yMid} c`,
  8038. `${x1} ${yMid - yOffset} ${
  8039. xMid + xOffset
  8040. } ${y0} ${xMid} ${y0} c`,
  8041. `${xMid - xOffset} ${y0} ${x0} ${
  8042. yMid - yOffset
  8043. } ${x0} ${yMid} c`,
  8044. `${x0} ${yMid + yOffset} ${
  8045. xMid - xOffset
  8046. } ${y1} ${xMid} ${y1} c`,
  8047. "h"
  8048. );
  8049. if (fillColor) {
  8050. buffer.push("B");
  8051. } else {
  8052. buffer.push("S");
  8053. }
  8054. return [points[0].x, points[1].x, points[3].y, points[1].y];
  8055. },
  8056. });
  8057. }
  8058. }
  8059. }
  8060. class PolylineAnnotation extends MarkupAnnotation {
  8061. constructor(parameters) {
  8062. super(parameters);
  8063. const { dict } = parameters;
  8064. this.data.annotationType = _util.AnnotationType.POLYLINE;
  8065. this.data.vertices = [];
  8066. if (!(this instanceof PolygonAnnotation)) {
  8067. this.setLineEndings(dict.getArray("LE"));
  8068. this.data.lineEndings = this.lineEndings;
  8069. }
  8070. const rawVertices = dict.getArray("Vertices");
  8071. if (!Array.isArray(rawVertices)) {
  8072. return;
  8073. }
  8074. for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
  8075. this.data.vertices.push({
  8076. x: rawVertices[i],
  8077. y: rawVertices[i + 1],
  8078. });
  8079. }
  8080. if (!this.appearance) {
  8081. const strokeColor = this.color
  8082. ? Array.from(this.color).map((c) => c / 255)
  8083. : [0, 0, 0];
  8084. const strokeAlpha = dict.get("CA");
  8085. const borderWidth = this.borderStyle.width || 1,
  8086. borderAdjust = 2 * borderWidth;
  8087. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  8088. for (const vertex of this.data.vertices) {
  8089. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  8090. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  8091. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  8092. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  8093. }
  8094. if (!_util.Util.intersect(this.rectangle, bbox)) {
  8095. this.rectangle = bbox;
  8096. }
  8097. this._setDefaultAppearance({
  8098. xref: parameters.xref,
  8099. extra: `${borderWidth} w`,
  8100. strokeColor,
  8101. strokeAlpha,
  8102. pointsCallback: (buffer, points) => {
  8103. const vertices = this.data.vertices;
  8104. for (let i = 0, ii = vertices.length; i < ii; i++) {
  8105. buffer.push(
  8106. `${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`
  8107. );
  8108. }
  8109. buffer.push("S");
  8110. return [points[0].x, points[1].x, points[3].y, points[1].y];
  8111. },
  8112. });
  8113. }
  8114. }
  8115. }
  8116. class PolygonAnnotation extends PolylineAnnotation {
  8117. constructor(parameters) {
  8118. super(parameters);
  8119. this.data.annotationType = _util.AnnotationType.POLYGON;
  8120. }
  8121. }
  8122. class CaretAnnotation extends MarkupAnnotation {
  8123. constructor(parameters) {
  8124. super(parameters);
  8125. this.data.annotationType = _util.AnnotationType.CARET;
  8126. }
  8127. }
  8128. class InkAnnotation extends MarkupAnnotation {
  8129. constructor(parameters) {
  8130. super(parameters);
  8131. this.data.annotationType = _util.AnnotationType.INK;
  8132. this.data.inkLists = [];
  8133. const rawInkLists = parameters.dict.getArray("InkList");
  8134. if (!Array.isArray(rawInkLists)) {
  8135. return;
  8136. }
  8137. const xref = parameters.xref;
  8138. for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
  8139. this.data.inkLists.push([]);
  8140. for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
  8141. this.data.inkLists[i].push({
  8142. x: xref.fetchIfRef(rawInkLists[i][j]),
  8143. y: xref.fetchIfRef(rawInkLists[i][j + 1]),
  8144. });
  8145. }
  8146. }
  8147. if (!this.appearance) {
  8148. const strokeColor = this.color
  8149. ? Array.from(this.color).map((c) => c / 255)
  8150. : [0, 0, 0];
  8151. const strokeAlpha = parameters.dict.get("CA");
  8152. const borderWidth = this.borderStyle.width || 1,
  8153. borderAdjust = 2 * borderWidth;
  8154. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  8155. for (const inkLists of this.data.inkLists) {
  8156. for (const vertex of inkLists) {
  8157. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  8158. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  8159. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  8160. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  8161. }
  8162. }
  8163. if (!_util.Util.intersect(this.rectangle, bbox)) {
  8164. this.rectangle = bbox;
  8165. }
  8166. this._setDefaultAppearance({
  8167. xref: parameters.xref,
  8168. extra: `${borderWidth} w`,
  8169. strokeColor,
  8170. strokeAlpha,
  8171. pointsCallback: (buffer, points) => {
  8172. for (const inkList of this.data.inkLists) {
  8173. for (let i = 0, ii = inkList.length; i < ii; i++) {
  8174. buffer.push(
  8175. `${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`
  8176. );
  8177. }
  8178. buffer.push("S");
  8179. }
  8180. return [points[0].x, points[1].x, points[3].y, points[1].y];
  8181. },
  8182. });
  8183. }
  8184. }
  8185. static createNewDict(annotation, xref, { apRef, ap }) {
  8186. const { paths, rect, rotation } = annotation;
  8187. const ink = new _primitives.Dict(xref);
  8188. ink.set("Type", _primitives.Name.get("Annot"));
  8189. ink.set("Subtype", _primitives.Name.get("Ink"));
  8190. ink.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
  8191. ink.set("Rect", rect);
  8192. ink.set(
  8193. "InkList",
  8194. paths.map((p) => p.points)
  8195. );
  8196. ink.set("F", 4);
  8197. ink.set("Border", [0, 0, 0]);
  8198. ink.set("Rotate", rotation);
  8199. const n = new _primitives.Dict(xref);
  8200. ink.set("AP", n);
  8201. if (apRef) {
  8202. n.set("N", apRef);
  8203. } else {
  8204. n.set("N", ap);
  8205. }
  8206. return ink;
  8207. }
  8208. static async createNewAppearanceStream(annotation, xref, params) {
  8209. const { color, rect, rotation, paths, thickness, opacity } =
  8210. annotation;
  8211. const [x1, y1, x2, y2] = rect;
  8212. let w = x2 - x1;
  8213. let h = y2 - y1;
  8214. if (rotation % 180 !== 0) {
  8215. [w, h] = [h, w];
  8216. }
  8217. const appearanceBuffer = [
  8218. `${thickness} w 1 J 1 j`,
  8219. `${(0, _default_appearance.getPdfColor)(color, false)}`,
  8220. ];
  8221. if (opacity !== 1) {
  8222. appearanceBuffer.push("/R0 gs");
  8223. }
  8224. const buffer = [];
  8225. for (const { bezier } of paths) {
  8226. buffer.length = 0;
  8227. buffer.push(
  8228. `${(0, _core_utils.numberToString)(bezier[0])} ${(0,
  8229. _core_utils.numberToString)(bezier[1])} m`
  8230. );
  8231. for (let i = 2, ii = bezier.length; i < ii; i += 6) {
  8232. const curve = bezier
  8233. .slice(i, i + 6)
  8234. .map(_core_utils.numberToString)
  8235. .join(" ");
  8236. buffer.push(`${curve} c`);
  8237. }
  8238. buffer.push("S");
  8239. appearanceBuffer.push(buffer.join("\n"));
  8240. }
  8241. const appearance = appearanceBuffer.join("\n");
  8242. const appearanceStreamDict = new _primitives.Dict(xref);
  8243. appearanceStreamDict.set("FormType", 1);
  8244. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  8245. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  8246. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  8247. appearanceStreamDict.set("Length", appearance.length);
  8248. if (rotation) {
  8249. const matrix = WidgetAnnotation._getRotationMatrix(
  8250. rotation,
  8251. w,
  8252. h
  8253. );
  8254. appearanceStreamDict.set("Matrix", matrix);
  8255. }
  8256. if (opacity !== 1) {
  8257. const resources = new _primitives.Dict(xref);
  8258. const extGState = new _primitives.Dict(xref);
  8259. const r0 = new _primitives.Dict(xref);
  8260. r0.set("CA", opacity);
  8261. r0.set("Type", _primitives.Name.get("ExtGState"));
  8262. extGState.set("R0", r0);
  8263. resources.set("ExtGState", extGState);
  8264. appearanceStreamDict.set("Resources", resources);
  8265. }
  8266. const ap = new _stream.StringStream(appearance);
  8267. ap.dict = appearanceStreamDict;
  8268. return ap;
  8269. }
  8270. }
  8271. class HighlightAnnotation extends MarkupAnnotation {
  8272. constructor(parameters) {
  8273. super(parameters);
  8274. this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
  8275. const quadPoints = (this.data.quadPoints = getQuadPoints(
  8276. parameters.dict,
  8277. null
  8278. ));
  8279. if (quadPoints) {
  8280. const resources =
  8281. this.appearance && this.appearance.dict.get("Resources");
  8282. if (
  8283. !this.appearance ||
  8284. !(resources && resources.has("ExtGState"))
  8285. ) {
  8286. if (this.appearance) {
  8287. (0, _util.warn)(
  8288. "HighlightAnnotation - ignoring built-in appearance stream."
  8289. );
  8290. }
  8291. const fillColor = this.color
  8292. ? Array.from(this.color).map((c) => c / 255)
  8293. : [1, 1, 0];
  8294. const fillAlpha = parameters.dict.get("CA");
  8295. this._setDefaultAppearance({
  8296. xref: parameters.xref,
  8297. fillColor,
  8298. blendMode: "Multiply",
  8299. fillAlpha,
  8300. pointsCallback: (buffer, points) => {
  8301. buffer.push(
  8302. `${points[0].x} ${points[0].y} m`,
  8303. `${points[1].x} ${points[1].y} l`,
  8304. `${points[3].x} ${points[3].y} l`,
  8305. `${points[2].x} ${points[2].y} l`,
  8306. "f"
  8307. );
  8308. return [points[0].x, points[1].x, points[3].y, points[1].y];
  8309. },
  8310. });
  8311. }
  8312. } else {
  8313. this.data.hasPopup = false;
  8314. }
  8315. }
  8316. }
  8317. class UnderlineAnnotation extends MarkupAnnotation {
  8318. constructor(parameters) {
  8319. super(parameters);
  8320. this.data.annotationType = _util.AnnotationType.UNDERLINE;
  8321. const quadPoints = (this.data.quadPoints = getQuadPoints(
  8322. parameters.dict,
  8323. null
  8324. ));
  8325. if (quadPoints) {
  8326. if (!this.appearance) {
  8327. const strokeColor = this.color
  8328. ? Array.from(this.color).map((c) => c / 255)
  8329. : [0, 0, 0];
  8330. const strokeAlpha = parameters.dict.get("CA");
  8331. this._setDefaultAppearance({
  8332. xref: parameters.xref,
  8333. extra: "[] 0 d 1 w",
  8334. strokeColor,
  8335. strokeAlpha,
  8336. pointsCallback: (buffer, points) => {
  8337. buffer.push(
  8338. `${points[2].x} ${points[2].y} m`,
  8339. `${points[3].x} ${points[3].y} l`,
  8340. "S"
  8341. );
  8342. return [points[0].x, points[1].x, points[3].y, points[1].y];
  8343. },
  8344. });
  8345. }
  8346. } else {
  8347. this.data.hasPopup = false;
  8348. }
  8349. }
  8350. }
  8351. class SquigglyAnnotation extends MarkupAnnotation {
  8352. constructor(parameters) {
  8353. super(parameters);
  8354. this.data.annotationType = _util.AnnotationType.SQUIGGLY;
  8355. const quadPoints = (this.data.quadPoints = getQuadPoints(
  8356. parameters.dict,
  8357. null
  8358. ));
  8359. if (quadPoints) {
  8360. if (!this.appearance) {
  8361. const strokeColor = this.color
  8362. ? Array.from(this.color).map((c) => c / 255)
  8363. : [0, 0, 0];
  8364. const strokeAlpha = parameters.dict.get("CA");
  8365. this._setDefaultAppearance({
  8366. xref: parameters.xref,
  8367. extra: "[] 0 d 1 w",
  8368. strokeColor,
  8369. strokeAlpha,
  8370. pointsCallback: (buffer, points) => {
  8371. const dy = (points[0].y - points[2].y) / 6;
  8372. let shift = dy;
  8373. let x = points[2].x;
  8374. const y = points[2].y;
  8375. const xEnd = points[3].x;
  8376. buffer.push(`${x} ${y + shift} m`);
  8377. do {
  8378. x += 2;
  8379. shift = shift === 0 ? dy : 0;
  8380. buffer.push(`${x} ${y + shift} l`);
  8381. } while (x < xEnd);
  8382. buffer.push("S");
  8383. return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy];
  8384. },
  8385. });
  8386. }
  8387. } else {
  8388. this.data.hasPopup = false;
  8389. }
  8390. }
  8391. }
  8392. class StrikeOutAnnotation extends MarkupAnnotation {
  8393. constructor(parameters) {
  8394. super(parameters);
  8395. this.data.annotationType = _util.AnnotationType.STRIKEOUT;
  8396. const quadPoints = (this.data.quadPoints = getQuadPoints(
  8397. parameters.dict,
  8398. null
  8399. ));
  8400. if (quadPoints) {
  8401. if (!this.appearance) {
  8402. const strokeColor = this.color
  8403. ? Array.from(this.color).map((c) => c / 255)
  8404. : [0, 0, 0];
  8405. const strokeAlpha = parameters.dict.get("CA");
  8406. this._setDefaultAppearance({
  8407. xref: parameters.xref,
  8408. extra: "[] 0 d 1 w",
  8409. strokeColor,
  8410. strokeAlpha,
  8411. pointsCallback: (buffer, points) => {
  8412. buffer.push(
  8413. `${(points[0].x + points[2].x) / 2} ` +
  8414. `${(points[0].y + points[2].y) / 2} m`,
  8415. `${(points[1].x + points[3].x) / 2} ` +
  8416. `${(points[1].y + points[3].y) / 2} l`,
  8417. "S"
  8418. );
  8419. return [points[0].x, points[1].x, points[3].y, points[1].y];
  8420. },
  8421. });
  8422. }
  8423. } else {
  8424. this.data.hasPopup = false;
  8425. }
  8426. }
  8427. }
  8428. class StampAnnotation extends MarkupAnnotation {
  8429. constructor(parameters) {
  8430. super(parameters);
  8431. this.data.annotationType = _util.AnnotationType.STAMP;
  8432. }
  8433. }
  8434. class FileAttachmentAnnotation extends MarkupAnnotation {
  8435. constructor(parameters) {
  8436. super(parameters);
  8437. const file = new _file_spec.FileSpec(
  8438. parameters.dict.get("FS"),
  8439. parameters.xref
  8440. );
  8441. this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
  8442. this.data.file = file.serializable;
  8443. }
  8444. }
  8445. /***/
  8446. },
  8447. /* 13 */
  8448. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  8449. Object.defineProperty(exports, "__esModule", {
  8450. value: true,
  8451. });
  8452. exports.createDefaultAppearance = createDefaultAppearance;
  8453. exports.getPdfColor = getPdfColor;
  8454. exports.parseDefaultAppearance = parseDefaultAppearance;
  8455. var _core_utils = __w_pdfjs_require__(6);
  8456. var _util = __w_pdfjs_require__(2);
  8457. var _colorspace = __w_pdfjs_require__(14);
  8458. var _evaluator = __w_pdfjs_require__(15);
  8459. var _primitives = __w_pdfjs_require__(5);
  8460. var _stream = __w_pdfjs_require__(10);
  8461. class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor {
  8462. constructor(str) {
  8463. super(new _stream.StringStream(str));
  8464. }
  8465. parse() {
  8466. const operation = {
  8467. fn: 0,
  8468. args: [],
  8469. };
  8470. const result = {
  8471. fontSize: 0,
  8472. fontName: "",
  8473. fontColor: new Uint8ClampedArray(3),
  8474. };
  8475. try {
  8476. while (true) {
  8477. operation.args.length = 0;
  8478. if (!this.read(operation)) {
  8479. break;
  8480. }
  8481. if (this.savedStatesDepth !== 0) {
  8482. continue;
  8483. }
  8484. const { fn, args } = operation;
  8485. switch (fn | 0) {
  8486. case _util.OPS.setFont:
  8487. const [fontName, fontSize] = args;
  8488. if (fontName instanceof _primitives.Name) {
  8489. result.fontName = fontName.name;
  8490. }
  8491. if (typeof fontSize === "number" && fontSize > 0) {
  8492. result.fontSize = fontSize;
  8493. }
  8494. break;
  8495. case _util.OPS.setFillRGBColor:
  8496. _colorspace.ColorSpace.singletons.rgb.getRgbItem(
  8497. args,
  8498. 0,
  8499. result.fontColor,
  8500. 0
  8501. );
  8502. break;
  8503. case _util.OPS.setFillGray:
  8504. _colorspace.ColorSpace.singletons.gray.getRgbItem(
  8505. args,
  8506. 0,
  8507. result.fontColor,
  8508. 0
  8509. );
  8510. break;
  8511. case _util.OPS.setFillColorSpace:
  8512. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(
  8513. args,
  8514. 0,
  8515. result.fontColor,
  8516. 0
  8517. );
  8518. break;
  8519. }
  8520. }
  8521. } catch (reason) {
  8522. (0, _util.warn)(
  8523. `parseDefaultAppearance - ignoring errors: "${reason}".`
  8524. );
  8525. }
  8526. return result;
  8527. }
  8528. }
  8529. function parseDefaultAppearance(str) {
  8530. return new DefaultAppearanceEvaluator(str).parse();
  8531. }
  8532. function getPdfColor(color, isFill) {
  8533. if (color[0] === color[1] && color[1] === color[2]) {
  8534. const gray = color[0] / 255;
  8535. return `${(0, _core_utils.numberToString)(gray)} ${
  8536. isFill ? "g" : "G"
  8537. }`;
  8538. }
  8539. return (
  8540. Array.from(color)
  8541. .map((c) => (0, _core_utils.numberToString)(c / 255))
  8542. .join(" ") + ` ${isFill ? "rg" : "RG"}`
  8543. );
  8544. }
  8545. function createDefaultAppearance({ fontSize, fontName, fontColor }) {
  8546. return `/${(0, _core_utils.escapePDFName)(
  8547. fontName
  8548. )} ${fontSize} Tf ${getPdfColor(fontColor, true)}`;
  8549. }
  8550. /***/
  8551. },
  8552. /* 14 */
  8553. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  8554. Object.defineProperty(exports, "__esModule", {
  8555. value: true,
  8556. });
  8557. exports.ColorSpace = void 0;
  8558. var _util = __w_pdfjs_require__(2);
  8559. var _primitives = __w_pdfjs_require__(5);
  8560. var _base_stream = __w_pdfjs_require__(7);
  8561. var _core_utils = __w_pdfjs_require__(6);
  8562. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  8563. const COMPONENTS = 3;
  8564. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  8565. const xRatio = w1 / w2;
  8566. const yRatio = h1 / h2;
  8567. let newIndex = 0,
  8568. oldIndex;
  8569. const xScaled = new Uint16Array(w2);
  8570. const w1Scanline = w1 * COMPONENTS;
  8571. for (let i = 0; i < w2; i++) {
  8572. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  8573. }
  8574. for (let i = 0; i < h2; i++) {
  8575. const py = Math.floor(i * yRatio) * w1Scanline;
  8576. for (let j = 0; j < w2; j++) {
  8577. oldIndex = py + xScaled[j];
  8578. dest[newIndex++] = src[oldIndex++];
  8579. dest[newIndex++] = src[oldIndex++];
  8580. dest[newIndex++] = src[oldIndex++];
  8581. newIndex += alpha01;
  8582. }
  8583. }
  8584. }
  8585. class ColorSpace {
  8586. constructor(name, numComps) {
  8587. if (this.constructor === ColorSpace) {
  8588. (0, _util.unreachable)("Cannot initialize ColorSpace.");
  8589. }
  8590. this.name = name;
  8591. this.numComps = numComps;
  8592. }
  8593. getRgb(src, srcOffset) {
  8594. const rgb = new Uint8ClampedArray(3);
  8595. this.getRgbItem(src, srcOffset, rgb, 0);
  8596. return rgb;
  8597. }
  8598. getRgbItem(src, srcOffset, dest, destOffset) {
  8599. (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
  8600. }
  8601. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8602. (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
  8603. }
  8604. getOutputLength(inputLength, alpha01) {
  8605. (0, _util.unreachable)(
  8606. "Should not call ColorSpace.getOutputLength"
  8607. );
  8608. }
  8609. isPassthrough(bits) {
  8610. return false;
  8611. }
  8612. isDefaultDecode(decodeMap, bpc) {
  8613. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  8614. }
  8615. fillRgb(
  8616. dest,
  8617. originalWidth,
  8618. originalHeight,
  8619. width,
  8620. height,
  8621. actualHeight,
  8622. bpc,
  8623. comps,
  8624. alpha01
  8625. ) {
  8626. const count = originalWidth * originalHeight;
  8627. let rgbBuf = null;
  8628. const numComponentColors = 1 << bpc;
  8629. const needsResizing =
  8630. originalHeight !== height || originalWidth !== width;
  8631. if (this.isPassthrough(bpc)) {
  8632. rgbBuf = comps;
  8633. } else if (
  8634. this.numComps === 1 &&
  8635. count > numComponentColors &&
  8636. this.name !== "DeviceGray" &&
  8637. this.name !== "DeviceRGB"
  8638. ) {
  8639. const allColors =
  8640. bpc <= 8
  8641. ? new Uint8Array(numComponentColors)
  8642. : new Uint16Array(numComponentColors);
  8643. for (let i = 0; i < numComponentColors; i++) {
  8644. allColors[i] = i;
  8645. }
  8646. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  8647. this.getRgbBuffer(
  8648. allColors,
  8649. 0,
  8650. numComponentColors,
  8651. colorMap,
  8652. 0,
  8653. bpc,
  8654. 0
  8655. );
  8656. if (!needsResizing) {
  8657. let destPos = 0;
  8658. for (let i = 0; i < count; ++i) {
  8659. const key = comps[i] * 3;
  8660. dest[destPos++] = colorMap[key];
  8661. dest[destPos++] = colorMap[key + 1];
  8662. dest[destPos++] = colorMap[key + 2];
  8663. destPos += alpha01;
  8664. }
  8665. } else {
  8666. rgbBuf = new Uint8Array(count * 3);
  8667. let rgbPos = 0;
  8668. for (let i = 0; i < count; ++i) {
  8669. const key = comps[i] * 3;
  8670. rgbBuf[rgbPos++] = colorMap[key];
  8671. rgbBuf[rgbPos++] = colorMap[key + 1];
  8672. rgbBuf[rgbPos++] = colorMap[key + 2];
  8673. }
  8674. }
  8675. } else {
  8676. if (!needsResizing) {
  8677. this.getRgbBuffer(
  8678. comps,
  8679. 0,
  8680. width * actualHeight,
  8681. dest,
  8682. 0,
  8683. bpc,
  8684. alpha01
  8685. );
  8686. } else {
  8687. rgbBuf = new Uint8ClampedArray(count * 3);
  8688. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  8689. }
  8690. }
  8691. if (rgbBuf) {
  8692. if (needsResizing) {
  8693. resizeRgbImage(
  8694. rgbBuf,
  8695. dest,
  8696. originalWidth,
  8697. originalHeight,
  8698. width,
  8699. height,
  8700. alpha01
  8701. );
  8702. } else {
  8703. let destPos = 0,
  8704. rgbPos = 0;
  8705. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  8706. dest[destPos++] = rgbBuf[rgbPos++];
  8707. dest[destPos++] = rgbBuf[rgbPos++];
  8708. dest[destPos++] = rgbBuf[rgbPos++];
  8709. destPos += alpha01;
  8710. }
  8711. }
  8712. }
  8713. }
  8714. get usesZeroToOneRange() {
  8715. return (0, _util.shadow)(this, "usesZeroToOneRange", true);
  8716. }
  8717. static _cache(
  8718. cacheKey,
  8719. xref,
  8720. localColorSpaceCache,
  8721. parsedColorSpace
  8722. ) {
  8723. if (!localColorSpaceCache) {
  8724. throw new Error(
  8725. 'ColorSpace._cache - expected "localColorSpaceCache" argument.'
  8726. );
  8727. }
  8728. if (!parsedColorSpace) {
  8729. throw new Error(
  8730. 'ColorSpace._cache - expected "parsedColorSpace" argument.'
  8731. );
  8732. }
  8733. let csName, csRef;
  8734. if (cacheKey instanceof _primitives.Ref) {
  8735. csRef = cacheKey;
  8736. cacheKey = xref.fetch(cacheKey);
  8737. }
  8738. if (cacheKey instanceof _primitives.Name) {
  8739. csName = cacheKey.name;
  8740. }
  8741. if (csName || csRef) {
  8742. localColorSpaceCache.set(csName, csRef, parsedColorSpace);
  8743. }
  8744. }
  8745. static getCached(cacheKey, xref, localColorSpaceCache) {
  8746. if (!localColorSpaceCache) {
  8747. throw new Error(
  8748. 'ColorSpace.getCached - expected "localColorSpaceCache" argument.'
  8749. );
  8750. }
  8751. if (cacheKey instanceof _primitives.Ref) {
  8752. const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
  8753. if (localColorSpace) {
  8754. return localColorSpace;
  8755. }
  8756. try {
  8757. cacheKey = xref.fetch(cacheKey);
  8758. } catch (ex) {
  8759. if (ex instanceof _core_utils.MissingDataException) {
  8760. throw ex;
  8761. }
  8762. }
  8763. }
  8764. if (cacheKey instanceof _primitives.Name) {
  8765. const localColorSpace = localColorSpaceCache.getByName(
  8766. cacheKey.name
  8767. );
  8768. if (localColorSpace) {
  8769. return localColorSpace;
  8770. }
  8771. }
  8772. return null;
  8773. }
  8774. static async parseAsync({
  8775. cs,
  8776. xref,
  8777. resources = null,
  8778. pdfFunctionFactory,
  8779. localColorSpaceCache,
  8780. }) {
  8781. const parsedColorSpace = this._parse(
  8782. cs,
  8783. xref,
  8784. resources,
  8785. pdfFunctionFactory
  8786. );
  8787. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  8788. return parsedColorSpace;
  8789. }
  8790. static parse({
  8791. cs,
  8792. xref,
  8793. resources = null,
  8794. pdfFunctionFactory,
  8795. localColorSpaceCache,
  8796. }) {
  8797. const cachedColorSpace = this.getCached(
  8798. cs,
  8799. xref,
  8800. localColorSpaceCache
  8801. );
  8802. if (cachedColorSpace) {
  8803. return cachedColorSpace;
  8804. }
  8805. const parsedColorSpace = this._parse(
  8806. cs,
  8807. xref,
  8808. resources,
  8809. pdfFunctionFactory
  8810. );
  8811. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  8812. return parsedColorSpace;
  8813. }
  8814. static _parse(cs, xref, resources = null, pdfFunctionFactory) {
  8815. cs = xref.fetchIfRef(cs);
  8816. if (cs instanceof _primitives.Name) {
  8817. switch (cs.name) {
  8818. case "G":
  8819. case "DeviceGray":
  8820. return this.singletons.gray;
  8821. case "RGB":
  8822. case "DeviceRGB":
  8823. return this.singletons.rgb;
  8824. case "CMYK":
  8825. case "DeviceCMYK":
  8826. return this.singletons.cmyk;
  8827. case "Pattern":
  8828. return new PatternCS(null);
  8829. default:
  8830. if (resources instanceof _primitives.Dict) {
  8831. const colorSpaces = resources.get("ColorSpace");
  8832. if (colorSpaces instanceof _primitives.Dict) {
  8833. const resourcesCS = colorSpaces.get(cs.name);
  8834. if (resourcesCS) {
  8835. if (resourcesCS instanceof _primitives.Name) {
  8836. return this._parse(
  8837. resourcesCS,
  8838. xref,
  8839. resources,
  8840. pdfFunctionFactory
  8841. );
  8842. }
  8843. cs = resourcesCS;
  8844. break;
  8845. }
  8846. }
  8847. }
  8848. throw new _util.FormatError(
  8849. `Unrecognized ColorSpace: ${cs.name}`
  8850. );
  8851. }
  8852. }
  8853. if (Array.isArray(cs)) {
  8854. const mode = xref.fetchIfRef(cs[0]).name;
  8855. let params, numComps, baseCS, whitePoint, blackPoint, gamma;
  8856. switch (mode) {
  8857. case "G":
  8858. case "DeviceGray":
  8859. return this.singletons.gray;
  8860. case "RGB":
  8861. case "DeviceRGB":
  8862. return this.singletons.rgb;
  8863. case "CMYK":
  8864. case "DeviceCMYK":
  8865. return this.singletons.cmyk;
  8866. case "CalGray":
  8867. params = xref.fetchIfRef(cs[1]);
  8868. whitePoint = params.getArray("WhitePoint");
  8869. blackPoint = params.getArray("BlackPoint");
  8870. gamma = params.get("Gamma");
  8871. return new CalGrayCS(whitePoint, blackPoint, gamma);
  8872. case "CalRGB":
  8873. params = xref.fetchIfRef(cs[1]);
  8874. whitePoint = params.getArray("WhitePoint");
  8875. blackPoint = params.getArray("BlackPoint");
  8876. gamma = params.getArray("Gamma");
  8877. const matrix = params.getArray("Matrix");
  8878. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  8879. case "ICCBased":
  8880. const stream = xref.fetchIfRef(cs[1]);
  8881. const dict = stream.dict;
  8882. numComps = dict.get("N");
  8883. const alt = dict.get("Alternate");
  8884. if (alt) {
  8885. const altCS = this._parse(
  8886. alt,
  8887. xref,
  8888. resources,
  8889. pdfFunctionFactory
  8890. );
  8891. if (altCS.numComps === numComps) {
  8892. return altCS;
  8893. }
  8894. (0, _util.warn)(
  8895. "ICCBased color space: Ignoring incorrect /Alternate entry."
  8896. );
  8897. }
  8898. if (numComps === 1) {
  8899. return this.singletons.gray;
  8900. } else if (numComps === 3) {
  8901. return this.singletons.rgb;
  8902. } else if (numComps === 4) {
  8903. return this.singletons.cmyk;
  8904. }
  8905. break;
  8906. case "Pattern":
  8907. baseCS = cs[1] || null;
  8908. if (baseCS) {
  8909. baseCS = this._parse(
  8910. baseCS,
  8911. xref,
  8912. resources,
  8913. pdfFunctionFactory
  8914. );
  8915. }
  8916. return new PatternCS(baseCS);
  8917. case "I":
  8918. case "Indexed":
  8919. baseCS = this._parse(
  8920. cs[1],
  8921. xref,
  8922. resources,
  8923. pdfFunctionFactory
  8924. );
  8925. const hiVal = xref.fetchIfRef(cs[2]) + 1;
  8926. const lookup = xref.fetchIfRef(cs[3]);
  8927. return new IndexedCS(baseCS, hiVal, lookup);
  8928. case "Separation":
  8929. case "DeviceN":
  8930. const name = xref.fetchIfRef(cs[1]);
  8931. numComps = Array.isArray(name) ? name.length : 1;
  8932. baseCS = this._parse(
  8933. cs[2],
  8934. xref,
  8935. resources,
  8936. pdfFunctionFactory
  8937. );
  8938. const tintFn = pdfFunctionFactory.create(cs[3]);
  8939. return new AlternateCS(numComps, baseCS, tintFn);
  8940. case "Lab":
  8941. params = xref.fetchIfRef(cs[1]);
  8942. whitePoint = params.getArray("WhitePoint");
  8943. blackPoint = params.getArray("BlackPoint");
  8944. const range = params.getArray("Range");
  8945. return new LabCS(whitePoint, blackPoint, range);
  8946. default:
  8947. throw new _util.FormatError(
  8948. `Unimplemented ColorSpace object: ${mode}`
  8949. );
  8950. }
  8951. }
  8952. throw new _util.FormatError(
  8953. `Unrecognized ColorSpace object: ${cs}`
  8954. );
  8955. }
  8956. static isDefaultDecode(decode, numComps) {
  8957. if (!Array.isArray(decode)) {
  8958. return true;
  8959. }
  8960. if (numComps * 2 !== decode.length) {
  8961. (0, _util.warn)("The decode map is not the correct length");
  8962. return true;
  8963. }
  8964. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  8965. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  8966. return false;
  8967. }
  8968. }
  8969. return true;
  8970. }
  8971. static get singletons() {
  8972. return (0, _util.shadow)(this, "singletons", {
  8973. get gray() {
  8974. return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
  8975. },
  8976. get rgb() {
  8977. return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
  8978. },
  8979. get cmyk() {
  8980. return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
  8981. },
  8982. });
  8983. }
  8984. }
  8985. exports.ColorSpace = ColorSpace;
  8986. class AlternateCS extends ColorSpace {
  8987. constructor(numComps, base, tintFn) {
  8988. super("Alternate", numComps);
  8989. this.base = base;
  8990. this.tintFn = tintFn;
  8991. this.tmpBuf = new Float32Array(base.numComps);
  8992. }
  8993. getRgbItem(src, srcOffset, dest, destOffset) {
  8994. const tmpBuf = this.tmpBuf;
  8995. this.tintFn(src, srcOffset, tmpBuf, 0);
  8996. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  8997. }
  8998. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8999. const tintFn = this.tintFn;
  9000. const base = this.base;
  9001. const scale = 1 / ((1 << bits) - 1);
  9002. const baseNumComps = base.numComps;
  9003. const usesZeroToOneRange = base.usesZeroToOneRange;
  9004. const isPassthrough =
  9005. (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  9006. let pos = isPassthrough ? destOffset : 0;
  9007. const baseBuf = isPassthrough
  9008. ? dest
  9009. : new Uint8ClampedArray(baseNumComps * count);
  9010. const numComps = this.numComps;
  9011. const scaled = new Float32Array(numComps);
  9012. const tinted = new Float32Array(baseNumComps);
  9013. let i, j;
  9014. for (i = 0; i < count; i++) {
  9015. for (j = 0; j < numComps; j++) {
  9016. scaled[j] = src[srcOffset++] * scale;
  9017. }
  9018. tintFn(scaled, 0, tinted, 0);
  9019. if (usesZeroToOneRange) {
  9020. for (j = 0; j < baseNumComps; j++) {
  9021. baseBuf[pos++] = tinted[j] * 255;
  9022. }
  9023. } else {
  9024. base.getRgbItem(tinted, 0, baseBuf, pos);
  9025. pos += baseNumComps;
  9026. }
  9027. }
  9028. if (!isPassthrough) {
  9029. base.getRgbBuffer(
  9030. baseBuf,
  9031. 0,
  9032. count,
  9033. dest,
  9034. destOffset,
  9035. 8,
  9036. alpha01
  9037. );
  9038. }
  9039. }
  9040. getOutputLength(inputLength, alpha01) {
  9041. return this.base.getOutputLength(
  9042. (inputLength * this.base.numComps) / this.numComps,
  9043. alpha01
  9044. );
  9045. }
  9046. }
  9047. class PatternCS extends ColorSpace {
  9048. constructor(baseCS) {
  9049. super("Pattern", null);
  9050. this.base = baseCS;
  9051. }
  9052. isDefaultDecode(decodeMap, bpc) {
  9053. (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
  9054. }
  9055. }
  9056. class IndexedCS extends ColorSpace {
  9057. constructor(base, highVal, lookup) {
  9058. super("Indexed", 1);
  9059. this.base = base;
  9060. this.highVal = highVal;
  9061. const length = base.numComps * highVal;
  9062. this.lookup = new Uint8Array(length);
  9063. if (lookup instanceof _base_stream.BaseStream) {
  9064. const bytes = lookup.getBytes(length);
  9065. this.lookup.set(bytes);
  9066. } else if (typeof lookup === "string") {
  9067. for (let i = 0; i < length; ++i) {
  9068. this.lookup[i] = lookup.charCodeAt(i) & 0xff;
  9069. }
  9070. } else {
  9071. throw new _util.FormatError(
  9072. `IndexedCS - unrecognized lookup table: ${lookup}`
  9073. );
  9074. }
  9075. }
  9076. getRgbItem(src, srcOffset, dest, destOffset) {
  9077. const numComps = this.base.numComps;
  9078. const start = src[srcOffset] * numComps;
  9079. this.base.getRgbBuffer(
  9080. this.lookup,
  9081. start,
  9082. 1,
  9083. dest,
  9084. destOffset,
  9085. 8,
  9086. 0
  9087. );
  9088. }
  9089. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9090. const base = this.base;
  9091. const numComps = base.numComps;
  9092. const outputDelta = base.getOutputLength(numComps, alpha01);
  9093. const lookup = this.lookup;
  9094. for (let i = 0; i < count; ++i) {
  9095. const lookupPos = src[srcOffset++] * numComps;
  9096. base.getRgbBuffer(
  9097. lookup,
  9098. lookupPos,
  9099. 1,
  9100. dest,
  9101. destOffset,
  9102. 8,
  9103. alpha01
  9104. );
  9105. destOffset += outputDelta;
  9106. }
  9107. }
  9108. getOutputLength(inputLength, alpha01) {
  9109. return this.base.getOutputLength(
  9110. inputLength * this.base.numComps,
  9111. alpha01
  9112. );
  9113. }
  9114. isDefaultDecode(decodeMap, bpc) {
  9115. if (!Array.isArray(decodeMap)) {
  9116. return true;
  9117. }
  9118. if (decodeMap.length !== 2) {
  9119. (0, _util.warn)("Decode map length is not correct");
  9120. return true;
  9121. }
  9122. if (!Number.isInteger(bpc) || bpc < 1) {
  9123. (0, _util.warn)("Bits per component is not correct");
  9124. return true;
  9125. }
  9126. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  9127. }
  9128. }
  9129. class DeviceGrayCS extends ColorSpace {
  9130. constructor() {
  9131. super("DeviceGray", 1);
  9132. }
  9133. getRgbItem(src, srcOffset, dest, destOffset) {
  9134. const c = src[srcOffset] * 255;
  9135. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  9136. }
  9137. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9138. const scale = 255 / ((1 << bits) - 1);
  9139. let j = srcOffset,
  9140. q = destOffset;
  9141. for (let i = 0; i < count; ++i) {
  9142. const c = scale * src[j++];
  9143. dest[q++] = c;
  9144. dest[q++] = c;
  9145. dest[q++] = c;
  9146. q += alpha01;
  9147. }
  9148. }
  9149. getOutputLength(inputLength, alpha01) {
  9150. return inputLength * (3 + alpha01);
  9151. }
  9152. }
  9153. class DeviceRgbCS extends ColorSpace {
  9154. constructor() {
  9155. super("DeviceRGB", 3);
  9156. }
  9157. getRgbItem(src, srcOffset, dest, destOffset) {
  9158. dest[destOffset] = src[srcOffset] * 255;
  9159. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  9160. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  9161. }
  9162. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9163. if (bits === 8 && alpha01 === 0) {
  9164. dest.set(
  9165. src.subarray(srcOffset, srcOffset + count * 3),
  9166. destOffset
  9167. );
  9168. return;
  9169. }
  9170. const scale = 255 / ((1 << bits) - 1);
  9171. let j = srcOffset,
  9172. q = destOffset;
  9173. for (let i = 0; i < count; ++i) {
  9174. dest[q++] = scale * src[j++];
  9175. dest[q++] = scale * src[j++];
  9176. dest[q++] = scale * src[j++];
  9177. q += alpha01;
  9178. }
  9179. }
  9180. getOutputLength(inputLength, alpha01) {
  9181. return ((inputLength * (3 + alpha01)) / 3) | 0;
  9182. }
  9183. isPassthrough(bits) {
  9184. return bits === 8;
  9185. }
  9186. }
  9187. const DeviceCmykCS = (function DeviceCmykCSClosure() {
  9188. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  9189. const c = src[srcOffset] * srcScale;
  9190. const m = src[srcOffset + 1] * srcScale;
  9191. const y = src[srcOffset + 2] * srcScale;
  9192. const k = src[srcOffset + 3] * srcScale;
  9193. dest[destOffset] =
  9194. 255 +
  9195. c *
  9196. (-4.387332384609988 * c +
  9197. 54.48615194189176 * m +
  9198. 18.82290502165302 * y +
  9199. 212.25662451639585 * k +
  9200. -285.2331026137004) +
  9201. m *
  9202. (1.7149763477362134 * m -
  9203. 5.6096736904047315 * y +
  9204. -17.873870861415444 * k -
  9205. 5.497006427196366) +
  9206. y *
  9207. (-2.5217340131683033 * y -
  9208. 21.248923337353073 * k +
  9209. 17.5119270841813) +
  9210. k * (-21.86122147463605 * k - 189.48180835922747);
  9211. dest[destOffset + 1] =
  9212. 255 +
  9213. c *
  9214. (8.841041422036149 * c +
  9215. 60.118027045597366 * m +
  9216. 6.871425592049007 * y +
  9217. 31.159100130055922 * k +
  9218. -79.2970844816548) +
  9219. m *
  9220. (-15.310361306967817 * m +
  9221. 17.575251261109482 * y +
  9222. 131.35250912493976 * k -
  9223. 190.9453302588951) +
  9224. y *
  9225. (4.444339102852739 * y +
  9226. 9.8632861493405 * k -
  9227. 24.86741582555878) +
  9228. k * (-20.737325471181034 * k - 187.80453709719578);
  9229. dest[destOffset + 2] =
  9230. 255 +
  9231. c *
  9232. (0.8842522430003296 * c +
  9233. 8.078677503112928 * m +
  9234. 30.89978309703729 * y -
  9235. 0.23883238689178934 * k +
  9236. -14.183576799673286) +
  9237. m *
  9238. (10.49593273432072 * m +
  9239. 63.02378494754052 * y +
  9240. 50.606957656360734 * k -
  9241. 112.23884253719248) +
  9242. y *
  9243. (0.03296041114873217 * y +
  9244. 115.60384449646641 * k +
  9245. -193.58209356861505) +
  9246. k * (-22.33816807309886 * k - 180.12613974708367);
  9247. }
  9248. class DeviceCmykCS extends ColorSpace {
  9249. constructor() {
  9250. super("DeviceCMYK", 4);
  9251. }
  9252. getRgbItem(src, srcOffset, dest, destOffset) {
  9253. convertToRgb(src, srcOffset, 1, dest, destOffset);
  9254. }
  9255. getRgbBuffer(
  9256. src,
  9257. srcOffset,
  9258. count,
  9259. dest,
  9260. destOffset,
  9261. bits,
  9262. alpha01
  9263. ) {
  9264. const scale = 1 / ((1 << bits) - 1);
  9265. for (let i = 0; i < count; i++) {
  9266. convertToRgb(src, srcOffset, scale, dest, destOffset);
  9267. srcOffset += 4;
  9268. destOffset += 3 + alpha01;
  9269. }
  9270. }
  9271. getOutputLength(inputLength, alpha01) {
  9272. return ((inputLength / 4) * (3 + alpha01)) | 0;
  9273. }
  9274. }
  9275. return DeviceCmykCS;
  9276. })();
  9277. const CalGrayCS = (function CalGrayCSClosure() {
  9278. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  9279. const A = src[srcOffset] * scale;
  9280. const AG = A ** cs.G;
  9281. const L = cs.YW * AG;
  9282. const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0);
  9283. dest[destOffset] = val;
  9284. dest[destOffset + 1] = val;
  9285. dest[destOffset + 2] = val;
  9286. }
  9287. class CalGrayCS extends ColorSpace {
  9288. constructor(whitePoint, blackPoint, gamma) {
  9289. super("CalGray", 1);
  9290. if (!whitePoint) {
  9291. throw new _util.FormatError(
  9292. "WhitePoint missing - required for color space CalGray"
  9293. );
  9294. }
  9295. blackPoint = blackPoint || [0, 0, 0];
  9296. gamma = gamma || 1;
  9297. this.XW = whitePoint[0];
  9298. this.YW = whitePoint[1];
  9299. this.ZW = whitePoint[2];
  9300. this.XB = blackPoint[0];
  9301. this.YB = blackPoint[1];
  9302. this.ZB = blackPoint[2];
  9303. this.G = gamma;
  9304. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  9305. throw new _util.FormatError(
  9306. `Invalid WhitePoint components for ${this.name}` +
  9307. ", no fallback available"
  9308. );
  9309. }
  9310. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  9311. (0, _util.info)(
  9312. `Invalid BlackPoint for ${this.name}, falling back to default.`
  9313. );
  9314. this.XB = this.YB = this.ZB = 0;
  9315. }
  9316. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  9317. (0, _util.warn)(
  9318. `${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` +
  9319. `ZB: ${this.ZB}, only default values are supported.`
  9320. );
  9321. }
  9322. if (this.G < 1) {
  9323. (0, _util.info)(
  9324. `Invalid Gamma: ${this.G} for ${this.name}, ` +
  9325. "falling back to default."
  9326. );
  9327. this.G = 1;
  9328. }
  9329. }
  9330. getRgbItem(src, srcOffset, dest, destOffset) {
  9331. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  9332. }
  9333. getRgbBuffer(
  9334. src,
  9335. srcOffset,
  9336. count,
  9337. dest,
  9338. destOffset,
  9339. bits,
  9340. alpha01
  9341. ) {
  9342. const scale = 1 / ((1 << bits) - 1);
  9343. for (let i = 0; i < count; ++i) {
  9344. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  9345. srcOffset += 1;
  9346. destOffset += 3 + alpha01;
  9347. }
  9348. }
  9349. getOutputLength(inputLength, alpha01) {
  9350. return inputLength * (3 + alpha01);
  9351. }
  9352. }
  9353. return CalGrayCS;
  9354. })();
  9355. const CalRGBCS = (function CalRGBCSClosure() {
  9356. const BRADFORD_SCALE_MATRIX = new Float32Array([
  9357. 0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685,
  9358. 1.0296,
  9359. ]);
  9360. const BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([
  9361. 0.9869929, -0.1470543, 0.1599627, 0.4323053, 0.5183603, 0.0492912,
  9362. -0.0085287, 0.0400428, 0.9684867,
  9363. ]);
  9364. const SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([
  9365. 3.2404542, -1.5371385, -0.4985314, -0.969266, 1.8760108, 0.041556,
  9366. 0.0556434, -0.2040259, 1.0572252,
  9367. ]);
  9368. const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  9369. const tempNormalizeMatrix = new Float32Array(3);
  9370. const tempConvertMatrix1 = new Float32Array(3);
  9371. const tempConvertMatrix2 = new Float32Array(3);
  9372. const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  9373. function matrixProduct(a, b, result) {
  9374. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  9375. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  9376. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  9377. }
  9378. function convertToFlat(sourceWhitePoint, LMS, result) {
  9379. result[0] = (LMS[0] * 1) / sourceWhitePoint[0];
  9380. result[1] = (LMS[1] * 1) / sourceWhitePoint[1];
  9381. result[2] = (LMS[2] * 1) / sourceWhitePoint[2];
  9382. }
  9383. function convertToD65(sourceWhitePoint, LMS, result) {
  9384. const D65X = 0.95047;
  9385. const D65Y = 1;
  9386. const D65Z = 1.08883;
  9387. result[0] = (LMS[0] * D65X) / sourceWhitePoint[0];
  9388. result[1] = (LMS[1] * D65Y) / sourceWhitePoint[1];
  9389. result[2] = (LMS[2] * D65Z) / sourceWhitePoint[2];
  9390. }
  9391. function sRGBTransferFunction(color) {
  9392. if (color <= 0.0031308) {
  9393. return adjustToRange(0, 1, 12.92 * color);
  9394. }
  9395. if (color >= 0.99554525) {
  9396. return 1;
  9397. }
  9398. return adjustToRange(
  9399. 0,
  9400. 1,
  9401. (1 + 0.055) * color ** (1 / 2.4) - 0.055
  9402. );
  9403. }
  9404. function adjustToRange(min, max, value) {
  9405. return Math.max(min, Math.min(max, value));
  9406. }
  9407. function decodeL(L) {
  9408. if (L < 0) {
  9409. return -decodeL(-L);
  9410. }
  9411. if (L > 8.0) {
  9412. return ((L + 16) / 116) ** 3;
  9413. }
  9414. return L * DECODE_L_CONSTANT;
  9415. }
  9416. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  9417. if (
  9418. sourceBlackPoint[0] === 0 &&
  9419. sourceBlackPoint[1] === 0 &&
  9420. sourceBlackPoint[2] === 0
  9421. ) {
  9422. result[0] = XYZ_Flat[0];
  9423. result[1] = XYZ_Flat[1];
  9424. result[2] = XYZ_Flat[2];
  9425. return;
  9426. }
  9427. const zeroDecodeL = decodeL(0);
  9428. const X_DST = zeroDecodeL;
  9429. const X_SRC = decodeL(sourceBlackPoint[0]);
  9430. const Y_DST = zeroDecodeL;
  9431. const Y_SRC = decodeL(sourceBlackPoint[1]);
  9432. const Z_DST = zeroDecodeL;
  9433. const Z_SRC = decodeL(sourceBlackPoint[2]);
  9434. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  9435. const X_Offset = 1 - X_Scale;
  9436. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  9437. const Y_Offset = 1 - Y_Scale;
  9438. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  9439. const Z_Offset = 1 - Z_Scale;
  9440. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  9441. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  9442. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  9443. }
  9444. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  9445. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  9446. result[0] = XYZ_In[0];
  9447. result[1] = XYZ_In[1];
  9448. result[2] = XYZ_In[2];
  9449. return;
  9450. }
  9451. const LMS = result;
  9452. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  9453. const LMS_Flat = tempNormalizeMatrix;
  9454. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  9455. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  9456. }
  9457. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  9458. const LMS = result;
  9459. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  9460. const LMS_D65 = tempNormalizeMatrix;
  9461. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  9462. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  9463. }
  9464. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  9465. const A = adjustToRange(0, 1, src[srcOffset] * scale);
  9466. const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  9467. const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  9468. const AGR = A === 1 ? 1 : A ** cs.GR;
  9469. const BGG = B === 1 ? 1 : B ** cs.GG;
  9470. const CGB = C === 1 ? 1 : C ** cs.GB;
  9471. const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  9472. const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  9473. const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  9474. const XYZ = tempConvertMatrix1;
  9475. XYZ[0] = X;
  9476. XYZ[1] = Y;
  9477. XYZ[2] = Z;
  9478. const XYZ_Flat = tempConvertMatrix2;
  9479. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  9480. const XYZ_Black = tempConvertMatrix1;
  9481. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  9482. const XYZ_D65 = tempConvertMatrix2;
  9483. normalizeWhitePointToD65(
  9484. FLAT_WHITEPOINT_MATRIX,
  9485. XYZ_Black,
  9486. XYZ_D65
  9487. );
  9488. const SRGB = tempConvertMatrix1;
  9489. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  9490. dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
  9491. dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
  9492. dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
  9493. }
  9494. class CalRGBCS extends ColorSpace {
  9495. constructor(whitePoint, blackPoint, gamma, matrix) {
  9496. super("CalRGB", 3);
  9497. if (!whitePoint) {
  9498. throw new _util.FormatError(
  9499. "WhitePoint missing - required for color space CalRGB"
  9500. );
  9501. }
  9502. blackPoint = blackPoint || new Float32Array(3);
  9503. gamma = gamma || new Float32Array([1, 1, 1]);
  9504. matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  9505. const XW = whitePoint[0];
  9506. const YW = whitePoint[1];
  9507. const ZW = whitePoint[2];
  9508. this.whitePoint = whitePoint;
  9509. const XB = blackPoint[0];
  9510. const YB = blackPoint[1];
  9511. const ZB = blackPoint[2];
  9512. this.blackPoint = blackPoint;
  9513. this.GR = gamma[0];
  9514. this.GG = gamma[1];
  9515. this.GB = gamma[2];
  9516. this.MXA = matrix[0];
  9517. this.MYA = matrix[1];
  9518. this.MZA = matrix[2];
  9519. this.MXB = matrix[3];
  9520. this.MYB = matrix[4];
  9521. this.MZB = matrix[5];
  9522. this.MXC = matrix[6];
  9523. this.MYC = matrix[7];
  9524. this.MZC = matrix[8];
  9525. if (XW < 0 || ZW < 0 || YW !== 1) {
  9526. throw new _util.FormatError(
  9527. `Invalid WhitePoint components for ${this.name}` +
  9528. ", no fallback available"
  9529. );
  9530. }
  9531. if (XB < 0 || YB < 0 || ZB < 0) {
  9532. (0, _util.info)(
  9533. `Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` +
  9534. "falling back to default."
  9535. );
  9536. this.blackPoint = new Float32Array(3);
  9537. }
  9538. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  9539. (0, _util.info)(
  9540. `Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` +
  9541. `${this.name}, falling back to default.`
  9542. );
  9543. this.GR = this.GG = this.GB = 1;
  9544. }
  9545. }
  9546. getRgbItem(src, srcOffset, dest, destOffset) {
  9547. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  9548. }
  9549. getRgbBuffer(
  9550. src,
  9551. srcOffset,
  9552. count,
  9553. dest,
  9554. destOffset,
  9555. bits,
  9556. alpha01
  9557. ) {
  9558. const scale = 1 / ((1 << bits) - 1);
  9559. for (let i = 0; i < count; ++i) {
  9560. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  9561. srcOffset += 3;
  9562. destOffset += 3 + alpha01;
  9563. }
  9564. }
  9565. getOutputLength(inputLength, alpha01) {
  9566. return ((inputLength * (3 + alpha01)) / 3) | 0;
  9567. }
  9568. }
  9569. return CalRGBCS;
  9570. })();
  9571. const LabCS = (function LabCSClosure() {
  9572. function fn_g(x) {
  9573. let result;
  9574. if (x >= 6 / 29) {
  9575. result = x ** 3;
  9576. } else {
  9577. result = (108 / 841) * (x - 4 / 29);
  9578. }
  9579. return result;
  9580. }
  9581. function decode(value, high1, low2, high2) {
  9582. return low2 + (value * (high2 - low2)) / high1;
  9583. }
  9584. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  9585. let Ls = src[srcOffset];
  9586. let as = src[srcOffset + 1];
  9587. let bs = src[srcOffset + 2];
  9588. if (maxVal !== false) {
  9589. Ls = decode(Ls, maxVal, 0, 100);
  9590. as = decode(as, maxVal, cs.amin, cs.amax);
  9591. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  9592. }
  9593. if (as > cs.amax) {
  9594. as = cs.amax;
  9595. } else if (as < cs.amin) {
  9596. as = cs.amin;
  9597. }
  9598. if (bs > cs.bmax) {
  9599. bs = cs.bmax;
  9600. } else if (bs < cs.bmin) {
  9601. bs = cs.bmin;
  9602. }
  9603. const M = (Ls + 16) / 116;
  9604. const L = M + as / 500;
  9605. const N = M - bs / 200;
  9606. const X = cs.XW * fn_g(L);
  9607. const Y = cs.YW * fn_g(M);
  9608. const Z = cs.ZW * fn_g(N);
  9609. let r, g, b;
  9610. if (cs.ZW < 1) {
  9611. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  9612. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  9613. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  9614. } else {
  9615. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  9616. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  9617. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  9618. }
  9619. dest[destOffset] = Math.sqrt(r) * 255;
  9620. dest[destOffset + 1] = Math.sqrt(g) * 255;
  9621. dest[destOffset + 2] = Math.sqrt(b) * 255;
  9622. }
  9623. class LabCS extends ColorSpace {
  9624. constructor(whitePoint, blackPoint, range) {
  9625. super("Lab", 3);
  9626. if (!whitePoint) {
  9627. throw new _util.FormatError(
  9628. "WhitePoint missing - required for color space Lab"
  9629. );
  9630. }
  9631. blackPoint = blackPoint || [0, 0, 0];
  9632. range = range || [-100, 100, -100, 100];
  9633. this.XW = whitePoint[0];
  9634. this.YW = whitePoint[1];
  9635. this.ZW = whitePoint[2];
  9636. this.amin = range[0];
  9637. this.amax = range[1];
  9638. this.bmin = range[2];
  9639. this.bmax = range[3];
  9640. this.XB = blackPoint[0];
  9641. this.YB = blackPoint[1];
  9642. this.ZB = blackPoint[2];
  9643. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  9644. throw new _util.FormatError(
  9645. "Invalid WhitePoint components, no fallback available"
  9646. );
  9647. }
  9648. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  9649. (0, _util.info)("Invalid BlackPoint, falling back to default");
  9650. this.XB = this.YB = this.ZB = 0;
  9651. }
  9652. if (this.amin > this.amax || this.bmin > this.bmax) {
  9653. (0, _util.info)("Invalid Range, falling back to defaults");
  9654. this.amin = -100;
  9655. this.amax = 100;
  9656. this.bmin = -100;
  9657. this.bmax = 100;
  9658. }
  9659. }
  9660. getRgbItem(src, srcOffset, dest, destOffset) {
  9661. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  9662. }
  9663. getRgbBuffer(
  9664. src,
  9665. srcOffset,
  9666. count,
  9667. dest,
  9668. destOffset,
  9669. bits,
  9670. alpha01
  9671. ) {
  9672. const maxVal = (1 << bits) - 1;
  9673. for (let i = 0; i < count; i++) {
  9674. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  9675. srcOffset += 3;
  9676. destOffset += 3 + alpha01;
  9677. }
  9678. }
  9679. getOutputLength(inputLength, alpha01) {
  9680. return ((inputLength * (3 + alpha01)) / 3) | 0;
  9681. }
  9682. isDefaultDecode(decodeMap, bpc) {
  9683. return true;
  9684. }
  9685. get usesZeroToOneRange() {
  9686. return (0, _util.shadow)(this, "usesZeroToOneRange", false);
  9687. }
  9688. }
  9689. return LabCS;
  9690. })();
  9691. /***/
  9692. },
  9693. /* 15 */
  9694. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  9695. Object.defineProperty(exports, "__esModule", {
  9696. value: true,
  9697. });
  9698. exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0;
  9699. var _util = __w_pdfjs_require__(2);
  9700. var _cmap = __w_pdfjs_require__(16);
  9701. var _primitives = __w_pdfjs_require__(5);
  9702. var _fonts = __w_pdfjs_require__(34);
  9703. var _fonts_utils = __w_pdfjs_require__(38);
  9704. var _encodings = __w_pdfjs_require__(37);
  9705. var _standard_fonts = __w_pdfjs_require__(41);
  9706. var _unicode = __w_pdfjs_require__(40);
  9707. var _pattern = __w_pdfjs_require__(50);
  9708. var _xfa_fonts = __w_pdfjs_require__(51);
  9709. var _to_unicode_map = __w_pdfjs_require__(42);
  9710. var _function = __w_pdfjs_require__(57);
  9711. var _parser = __w_pdfjs_require__(17);
  9712. var _image_utils = __w_pdfjs_require__(59);
  9713. var _stream = __w_pdfjs_require__(10);
  9714. var _base_stream = __w_pdfjs_require__(7);
  9715. var _bidi = __w_pdfjs_require__(60);
  9716. var _colorspace = __w_pdfjs_require__(14);
  9717. var _decode_stream = __w_pdfjs_require__(19);
  9718. var _glyphlist = __w_pdfjs_require__(39);
  9719. var _core_utils = __w_pdfjs_require__(6);
  9720. var _metrics = __w_pdfjs_require__(45);
  9721. var _murmurhash = __w_pdfjs_require__(61);
  9722. var _operator_list = __w_pdfjs_require__(62);
  9723. var _image = __w_pdfjs_require__(63);
  9724. const DefaultPartialEvaluatorOptions = Object.freeze({
  9725. maxImageSize: -1,
  9726. disableFontFace: false,
  9727. ignoreErrors: false,
  9728. isEvalSupported: true,
  9729. fontExtraProperties: false,
  9730. useSystemFonts: true,
  9731. cMapUrl: null,
  9732. standardFontDataUrl: null,
  9733. });
  9734. const PatternType = {
  9735. TILING: 1,
  9736. SHADING: 2,
  9737. };
  9738. const TEXT_CHUNK_BATCH_SIZE = 10;
  9739. const deferred = Promise.resolve();
  9740. function normalizeBlendMode(value, parsingArray = false) {
  9741. if (Array.isArray(value)) {
  9742. for (let i = 0, ii = value.length; i < ii; i++) {
  9743. const maybeBM = normalizeBlendMode(value[i], true);
  9744. if (maybeBM) {
  9745. return maybeBM;
  9746. }
  9747. }
  9748. (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
  9749. return "source-over";
  9750. }
  9751. if (!(value instanceof _primitives.Name)) {
  9752. if (parsingArray) {
  9753. return null;
  9754. }
  9755. return "source-over";
  9756. }
  9757. switch (value.name) {
  9758. case "Normal":
  9759. case "Compatible":
  9760. return "source-over";
  9761. case "Multiply":
  9762. return "multiply";
  9763. case "Screen":
  9764. return "screen";
  9765. case "Overlay":
  9766. return "overlay";
  9767. case "Darken":
  9768. return "darken";
  9769. case "Lighten":
  9770. return "lighten";
  9771. case "ColorDodge":
  9772. return "color-dodge";
  9773. case "ColorBurn":
  9774. return "color-burn";
  9775. case "HardLight":
  9776. return "hard-light";
  9777. case "SoftLight":
  9778. return "soft-light";
  9779. case "Difference":
  9780. return "difference";
  9781. case "Exclusion":
  9782. return "exclusion";
  9783. case "Hue":
  9784. return "hue";
  9785. case "Saturation":
  9786. return "saturation";
  9787. case "Color":
  9788. return "color";
  9789. case "Luminosity":
  9790. return "luminosity";
  9791. }
  9792. if (parsingArray) {
  9793. return null;
  9794. }
  9795. (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
  9796. return "source-over";
  9797. }
  9798. function incrementCachedImageMaskCount(data) {
  9799. if (
  9800. data.fn === _util.OPS.paintImageMaskXObject &&
  9801. data.args[0] &&
  9802. data.args[0].count > 0
  9803. ) {
  9804. data.args[0].count++;
  9805. }
  9806. }
  9807. class TimeSlotManager {
  9808. static get TIME_SLOT_DURATION_MS() {
  9809. return (0, _util.shadow)(this, "TIME_SLOT_DURATION_MS", 20);
  9810. }
  9811. static get CHECK_TIME_EVERY() {
  9812. return (0, _util.shadow)(this, "CHECK_TIME_EVERY", 100);
  9813. }
  9814. constructor() {
  9815. this.reset();
  9816. }
  9817. check() {
  9818. if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
  9819. return false;
  9820. }
  9821. this.checked = 0;
  9822. return this.endTime <= Date.now();
  9823. }
  9824. reset() {
  9825. this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
  9826. this.checked = 0;
  9827. }
  9828. }
  9829. class PartialEvaluator {
  9830. constructor({
  9831. xref,
  9832. handler,
  9833. pageIndex,
  9834. idFactory,
  9835. fontCache,
  9836. builtInCMapCache,
  9837. standardFontDataCache,
  9838. globalImageCache,
  9839. options = null,
  9840. }) {
  9841. this.xref = xref;
  9842. this.handler = handler;
  9843. this.pageIndex = pageIndex;
  9844. this.idFactory = idFactory;
  9845. this.fontCache = fontCache;
  9846. this.builtInCMapCache = builtInCMapCache;
  9847. this.standardFontDataCache = standardFontDataCache;
  9848. this.globalImageCache = globalImageCache;
  9849. this.options = options || DefaultPartialEvaluatorOptions;
  9850. this.parsingType3Font = false;
  9851. this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
  9852. }
  9853. get _pdfFunctionFactory() {
  9854. const pdfFunctionFactory = new _function.PDFFunctionFactory({
  9855. xref: this.xref,
  9856. isEvalSupported: this.options.isEvalSupported,
  9857. });
  9858. return (0, _util.shadow)(
  9859. this,
  9860. "_pdfFunctionFactory",
  9861. pdfFunctionFactory
  9862. );
  9863. }
  9864. clone(newOptions = null) {
  9865. const newEvaluator = Object.create(this);
  9866. newEvaluator.options = Object.assign(
  9867. Object.create(null),
  9868. this.options,
  9869. newOptions
  9870. );
  9871. return newEvaluator;
  9872. }
  9873. hasBlendModes(resources, nonBlendModesSet) {
  9874. if (!(resources instanceof _primitives.Dict)) {
  9875. return false;
  9876. }
  9877. if (resources.objId && nonBlendModesSet.has(resources.objId)) {
  9878. return false;
  9879. }
  9880. const processed = new _primitives.RefSet(nonBlendModesSet);
  9881. if (resources.objId) {
  9882. processed.put(resources.objId);
  9883. }
  9884. const nodes = [resources],
  9885. xref = this.xref;
  9886. while (nodes.length) {
  9887. const node = nodes.shift();
  9888. const graphicStates = node.get("ExtGState");
  9889. if (graphicStates instanceof _primitives.Dict) {
  9890. for (let graphicState of graphicStates.getRawValues()) {
  9891. if (graphicState instanceof _primitives.Ref) {
  9892. if (processed.has(graphicState)) {
  9893. continue;
  9894. }
  9895. try {
  9896. graphicState = xref.fetch(graphicState);
  9897. } catch (ex) {
  9898. processed.put(graphicState);
  9899. (0, _util.info)(
  9900. `hasBlendModes - ignoring ExtGState: "${ex}".`
  9901. );
  9902. continue;
  9903. }
  9904. }
  9905. if (!(graphicState instanceof _primitives.Dict)) {
  9906. continue;
  9907. }
  9908. if (graphicState.objId) {
  9909. processed.put(graphicState.objId);
  9910. }
  9911. const bm = graphicState.get("BM");
  9912. if (bm instanceof _primitives.Name) {
  9913. if (bm.name !== "Normal") {
  9914. return true;
  9915. }
  9916. continue;
  9917. }
  9918. if (bm !== undefined && Array.isArray(bm)) {
  9919. for (const element of bm) {
  9920. if (
  9921. element instanceof _primitives.Name &&
  9922. element.name !== "Normal"
  9923. ) {
  9924. return true;
  9925. }
  9926. }
  9927. }
  9928. }
  9929. }
  9930. const xObjects = node.get("XObject");
  9931. if (!(xObjects instanceof _primitives.Dict)) {
  9932. continue;
  9933. }
  9934. for (let xObject of xObjects.getRawValues()) {
  9935. if (xObject instanceof _primitives.Ref) {
  9936. if (processed.has(xObject)) {
  9937. continue;
  9938. }
  9939. try {
  9940. xObject = xref.fetch(xObject);
  9941. } catch (ex) {
  9942. processed.put(xObject);
  9943. (0, _util.info)(
  9944. `hasBlendModes - ignoring XObject: "${ex}".`
  9945. );
  9946. continue;
  9947. }
  9948. }
  9949. if (!(xObject instanceof _base_stream.BaseStream)) {
  9950. continue;
  9951. }
  9952. if (xObject.dict.objId) {
  9953. processed.put(xObject.dict.objId);
  9954. }
  9955. const xResources = xObject.dict.get("Resources");
  9956. if (!(xResources instanceof _primitives.Dict)) {
  9957. continue;
  9958. }
  9959. if (xResources.objId && processed.has(xResources.objId)) {
  9960. continue;
  9961. }
  9962. nodes.push(xResources);
  9963. if (xResources.objId) {
  9964. processed.put(xResources.objId);
  9965. }
  9966. }
  9967. }
  9968. for (const ref of processed) {
  9969. nonBlendModesSet.put(ref);
  9970. }
  9971. return false;
  9972. }
  9973. async fetchBuiltInCMap(name) {
  9974. const cachedData = this.builtInCMapCache.get(name);
  9975. if (cachedData) {
  9976. return cachedData;
  9977. }
  9978. let data;
  9979. if (this.options.cMapUrl !== null) {
  9980. const url = `${this.options.cMapUrl}${name}.bcmap`;
  9981. const response = await fetch(url);
  9982. if (!response.ok) {
  9983. throw new Error(
  9984. `fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`
  9985. );
  9986. }
  9987. data = {
  9988. cMapData: new Uint8Array(await response.arrayBuffer()),
  9989. compressionType: _util.CMapCompressionType.BINARY,
  9990. };
  9991. } else {
  9992. data = await this.handler.sendWithPromise("FetchBuiltInCMap", {
  9993. name,
  9994. });
  9995. }
  9996. if (data.compressionType !== _util.CMapCompressionType.NONE) {
  9997. this.builtInCMapCache.set(name, data);
  9998. }
  9999. return data;
  10000. }
  10001. async fetchStandardFontData(name) {
  10002. const cachedData = this.standardFontDataCache.get(name);
  10003. if (cachedData) {
  10004. return new _stream.Stream(cachedData);
  10005. }
  10006. if (
  10007. this.options.useSystemFonts &&
  10008. name !== "Symbol" &&
  10009. name !== "ZapfDingbats"
  10010. ) {
  10011. return null;
  10012. }
  10013. const standardFontNameToFileName = (0,
  10014. _standard_fonts.getFontNameToFileMap)(),
  10015. filename = standardFontNameToFileName[name];
  10016. let data;
  10017. if (this.options.standardFontDataUrl !== null) {
  10018. const url = `${this.options.standardFontDataUrl}${filename}`;
  10019. const response = await fetch(url);
  10020. if (!response.ok) {
  10021. (0, _util.warn)(
  10022. `fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`
  10023. );
  10024. } else {
  10025. data = await response.arrayBuffer();
  10026. }
  10027. } else {
  10028. try {
  10029. data = await this.handler.sendWithPromise(
  10030. "FetchStandardFontData",
  10031. {
  10032. filename,
  10033. }
  10034. );
  10035. } catch (e) {
  10036. (0, _util.warn)(
  10037. `fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`
  10038. );
  10039. }
  10040. }
  10041. if (!data) {
  10042. return null;
  10043. }
  10044. this.standardFontDataCache.set(name, data);
  10045. return new _stream.Stream(data);
  10046. }
  10047. async buildFormXObject(
  10048. resources,
  10049. xobj,
  10050. smask,
  10051. operatorList,
  10052. task,
  10053. initialState,
  10054. localColorSpaceCache
  10055. ) {
  10056. const dict = xobj.dict;
  10057. const matrix = dict.getArray("Matrix");
  10058. let bbox = dict.getArray("BBox");
  10059. if (Array.isArray(bbox) && bbox.length === 4) {
  10060. bbox = _util.Util.normalizeRect(bbox);
  10061. } else {
  10062. bbox = null;
  10063. }
  10064. let optionalContent, groupOptions;
  10065. if (dict.has("OC")) {
  10066. optionalContent = await this.parseMarkedContentProps(
  10067. dict.get("OC"),
  10068. resources
  10069. );
  10070. }
  10071. if (optionalContent !== undefined) {
  10072. operatorList.addOp(_util.OPS.beginMarkedContentProps, [
  10073. "OC",
  10074. optionalContent,
  10075. ]);
  10076. }
  10077. const group = dict.get("Group");
  10078. if (group) {
  10079. groupOptions = {
  10080. matrix,
  10081. bbox,
  10082. smask,
  10083. isolated: false,
  10084. knockout: false,
  10085. };
  10086. const groupSubtype = group.get("S");
  10087. let colorSpace = null;
  10088. if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
  10089. groupOptions.isolated = group.get("I") || false;
  10090. groupOptions.knockout = group.get("K") || false;
  10091. if (group.has("CS")) {
  10092. const cs = group.getRaw("CS");
  10093. const cachedColorSpace = _colorspace.ColorSpace.getCached(
  10094. cs,
  10095. this.xref,
  10096. localColorSpaceCache
  10097. );
  10098. if (cachedColorSpace) {
  10099. colorSpace = cachedColorSpace;
  10100. } else {
  10101. colorSpace = await this.parseColorSpace({
  10102. cs,
  10103. resources,
  10104. localColorSpaceCache,
  10105. });
  10106. }
  10107. }
  10108. }
  10109. if (smask && smask.backdrop) {
  10110. colorSpace =
  10111. colorSpace || _colorspace.ColorSpace.singletons.rgb;
  10112. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  10113. }
  10114. operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
  10115. }
  10116. const args = group ? [matrix, null] : [matrix, bbox];
  10117. operatorList.addOp(_util.OPS.paintFormXObjectBegin, args);
  10118. return this.getOperatorList({
  10119. stream: xobj,
  10120. task,
  10121. resources: dict.get("Resources") || resources,
  10122. operatorList,
  10123. initialState,
  10124. }).then(function () {
  10125. operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
  10126. if (group) {
  10127. operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
  10128. }
  10129. if (optionalContent !== undefined) {
  10130. operatorList.addOp(_util.OPS.endMarkedContent, []);
  10131. }
  10132. });
  10133. }
  10134. _sendImgData(objId, imgData, cacheGlobally = false) {
  10135. const transfers = imgData
  10136. ? [imgData.bitmap || imgData.data.buffer]
  10137. : null;
  10138. if (this.parsingType3Font || cacheGlobally) {
  10139. return this.handler.send(
  10140. "commonobj",
  10141. [objId, "Image", imgData],
  10142. transfers
  10143. );
  10144. }
  10145. return this.handler.send(
  10146. "obj",
  10147. [objId, this.pageIndex, "Image", imgData],
  10148. transfers
  10149. );
  10150. }
  10151. async buildPaintImageXObject({
  10152. resources,
  10153. image,
  10154. isInline = false,
  10155. operatorList,
  10156. cacheKey,
  10157. localImageCache,
  10158. localColorSpaceCache,
  10159. }) {
  10160. const dict = image.dict;
  10161. const imageRef = dict.objId;
  10162. const w = dict.get("W", "Width");
  10163. const h = dict.get("H", "Height");
  10164. if (
  10165. !(w && typeof w === "number") ||
  10166. !(h && typeof h === "number")
  10167. ) {
  10168. (0, _util.warn)("Image dimensions are missing, or not numbers.");
  10169. return;
  10170. }
  10171. const maxImageSize = this.options.maxImageSize;
  10172. if (maxImageSize !== -1 && w * h > maxImageSize) {
  10173. const msg =
  10174. "Image exceeded maximum allowed size and was removed.";
  10175. if (this.options.ignoreErrors) {
  10176. (0, _util.warn)(msg);
  10177. return;
  10178. }
  10179. throw new Error(msg);
  10180. }
  10181. let optionalContent;
  10182. if (dict.has("OC")) {
  10183. optionalContent = await this.parseMarkedContentProps(
  10184. dict.get("OC"),
  10185. resources
  10186. );
  10187. }
  10188. const imageMask = dict.get("IM", "ImageMask") || false;
  10189. let imgData, args;
  10190. if (imageMask) {
  10191. const interpolate = dict.get("I", "Interpolate");
  10192. const bitStrideLength = (w + 7) >> 3;
  10193. const imgArray = image.getBytes(bitStrideLength * h);
  10194. const decode = dict.getArray("D", "Decode");
  10195. if (this.parsingType3Font) {
  10196. imgData = _image.PDFImage.createRawMask({
  10197. imgArray,
  10198. width: w,
  10199. height: h,
  10200. imageIsFromDecodeStream:
  10201. image instanceof _decode_stream.DecodeStream,
  10202. inverseDecode: !!decode && decode[0] > 0,
  10203. interpolate,
  10204. });
  10205. imgData.cached = !!cacheKey;
  10206. args = [imgData];
  10207. operatorList.addImageOps(
  10208. _util.OPS.paintImageMaskXObject,
  10209. args,
  10210. optionalContent
  10211. );
  10212. if (cacheKey) {
  10213. localImageCache.set(cacheKey, imageRef, {
  10214. fn: _util.OPS.paintImageMaskXObject,
  10215. args,
  10216. optionalContent,
  10217. });
  10218. }
  10219. return;
  10220. }
  10221. imgData = _image.PDFImage.createMask({
  10222. imgArray,
  10223. width: w,
  10224. height: h,
  10225. imageIsFromDecodeStream:
  10226. image instanceof _decode_stream.DecodeStream,
  10227. inverseDecode: !!decode && decode[0] > 0,
  10228. interpolate,
  10229. });
  10230. if (imgData.isSingleOpaquePixel) {
  10231. operatorList.addImageOps(
  10232. _util.OPS.paintSolidColorImageMask,
  10233. [],
  10234. optionalContent
  10235. );
  10236. if (cacheKey) {
  10237. localImageCache.set(cacheKey, imageRef, {
  10238. fn: _util.OPS.paintSolidColorImageMask,
  10239. args: [],
  10240. optionalContent,
  10241. });
  10242. }
  10243. return;
  10244. }
  10245. const objId = `mask_${this.idFactory.createObjId()}`;
  10246. operatorList.addDependency(objId);
  10247. this._sendImgData(objId, imgData);
  10248. args = [
  10249. {
  10250. data: objId,
  10251. width: imgData.width,
  10252. height: imgData.height,
  10253. interpolate: imgData.interpolate,
  10254. count: 1,
  10255. },
  10256. ];
  10257. operatorList.addImageOps(
  10258. _util.OPS.paintImageMaskXObject,
  10259. args,
  10260. optionalContent
  10261. );
  10262. if (cacheKey) {
  10263. localImageCache.set(cacheKey, imageRef, {
  10264. fn: _util.OPS.paintImageMaskXObject,
  10265. args,
  10266. optionalContent,
  10267. });
  10268. }
  10269. return;
  10270. }
  10271. const softMask = dict.get("SM", "SMask") || false;
  10272. const mask = dict.get("Mask") || false;
  10273. const SMALL_IMAGE_DIMENSIONS = 200;
  10274. if (
  10275. isInline &&
  10276. !softMask &&
  10277. !mask &&
  10278. w + h < SMALL_IMAGE_DIMENSIONS
  10279. ) {
  10280. const imageObj = new _image.PDFImage({
  10281. xref: this.xref,
  10282. res: resources,
  10283. image,
  10284. isInline,
  10285. pdfFunctionFactory: this._pdfFunctionFactory,
  10286. localColorSpaceCache,
  10287. });
  10288. imgData = imageObj.createImageData(true);
  10289. operatorList.addImageOps(
  10290. _util.OPS.paintInlineImageXObject,
  10291. [imgData],
  10292. optionalContent
  10293. );
  10294. return;
  10295. }
  10296. let objId = `img_${this.idFactory.createObjId()}`,
  10297. cacheGlobally = false;
  10298. if (this.parsingType3Font) {
  10299. objId = `${this.idFactory.getDocId()}_type3_${objId}`;
  10300. } else if (imageRef) {
  10301. cacheGlobally = this.globalImageCache.shouldCache(
  10302. imageRef,
  10303. this.pageIndex
  10304. );
  10305. if (cacheGlobally) {
  10306. objId = `${this.idFactory.getDocId()}_${objId}`;
  10307. }
  10308. }
  10309. operatorList.addDependency(objId);
  10310. args = [objId, w, h];
  10311. _image.PDFImage.buildImage({
  10312. xref: this.xref,
  10313. res: resources,
  10314. image,
  10315. isInline,
  10316. pdfFunctionFactory: this._pdfFunctionFactory,
  10317. localColorSpaceCache,
  10318. })
  10319. .then((imageObj) => {
  10320. imgData = imageObj.createImageData(false);
  10321. if (cacheKey && imageRef && cacheGlobally) {
  10322. this.globalImageCache.addByteSize(
  10323. imageRef,
  10324. imgData.data.length
  10325. );
  10326. }
  10327. return this._sendImgData(objId, imgData, cacheGlobally);
  10328. })
  10329. .catch((reason) => {
  10330. (0, _util.warn)(
  10331. `Unable to decode image "${objId}": "${reason}".`
  10332. );
  10333. return this._sendImgData(objId, null, cacheGlobally);
  10334. });
  10335. operatorList.addImageOps(
  10336. _util.OPS.paintImageXObject,
  10337. args,
  10338. optionalContent
  10339. );
  10340. if (cacheKey) {
  10341. localImageCache.set(cacheKey, imageRef, {
  10342. fn: _util.OPS.paintImageXObject,
  10343. args,
  10344. optionalContent,
  10345. });
  10346. if (imageRef) {
  10347. (0, _util.assert)(
  10348. !isInline,
  10349. "Cannot cache an inline image globally."
  10350. );
  10351. this.globalImageCache.addPageIndex(imageRef, this.pageIndex);
  10352. if (cacheGlobally) {
  10353. this.globalImageCache.setData(imageRef, {
  10354. objId,
  10355. fn: _util.OPS.paintImageXObject,
  10356. args,
  10357. optionalContent,
  10358. byteSize: 0,
  10359. });
  10360. }
  10361. }
  10362. }
  10363. }
  10364. handleSMask(
  10365. smask,
  10366. resources,
  10367. operatorList,
  10368. task,
  10369. stateManager,
  10370. localColorSpaceCache
  10371. ) {
  10372. const smaskContent = smask.get("G");
  10373. const smaskOptions = {
  10374. subtype: smask.get("S").name,
  10375. backdrop: smask.get("BC"),
  10376. };
  10377. const transferObj = smask.get("TR");
  10378. if ((0, _function.isPDFFunction)(transferObj)) {
  10379. const transferFn = this._pdfFunctionFactory.create(transferObj);
  10380. const transferMap = new Uint8Array(256);
  10381. const tmp = new Float32Array(1);
  10382. for (let i = 0; i < 256; i++) {
  10383. tmp[0] = i / 255;
  10384. transferFn(tmp, 0, tmp, 0);
  10385. transferMap[i] = (tmp[0] * 255) | 0;
  10386. }
  10387. smaskOptions.transferMap = transferMap;
  10388. }
  10389. return this.buildFormXObject(
  10390. resources,
  10391. smaskContent,
  10392. smaskOptions,
  10393. operatorList,
  10394. task,
  10395. stateManager.state.clone(),
  10396. localColorSpaceCache
  10397. );
  10398. }
  10399. handleTransferFunction(tr) {
  10400. let transferArray;
  10401. if (Array.isArray(tr)) {
  10402. transferArray = tr;
  10403. } else if ((0, _function.isPDFFunction)(tr)) {
  10404. transferArray = [tr];
  10405. } else {
  10406. return null;
  10407. }
  10408. const transferMaps = [];
  10409. let numFns = 0,
  10410. numEffectfulFns = 0;
  10411. for (const entry of transferArray) {
  10412. const transferObj = this.xref.fetchIfRef(entry);
  10413. numFns++;
  10414. if ((0, _primitives.isName)(transferObj, "Identity")) {
  10415. transferMaps.push(null);
  10416. continue;
  10417. } else if (!(0, _function.isPDFFunction)(transferObj)) {
  10418. return null;
  10419. }
  10420. const transferFn = this._pdfFunctionFactory.create(transferObj);
  10421. const transferMap = new Uint8Array(256),
  10422. tmp = new Float32Array(1);
  10423. for (let j = 0; j < 256; j++) {
  10424. tmp[0] = j / 255;
  10425. transferFn(tmp, 0, tmp, 0);
  10426. transferMap[j] = (tmp[0] * 255) | 0;
  10427. }
  10428. transferMaps.push(transferMap);
  10429. numEffectfulFns++;
  10430. }
  10431. if (!(numFns === 1 || numFns === 4)) {
  10432. return null;
  10433. }
  10434. if (numEffectfulFns === 0) {
  10435. return null;
  10436. }
  10437. return transferMaps;
  10438. }
  10439. handleTilingType(
  10440. fn,
  10441. color,
  10442. resources,
  10443. pattern,
  10444. patternDict,
  10445. operatorList,
  10446. task,
  10447. localTilingPatternCache
  10448. ) {
  10449. const tilingOpList = new _operator_list.OperatorList();
  10450. const patternResources = _primitives.Dict.merge({
  10451. xref: this.xref,
  10452. dictArray: [patternDict.get("Resources"), resources],
  10453. });
  10454. return this.getOperatorList({
  10455. stream: pattern,
  10456. task,
  10457. resources: patternResources,
  10458. operatorList: tilingOpList,
  10459. })
  10460. .then(function () {
  10461. const operatorListIR = tilingOpList.getIR();
  10462. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(
  10463. operatorListIR,
  10464. patternDict,
  10465. color
  10466. );
  10467. operatorList.addDependencies(tilingOpList.dependencies);
  10468. operatorList.addOp(fn, tilingPatternIR);
  10469. if (patternDict.objId) {
  10470. localTilingPatternCache.set(null, patternDict.objId, {
  10471. operatorListIR,
  10472. dict: patternDict,
  10473. });
  10474. }
  10475. })
  10476. .catch((reason) => {
  10477. if (reason instanceof _util.AbortException) {
  10478. return;
  10479. }
  10480. if (this.options.ignoreErrors) {
  10481. this.handler.send("UnsupportedFeature", {
  10482. featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern,
  10483. });
  10484. (0, _util.warn)(
  10485. `handleTilingType - ignoring pattern: "${reason}".`
  10486. );
  10487. return;
  10488. }
  10489. throw reason;
  10490. });
  10491. }
  10492. handleSetFont(
  10493. resources,
  10494. fontArgs,
  10495. fontRef,
  10496. operatorList,
  10497. task,
  10498. state,
  10499. fallbackFontDict = null,
  10500. cssFontInfo = null
  10501. ) {
  10502. const fontName =
  10503. fontArgs && fontArgs[0] instanceof _primitives.Name
  10504. ? fontArgs[0].name
  10505. : null;
  10506. return this.loadFont(
  10507. fontName,
  10508. fontRef,
  10509. resources,
  10510. fallbackFontDict,
  10511. cssFontInfo
  10512. )
  10513. .then((translated) => {
  10514. if (!translated.font.isType3Font) {
  10515. return translated;
  10516. }
  10517. return translated
  10518. .loadType3Data(this, resources, task)
  10519. .then(function () {
  10520. operatorList.addDependencies(translated.type3Dependencies);
  10521. return translated;
  10522. })
  10523. .catch((reason) => {
  10524. this.handler.send("UnsupportedFeature", {
  10525. featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3,
  10526. });
  10527. return new TranslatedFont({
  10528. loadedName: "g_font_error",
  10529. font: new _fonts.ErrorFont(
  10530. `Type3 font load error: ${reason}`
  10531. ),
  10532. dict: translated.font,
  10533. evaluatorOptions: this.options,
  10534. });
  10535. });
  10536. })
  10537. .then((translated) => {
  10538. state.font = translated.font;
  10539. translated.send(this.handler);
  10540. return translated.loadedName;
  10541. });
  10542. }
  10543. handleText(chars, state) {
  10544. const font = state.font;
  10545. const glyphs = font.charsToGlyphs(chars);
  10546. if (font.data) {
  10547. const isAddToPathSet = !!(
  10548. state.textRenderingMode &
  10549. _util.TextRenderingMode.ADD_TO_PATH_FLAG
  10550. );
  10551. if (
  10552. isAddToPathSet ||
  10553. state.fillColorSpace.name === "Pattern" ||
  10554. font.disableFontFace ||
  10555. this.options.disableFontFace
  10556. ) {
  10557. PartialEvaluator.buildFontPaths(
  10558. font,
  10559. glyphs,
  10560. this.handler,
  10561. this.options
  10562. );
  10563. }
  10564. }
  10565. return glyphs;
  10566. }
  10567. ensureStateFont(state) {
  10568. if (state.font) {
  10569. return;
  10570. }
  10571. const reason = new _util.FormatError(
  10572. "Missing setFont (Tf) operator before text rendering operator."
  10573. );
  10574. if (this.options.ignoreErrors) {
  10575. this.handler.send("UnsupportedFeature", {
  10576. featureId: _util.UNSUPPORTED_FEATURES.errorFontState,
  10577. });
  10578. (0, _util.warn)(`ensureStateFont: "${reason}".`);
  10579. return;
  10580. }
  10581. throw reason;
  10582. }
  10583. async setGState({
  10584. resources,
  10585. gState,
  10586. operatorList,
  10587. cacheKey,
  10588. task,
  10589. stateManager,
  10590. localGStateCache,
  10591. localColorSpaceCache,
  10592. }) {
  10593. const gStateRef = gState.objId;
  10594. let isSimpleGState = true;
  10595. const gStateObj = [];
  10596. const gStateKeys = gState.getKeys();
  10597. let promise = Promise.resolve();
  10598. for (let i = 0, ii = gStateKeys.length; i < ii; i++) {
  10599. const key = gStateKeys[i];
  10600. const value = gState.get(key);
  10601. switch (key) {
  10602. case "Type":
  10603. break;
  10604. case "LW":
  10605. case "LC":
  10606. case "LJ":
  10607. case "ML":
  10608. case "D":
  10609. case "RI":
  10610. case "FL":
  10611. case "CA":
  10612. case "ca":
  10613. gStateObj.push([key, value]);
  10614. break;
  10615. case "Font":
  10616. isSimpleGState = false;
  10617. promise = promise.then(() => {
  10618. return this.handleSetFont(
  10619. resources,
  10620. null,
  10621. value[0],
  10622. operatorList,
  10623. task,
  10624. stateManager.state
  10625. ).then(function (loadedName) {
  10626. operatorList.addDependency(loadedName);
  10627. gStateObj.push([key, [loadedName, value[1]]]);
  10628. });
  10629. });
  10630. break;
  10631. case "BM":
  10632. gStateObj.push([key, normalizeBlendMode(value)]);
  10633. break;
  10634. case "SMask":
  10635. if ((0, _primitives.isName)(value, "None")) {
  10636. gStateObj.push([key, false]);
  10637. break;
  10638. }
  10639. if (value instanceof _primitives.Dict) {
  10640. isSimpleGState = false;
  10641. promise = promise.then(() => {
  10642. return this.handleSMask(
  10643. value,
  10644. resources,
  10645. operatorList,
  10646. task,
  10647. stateManager,
  10648. localColorSpaceCache
  10649. );
  10650. });
  10651. gStateObj.push([key, true]);
  10652. } else {
  10653. (0, _util.warn)("Unsupported SMask type");
  10654. }
  10655. break;
  10656. case "TR":
  10657. const transferMaps = this.handleTransferFunction(value);
  10658. gStateObj.push([key, transferMaps]);
  10659. break;
  10660. case "OP":
  10661. case "op":
  10662. case "OPM":
  10663. case "BG":
  10664. case "BG2":
  10665. case "UCR":
  10666. case "UCR2":
  10667. case "TR2":
  10668. case "HT":
  10669. case "SM":
  10670. case "SA":
  10671. case "AIS":
  10672. case "TK":
  10673. (0, _util.info)("graphic state operator " + key);
  10674. break;
  10675. default:
  10676. (0, _util.info)("Unknown graphic state operator " + key);
  10677. break;
  10678. }
  10679. }
  10680. return promise.then(function () {
  10681. if (gStateObj.length > 0) {
  10682. operatorList.addOp(_util.OPS.setGState, [gStateObj]);
  10683. }
  10684. if (isSimpleGState) {
  10685. localGStateCache.set(cacheKey, gStateRef, gStateObj);
  10686. }
  10687. });
  10688. }
  10689. loadFont(
  10690. fontName,
  10691. font,
  10692. resources,
  10693. fallbackFontDict = null,
  10694. cssFontInfo = null
  10695. ) {
  10696. const errorFont = async () => {
  10697. return new TranslatedFont({
  10698. loadedName: "g_font_error",
  10699. font: new _fonts.ErrorFont(
  10700. `Font "${fontName}" is not available.`
  10701. ),
  10702. dict: font,
  10703. evaluatorOptions: this.options,
  10704. });
  10705. };
  10706. const xref = this.xref;
  10707. let fontRef;
  10708. if (font) {
  10709. if (font instanceof _primitives.Ref) {
  10710. fontRef = font;
  10711. }
  10712. } else {
  10713. const fontRes = resources.get("Font");
  10714. if (fontRes) {
  10715. fontRef = fontRes.getRaw(fontName);
  10716. }
  10717. }
  10718. if (!fontRef) {
  10719. const partialMsg = `Font "${
  10720. fontName || (font && font.toString())
  10721. }" is not available`;
  10722. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  10723. (0, _util.warn)(`${partialMsg}.`);
  10724. return errorFont();
  10725. }
  10726. this.handler.send("UnsupportedFeature", {
  10727. featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing,
  10728. });
  10729. (0, _util.warn)(
  10730. `${partialMsg} -- attempting to fallback to a default font.`
  10731. );
  10732. if (fallbackFontDict) {
  10733. fontRef = fallbackFontDict;
  10734. } else {
  10735. fontRef = PartialEvaluator.fallbackFontDict;
  10736. }
  10737. }
  10738. if (this.parsingType3Font && this.type3FontRefs.has(fontRef)) {
  10739. return errorFont();
  10740. }
  10741. if (this.fontCache.has(fontRef)) {
  10742. return this.fontCache.get(fontRef);
  10743. }
  10744. font = xref.fetchIfRef(fontRef);
  10745. if (!(font instanceof _primitives.Dict)) {
  10746. return errorFont();
  10747. }
  10748. if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
  10749. return this.fontCache.get(font.cacheKey);
  10750. }
  10751. const fontCapability = (0, _util.createPromiseCapability)();
  10752. let preEvaluatedFont;
  10753. try {
  10754. preEvaluatedFont = this.preEvaluateFont(font);
  10755. preEvaluatedFont.cssFontInfo = cssFontInfo;
  10756. } catch (reason) {
  10757. (0, _util.warn)(
  10758. `loadFont - preEvaluateFont failed: "${reason}".`
  10759. );
  10760. return errorFont();
  10761. }
  10762. const { descriptor, hash } = preEvaluatedFont;
  10763. const fontRefIsRef = fontRef instanceof _primitives.Ref;
  10764. let fontID;
  10765. if (fontRefIsRef) {
  10766. fontID = `f${fontRef.toString()}`;
  10767. }
  10768. if (hash && descriptor instanceof _primitives.Dict) {
  10769. if (!descriptor.fontAliases) {
  10770. descriptor.fontAliases = Object.create(null);
  10771. }
  10772. const fontAliases = descriptor.fontAliases;
  10773. if (fontAliases[hash]) {
  10774. const aliasFontRef = fontAliases[hash].aliasRef;
  10775. if (
  10776. fontRefIsRef &&
  10777. aliasFontRef &&
  10778. this.fontCache.has(aliasFontRef)
  10779. ) {
  10780. this.fontCache.putAlias(fontRef, aliasFontRef);
  10781. return this.fontCache.get(fontRef);
  10782. }
  10783. } else {
  10784. fontAliases[hash] = {
  10785. fontID: this.idFactory.createFontId(),
  10786. };
  10787. }
  10788. if (fontRefIsRef) {
  10789. fontAliases[hash].aliasRef = fontRef;
  10790. }
  10791. fontID = fontAliases[hash].fontID;
  10792. }
  10793. if (fontRefIsRef) {
  10794. this.fontCache.put(fontRef, fontCapability.promise);
  10795. } else {
  10796. if (!fontID) {
  10797. fontID = this.idFactory.createFontId();
  10798. }
  10799. font.cacheKey = `cacheKey_${fontID}`;
  10800. this.fontCache.put(font.cacheKey, fontCapability.promise);
  10801. }
  10802. (0, _util.assert)(
  10803. fontID && fontID.startsWith("f"),
  10804. 'The "fontID" must be (correctly) defined.'
  10805. );
  10806. font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
  10807. this.translateFont(preEvaluatedFont)
  10808. .then((translatedFont) => {
  10809. if (translatedFont.fontType !== undefined) {
  10810. xref.stats.addFontType(translatedFont.fontType);
  10811. }
  10812. fontCapability.resolve(
  10813. new TranslatedFont({
  10814. loadedName: font.loadedName,
  10815. font: translatedFont,
  10816. dict: font,
  10817. evaluatorOptions: this.options,
  10818. })
  10819. );
  10820. })
  10821. .catch((reason) => {
  10822. this.handler.send("UnsupportedFeature", {
  10823. featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate,
  10824. });
  10825. (0, _util.warn)(
  10826. `loadFont - translateFont failed: "${reason}".`
  10827. );
  10828. try {
  10829. const fontFile3 = descriptor && descriptor.get("FontFile3");
  10830. const subtype = fontFile3 && fontFile3.get("Subtype");
  10831. const fontType = (0, _fonts_utils.getFontType)(
  10832. preEvaluatedFont.type,
  10833. subtype && subtype.name
  10834. );
  10835. if (fontType !== undefined) {
  10836. xref.stats.addFontType(fontType);
  10837. }
  10838. } catch (ex) {}
  10839. fontCapability.resolve(
  10840. new TranslatedFont({
  10841. loadedName: font.loadedName,
  10842. font: new _fonts.ErrorFont(
  10843. reason instanceof Error ? reason.message : reason
  10844. ),
  10845. dict: font,
  10846. evaluatorOptions: this.options,
  10847. })
  10848. );
  10849. });
  10850. return fontCapability.promise;
  10851. }
  10852. buildPath(operatorList, fn, args, parsingText = false) {
  10853. const lastIndex = operatorList.length - 1;
  10854. if (!args) {
  10855. args = [];
  10856. }
  10857. let minMax;
  10858. if (
  10859. lastIndex < 0 ||
  10860. operatorList.fnArray[lastIndex] !== _util.OPS.constructPath
  10861. ) {
  10862. if (parsingText) {
  10863. (0, _util.warn)(
  10864. `Encountered path operator "${fn}" inside of a text object.`
  10865. );
  10866. operatorList.addOp(_util.OPS.save, null);
  10867. }
  10868. minMax = [Infinity, -Infinity, Infinity, -Infinity];
  10869. operatorList.addOp(_util.OPS.constructPath, [[fn], args, minMax]);
  10870. if (parsingText) {
  10871. operatorList.addOp(_util.OPS.restore, null);
  10872. }
  10873. } else {
  10874. const opArgs = operatorList.argsArray[lastIndex];
  10875. opArgs[0].push(fn);
  10876. Array.prototype.push.apply(opArgs[1], args);
  10877. minMax = opArgs[2];
  10878. }
  10879. switch (fn) {
  10880. case _util.OPS.rectangle:
  10881. minMax[0] = Math.min(minMax[0], args[0], args[0] + args[2]);
  10882. minMax[1] = Math.max(minMax[1], args[0], args[0] + args[2]);
  10883. minMax[2] = Math.min(minMax[2], args[1], args[1] + args[3]);
  10884. minMax[3] = Math.max(minMax[3], args[1], args[1] + args[3]);
  10885. break;
  10886. case _util.OPS.moveTo:
  10887. case _util.OPS.lineTo:
  10888. minMax[0] = Math.min(minMax[0], args[0]);
  10889. minMax[1] = Math.max(minMax[1], args[0]);
  10890. minMax[2] = Math.min(minMax[2], args[1]);
  10891. minMax[3] = Math.max(minMax[3], args[1]);
  10892. break;
  10893. }
  10894. }
  10895. parseColorSpace({ cs, resources, localColorSpaceCache }) {
  10896. return _colorspace.ColorSpace.parseAsync({
  10897. cs,
  10898. xref: this.xref,
  10899. resources,
  10900. pdfFunctionFactory: this._pdfFunctionFactory,
  10901. localColorSpaceCache,
  10902. }).catch((reason) => {
  10903. if (reason instanceof _util.AbortException) {
  10904. return null;
  10905. }
  10906. if (this.options.ignoreErrors) {
  10907. this.handler.send("UnsupportedFeature", {
  10908. featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace,
  10909. });
  10910. (0, _util.warn)(
  10911. `parseColorSpace - ignoring ColorSpace: "${reason}".`
  10912. );
  10913. return null;
  10914. }
  10915. throw reason;
  10916. });
  10917. }
  10918. parseShading({
  10919. shading,
  10920. resources,
  10921. localColorSpaceCache,
  10922. localShadingPatternCache,
  10923. }) {
  10924. let id = localShadingPatternCache.get(shading);
  10925. if (!id) {
  10926. var shadingFill = _pattern.Pattern.parseShading(
  10927. shading,
  10928. this.xref,
  10929. resources,
  10930. this.handler,
  10931. this._pdfFunctionFactory,
  10932. localColorSpaceCache
  10933. );
  10934. const patternIR = shadingFill.getIR();
  10935. id = `pattern_${this.idFactory.createObjId()}`;
  10936. localShadingPatternCache.set(shading, id);
  10937. this.handler.send("obj", [
  10938. id,
  10939. this.pageIndex,
  10940. "Pattern",
  10941. patternIR,
  10942. ]);
  10943. }
  10944. return id;
  10945. }
  10946. handleColorN(
  10947. operatorList,
  10948. fn,
  10949. args,
  10950. cs,
  10951. patterns,
  10952. resources,
  10953. task,
  10954. localColorSpaceCache,
  10955. localTilingPatternCache,
  10956. localShadingPatternCache
  10957. ) {
  10958. const patternName = args.pop();
  10959. if (patternName instanceof _primitives.Name) {
  10960. const rawPattern = patterns.getRaw(patternName.name);
  10961. const localTilingPattern =
  10962. rawPattern instanceof _primitives.Ref &&
  10963. localTilingPatternCache.getByRef(rawPattern);
  10964. if (localTilingPattern) {
  10965. try {
  10966. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  10967. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(
  10968. localTilingPattern.operatorListIR,
  10969. localTilingPattern.dict,
  10970. color
  10971. );
  10972. operatorList.addOp(fn, tilingPatternIR);
  10973. return undefined;
  10974. } catch (ex) {}
  10975. }
  10976. const pattern = this.xref.fetchIfRef(rawPattern);
  10977. if (pattern) {
  10978. const dict =
  10979. pattern instanceof _base_stream.BaseStream
  10980. ? pattern.dict
  10981. : pattern;
  10982. const typeNum = dict.get("PatternType");
  10983. if (typeNum === PatternType.TILING) {
  10984. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  10985. return this.handleTilingType(
  10986. fn,
  10987. color,
  10988. resources,
  10989. pattern,
  10990. dict,
  10991. operatorList,
  10992. task,
  10993. localTilingPatternCache
  10994. );
  10995. } else if (typeNum === PatternType.SHADING) {
  10996. const shading = dict.get("Shading");
  10997. const matrix = dict.getArray("Matrix");
  10998. const objId = this.parseShading({
  10999. shading,
  11000. resources,
  11001. localColorSpaceCache,
  11002. localShadingPatternCache,
  11003. });
  11004. operatorList.addOp(fn, ["Shading", objId, matrix]);
  11005. return undefined;
  11006. }
  11007. throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
  11008. }
  11009. }
  11010. throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
  11011. }
  11012. _parseVisibilityExpression(array, nestingCounter, currentResult) {
  11013. const MAX_NESTING = 10;
  11014. if (++nestingCounter > MAX_NESTING) {
  11015. (0, _util.warn)("Visibility expression is too deeply nested");
  11016. return;
  11017. }
  11018. const length = array.length;
  11019. const operator = this.xref.fetchIfRef(array[0]);
  11020. if (length < 2 || !(operator instanceof _primitives.Name)) {
  11021. (0, _util.warn)("Invalid visibility expression");
  11022. return;
  11023. }
  11024. switch (operator.name) {
  11025. case "And":
  11026. case "Or":
  11027. case "Not":
  11028. currentResult.push(operator.name);
  11029. break;
  11030. default:
  11031. (0, _util.warn)(
  11032. `Invalid operator ${operator.name} in visibility expression`
  11033. );
  11034. return;
  11035. }
  11036. for (let i = 1; i < length; i++) {
  11037. const raw = array[i];
  11038. const object = this.xref.fetchIfRef(raw);
  11039. if (Array.isArray(object)) {
  11040. const nestedResult = [];
  11041. currentResult.push(nestedResult);
  11042. this._parseVisibilityExpression(
  11043. object,
  11044. nestingCounter,
  11045. nestedResult
  11046. );
  11047. } else if (raw instanceof _primitives.Ref) {
  11048. currentResult.push(raw.toString());
  11049. }
  11050. }
  11051. }
  11052. async parseMarkedContentProps(contentProperties, resources) {
  11053. let optionalContent;
  11054. if (contentProperties instanceof _primitives.Name) {
  11055. const properties = resources.get("Properties");
  11056. optionalContent = properties.get(contentProperties.name);
  11057. } else if (contentProperties instanceof _primitives.Dict) {
  11058. optionalContent = contentProperties;
  11059. } else {
  11060. throw new _util.FormatError(
  11061. "Optional content properties malformed."
  11062. );
  11063. }
  11064. const optionalContentType = optionalContent.get("Type").name;
  11065. if (optionalContentType === "OCG") {
  11066. return {
  11067. type: optionalContentType,
  11068. id: optionalContent.objId,
  11069. };
  11070. } else if (optionalContentType === "OCMD") {
  11071. const expression = optionalContent.get("VE");
  11072. if (Array.isArray(expression)) {
  11073. const result = [];
  11074. this._parseVisibilityExpression(expression, 0, result);
  11075. if (result.length > 0) {
  11076. return {
  11077. type: "OCMD",
  11078. expression: result,
  11079. };
  11080. }
  11081. }
  11082. const optionalContentGroups = optionalContent.get("OCGs");
  11083. if (
  11084. Array.isArray(optionalContentGroups) ||
  11085. optionalContentGroups instanceof _primitives.Dict
  11086. ) {
  11087. const groupIds = [];
  11088. if (Array.isArray(optionalContentGroups)) {
  11089. for (const ocg of optionalContentGroups) {
  11090. groupIds.push(ocg.toString());
  11091. }
  11092. } else {
  11093. groupIds.push(optionalContentGroups.objId);
  11094. }
  11095. return {
  11096. type: optionalContentType,
  11097. ids: groupIds,
  11098. policy:
  11099. optionalContent.get("P") instanceof _primitives.Name
  11100. ? optionalContent.get("P").name
  11101. : null,
  11102. expression: null,
  11103. };
  11104. } else if (optionalContentGroups instanceof _primitives.Ref) {
  11105. return {
  11106. type: optionalContentType,
  11107. id: optionalContentGroups.toString(),
  11108. };
  11109. }
  11110. }
  11111. return null;
  11112. }
  11113. getOperatorList({
  11114. stream,
  11115. task,
  11116. resources,
  11117. operatorList,
  11118. initialState = null,
  11119. fallbackFontDict = null,
  11120. }) {
  11121. resources = resources || _primitives.Dict.empty;
  11122. initialState = initialState || new EvalState();
  11123. if (!operatorList) {
  11124. throw new Error(
  11125. 'getOperatorList: missing "operatorList" parameter'
  11126. );
  11127. }
  11128. const self = this;
  11129. const xref = this.xref;
  11130. let parsingText = false;
  11131. const localImageCache = new _image_utils.LocalImageCache();
  11132. const localColorSpaceCache =
  11133. new _image_utils.LocalColorSpaceCache();
  11134. const localGStateCache = new _image_utils.LocalGStateCache();
  11135. const localTilingPatternCache =
  11136. new _image_utils.LocalTilingPatternCache();
  11137. const localShadingPatternCache = new Map();
  11138. const xobjs = resources.get("XObject") || _primitives.Dict.empty;
  11139. const patterns = resources.get("Pattern") || _primitives.Dict.empty;
  11140. const stateManager = new StateManager(initialState);
  11141. const preprocessor = new EvaluatorPreprocessor(
  11142. stream,
  11143. xref,
  11144. stateManager
  11145. );
  11146. const timeSlotManager = new TimeSlotManager();
  11147. function closePendingRestoreOPS(argument) {
  11148. for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  11149. operatorList.addOp(_util.OPS.restore, []);
  11150. }
  11151. }
  11152. return new Promise(function promiseBody(resolve, reject) {
  11153. const next = function (promise) {
  11154. Promise.all([promise, operatorList.ready]).then(function () {
  11155. try {
  11156. promiseBody(resolve, reject);
  11157. } catch (ex) {
  11158. reject(ex);
  11159. }
  11160. }, reject);
  11161. };
  11162. task.ensureNotTerminated();
  11163. timeSlotManager.reset();
  11164. const operation = {};
  11165. let stop, i, ii, cs, name, isValidName;
  11166. while (!(stop = timeSlotManager.check())) {
  11167. operation.args = null;
  11168. if (!preprocessor.read(operation)) {
  11169. break;
  11170. }
  11171. let args = operation.args;
  11172. let fn = operation.fn;
  11173. switch (fn | 0) {
  11174. case _util.OPS.paintXObject:
  11175. isValidName = args[0] instanceof _primitives.Name;
  11176. name = args[0].name;
  11177. if (isValidName) {
  11178. const localImage = localImageCache.getByName(name);
  11179. if (localImage) {
  11180. operatorList.addImageOps(
  11181. localImage.fn,
  11182. localImage.args,
  11183. localImage.optionalContent
  11184. );
  11185. incrementCachedImageMaskCount(localImage);
  11186. args = null;
  11187. continue;
  11188. }
  11189. }
  11190. next(
  11191. new Promise(function (resolveXObject, rejectXObject) {
  11192. if (!isValidName) {
  11193. throw new _util.FormatError(
  11194. "XObject must be referred to by name."
  11195. );
  11196. }
  11197. let xobj = xobjs.getRaw(name);
  11198. if (xobj instanceof _primitives.Ref) {
  11199. const localImage = localImageCache.getByRef(xobj);
  11200. if (localImage) {
  11201. operatorList.addImageOps(
  11202. localImage.fn,
  11203. localImage.args,
  11204. localImage.optionalContent
  11205. );
  11206. incrementCachedImageMaskCount(localImage);
  11207. resolveXObject();
  11208. return;
  11209. }
  11210. const globalImage = self.globalImageCache.getData(
  11211. xobj,
  11212. self.pageIndex
  11213. );
  11214. if (globalImage) {
  11215. operatorList.addDependency(globalImage.objId);
  11216. operatorList.addImageOps(
  11217. globalImage.fn,
  11218. globalImage.args,
  11219. globalImage.optionalContent
  11220. );
  11221. resolveXObject();
  11222. return;
  11223. }
  11224. xobj = xref.fetch(xobj);
  11225. }
  11226. if (!(xobj instanceof _base_stream.BaseStream)) {
  11227. throw new _util.FormatError(
  11228. "XObject should be a stream"
  11229. );
  11230. }
  11231. const type = xobj.dict.get("Subtype");
  11232. if (!(type instanceof _primitives.Name)) {
  11233. throw new _util.FormatError(
  11234. "XObject should have a Name subtype"
  11235. );
  11236. }
  11237. if (type.name === "Form") {
  11238. stateManager.save();
  11239. self
  11240. .buildFormXObject(
  11241. resources,
  11242. xobj,
  11243. null,
  11244. operatorList,
  11245. task,
  11246. stateManager.state.clone(),
  11247. localColorSpaceCache
  11248. )
  11249. .then(function () {
  11250. stateManager.restore();
  11251. resolveXObject();
  11252. }, rejectXObject);
  11253. return;
  11254. } else if (type.name === "Image") {
  11255. self
  11256. .buildPaintImageXObject({
  11257. resources,
  11258. image: xobj,
  11259. operatorList,
  11260. cacheKey: name,
  11261. localImageCache,
  11262. localColorSpaceCache,
  11263. })
  11264. .then(resolveXObject, rejectXObject);
  11265. return;
  11266. } else if (type.name === "PS") {
  11267. (0, _util.info)("Ignored XObject subtype PS");
  11268. } else {
  11269. throw new _util.FormatError(
  11270. `Unhandled XObject subtype ${type.name}`
  11271. );
  11272. }
  11273. resolveXObject();
  11274. }).catch(function (reason) {
  11275. if (reason instanceof _util.AbortException) {
  11276. return;
  11277. }
  11278. if (self.options.ignoreErrors) {
  11279. self.handler.send("UnsupportedFeature", {
  11280. featureId: _util.UNSUPPORTED_FEATURES.errorXObject,
  11281. });
  11282. (0, _util.warn)(
  11283. `getOperatorList - ignoring XObject: "${reason}".`
  11284. );
  11285. return;
  11286. }
  11287. throw reason;
  11288. })
  11289. );
  11290. return;
  11291. case _util.OPS.setFont:
  11292. var fontSize = args[1];
  11293. next(
  11294. self
  11295. .handleSetFont(
  11296. resources,
  11297. args,
  11298. null,
  11299. operatorList,
  11300. task,
  11301. stateManager.state,
  11302. fallbackFontDict
  11303. )
  11304. .then(function (loadedName) {
  11305. operatorList.addDependency(loadedName);
  11306. operatorList.addOp(_util.OPS.setFont, [
  11307. loadedName,
  11308. fontSize,
  11309. ]);
  11310. })
  11311. );
  11312. return;
  11313. case _util.OPS.beginText:
  11314. parsingText = true;
  11315. break;
  11316. case _util.OPS.endText:
  11317. parsingText = false;
  11318. break;
  11319. case _util.OPS.endInlineImage:
  11320. var cacheKey = args[0].cacheKey;
  11321. if (cacheKey) {
  11322. const localImage = localImageCache.getByName(cacheKey);
  11323. if (localImage) {
  11324. operatorList.addImageOps(
  11325. localImage.fn,
  11326. localImage.args,
  11327. localImage.optionalContent
  11328. );
  11329. incrementCachedImageMaskCount(localImage);
  11330. args = null;
  11331. continue;
  11332. }
  11333. }
  11334. next(
  11335. self.buildPaintImageXObject({
  11336. resources,
  11337. image: args[0],
  11338. isInline: true,
  11339. operatorList,
  11340. cacheKey,
  11341. localImageCache,
  11342. localColorSpaceCache,
  11343. })
  11344. );
  11345. return;
  11346. case _util.OPS.showText:
  11347. if (!stateManager.state.font) {
  11348. self.ensureStateFont(stateManager.state);
  11349. continue;
  11350. }
  11351. args[0] = self.handleText(args[0], stateManager.state);
  11352. break;
  11353. case _util.OPS.showSpacedText:
  11354. if (!stateManager.state.font) {
  11355. self.ensureStateFont(stateManager.state);
  11356. continue;
  11357. }
  11358. var arr = args[0];
  11359. var combinedGlyphs = [];
  11360. var arrLength = arr.length;
  11361. var state = stateManager.state;
  11362. for (i = 0; i < arrLength; ++i) {
  11363. const arrItem = arr[i];
  11364. if (typeof arrItem === "string") {
  11365. Array.prototype.push.apply(
  11366. combinedGlyphs,
  11367. self.handleText(arrItem, state)
  11368. );
  11369. } else if (typeof arrItem === "number") {
  11370. combinedGlyphs.push(arrItem);
  11371. }
  11372. }
  11373. args[0] = combinedGlyphs;
  11374. fn = _util.OPS.showText;
  11375. break;
  11376. case _util.OPS.nextLineShowText:
  11377. if (!stateManager.state.font) {
  11378. self.ensureStateFont(stateManager.state);
  11379. continue;
  11380. }
  11381. operatorList.addOp(_util.OPS.nextLine);
  11382. args[0] = self.handleText(args[0], stateManager.state);
  11383. fn = _util.OPS.showText;
  11384. break;
  11385. case _util.OPS.nextLineSetSpacingShowText:
  11386. if (!stateManager.state.font) {
  11387. self.ensureStateFont(stateManager.state);
  11388. continue;
  11389. }
  11390. operatorList.addOp(_util.OPS.nextLine);
  11391. operatorList.addOp(_util.OPS.setWordSpacing, [
  11392. args.shift(),
  11393. ]);
  11394. operatorList.addOp(_util.OPS.setCharSpacing, [
  11395. args.shift(),
  11396. ]);
  11397. args[0] = self.handleText(args[0], stateManager.state);
  11398. fn = _util.OPS.showText;
  11399. break;
  11400. case _util.OPS.setTextRenderingMode:
  11401. stateManager.state.textRenderingMode = args[0];
  11402. break;
  11403. case _util.OPS.setFillColorSpace: {
  11404. const cachedColorSpace = _colorspace.ColorSpace.getCached(
  11405. args[0],
  11406. xref,
  11407. localColorSpaceCache
  11408. );
  11409. if (cachedColorSpace) {
  11410. stateManager.state.fillColorSpace = cachedColorSpace;
  11411. continue;
  11412. }
  11413. next(
  11414. self
  11415. .parseColorSpace({
  11416. cs: args[0],
  11417. resources,
  11418. localColorSpaceCache,
  11419. })
  11420. .then(function (colorSpace) {
  11421. if (colorSpace) {
  11422. stateManager.state.fillColorSpace = colorSpace;
  11423. }
  11424. })
  11425. );
  11426. return;
  11427. }
  11428. case _util.OPS.setStrokeColorSpace: {
  11429. const cachedColorSpace = _colorspace.ColorSpace.getCached(
  11430. args[0],
  11431. xref,
  11432. localColorSpaceCache
  11433. );
  11434. if (cachedColorSpace) {
  11435. stateManager.state.strokeColorSpace = cachedColorSpace;
  11436. continue;
  11437. }
  11438. next(
  11439. self
  11440. .parseColorSpace({
  11441. cs: args[0],
  11442. resources,
  11443. localColorSpaceCache,
  11444. })
  11445. .then(function (colorSpace) {
  11446. if (colorSpace) {
  11447. stateManager.state.strokeColorSpace = colorSpace;
  11448. }
  11449. })
  11450. );
  11451. return;
  11452. }
  11453. case _util.OPS.setFillColor:
  11454. cs = stateManager.state.fillColorSpace;
  11455. args = cs.getRgb(args, 0);
  11456. fn = _util.OPS.setFillRGBColor;
  11457. break;
  11458. case _util.OPS.setStrokeColor:
  11459. cs = stateManager.state.strokeColorSpace;
  11460. args = cs.getRgb(args, 0);
  11461. fn = _util.OPS.setStrokeRGBColor;
  11462. break;
  11463. case _util.OPS.setFillGray:
  11464. stateManager.state.fillColorSpace =
  11465. _colorspace.ColorSpace.singletons.gray;
  11466. args = _colorspace.ColorSpace.singletons.gray.getRgb(
  11467. args,
  11468. 0
  11469. );
  11470. fn = _util.OPS.setFillRGBColor;
  11471. break;
  11472. case _util.OPS.setStrokeGray:
  11473. stateManager.state.strokeColorSpace =
  11474. _colorspace.ColorSpace.singletons.gray;
  11475. args = _colorspace.ColorSpace.singletons.gray.getRgb(
  11476. args,
  11477. 0
  11478. );
  11479. fn = _util.OPS.setStrokeRGBColor;
  11480. break;
  11481. case _util.OPS.setFillCMYKColor:
  11482. stateManager.state.fillColorSpace =
  11483. _colorspace.ColorSpace.singletons.cmyk;
  11484. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(
  11485. args,
  11486. 0
  11487. );
  11488. fn = _util.OPS.setFillRGBColor;
  11489. break;
  11490. case _util.OPS.setStrokeCMYKColor:
  11491. stateManager.state.strokeColorSpace =
  11492. _colorspace.ColorSpace.singletons.cmyk;
  11493. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(
  11494. args,
  11495. 0
  11496. );
  11497. fn = _util.OPS.setStrokeRGBColor;
  11498. break;
  11499. case _util.OPS.setFillRGBColor:
  11500. stateManager.state.fillColorSpace =
  11501. _colorspace.ColorSpace.singletons.rgb;
  11502. args = _colorspace.ColorSpace.singletons.rgb.getRgb(
  11503. args,
  11504. 0
  11505. );
  11506. break;
  11507. case _util.OPS.setStrokeRGBColor:
  11508. stateManager.state.strokeColorSpace =
  11509. _colorspace.ColorSpace.singletons.rgb;
  11510. args = _colorspace.ColorSpace.singletons.rgb.getRgb(
  11511. args,
  11512. 0
  11513. );
  11514. break;
  11515. case _util.OPS.setFillColorN:
  11516. cs = stateManager.state.fillColorSpace;
  11517. if (cs.name === "Pattern") {
  11518. next(
  11519. self.handleColorN(
  11520. operatorList,
  11521. _util.OPS.setFillColorN,
  11522. args,
  11523. cs,
  11524. patterns,
  11525. resources,
  11526. task,
  11527. localColorSpaceCache,
  11528. localTilingPatternCache,
  11529. localShadingPatternCache
  11530. )
  11531. );
  11532. return;
  11533. }
  11534. args = cs.getRgb(args, 0);
  11535. fn = _util.OPS.setFillRGBColor;
  11536. break;
  11537. case _util.OPS.setStrokeColorN:
  11538. cs = stateManager.state.strokeColorSpace;
  11539. if (cs.name === "Pattern") {
  11540. next(
  11541. self.handleColorN(
  11542. operatorList,
  11543. _util.OPS.setStrokeColorN,
  11544. args,
  11545. cs,
  11546. patterns,
  11547. resources,
  11548. task,
  11549. localColorSpaceCache,
  11550. localTilingPatternCache,
  11551. localShadingPatternCache
  11552. )
  11553. );
  11554. return;
  11555. }
  11556. args = cs.getRgb(args, 0);
  11557. fn = _util.OPS.setStrokeRGBColor;
  11558. break;
  11559. case _util.OPS.shadingFill:
  11560. var shadingRes = resources.get("Shading");
  11561. if (!shadingRes) {
  11562. throw new _util.FormatError("No shading resource found");
  11563. }
  11564. var shading = shadingRes.get(args[0].name);
  11565. if (!shading) {
  11566. throw new _util.FormatError("No shading object found");
  11567. }
  11568. const patternId = self.parseShading({
  11569. shading,
  11570. resources,
  11571. localColorSpaceCache,
  11572. localShadingPatternCache,
  11573. });
  11574. args = [patternId];
  11575. fn = _util.OPS.shadingFill;
  11576. break;
  11577. case _util.OPS.setGState:
  11578. isValidName = args[0] instanceof _primitives.Name;
  11579. name = args[0].name;
  11580. if (isValidName) {
  11581. const localGStateObj = localGStateCache.getByName(name);
  11582. if (localGStateObj) {
  11583. if (localGStateObj.length > 0) {
  11584. operatorList.addOp(_util.OPS.setGState, [
  11585. localGStateObj,
  11586. ]);
  11587. }
  11588. args = null;
  11589. continue;
  11590. }
  11591. }
  11592. next(
  11593. new Promise(function (resolveGState, rejectGState) {
  11594. if (!isValidName) {
  11595. throw new _util.FormatError(
  11596. "GState must be referred to by name."
  11597. );
  11598. }
  11599. const extGState = resources.get("ExtGState");
  11600. if (!(extGState instanceof _primitives.Dict)) {
  11601. throw new _util.FormatError(
  11602. "ExtGState should be a dictionary."
  11603. );
  11604. }
  11605. const gState = extGState.get(name);
  11606. if (!(gState instanceof _primitives.Dict)) {
  11607. throw new _util.FormatError(
  11608. "GState should be a dictionary."
  11609. );
  11610. }
  11611. self
  11612. .setGState({
  11613. resources,
  11614. gState,
  11615. operatorList,
  11616. cacheKey: name,
  11617. task,
  11618. stateManager,
  11619. localGStateCache,
  11620. localColorSpaceCache,
  11621. })
  11622. .then(resolveGState, rejectGState);
  11623. }).catch(function (reason) {
  11624. if (reason instanceof _util.AbortException) {
  11625. return;
  11626. }
  11627. if (self.options.ignoreErrors) {
  11628. self.handler.send("UnsupportedFeature", {
  11629. featureId:
  11630. _util.UNSUPPORTED_FEATURES.errorExtGState,
  11631. });
  11632. (0, _util.warn)(
  11633. `getOperatorList - ignoring ExtGState: "${reason}".`
  11634. );
  11635. return;
  11636. }
  11637. throw reason;
  11638. })
  11639. );
  11640. return;
  11641. case _util.OPS.moveTo:
  11642. case _util.OPS.lineTo:
  11643. case _util.OPS.curveTo:
  11644. case _util.OPS.curveTo2:
  11645. case _util.OPS.curveTo3:
  11646. case _util.OPS.closePath:
  11647. case _util.OPS.rectangle:
  11648. self.buildPath(operatorList, fn, args, parsingText);
  11649. continue;
  11650. case _util.OPS.markPoint:
  11651. case _util.OPS.markPointProps:
  11652. case _util.OPS.beginCompat:
  11653. case _util.OPS.endCompat:
  11654. continue;
  11655. case _util.OPS.beginMarkedContentProps:
  11656. if (!(args[0] instanceof _primitives.Name)) {
  11657. (0, _util.warn)(
  11658. `Expected name for beginMarkedContentProps arg0=${args[0]}`
  11659. );
  11660. continue;
  11661. }
  11662. if (args[0].name === "OC") {
  11663. next(
  11664. self
  11665. .parseMarkedContentProps(args[1], resources)
  11666. .then((data) => {
  11667. operatorList.addOp(
  11668. _util.OPS.beginMarkedContentProps,
  11669. ["OC", data]
  11670. );
  11671. })
  11672. .catch((reason) => {
  11673. if (reason instanceof _util.AbortException) {
  11674. return;
  11675. }
  11676. if (self.options.ignoreErrors) {
  11677. self.handler.send("UnsupportedFeature", {
  11678. featureId:
  11679. _util.UNSUPPORTED_FEATURES.errorMarkedContent,
  11680. });
  11681. (0, _util.warn)(
  11682. `getOperatorList - ignoring beginMarkedContentProps: "${reason}".`
  11683. );
  11684. return;
  11685. }
  11686. throw reason;
  11687. })
  11688. );
  11689. return;
  11690. }
  11691. args = [
  11692. args[0].name,
  11693. args[1] instanceof _primitives.Dict
  11694. ? args[1].get("MCID")
  11695. : null,
  11696. ];
  11697. break;
  11698. case _util.OPS.beginMarkedContent:
  11699. case _util.OPS.endMarkedContent:
  11700. default:
  11701. if (args !== null) {
  11702. for (i = 0, ii = args.length; i < ii; i++) {
  11703. if (args[i] instanceof _primitives.Dict) {
  11704. break;
  11705. }
  11706. }
  11707. if (i < ii) {
  11708. (0, _util.warn)(
  11709. "getOperatorList - ignoring operator: " + fn
  11710. );
  11711. continue;
  11712. }
  11713. }
  11714. }
  11715. operatorList.addOp(fn, args);
  11716. }
  11717. if (stop) {
  11718. next(deferred);
  11719. return;
  11720. }
  11721. closePendingRestoreOPS();
  11722. resolve();
  11723. }).catch((reason) => {
  11724. if (reason instanceof _util.AbortException) {
  11725. return;
  11726. }
  11727. if (this.options.ignoreErrors) {
  11728. this.handler.send("UnsupportedFeature", {
  11729. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList,
  11730. });
  11731. (0, _util.warn)(
  11732. `getOperatorList - ignoring errors during "${task.name}" ` +
  11733. `task: "${reason}".`
  11734. );
  11735. closePendingRestoreOPS();
  11736. return;
  11737. }
  11738. throw reason;
  11739. });
  11740. }
  11741. getTextContent({
  11742. stream,
  11743. task,
  11744. resources,
  11745. stateManager = null,
  11746. combineTextItems = false,
  11747. includeMarkedContent = false,
  11748. sink,
  11749. seenStyles = new Set(),
  11750. viewBox,
  11751. }) {
  11752. resources = resources || _primitives.Dict.empty;
  11753. stateManager = stateManager || new StateManager(new TextState());
  11754. const NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)();
  11755. const textContent = {
  11756. items: [],
  11757. styles: Object.create(null),
  11758. };
  11759. const textContentItem = {
  11760. initialized: false,
  11761. str: [],
  11762. totalWidth: 0,
  11763. totalHeight: 0,
  11764. width: 0,
  11765. height: 0,
  11766. vertical: false,
  11767. prevTransform: null,
  11768. textAdvanceScale: 0,
  11769. spaceInFlowMin: 0,
  11770. spaceInFlowMax: 0,
  11771. trackingSpaceMin: Infinity,
  11772. negativeSpaceMax: -Infinity,
  11773. notASpace: -Infinity,
  11774. transform: null,
  11775. fontName: null,
  11776. hasEOL: false,
  11777. };
  11778. const twoLastChars = [" ", " "];
  11779. let twoLastCharsPos = 0;
  11780. function saveLastChar(char) {
  11781. const nextPos = (twoLastCharsPos + 1) % 2;
  11782. const ret =
  11783. twoLastChars[twoLastCharsPos] !== " " &&
  11784. twoLastChars[nextPos] === " ";
  11785. twoLastChars[twoLastCharsPos] = char;
  11786. twoLastCharsPos = nextPos;
  11787. return ret;
  11788. }
  11789. function resetLastChars() {
  11790. twoLastChars[0] = twoLastChars[1] = " ";
  11791. twoLastCharsPos = 0;
  11792. }
  11793. const TRACKING_SPACE_FACTOR = 0.1;
  11794. const NOT_A_SPACE_FACTOR = 0.03;
  11795. const NEGATIVE_SPACE_FACTOR = -0.2;
  11796. const SPACE_IN_FLOW_MIN_FACTOR = 0.1;
  11797. const SPACE_IN_FLOW_MAX_FACTOR = 0.6;
  11798. const self = this;
  11799. const xref = this.xref;
  11800. const showSpacedTextBuffer = [];
  11801. let xobjs = null;
  11802. const emptyXObjectCache = new _image_utils.LocalImageCache();
  11803. const emptyGStateCache = new _image_utils.LocalGStateCache();
  11804. const preprocessor = new EvaluatorPreprocessor(
  11805. stream,
  11806. xref,
  11807. stateManager
  11808. );
  11809. let textState;
  11810. function getCurrentTextTransform() {
  11811. const font = textState.font;
  11812. const tsm = [
  11813. textState.fontSize * textState.textHScale,
  11814. 0,
  11815. 0,
  11816. textState.fontSize,
  11817. 0,
  11818. textState.textRise,
  11819. ];
  11820. if (
  11821. font.isType3Font &&
  11822. (textState.fontSize <= 1 || font.isCharBBox) &&
  11823. !(0, _util.isArrayEqual)(
  11824. textState.fontMatrix,
  11825. _util.FONT_IDENTITY_MATRIX
  11826. )
  11827. ) {
  11828. const glyphHeight = font.bbox[3] - font.bbox[1];
  11829. if (glyphHeight > 0) {
  11830. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  11831. }
  11832. }
  11833. return _util.Util.transform(
  11834. textState.ctm,
  11835. _util.Util.transform(textState.textMatrix, tsm)
  11836. );
  11837. }
  11838. function ensureTextContentItem() {
  11839. if (textContentItem.initialized) {
  11840. return textContentItem;
  11841. }
  11842. const font = textState.font,
  11843. loadedName = font.loadedName;
  11844. if (!seenStyles.has(loadedName)) {
  11845. seenStyles.add(loadedName);
  11846. textContent.styles[loadedName] = {
  11847. fontFamily: font.fallbackName,
  11848. ascent: font.ascent,
  11849. descent: font.descent,
  11850. vertical: font.vertical,
  11851. };
  11852. }
  11853. textContentItem.fontName = loadedName;
  11854. const trm = (textContentItem.transform =
  11855. getCurrentTextTransform());
  11856. if (!font.vertical) {
  11857. textContentItem.width = textContentItem.totalWidth = 0;
  11858. textContentItem.height = textContentItem.totalHeight =
  11859. Math.hypot(trm[2], trm[3]);
  11860. textContentItem.vertical = false;
  11861. } else {
  11862. textContentItem.width = textContentItem.totalWidth = Math.hypot(
  11863. trm[0],
  11864. trm[1]
  11865. );
  11866. textContentItem.height = textContentItem.totalHeight = 0;
  11867. textContentItem.vertical = true;
  11868. }
  11869. const scaleLineX = Math.hypot(
  11870. textState.textLineMatrix[0],
  11871. textState.textLineMatrix[1]
  11872. );
  11873. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  11874. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  11875. textContentItem.trackingSpaceMin =
  11876. textState.fontSize * TRACKING_SPACE_FACTOR;
  11877. textContentItem.notASpace =
  11878. textState.fontSize * NOT_A_SPACE_FACTOR;
  11879. textContentItem.negativeSpaceMax =
  11880. textState.fontSize * NEGATIVE_SPACE_FACTOR;
  11881. textContentItem.spaceInFlowMin =
  11882. textState.fontSize * SPACE_IN_FLOW_MIN_FACTOR;
  11883. textContentItem.spaceInFlowMax =
  11884. textState.fontSize * SPACE_IN_FLOW_MAX_FACTOR;
  11885. textContentItem.hasEOL = false;
  11886. textContentItem.initialized = true;
  11887. return textContentItem;
  11888. }
  11889. function updateAdvanceScale() {
  11890. if (!textContentItem.initialized) {
  11891. return;
  11892. }
  11893. const scaleLineX = Math.hypot(
  11894. textState.textLineMatrix[0],
  11895. textState.textLineMatrix[1]
  11896. );
  11897. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  11898. const scaleFactor = scaleCtmX * scaleLineX;
  11899. if (scaleFactor === textContentItem.textAdvanceScale) {
  11900. return;
  11901. }
  11902. if (!textContentItem.vertical) {
  11903. textContentItem.totalWidth +=
  11904. textContentItem.width * textContentItem.textAdvanceScale;
  11905. textContentItem.width = 0;
  11906. } else {
  11907. textContentItem.totalHeight +=
  11908. textContentItem.height * textContentItem.textAdvanceScale;
  11909. textContentItem.height = 0;
  11910. }
  11911. textContentItem.textAdvanceScale = scaleFactor;
  11912. }
  11913. function runBidiTransform(textChunk) {
  11914. const text = textChunk.str.join("");
  11915. const bidiResult = (0, _bidi.bidi)(text, -1, textChunk.vertical);
  11916. return {
  11917. str: bidiResult.str,
  11918. dir: bidiResult.dir,
  11919. width: Math.abs(textChunk.totalWidth),
  11920. height: Math.abs(textChunk.totalHeight),
  11921. transform: textChunk.transform,
  11922. fontName: textChunk.fontName,
  11923. hasEOL: textChunk.hasEOL,
  11924. };
  11925. }
  11926. function handleSetFont(fontName, fontRef) {
  11927. return self
  11928. .loadFont(fontName, fontRef, resources)
  11929. .then(function (translated) {
  11930. if (!translated.font.isType3Font) {
  11931. return translated;
  11932. }
  11933. return translated
  11934. .loadType3Data(self, resources, task)
  11935. .catch(function () {})
  11936. .then(function () {
  11937. return translated;
  11938. });
  11939. })
  11940. .then(function (translated) {
  11941. textState.font = translated.font;
  11942. textState.fontMatrix =
  11943. translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  11944. });
  11945. }
  11946. function applyInverseRotation(x, y, matrix) {
  11947. const scale = Math.hypot(matrix[0], matrix[1]);
  11948. return [
  11949. (matrix[0] * x + matrix[1] * y) / scale,
  11950. (matrix[2] * x + matrix[3] * y) / scale,
  11951. ];
  11952. }
  11953. function compareWithLastPosition() {
  11954. const currentTransform = getCurrentTextTransform();
  11955. let posX = currentTransform[4];
  11956. let posY = currentTransform[5];
  11957. const shiftedX = posX - viewBox[0];
  11958. const shiftedY = posY - viewBox[1];
  11959. if (
  11960. shiftedX < 0 ||
  11961. shiftedX > viewBox[2] ||
  11962. shiftedY < 0 ||
  11963. shiftedY > viewBox[3]
  11964. ) {
  11965. return false;
  11966. }
  11967. if (
  11968. !combineTextItems ||
  11969. !textState.font ||
  11970. !textContentItem.prevTransform
  11971. ) {
  11972. return true;
  11973. }
  11974. let lastPosX = textContentItem.prevTransform[4];
  11975. let lastPosY = textContentItem.prevTransform[5];
  11976. if (lastPosX === posX && lastPosY === posY) {
  11977. return true;
  11978. }
  11979. let rotate = -1;
  11980. if (
  11981. currentTransform[0] &&
  11982. currentTransform[1] === 0 &&
  11983. currentTransform[2] === 0
  11984. ) {
  11985. rotate = currentTransform[0] > 0 ? 0 : 180;
  11986. } else if (
  11987. currentTransform[1] &&
  11988. currentTransform[0] === 0 &&
  11989. currentTransform[3] === 0
  11990. ) {
  11991. rotate = currentTransform[1] > 0 ? 90 : 270;
  11992. }
  11993. switch (rotate) {
  11994. case 0:
  11995. break;
  11996. case 90:
  11997. [posX, posY] = [posY, posX];
  11998. [lastPosX, lastPosY] = [lastPosY, lastPosX];
  11999. break;
  12000. case 180:
  12001. [posX, posY, lastPosX, lastPosY] = [
  12002. -posX,
  12003. -posY,
  12004. -lastPosX,
  12005. -lastPosY,
  12006. ];
  12007. break;
  12008. case 270:
  12009. [posX, posY] = [-posY, -posX];
  12010. [lastPosX, lastPosY] = [-lastPosY, -lastPosX];
  12011. break;
  12012. default:
  12013. [posX, posY] = applyInverseRotation(
  12014. posX,
  12015. posY,
  12016. currentTransform
  12017. );
  12018. [lastPosX, lastPosY] = applyInverseRotation(
  12019. lastPosX,
  12020. lastPosY,
  12021. textContentItem.prevTransform
  12022. );
  12023. }
  12024. if (textState.font.vertical) {
  12025. const advanceY =
  12026. (lastPosY - posY) / textContentItem.textAdvanceScale;
  12027. const advanceX = posX - lastPosX;
  12028. const textOrientation = Math.sign(textContentItem.height);
  12029. if (
  12030. advanceY <
  12031. textOrientation * textContentItem.negativeSpaceMax
  12032. ) {
  12033. if (Math.abs(advanceX) > 0.5 * textContentItem.width) {
  12034. appendEOL();
  12035. return true;
  12036. }
  12037. resetLastChars();
  12038. flushTextContentItem();
  12039. return true;
  12040. }
  12041. if (Math.abs(advanceX) > textContentItem.width) {
  12042. appendEOL();
  12043. return true;
  12044. }
  12045. if (advanceY <= textOrientation * textContentItem.notASpace) {
  12046. resetLastChars();
  12047. }
  12048. if (
  12049. advanceY <=
  12050. textOrientation * textContentItem.trackingSpaceMin
  12051. ) {
  12052. textContentItem.height += advanceY;
  12053. } else if (
  12054. !addFakeSpaces(
  12055. advanceY,
  12056. textContentItem.prevTransform,
  12057. textOrientation
  12058. )
  12059. ) {
  12060. if (textContentItem.str.length === 0) {
  12061. resetLastChars();
  12062. textContent.items.push({
  12063. str: " ",
  12064. dir: "ltr",
  12065. width: 0,
  12066. height: Math.abs(advanceY),
  12067. transform: textContentItem.prevTransform,
  12068. fontName: textContentItem.fontName,
  12069. hasEOL: false,
  12070. });
  12071. } else {
  12072. textContentItem.height += advanceY;
  12073. }
  12074. }
  12075. return true;
  12076. }
  12077. const advanceX =
  12078. (posX - lastPosX) / textContentItem.textAdvanceScale;
  12079. const advanceY = posY - lastPosY;
  12080. const textOrientation = Math.sign(textContentItem.width);
  12081. if (
  12082. advanceX <
  12083. textOrientation * textContentItem.negativeSpaceMax
  12084. ) {
  12085. if (Math.abs(advanceY) > 0.5 * textContentItem.height) {
  12086. appendEOL();
  12087. return true;
  12088. }
  12089. resetLastChars();
  12090. flushTextContentItem();
  12091. return true;
  12092. }
  12093. if (Math.abs(advanceY) > textContentItem.height) {
  12094. appendEOL();
  12095. return true;
  12096. }
  12097. if (advanceX <= textOrientation * textContentItem.notASpace) {
  12098. resetLastChars();
  12099. }
  12100. if (
  12101. advanceX <=
  12102. textOrientation * textContentItem.trackingSpaceMin
  12103. ) {
  12104. textContentItem.width += advanceX;
  12105. } else if (
  12106. !addFakeSpaces(
  12107. advanceX,
  12108. textContentItem.prevTransform,
  12109. textOrientation
  12110. )
  12111. ) {
  12112. if (textContentItem.str.length === 0) {
  12113. resetLastChars();
  12114. textContent.items.push({
  12115. str: " ",
  12116. dir: "ltr",
  12117. width: Math.abs(advanceX),
  12118. height: 0,
  12119. transform: textContentItem.prevTransform,
  12120. fontName: textContentItem.fontName,
  12121. hasEOL: false,
  12122. });
  12123. } else {
  12124. textContentItem.width += advanceX;
  12125. }
  12126. }
  12127. return true;
  12128. }
  12129. function buildTextContentItem({ chars, extraSpacing }) {
  12130. const font = textState.font;
  12131. if (!chars) {
  12132. const charSpacing = textState.charSpacing + extraSpacing;
  12133. if (charSpacing) {
  12134. if (!font.vertical) {
  12135. textState.translateTextMatrix(
  12136. charSpacing * textState.textHScale,
  12137. 0
  12138. );
  12139. } else {
  12140. textState.translateTextMatrix(0, -charSpacing);
  12141. }
  12142. }
  12143. return;
  12144. }
  12145. const glyphs = font.charsToGlyphs(chars);
  12146. const scale = textState.fontMatrix[0] * textState.fontSize;
  12147. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  12148. const glyph = glyphs[i];
  12149. if (glyph.isInvisibleFormatMark) {
  12150. continue;
  12151. }
  12152. let charSpacing =
  12153. textState.charSpacing + (i + 1 === ii ? extraSpacing : 0);
  12154. let glyphWidth = glyph.width;
  12155. if (font.vertical) {
  12156. glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth;
  12157. }
  12158. let scaledDim = glyphWidth * scale;
  12159. if (glyph.isWhitespace) {
  12160. if (!font.vertical) {
  12161. charSpacing += scaledDim + textState.wordSpacing;
  12162. textState.translateTextMatrix(
  12163. charSpacing * textState.textHScale,
  12164. 0
  12165. );
  12166. } else {
  12167. charSpacing += -scaledDim + textState.wordSpacing;
  12168. textState.translateTextMatrix(0, -charSpacing);
  12169. }
  12170. saveLastChar(" ");
  12171. continue;
  12172. }
  12173. if (!compareWithLastPosition()) {
  12174. continue;
  12175. }
  12176. const textChunk = ensureTextContentItem();
  12177. if (glyph.isZeroWidthDiacritic) {
  12178. scaledDim = 0;
  12179. }
  12180. if (!font.vertical) {
  12181. scaledDim *= textState.textHScale;
  12182. textState.translateTextMatrix(scaledDim, 0);
  12183. textChunk.width += scaledDim;
  12184. } else {
  12185. textState.translateTextMatrix(0, scaledDim);
  12186. scaledDim = Math.abs(scaledDim);
  12187. textChunk.height += scaledDim;
  12188. }
  12189. if (scaledDim) {
  12190. textChunk.prevTransform = getCurrentTextTransform();
  12191. }
  12192. let glyphUnicode = glyph.unicode;
  12193. glyphUnicode = NormalizedUnicodes[glyphUnicode] || glyphUnicode;
  12194. glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode);
  12195. if (saveLastChar(glyphUnicode)) {
  12196. textChunk.str.push(" ");
  12197. }
  12198. textChunk.str.push(glyphUnicode);
  12199. if (charSpacing) {
  12200. if (!font.vertical) {
  12201. textState.translateTextMatrix(
  12202. charSpacing * textState.textHScale,
  12203. 0
  12204. );
  12205. } else {
  12206. textState.translateTextMatrix(0, -charSpacing);
  12207. }
  12208. }
  12209. }
  12210. }
  12211. function appendEOL() {
  12212. resetLastChars();
  12213. if (textContentItem.initialized) {
  12214. textContentItem.hasEOL = true;
  12215. flushTextContentItem();
  12216. } else {
  12217. textContent.items.push({
  12218. str: "",
  12219. dir: "ltr",
  12220. width: 0,
  12221. height: 0,
  12222. transform: getCurrentTextTransform(),
  12223. fontName: textState.font.loadedName,
  12224. hasEOL: true,
  12225. });
  12226. }
  12227. }
  12228. function addFakeSpaces(width, transf, textOrientation) {
  12229. if (
  12230. textOrientation * textContentItem.spaceInFlowMin <= width &&
  12231. width <= textOrientation * textContentItem.spaceInFlowMax
  12232. ) {
  12233. if (textContentItem.initialized) {
  12234. resetLastChars();
  12235. textContentItem.str.push(" ");
  12236. }
  12237. return false;
  12238. }
  12239. const fontName = textContentItem.fontName;
  12240. let height = 0;
  12241. if (textContentItem.vertical) {
  12242. height = width;
  12243. width = 0;
  12244. }
  12245. flushTextContentItem();
  12246. resetLastChars();
  12247. textContent.items.push({
  12248. str: " ",
  12249. dir: "ltr",
  12250. width: Math.abs(width),
  12251. height: Math.abs(height),
  12252. transform: transf || getCurrentTextTransform(),
  12253. fontName,
  12254. hasEOL: false,
  12255. });
  12256. return true;
  12257. }
  12258. function flushTextContentItem() {
  12259. if (!textContentItem.initialized || !textContentItem.str) {
  12260. return;
  12261. }
  12262. if (!textContentItem.vertical) {
  12263. textContentItem.totalWidth +=
  12264. textContentItem.width * textContentItem.textAdvanceScale;
  12265. } else {
  12266. textContentItem.totalHeight +=
  12267. textContentItem.height * textContentItem.textAdvanceScale;
  12268. }
  12269. textContent.items.push(runBidiTransform(textContentItem));
  12270. textContentItem.initialized = false;
  12271. textContentItem.str.length = 0;
  12272. }
  12273. function enqueueChunk(batch = false) {
  12274. const length = textContent.items.length;
  12275. if (length === 0) {
  12276. return;
  12277. }
  12278. if (batch && length < TEXT_CHUNK_BATCH_SIZE) {
  12279. return;
  12280. }
  12281. sink.enqueue(textContent, length);
  12282. textContent.items = [];
  12283. textContent.styles = Object.create(null);
  12284. }
  12285. const timeSlotManager = new TimeSlotManager();
  12286. return new Promise(function promiseBody(resolve, reject) {
  12287. const next = function (promise) {
  12288. enqueueChunk(true);
  12289. Promise.all([promise, sink.ready]).then(function () {
  12290. try {
  12291. promiseBody(resolve, reject);
  12292. } catch (ex) {
  12293. reject(ex);
  12294. }
  12295. }, reject);
  12296. };
  12297. task.ensureNotTerminated();
  12298. timeSlotManager.reset();
  12299. const operation = {};
  12300. let stop,
  12301. args = [];
  12302. while (!(stop = timeSlotManager.check())) {
  12303. args.length = 0;
  12304. operation.args = args;
  12305. if (!preprocessor.read(operation)) {
  12306. break;
  12307. }
  12308. textState = stateManager.state;
  12309. const fn = operation.fn;
  12310. args = operation.args;
  12311. switch (fn | 0) {
  12312. case _util.OPS.setFont:
  12313. var fontNameArg = args[0].name,
  12314. fontSizeArg = args[1];
  12315. if (
  12316. textState.font &&
  12317. fontNameArg === textState.fontName &&
  12318. fontSizeArg === textState.fontSize
  12319. ) {
  12320. break;
  12321. }
  12322. flushTextContentItem();
  12323. textState.fontName = fontNameArg;
  12324. textState.fontSize = fontSizeArg;
  12325. next(handleSetFont(fontNameArg, null));
  12326. return;
  12327. case _util.OPS.setTextRise:
  12328. textState.textRise = args[0];
  12329. break;
  12330. case _util.OPS.setHScale:
  12331. textState.textHScale = args[0] / 100;
  12332. break;
  12333. case _util.OPS.setLeading:
  12334. textState.leading = args[0];
  12335. break;
  12336. case _util.OPS.moveText:
  12337. textState.translateTextLineMatrix(args[0], args[1]);
  12338. textState.textMatrix = textState.textLineMatrix.slice();
  12339. break;
  12340. case _util.OPS.setLeadingMoveText:
  12341. textState.leading = -args[1];
  12342. textState.translateTextLineMatrix(args[0], args[1]);
  12343. textState.textMatrix = textState.textLineMatrix.slice();
  12344. break;
  12345. case _util.OPS.nextLine:
  12346. textState.carriageReturn();
  12347. break;
  12348. case _util.OPS.setTextMatrix:
  12349. textState.setTextMatrix(
  12350. args[0],
  12351. args[1],
  12352. args[2],
  12353. args[3],
  12354. args[4],
  12355. args[5]
  12356. );
  12357. textState.setTextLineMatrix(
  12358. args[0],
  12359. args[1],
  12360. args[2],
  12361. args[3],
  12362. args[4],
  12363. args[5]
  12364. );
  12365. updateAdvanceScale();
  12366. break;
  12367. case _util.OPS.setCharSpacing:
  12368. textState.charSpacing = args[0];
  12369. break;
  12370. case _util.OPS.setWordSpacing:
  12371. textState.wordSpacing = args[0];
  12372. break;
  12373. case _util.OPS.beginText:
  12374. textState.textMatrix = _util.IDENTITY_MATRIX.slice();
  12375. textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  12376. break;
  12377. case _util.OPS.showSpacedText:
  12378. if (!stateManager.state.font) {
  12379. self.ensureStateFont(stateManager.state);
  12380. continue;
  12381. }
  12382. const spaceFactor =
  12383. ((textState.font.vertical ? 1 : -1) *
  12384. textState.fontSize) /
  12385. 1000;
  12386. const elements = args[0];
  12387. for (let i = 0, ii = elements.length; i < ii - 1; i++) {
  12388. const item = elements[i];
  12389. if (typeof item === "string") {
  12390. showSpacedTextBuffer.push(item);
  12391. } else if (typeof item === "number" && item !== 0) {
  12392. const str = showSpacedTextBuffer.join("");
  12393. showSpacedTextBuffer.length = 0;
  12394. buildTextContentItem({
  12395. chars: str,
  12396. extraSpacing: item * spaceFactor,
  12397. });
  12398. }
  12399. }
  12400. const item = elements.at(-1);
  12401. if (typeof item === "string") {
  12402. showSpacedTextBuffer.push(item);
  12403. }
  12404. if (showSpacedTextBuffer.length > 0) {
  12405. const str = showSpacedTextBuffer.join("");
  12406. showSpacedTextBuffer.length = 0;
  12407. buildTextContentItem({
  12408. chars: str,
  12409. extraSpacing: 0,
  12410. });
  12411. }
  12412. break;
  12413. case _util.OPS.showText:
  12414. if (!stateManager.state.font) {
  12415. self.ensureStateFont(stateManager.state);
  12416. continue;
  12417. }
  12418. buildTextContentItem({
  12419. chars: args[0],
  12420. extraSpacing: 0,
  12421. });
  12422. break;
  12423. case _util.OPS.nextLineShowText:
  12424. if (!stateManager.state.font) {
  12425. self.ensureStateFont(stateManager.state);
  12426. continue;
  12427. }
  12428. textState.carriageReturn();
  12429. buildTextContentItem({
  12430. chars: args[0],
  12431. extraSpacing: 0,
  12432. });
  12433. break;
  12434. case _util.OPS.nextLineSetSpacingShowText:
  12435. if (!stateManager.state.font) {
  12436. self.ensureStateFont(stateManager.state);
  12437. continue;
  12438. }
  12439. textState.wordSpacing = args[0];
  12440. textState.charSpacing = args[1];
  12441. textState.carriageReturn();
  12442. buildTextContentItem({
  12443. chars: args[2],
  12444. extraSpacing: 0,
  12445. });
  12446. break;
  12447. case _util.OPS.paintXObject:
  12448. flushTextContentItem();
  12449. if (!xobjs) {
  12450. xobjs =
  12451. resources.get("XObject") || _primitives.Dict.empty;
  12452. }
  12453. var isValidName = args[0] instanceof _primitives.Name;
  12454. var name = args[0].name;
  12455. if (isValidName && emptyXObjectCache.getByName(name)) {
  12456. break;
  12457. }
  12458. next(
  12459. new Promise(function (resolveXObject, rejectXObject) {
  12460. if (!isValidName) {
  12461. throw new _util.FormatError(
  12462. "XObject must be referred to by name."
  12463. );
  12464. }
  12465. let xobj = xobjs.getRaw(name);
  12466. if (xobj instanceof _primitives.Ref) {
  12467. if (emptyXObjectCache.getByRef(xobj)) {
  12468. resolveXObject();
  12469. return;
  12470. }
  12471. const globalImage = self.globalImageCache.getData(
  12472. xobj,
  12473. self.pageIndex
  12474. );
  12475. if (globalImage) {
  12476. resolveXObject();
  12477. return;
  12478. }
  12479. xobj = xref.fetch(xobj);
  12480. }
  12481. if (!(xobj instanceof _base_stream.BaseStream)) {
  12482. throw new _util.FormatError(
  12483. "XObject should be a stream"
  12484. );
  12485. }
  12486. const type = xobj.dict.get("Subtype");
  12487. if (!(type instanceof _primitives.Name)) {
  12488. throw new _util.FormatError(
  12489. "XObject should have a Name subtype"
  12490. );
  12491. }
  12492. if (type.name !== "Form") {
  12493. emptyXObjectCache.set(name, xobj.dict.objId, true);
  12494. resolveXObject();
  12495. return;
  12496. }
  12497. const currentState = stateManager.state.clone();
  12498. const xObjStateManager = new StateManager(currentState);
  12499. const matrix = xobj.dict.getArray("Matrix");
  12500. if (Array.isArray(matrix) && matrix.length === 6) {
  12501. xObjStateManager.transform(matrix);
  12502. }
  12503. enqueueChunk();
  12504. const sinkWrapper = {
  12505. enqueueInvoked: false,
  12506. enqueue(chunk, size) {
  12507. this.enqueueInvoked = true;
  12508. sink.enqueue(chunk, size);
  12509. },
  12510. get desiredSize() {
  12511. return sink.desiredSize;
  12512. },
  12513. get ready() {
  12514. return sink.ready;
  12515. },
  12516. };
  12517. self
  12518. .getTextContent({
  12519. stream: xobj,
  12520. task,
  12521. resources: xobj.dict.get("Resources") || resources,
  12522. stateManager: xObjStateManager,
  12523. combineTextItems,
  12524. includeMarkedContent,
  12525. sink: sinkWrapper,
  12526. seenStyles,
  12527. viewBox,
  12528. })
  12529. .then(function () {
  12530. if (!sinkWrapper.enqueueInvoked) {
  12531. emptyXObjectCache.set(
  12532. name,
  12533. xobj.dict.objId,
  12534. true
  12535. );
  12536. }
  12537. resolveXObject();
  12538. }, rejectXObject);
  12539. }).catch(function (reason) {
  12540. if (reason instanceof _util.AbortException) {
  12541. return;
  12542. }
  12543. if (self.options.ignoreErrors) {
  12544. (0, _util.warn)(
  12545. `getTextContent - ignoring XObject: "${reason}".`
  12546. );
  12547. return;
  12548. }
  12549. throw reason;
  12550. })
  12551. );
  12552. return;
  12553. case _util.OPS.setGState:
  12554. isValidName = args[0] instanceof _primitives.Name;
  12555. name = args[0].name;
  12556. if (isValidName && emptyGStateCache.getByName(name)) {
  12557. break;
  12558. }
  12559. next(
  12560. new Promise(function (resolveGState, rejectGState) {
  12561. if (!isValidName) {
  12562. throw new _util.FormatError(
  12563. "GState must be referred to by name."
  12564. );
  12565. }
  12566. const extGState = resources.get("ExtGState");
  12567. if (!(extGState instanceof _primitives.Dict)) {
  12568. throw new _util.FormatError(
  12569. "ExtGState should be a dictionary."
  12570. );
  12571. }
  12572. const gState = extGState.get(name);
  12573. if (!(gState instanceof _primitives.Dict)) {
  12574. throw new _util.FormatError(
  12575. "GState should be a dictionary."
  12576. );
  12577. }
  12578. const gStateFont = gState.get("Font");
  12579. if (!gStateFont) {
  12580. emptyGStateCache.set(name, gState.objId, true);
  12581. resolveGState();
  12582. return;
  12583. }
  12584. flushTextContentItem();
  12585. textState.fontName = null;
  12586. textState.fontSize = gStateFont[1];
  12587. handleSetFont(null, gStateFont[0]).then(
  12588. resolveGState,
  12589. rejectGState
  12590. );
  12591. }).catch(function (reason) {
  12592. if (reason instanceof _util.AbortException) {
  12593. return;
  12594. }
  12595. if (self.options.ignoreErrors) {
  12596. (0, _util.warn)(
  12597. `getTextContent - ignoring ExtGState: "${reason}".`
  12598. );
  12599. return;
  12600. }
  12601. throw reason;
  12602. })
  12603. );
  12604. return;
  12605. case _util.OPS.beginMarkedContent:
  12606. flushTextContentItem();
  12607. if (includeMarkedContent) {
  12608. textContent.items.push({
  12609. type: "beginMarkedContent",
  12610. tag:
  12611. args[0] instanceof _primitives.Name
  12612. ? args[0].name
  12613. : null,
  12614. });
  12615. }
  12616. break;
  12617. case _util.OPS.beginMarkedContentProps:
  12618. flushTextContentItem();
  12619. if (includeMarkedContent) {
  12620. let mcid = null;
  12621. if (args[1] instanceof _primitives.Dict) {
  12622. mcid = args[1].get("MCID");
  12623. }
  12624. textContent.items.push({
  12625. type: "beginMarkedContentProps",
  12626. id: Number.isInteger(mcid)
  12627. ? `${self.idFactory.getPageObjId()}_mcid${mcid}`
  12628. : null,
  12629. tag:
  12630. args[0] instanceof _primitives.Name
  12631. ? args[0].name
  12632. : null,
  12633. });
  12634. }
  12635. break;
  12636. case _util.OPS.endMarkedContent:
  12637. flushTextContentItem();
  12638. if (includeMarkedContent) {
  12639. textContent.items.push({
  12640. type: "endMarkedContent",
  12641. });
  12642. }
  12643. break;
  12644. }
  12645. if (textContent.items.length >= sink.desiredSize) {
  12646. stop = true;
  12647. break;
  12648. }
  12649. }
  12650. if (stop) {
  12651. next(deferred);
  12652. return;
  12653. }
  12654. flushTextContentItem();
  12655. enqueueChunk();
  12656. resolve();
  12657. }).catch((reason) => {
  12658. if (reason instanceof _util.AbortException) {
  12659. return;
  12660. }
  12661. if (this.options.ignoreErrors) {
  12662. (0, _util.warn)(
  12663. `getTextContent - ignoring errors during "${task.name}" ` +
  12664. `task: "${reason}".`
  12665. );
  12666. flushTextContentItem();
  12667. enqueueChunk();
  12668. return;
  12669. }
  12670. throw reason;
  12671. });
  12672. }
  12673. extractDataStructures(dict, baseDict, properties) {
  12674. const xref = this.xref;
  12675. let cidToGidBytes;
  12676. const toUnicodePromise = this.readToUnicode(
  12677. properties.toUnicode ||
  12678. dict.get("ToUnicode") ||
  12679. baseDict.get("ToUnicode")
  12680. );
  12681. if (properties.composite) {
  12682. const cidSystemInfo = dict.get("CIDSystemInfo");
  12683. if (cidSystemInfo instanceof _primitives.Dict) {
  12684. properties.cidSystemInfo = {
  12685. registry: (0, _util.stringToPDFString)(
  12686. cidSystemInfo.get("Registry")
  12687. ),
  12688. ordering: (0, _util.stringToPDFString)(
  12689. cidSystemInfo.get("Ordering")
  12690. ),
  12691. supplement: cidSystemInfo.get("Supplement"),
  12692. };
  12693. }
  12694. try {
  12695. const cidToGidMap = dict.get("CIDToGIDMap");
  12696. if (cidToGidMap instanceof _base_stream.BaseStream) {
  12697. cidToGidBytes = cidToGidMap.getBytes();
  12698. }
  12699. } catch (ex) {
  12700. if (!this.options.ignoreErrors) {
  12701. throw ex;
  12702. }
  12703. (0, _util.warn)(
  12704. `extractDataStructures - ignoring CIDToGIDMap data: "${ex}".`
  12705. );
  12706. }
  12707. }
  12708. const differences = [];
  12709. let baseEncodingName = null;
  12710. let encoding;
  12711. if (dict.has("Encoding")) {
  12712. encoding = dict.get("Encoding");
  12713. if (encoding instanceof _primitives.Dict) {
  12714. baseEncodingName = encoding.get("BaseEncoding");
  12715. baseEncodingName =
  12716. baseEncodingName instanceof _primitives.Name
  12717. ? baseEncodingName.name
  12718. : null;
  12719. if (encoding.has("Differences")) {
  12720. const diffEncoding = encoding.get("Differences");
  12721. let index = 0;
  12722. for (let j = 0, jj = diffEncoding.length; j < jj; j++) {
  12723. const data = xref.fetchIfRef(diffEncoding[j]);
  12724. if (typeof data === "number") {
  12725. index = data;
  12726. } else if (data instanceof _primitives.Name) {
  12727. differences[index++] = data.name;
  12728. } else {
  12729. throw new _util.FormatError(
  12730. `Invalid entry in 'Differences' array: ${data}`
  12731. );
  12732. }
  12733. }
  12734. }
  12735. } else if (encoding instanceof _primitives.Name) {
  12736. baseEncodingName = encoding.name;
  12737. } else {
  12738. const msg = "Encoding is not a Name nor a Dict";
  12739. if (!this.options.ignoreErrors) {
  12740. throw new _util.FormatError(msg);
  12741. }
  12742. (0, _util.warn)(msg);
  12743. }
  12744. if (
  12745. baseEncodingName !== "MacRomanEncoding" &&
  12746. baseEncodingName !== "MacExpertEncoding" &&
  12747. baseEncodingName !== "WinAnsiEncoding"
  12748. ) {
  12749. baseEncodingName = null;
  12750. }
  12751. }
  12752. if (baseEncodingName) {
  12753. properties.defaultEncoding = (0, _encodings.getEncoding)(
  12754. baseEncodingName
  12755. );
  12756. } else {
  12757. const isSymbolicFont = !!(
  12758. properties.flags & _fonts_utils.FontFlags.Symbolic
  12759. );
  12760. const isNonsymbolicFont = !!(
  12761. properties.flags & _fonts_utils.FontFlags.Nonsymbolic
  12762. );
  12763. encoding = _encodings.StandardEncoding;
  12764. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  12765. encoding = _encodings.WinAnsiEncoding;
  12766. }
  12767. if (isSymbolicFont) {
  12768. encoding = _encodings.MacRomanEncoding;
  12769. if (!properties.file || properties.isInternalFont) {
  12770. if (/Symbol/i.test(properties.name)) {
  12771. encoding = _encodings.SymbolSetEncoding;
  12772. } else if (/Dingbats|Wingdings/i.test(properties.name)) {
  12773. encoding = _encodings.ZapfDingbatsEncoding;
  12774. }
  12775. }
  12776. }
  12777. properties.defaultEncoding = encoding;
  12778. }
  12779. properties.differences = differences;
  12780. properties.baseEncodingName = baseEncodingName;
  12781. properties.hasEncoding =
  12782. !!baseEncodingName || differences.length > 0;
  12783. properties.dict = dict;
  12784. return toUnicodePromise
  12785. .then((readToUnicode) => {
  12786. properties.toUnicode = readToUnicode;
  12787. return this.buildToUnicode(properties);
  12788. })
  12789. .then((builtToUnicode) => {
  12790. properties.toUnicode = builtToUnicode;
  12791. if (cidToGidBytes) {
  12792. properties.cidToGidMap = this.readCidToGidMap(
  12793. cidToGidBytes,
  12794. builtToUnicode
  12795. );
  12796. }
  12797. return properties;
  12798. });
  12799. }
  12800. _simpleFontToUnicode(properties, forceGlyphs = false) {
  12801. (0, _util.assert)(!properties.composite, "Must be a simple font.");
  12802. const toUnicode = [];
  12803. const encoding = properties.defaultEncoding.slice();
  12804. const baseEncodingName = properties.baseEncodingName;
  12805. const differences = properties.differences;
  12806. for (const charcode in differences) {
  12807. const glyphName = differences[charcode];
  12808. if (glyphName === ".notdef") {
  12809. continue;
  12810. }
  12811. encoding[charcode] = glyphName;
  12812. }
  12813. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  12814. for (const charcode in encoding) {
  12815. let glyphName = encoding[charcode];
  12816. if (glyphName === "") {
  12817. continue;
  12818. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  12819. let code = 0;
  12820. switch (glyphName[0]) {
  12821. case "G":
  12822. if (glyphName.length === 3) {
  12823. code = parseInt(glyphName.substring(1), 16);
  12824. }
  12825. break;
  12826. case "g":
  12827. if (glyphName.length === 5) {
  12828. code = parseInt(glyphName.substring(1), 16);
  12829. }
  12830. break;
  12831. case "C":
  12832. case "c":
  12833. if (glyphName.length >= 3 && glyphName.length <= 4) {
  12834. const codeStr = glyphName.substring(1);
  12835. if (forceGlyphs) {
  12836. code = parseInt(codeStr, 16);
  12837. break;
  12838. }
  12839. code = +codeStr;
  12840. if (
  12841. Number.isNaN(code) &&
  12842. Number.isInteger(parseInt(codeStr, 16))
  12843. ) {
  12844. return this._simpleFontToUnicode(properties, true);
  12845. }
  12846. }
  12847. break;
  12848. default:
  12849. const unicode = (0, _unicode.getUnicodeForGlyph)(
  12850. glyphName,
  12851. glyphsUnicodeMap
  12852. );
  12853. if (unicode !== -1) {
  12854. code = unicode;
  12855. }
  12856. }
  12857. if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
  12858. if (baseEncodingName && code === +charcode) {
  12859. const baseEncoding = (0, _encodings.getEncoding)(
  12860. baseEncodingName
  12861. );
  12862. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  12863. toUnicode[charcode] = String.fromCharCode(
  12864. glyphsUnicodeMap[glyphName]
  12865. );
  12866. continue;
  12867. }
  12868. }
  12869. toUnicode[charcode] = String.fromCodePoint(code);
  12870. }
  12871. continue;
  12872. }
  12873. toUnicode[charcode] = String.fromCharCode(
  12874. glyphsUnicodeMap[glyphName]
  12875. );
  12876. }
  12877. return toUnicode;
  12878. }
  12879. async buildToUnicode(properties) {
  12880. properties.hasIncludedToUnicodeMap =
  12881. !!properties.toUnicode && properties.toUnicode.length > 0;
  12882. if (properties.hasIncludedToUnicodeMap) {
  12883. if (!properties.composite && properties.hasEncoding) {
  12884. properties.fallbackToUnicode =
  12885. this._simpleFontToUnicode(properties);
  12886. }
  12887. return properties.toUnicode;
  12888. }
  12889. if (!properties.composite) {
  12890. return new _to_unicode_map.ToUnicodeMap(
  12891. this._simpleFontToUnicode(properties)
  12892. );
  12893. }
  12894. if (
  12895. properties.composite &&
  12896. ((properties.cMap.builtInCMap &&
  12897. !(properties.cMap instanceof _cmap.IdentityCMap)) ||
  12898. (properties.cidSystemInfo.registry === "Adobe" &&
  12899. (properties.cidSystemInfo.ordering === "GB1" ||
  12900. properties.cidSystemInfo.ordering === "CNS1" ||
  12901. properties.cidSystemInfo.ordering === "Japan1" ||
  12902. properties.cidSystemInfo.ordering === "Korea1")))
  12903. ) {
  12904. const { registry, ordering } = properties.cidSystemInfo;
  12905. const ucs2CMapName = _primitives.Name.get(
  12906. `${registry}-${ordering}-UCS2`
  12907. );
  12908. const ucs2CMap = await _cmap.CMapFactory.create({
  12909. encoding: ucs2CMapName,
  12910. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  12911. useCMap: null,
  12912. });
  12913. const toUnicode = [];
  12914. properties.cMap.forEach(function (charcode, cid) {
  12915. if (cid > 0xffff) {
  12916. throw new _util.FormatError("Max size of CID is 65,535");
  12917. }
  12918. const ucs2 = ucs2CMap.lookup(cid);
  12919. if (ucs2) {
  12920. toUnicode[charcode] = String.fromCharCode(
  12921. (ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1)
  12922. );
  12923. }
  12924. });
  12925. return new _to_unicode_map.ToUnicodeMap(toUnicode);
  12926. }
  12927. return new _to_unicode_map.IdentityToUnicodeMap(
  12928. properties.firstChar,
  12929. properties.lastChar
  12930. );
  12931. }
  12932. readToUnicode(cmapObj) {
  12933. if (!cmapObj) {
  12934. return Promise.resolve(null);
  12935. }
  12936. if (cmapObj instanceof _primitives.Name) {
  12937. return _cmap.CMapFactory.create({
  12938. encoding: cmapObj,
  12939. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  12940. useCMap: null,
  12941. }).then(function (cmap) {
  12942. if (cmap instanceof _cmap.IdentityCMap) {
  12943. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  12944. }
  12945. return new _to_unicode_map.ToUnicodeMap(cmap.getMap());
  12946. });
  12947. } else if (cmapObj instanceof _base_stream.BaseStream) {
  12948. return _cmap.CMapFactory.create({
  12949. encoding: cmapObj,
  12950. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  12951. useCMap: null,
  12952. }).then(
  12953. function (cmap) {
  12954. if (cmap instanceof _cmap.IdentityCMap) {
  12955. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  12956. }
  12957. const map = new Array(cmap.length);
  12958. cmap.forEach(function (charCode, token) {
  12959. if (typeof token === "number") {
  12960. map[charCode] = String.fromCodePoint(token);
  12961. return;
  12962. }
  12963. const str = [];
  12964. for (let k = 0; k < token.length; k += 2) {
  12965. const w1 =
  12966. (token.charCodeAt(k) << 8) | token.charCodeAt(k + 1);
  12967. if ((w1 & 0xf800) !== 0xd800) {
  12968. str.push(w1);
  12969. continue;
  12970. }
  12971. k += 2;
  12972. const w2 =
  12973. (token.charCodeAt(k) << 8) | token.charCodeAt(k + 1);
  12974. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  12975. }
  12976. map[charCode] = String.fromCodePoint(...str);
  12977. });
  12978. return new _to_unicode_map.ToUnicodeMap(map);
  12979. },
  12980. (reason) => {
  12981. if (reason instanceof _util.AbortException) {
  12982. return null;
  12983. }
  12984. if (this.options.ignoreErrors) {
  12985. this.handler.send("UnsupportedFeature", {
  12986. featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode,
  12987. });
  12988. (0, _util.warn)(
  12989. `readToUnicode - ignoring ToUnicode data: "${reason}".`
  12990. );
  12991. return null;
  12992. }
  12993. throw reason;
  12994. }
  12995. );
  12996. }
  12997. return Promise.resolve(null);
  12998. }
  12999. readCidToGidMap(glyphsData, toUnicode) {
  13000. const result = [];
  13001. for (let j = 0, jj = glyphsData.length; j < jj; j++) {
  13002. const glyphID = (glyphsData[j++] << 8) | glyphsData[j];
  13003. const code = j >> 1;
  13004. if (glyphID === 0 && !toUnicode.has(code)) {
  13005. continue;
  13006. }
  13007. result[code] = glyphID;
  13008. }
  13009. return result;
  13010. }
  13011. extractWidths(dict, descriptor, properties) {
  13012. const xref = this.xref;
  13013. let glyphsWidths = [];
  13014. let defaultWidth = 0;
  13015. const glyphsVMetrics = [];
  13016. let defaultVMetrics;
  13017. let i, ii, j, jj, start, code, widths;
  13018. if (properties.composite) {
  13019. defaultWidth = dict.has("DW") ? dict.get("DW") : 1000;
  13020. widths = dict.get("W");
  13021. if (widths) {
  13022. for (i = 0, ii = widths.length; i < ii; i++) {
  13023. start = xref.fetchIfRef(widths[i++]);
  13024. code = xref.fetchIfRef(widths[i]);
  13025. if (Array.isArray(code)) {
  13026. for (j = 0, jj = code.length; j < jj; j++) {
  13027. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  13028. }
  13029. } else {
  13030. const width = xref.fetchIfRef(widths[++i]);
  13031. for (j = start; j <= code; j++) {
  13032. glyphsWidths[j] = width;
  13033. }
  13034. }
  13035. }
  13036. }
  13037. if (properties.vertical) {
  13038. let vmetrics = dict.getArray("DW2") || [880, -1000];
  13039. defaultVMetrics = [
  13040. vmetrics[1],
  13041. defaultWidth * 0.5,
  13042. vmetrics[0],
  13043. ];
  13044. vmetrics = dict.get("W2");
  13045. if (vmetrics) {
  13046. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  13047. start = xref.fetchIfRef(vmetrics[i++]);
  13048. code = xref.fetchIfRef(vmetrics[i]);
  13049. if (Array.isArray(code)) {
  13050. for (j = 0, jj = code.length; j < jj; j++) {
  13051. glyphsVMetrics[start++] = [
  13052. xref.fetchIfRef(code[j++]),
  13053. xref.fetchIfRef(code[j++]),
  13054. xref.fetchIfRef(code[j]),
  13055. ];
  13056. }
  13057. } else {
  13058. const vmetric = [
  13059. xref.fetchIfRef(vmetrics[++i]),
  13060. xref.fetchIfRef(vmetrics[++i]),
  13061. xref.fetchIfRef(vmetrics[++i]),
  13062. ];
  13063. for (j = start; j <= code; j++) {
  13064. glyphsVMetrics[j] = vmetric;
  13065. }
  13066. }
  13067. }
  13068. }
  13069. }
  13070. } else {
  13071. const firstChar = properties.firstChar;
  13072. widths = dict.get("Widths");
  13073. if (widths) {
  13074. j = firstChar;
  13075. for (i = 0, ii = widths.length; i < ii; i++) {
  13076. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  13077. }
  13078. defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0;
  13079. } else {
  13080. const baseFontName = dict.get("BaseFont");
  13081. if (baseFontName instanceof _primitives.Name) {
  13082. const metrics = this.getBaseFontMetrics(baseFontName.name);
  13083. glyphsWidths = this.buildCharCodeToWidth(
  13084. metrics.widths,
  13085. properties
  13086. );
  13087. defaultWidth = metrics.defaultWidth;
  13088. }
  13089. }
  13090. }
  13091. let isMonospace = true;
  13092. let firstWidth = defaultWidth;
  13093. for (const glyph in glyphsWidths) {
  13094. const glyphWidth = glyphsWidths[glyph];
  13095. if (!glyphWidth) {
  13096. continue;
  13097. }
  13098. if (!firstWidth) {
  13099. firstWidth = glyphWidth;
  13100. continue;
  13101. }
  13102. if (firstWidth !== glyphWidth) {
  13103. isMonospace = false;
  13104. break;
  13105. }
  13106. }
  13107. if (isMonospace) {
  13108. properties.flags |= _fonts_utils.FontFlags.FixedPitch;
  13109. }
  13110. properties.defaultWidth = defaultWidth;
  13111. properties.widths = glyphsWidths;
  13112. properties.defaultVMetrics = defaultVMetrics;
  13113. properties.vmetrics = glyphsVMetrics;
  13114. }
  13115. isSerifFont(baseFontName) {
  13116. const fontNameWoStyle = baseFontName.split("-")[0];
  13117. return (
  13118. fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() ||
  13119. fontNameWoStyle.search(/serif/gi) !== -1
  13120. );
  13121. }
  13122. getBaseFontMetrics(name) {
  13123. let defaultWidth = 0;
  13124. let widths = Object.create(null);
  13125. let monospace = false;
  13126. const stdFontMap = (0, _standard_fonts.getStdFontMap)();
  13127. let lookupName = stdFontMap[name] || name;
  13128. const Metrics = (0, _metrics.getMetrics)();
  13129. if (!(lookupName in Metrics)) {
  13130. if (this.isSerifFont(name)) {
  13131. lookupName = "Times-Roman";
  13132. } else {
  13133. lookupName = "Helvetica";
  13134. }
  13135. }
  13136. const glyphWidths = Metrics[lookupName];
  13137. if (typeof glyphWidths === "number") {
  13138. defaultWidth = glyphWidths;
  13139. monospace = true;
  13140. } else {
  13141. widths = glyphWidths();
  13142. }
  13143. return {
  13144. defaultWidth,
  13145. monospace,
  13146. widths,
  13147. };
  13148. }
  13149. buildCharCodeToWidth(widthsByGlyphName, properties) {
  13150. const widths = Object.create(null);
  13151. const differences = properties.differences;
  13152. const encoding = properties.defaultEncoding;
  13153. for (let charCode = 0; charCode < 256; charCode++) {
  13154. if (
  13155. charCode in differences &&
  13156. widthsByGlyphName[differences[charCode]]
  13157. ) {
  13158. widths[charCode] = widthsByGlyphName[differences[charCode]];
  13159. continue;
  13160. }
  13161. if (
  13162. charCode in encoding &&
  13163. widthsByGlyphName[encoding[charCode]]
  13164. ) {
  13165. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  13166. continue;
  13167. }
  13168. }
  13169. return widths;
  13170. }
  13171. preEvaluateFont(dict) {
  13172. const baseDict = dict;
  13173. let type = dict.get("Subtype");
  13174. if (!(type instanceof _primitives.Name)) {
  13175. throw new _util.FormatError("invalid font Subtype");
  13176. }
  13177. let composite = false;
  13178. let hash, toUnicode;
  13179. if (type.name === "Type0") {
  13180. const df = dict.get("DescendantFonts");
  13181. if (!df) {
  13182. throw new _util.FormatError(
  13183. "Descendant fonts are not specified"
  13184. );
  13185. }
  13186. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  13187. if (!(dict instanceof _primitives.Dict)) {
  13188. throw new _util.FormatError(
  13189. "Descendant font is not a dictionary."
  13190. );
  13191. }
  13192. type = dict.get("Subtype");
  13193. if (!(type instanceof _primitives.Name)) {
  13194. throw new _util.FormatError("invalid font Subtype");
  13195. }
  13196. composite = true;
  13197. }
  13198. const firstChar = dict.get("FirstChar") || 0,
  13199. lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
  13200. const descriptor = dict.get("FontDescriptor");
  13201. if (descriptor) {
  13202. hash = new _murmurhash.MurmurHash3_64();
  13203. const encoding = baseDict.getRaw("Encoding");
  13204. if (encoding instanceof _primitives.Name) {
  13205. hash.update(encoding.name);
  13206. } else if (encoding instanceof _primitives.Ref) {
  13207. hash.update(encoding.toString());
  13208. } else if (encoding instanceof _primitives.Dict) {
  13209. for (const entry of encoding.getRawValues()) {
  13210. if (entry instanceof _primitives.Name) {
  13211. hash.update(entry.name);
  13212. } else if (entry instanceof _primitives.Ref) {
  13213. hash.update(entry.toString());
  13214. } else if (Array.isArray(entry)) {
  13215. const diffLength = entry.length,
  13216. diffBuf = new Array(diffLength);
  13217. for (let j = 0; j < diffLength; j++) {
  13218. const diffEntry = entry[j];
  13219. if (diffEntry instanceof _primitives.Name) {
  13220. diffBuf[j] = diffEntry.name;
  13221. } else if (
  13222. typeof diffEntry === "number" ||
  13223. diffEntry instanceof _primitives.Ref
  13224. ) {
  13225. diffBuf[j] = diffEntry.toString();
  13226. }
  13227. }
  13228. hash.update(diffBuf.join());
  13229. }
  13230. }
  13231. }
  13232. hash.update(`${firstChar}-${lastChar}`);
  13233. toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  13234. if (toUnicode instanceof _base_stream.BaseStream) {
  13235. const stream = toUnicode.str || toUnicode;
  13236. const uint8array = stream.buffer
  13237. ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength)
  13238. : new Uint8Array(
  13239. stream.bytes.buffer,
  13240. stream.start,
  13241. stream.end - stream.start
  13242. );
  13243. hash.update(uint8array);
  13244. } else if (toUnicode instanceof _primitives.Name) {
  13245. hash.update(toUnicode.name);
  13246. }
  13247. const widths = dict.get("Widths") || baseDict.get("Widths");
  13248. if (Array.isArray(widths)) {
  13249. const widthsBuf = [];
  13250. for (const entry of widths) {
  13251. if (
  13252. typeof entry === "number" ||
  13253. entry instanceof _primitives.Ref
  13254. ) {
  13255. widthsBuf.push(entry.toString());
  13256. }
  13257. }
  13258. hash.update(widthsBuf.join());
  13259. }
  13260. if (composite) {
  13261. hash.update("compositeFont");
  13262. const compositeWidths = dict.get("W") || baseDict.get("W");
  13263. if (Array.isArray(compositeWidths)) {
  13264. const widthsBuf = [];
  13265. for (const entry of compositeWidths) {
  13266. if (
  13267. typeof entry === "number" ||
  13268. entry instanceof _primitives.Ref
  13269. ) {
  13270. widthsBuf.push(entry.toString());
  13271. } else if (Array.isArray(entry)) {
  13272. const subWidthsBuf = [];
  13273. for (const element of entry) {
  13274. if (
  13275. typeof element === "number" ||
  13276. element instanceof _primitives.Ref
  13277. ) {
  13278. subWidthsBuf.push(element.toString());
  13279. }
  13280. }
  13281. widthsBuf.push(`[${subWidthsBuf.join()}]`);
  13282. }
  13283. }
  13284. hash.update(widthsBuf.join());
  13285. }
  13286. const cidToGidMap =
  13287. dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap");
  13288. if (cidToGidMap instanceof _primitives.Name) {
  13289. hash.update(cidToGidMap.name);
  13290. } else if (cidToGidMap instanceof _primitives.Ref) {
  13291. hash.update(cidToGidMap.toString());
  13292. } else if (cidToGidMap instanceof _base_stream.BaseStream) {
  13293. hash.update(cidToGidMap.peekBytes());
  13294. }
  13295. }
  13296. }
  13297. return {
  13298. descriptor,
  13299. dict,
  13300. baseDict,
  13301. composite,
  13302. type: type.name,
  13303. firstChar,
  13304. lastChar,
  13305. toUnicode,
  13306. hash: hash ? hash.hexdigest() : "",
  13307. };
  13308. }
  13309. async translateFont({
  13310. descriptor,
  13311. dict,
  13312. baseDict,
  13313. composite,
  13314. type,
  13315. firstChar,
  13316. lastChar,
  13317. toUnicode,
  13318. cssFontInfo,
  13319. }) {
  13320. const isType3Font = type === "Type3";
  13321. let properties;
  13322. if (!descriptor) {
  13323. if (isType3Font) {
  13324. descriptor = new _primitives.Dict(null);
  13325. descriptor.set("FontName", _primitives.Name.get(type));
  13326. descriptor.set(
  13327. "FontBBox",
  13328. dict.getArray("FontBBox") || [0, 0, 0, 0]
  13329. );
  13330. } else {
  13331. let baseFontName = dict.get("BaseFont");
  13332. if (!(baseFontName instanceof _primitives.Name)) {
  13333. throw new _util.FormatError("Base font is not specified");
  13334. }
  13335. baseFontName = baseFontName.name.replace(/[,_]/g, "-");
  13336. const metrics = this.getBaseFontMetrics(baseFontName);
  13337. const fontNameWoStyle = baseFontName.split("-")[0];
  13338. const flags =
  13339. (this.isSerifFont(fontNameWoStyle)
  13340. ? _fonts_utils.FontFlags.Serif
  13341. : 0) |
  13342. (metrics.monospace ? _fonts_utils.FontFlags.FixedPitch : 0) |
  13343. ((0, _standard_fonts.getSymbolsFonts)()[fontNameWoStyle]
  13344. ? _fonts_utils.FontFlags.Symbolic
  13345. : _fonts_utils.FontFlags.Nonsymbolic);
  13346. properties = {
  13347. type,
  13348. name: baseFontName,
  13349. loadedName: baseDict.loadedName,
  13350. widths: metrics.widths,
  13351. defaultWidth: metrics.defaultWidth,
  13352. isSimulatedFlags: true,
  13353. flags,
  13354. firstChar,
  13355. lastChar,
  13356. toUnicode,
  13357. xHeight: 0,
  13358. capHeight: 0,
  13359. italicAngle: 0,
  13360. isType3Font,
  13361. };
  13362. const widths = dict.get("Widths");
  13363. const standardFontName = (0,
  13364. _standard_fonts.getStandardFontName)(baseFontName);
  13365. let file = null;
  13366. if (standardFontName) {
  13367. properties.isStandardFont = true;
  13368. file = await this.fetchStandardFontData(standardFontName);
  13369. properties.isInternalFont = !!file;
  13370. }
  13371. return this.extractDataStructures(dict, dict, properties).then(
  13372. (newProperties) => {
  13373. if (widths) {
  13374. const glyphWidths = [];
  13375. let j = firstChar;
  13376. for (let i = 0, ii = widths.length; i < ii; i++) {
  13377. glyphWidths[j++] = this.xref.fetchIfRef(widths[i]);
  13378. }
  13379. newProperties.widths = glyphWidths;
  13380. } else {
  13381. newProperties.widths = this.buildCharCodeToWidth(
  13382. metrics.widths,
  13383. newProperties
  13384. );
  13385. }
  13386. return new _fonts.Font(baseFontName, file, newProperties);
  13387. }
  13388. );
  13389. }
  13390. }
  13391. let fontName = descriptor.get("FontName");
  13392. let baseFont = dict.get("BaseFont");
  13393. if (typeof fontName === "string") {
  13394. fontName = _primitives.Name.get(fontName);
  13395. }
  13396. if (typeof baseFont === "string") {
  13397. baseFont = _primitives.Name.get(baseFont);
  13398. }
  13399. if (!isType3Font) {
  13400. const fontNameStr = fontName && fontName.name;
  13401. const baseFontStr = baseFont && baseFont.name;
  13402. if (fontNameStr !== baseFontStr) {
  13403. (0, _util.info)(
  13404. `The FontDescriptor's FontName is "${fontNameStr}" but ` +
  13405. `should be the same as the Font's BaseFont "${baseFontStr}".`
  13406. );
  13407. if (
  13408. fontNameStr &&
  13409. baseFontStr &&
  13410. baseFontStr.startsWith(fontNameStr)
  13411. ) {
  13412. fontName = baseFont;
  13413. }
  13414. }
  13415. }
  13416. fontName = fontName || baseFont;
  13417. if (!(fontName instanceof _primitives.Name)) {
  13418. throw new _util.FormatError("invalid font name");
  13419. }
  13420. let fontFile, subtype, length1, length2, length3;
  13421. try {
  13422. fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  13423. } catch (ex) {
  13424. if (!this.options.ignoreErrors) {
  13425. throw ex;
  13426. }
  13427. (0, _util.warn)(
  13428. `translateFont - fetching "${fontName.name}" font file: "${ex}".`
  13429. );
  13430. fontFile = new _stream.NullStream();
  13431. }
  13432. let isStandardFont = false;
  13433. let isInternalFont = false;
  13434. let glyphScaleFactors = null;
  13435. if (fontFile) {
  13436. if (fontFile.dict) {
  13437. const subtypeEntry = fontFile.dict.get("Subtype");
  13438. if (subtypeEntry instanceof _primitives.Name) {
  13439. subtype = subtypeEntry.name;
  13440. }
  13441. length1 = fontFile.dict.get("Length1");
  13442. length2 = fontFile.dict.get("Length2");
  13443. length3 = fontFile.dict.get("Length3");
  13444. }
  13445. } else if (cssFontInfo) {
  13446. const standardFontName = (0, _xfa_fonts.getXfaFontName)(
  13447. fontName.name
  13448. );
  13449. if (standardFontName) {
  13450. cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`;
  13451. cssFontInfo.metrics = standardFontName.metrics || null;
  13452. glyphScaleFactors = standardFontName.factors || null;
  13453. fontFile = await this.fetchStandardFontData(
  13454. standardFontName.name
  13455. );
  13456. isInternalFont = !!fontFile;
  13457. baseDict = dict = (0, _xfa_fonts.getXfaFontDict)(fontName.name);
  13458. composite = true;
  13459. }
  13460. } else if (!isType3Font) {
  13461. const standardFontName = (0, _standard_fonts.getStandardFontName)(
  13462. fontName.name
  13463. );
  13464. if (standardFontName) {
  13465. isStandardFont = true;
  13466. fontFile = await this.fetchStandardFontData(standardFontName);
  13467. isInternalFont = !!fontFile;
  13468. }
  13469. }
  13470. properties = {
  13471. type,
  13472. name: fontName.name,
  13473. subtype,
  13474. file: fontFile,
  13475. length1,
  13476. length2,
  13477. length3,
  13478. isStandardFont,
  13479. isInternalFont,
  13480. loadedName: baseDict.loadedName,
  13481. composite,
  13482. fixedPitch: false,
  13483. fontMatrix:
  13484. dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
  13485. firstChar,
  13486. lastChar,
  13487. toUnicode,
  13488. bbox:
  13489. descriptor.getArray("FontBBox") || dict.getArray("FontBBox"),
  13490. ascent: descriptor.get("Ascent"),
  13491. descent: descriptor.get("Descent"),
  13492. xHeight: descriptor.get("XHeight") || 0,
  13493. capHeight: descriptor.get("CapHeight") || 0,
  13494. flags: descriptor.get("Flags"),
  13495. italicAngle: descriptor.get("ItalicAngle") || 0,
  13496. isType3Font,
  13497. cssFontInfo,
  13498. scaleFactors: glyphScaleFactors,
  13499. };
  13500. if (composite) {
  13501. const cidEncoding = baseDict.get("Encoding");
  13502. if (cidEncoding instanceof _primitives.Name) {
  13503. properties.cidEncoding = cidEncoding.name;
  13504. }
  13505. const cMap = await _cmap.CMapFactory.create({
  13506. encoding: cidEncoding,
  13507. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  13508. useCMap: null,
  13509. });
  13510. properties.cMap = cMap;
  13511. properties.vertical = properties.cMap.vertical;
  13512. }
  13513. return this.extractDataStructures(dict, baseDict, properties).then(
  13514. (newProperties) => {
  13515. this.extractWidths(dict, descriptor, newProperties);
  13516. return new _fonts.Font(fontName.name, fontFile, newProperties);
  13517. }
  13518. );
  13519. }
  13520. static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
  13521. function buildPath(fontChar) {
  13522. const glyphName = `${font.loadedName}_path_${fontChar}`;
  13523. try {
  13524. if (font.renderer.hasBuiltPath(fontChar)) {
  13525. return;
  13526. }
  13527. handler.send("commonobj", [
  13528. glyphName,
  13529. "FontPath",
  13530. font.renderer.getPathJs(fontChar),
  13531. ]);
  13532. } catch (reason) {
  13533. if (evaluatorOptions.ignoreErrors) {
  13534. handler.send("UnsupportedFeature", {
  13535. featureId: _util.UNSUPPORTED_FEATURES.errorFontBuildPath,
  13536. });
  13537. (0, _util.warn)(
  13538. `buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`
  13539. );
  13540. return;
  13541. }
  13542. throw reason;
  13543. }
  13544. }
  13545. for (const glyph of glyphs) {
  13546. buildPath(glyph.fontChar);
  13547. const accent = glyph.accent;
  13548. if (accent && accent.fontChar) {
  13549. buildPath(accent.fontChar);
  13550. }
  13551. }
  13552. }
  13553. static get fallbackFontDict() {
  13554. const dict = new _primitives.Dict();
  13555. dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont"));
  13556. dict.set("Type", _primitives.Name.get("FallbackType"));
  13557. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  13558. dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  13559. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  13560. }
  13561. }
  13562. exports.PartialEvaluator = PartialEvaluator;
  13563. class TranslatedFont {
  13564. constructor({ loadedName, font, dict, evaluatorOptions }) {
  13565. this.loadedName = loadedName;
  13566. this.font = font;
  13567. this.dict = dict;
  13568. this._evaluatorOptions =
  13569. evaluatorOptions || DefaultPartialEvaluatorOptions;
  13570. this.type3Loaded = null;
  13571. this.type3Dependencies = font.isType3Font ? new Set() : null;
  13572. this.sent = false;
  13573. }
  13574. send(handler) {
  13575. if (this.sent) {
  13576. return;
  13577. }
  13578. this.sent = true;
  13579. handler.send("commonobj", [
  13580. this.loadedName,
  13581. "Font",
  13582. this.font.exportData(this._evaluatorOptions.fontExtraProperties),
  13583. ]);
  13584. }
  13585. fallback(handler) {
  13586. if (!this.font.data) {
  13587. return;
  13588. }
  13589. this.font.disableFontFace = true;
  13590. PartialEvaluator.buildFontPaths(
  13591. this.font,
  13592. this.font.glyphCacheValues,
  13593. handler,
  13594. this._evaluatorOptions
  13595. );
  13596. }
  13597. loadType3Data(evaluator, resources, task) {
  13598. if (this.type3Loaded) {
  13599. return this.type3Loaded;
  13600. }
  13601. if (!this.font.isType3Font) {
  13602. throw new Error("Must be a Type3 font.");
  13603. }
  13604. const type3Evaluator = evaluator.clone({
  13605. ignoreErrors: false,
  13606. });
  13607. type3Evaluator.parsingType3Font = true;
  13608. const type3FontRefs = new _primitives.RefSet(
  13609. evaluator.type3FontRefs
  13610. );
  13611. if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
  13612. type3FontRefs.put(this.dict.objId);
  13613. }
  13614. type3Evaluator.type3FontRefs = type3FontRefs;
  13615. const translatedFont = this.font,
  13616. type3Dependencies = this.type3Dependencies;
  13617. let loadCharProcsPromise = Promise.resolve();
  13618. const charProcs = this.dict.get("CharProcs");
  13619. const fontResources = this.dict.get("Resources") || resources;
  13620. const charProcOperatorList = Object.create(null);
  13621. const fontBBox = _util.Util.normalizeRect(
  13622. translatedFont.bbox || [0, 0, 0, 0]
  13623. ),
  13624. width = fontBBox[2] - fontBBox[0],
  13625. height = fontBBox[3] - fontBBox[1];
  13626. const fontBBoxSize = Math.hypot(width, height);
  13627. for (const key of charProcs.getKeys()) {
  13628. loadCharProcsPromise = loadCharProcsPromise.then(() => {
  13629. const glyphStream = charProcs.get(key);
  13630. const operatorList = new _operator_list.OperatorList();
  13631. return type3Evaluator
  13632. .getOperatorList({
  13633. stream: glyphStream,
  13634. task,
  13635. resources: fontResources,
  13636. operatorList,
  13637. })
  13638. .then(() => {
  13639. if (
  13640. operatorList.fnArray[0] ===
  13641. _util.OPS.setCharWidthAndBounds
  13642. ) {
  13643. this._removeType3ColorOperators(
  13644. operatorList,
  13645. fontBBoxSize
  13646. );
  13647. }
  13648. charProcOperatorList[key] = operatorList.getIR();
  13649. for (const dependency of operatorList.dependencies) {
  13650. type3Dependencies.add(dependency);
  13651. }
  13652. })
  13653. .catch(function (reason) {
  13654. (0,
  13655. _util.warn)(`Type3 font resource "${key}" is not available.`);
  13656. const dummyOperatorList = new _operator_list.OperatorList();
  13657. charProcOperatorList[key] = dummyOperatorList.getIR();
  13658. });
  13659. });
  13660. }
  13661. this.type3Loaded = loadCharProcsPromise.then(() => {
  13662. translatedFont.charProcOperatorList = charProcOperatorList;
  13663. if (this._bbox) {
  13664. translatedFont.isCharBBox = true;
  13665. translatedFont.bbox = this._bbox;
  13666. }
  13667. });
  13668. return this.type3Loaded;
  13669. }
  13670. _removeType3ColorOperators(operatorList, fontBBoxSize = NaN) {
  13671. const charBBox = _util.Util.normalizeRect(
  13672. operatorList.argsArray[0].slice(2)
  13673. ),
  13674. width = charBBox[2] - charBBox[0],
  13675. height = charBBox[3] - charBBox[1];
  13676. const charBBoxSize = Math.hypot(width, height);
  13677. if (width === 0 || height === 0) {
  13678. operatorList.fnArray.splice(0, 1);
  13679. operatorList.argsArray.splice(0, 1);
  13680. } else if (
  13681. fontBBoxSize === 0 ||
  13682. Math.round(charBBoxSize / fontBBoxSize) >= 10
  13683. ) {
  13684. if (!this._bbox) {
  13685. this._bbox = [Infinity, Infinity, -Infinity, -Infinity];
  13686. }
  13687. this._bbox[0] = Math.min(this._bbox[0], charBBox[0]);
  13688. this._bbox[1] = Math.min(this._bbox[1], charBBox[1]);
  13689. this._bbox[2] = Math.max(this._bbox[2], charBBox[2]);
  13690. this._bbox[3] = Math.max(this._bbox[3], charBBox[3]);
  13691. }
  13692. let i = 0,
  13693. ii = operatorList.length;
  13694. while (i < ii) {
  13695. switch (operatorList.fnArray[i]) {
  13696. case _util.OPS.setCharWidthAndBounds:
  13697. break;
  13698. case _util.OPS.setStrokeColorSpace:
  13699. case _util.OPS.setFillColorSpace:
  13700. case _util.OPS.setStrokeColor:
  13701. case _util.OPS.setStrokeColorN:
  13702. case _util.OPS.setFillColor:
  13703. case _util.OPS.setFillColorN:
  13704. case _util.OPS.setStrokeGray:
  13705. case _util.OPS.setFillGray:
  13706. case _util.OPS.setStrokeRGBColor:
  13707. case _util.OPS.setFillRGBColor:
  13708. case _util.OPS.setStrokeCMYKColor:
  13709. case _util.OPS.setFillCMYKColor:
  13710. case _util.OPS.shadingFill:
  13711. case _util.OPS.setRenderingIntent:
  13712. operatorList.fnArray.splice(i, 1);
  13713. operatorList.argsArray.splice(i, 1);
  13714. ii--;
  13715. continue;
  13716. case _util.OPS.setGState:
  13717. const [gStateObj] = operatorList.argsArray[i];
  13718. let j = 0,
  13719. jj = gStateObj.length;
  13720. while (j < jj) {
  13721. const [gStateKey] = gStateObj[j];
  13722. switch (gStateKey) {
  13723. case "TR":
  13724. case "TR2":
  13725. case "HT":
  13726. case "BG":
  13727. case "BG2":
  13728. case "UCR":
  13729. case "UCR2":
  13730. gStateObj.splice(j, 1);
  13731. jj--;
  13732. continue;
  13733. }
  13734. j++;
  13735. }
  13736. break;
  13737. }
  13738. i++;
  13739. }
  13740. }
  13741. }
  13742. class StateManager {
  13743. constructor(initialState = new EvalState()) {
  13744. this.state = initialState;
  13745. this.stateStack = [];
  13746. }
  13747. save() {
  13748. const old = this.state;
  13749. this.stateStack.push(this.state);
  13750. this.state = old.clone();
  13751. }
  13752. restore() {
  13753. const prev = this.stateStack.pop();
  13754. if (prev) {
  13755. this.state = prev;
  13756. }
  13757. }
  13758. transform(args) {
  13759. this.state.ctm = _util.Util.transform(this.state.ctm, args);
  13760. }
  13761. }
  13762. class TextState {
  13763. constructor() {
  13764. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  13765. this.fontName = null;
  13766. this.fontSize = 0;
  13767. this.font = null;
  13768. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  13769. this.textMatrix = _util.IDENTITY_MATRIX.slice();
  13770. this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  13771. this.charSpacing = 0;
  13772. this.wordSpacing = 0;
  13773. this.leading = 0;
  13774. this.textHScale = 1;
  13775. this.textRise = 0;
  13776. }
  13777. setTextMatrix(a, b, c, d, e, f) {
  13778. const m = this.textMatrix;
  13779. m[0] = a;
  13780. m[1] = b;
  13781. m[2] = c;
  13782. m[3] = d;
  13783. m[4] = e;
  13784. m[5] = f;
  13785. }
  13786. setTextLineMatrix(a, b, c, d, e, f) {
  13787. const m = this.textLineMatrix;
  13788. m[0] = a;
  13789. m[1] = b;
  13790. m[2] = c;
  13791. m[3] = d;
  13792. m[4] = e;
  13793. m[5] = f;
  13794. }
  13795. translateTextMatrix(x, y) {
  13796. const m = this.textMatrix;
  13797. m[4] = m[0] * x + m[2] * y + m[4];
  13798. m[5] = m[1] * x + m[3] * y + m[5];
  13799. }
  13800. translateTextLineMatrix(x, y) {
  13801. const m = this.textLineMatrix;
  13802. m[4] = m[0] * x + m[2] * y + m[4];
  13803. m[5] = m[1] * x + m[3] * y + m[5];
  13804. }
  13805. carriageReturn() {
  13806. this.translateTextLineMatrix(0, -this.leading);
  13807. this.textMatrix = this.textLineMatrix.slice();
  13808. }
  13809. clone() {
  13810. const clone = Object.create(this);
  13811. clone.textMatrix = this.textMatrix.slice();
  13812. clone.textLineMatrix = this.textLineMatrix.slice();
  13813. clone.fontMatrix = this.fontMatrix.slice();
  13814. return clone;
  13815. }
  13816. }
  13817. class EvalState {
  13818. constructor() {
  13819. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  13820. this.font = null;
  13821. this.textRenderingMode = _util.TextRenderingMode.FILL;
  13822. this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  13823. this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  13824. }
  13825. clone() {
  13826. return Object.create(this);
  13827. }
  13828. }
  13829. class EvaluatorPreprocessor {
  13830. static get opMap() {
  13831. const getOPMap = (0, _core_utils.getLookupTableFactory)(function (
  13832. t
  13833. ) {
  13834. t.w = {
  13835. id: _util.OPS.setLineWidth,
  13836. numArgs: 1,
  13837. variableArgs: false,
  13838. };
  13839. t.J = {
  13840. id: _util.OPS.setLineCap,
  13841. numArgs: 1,
  13842. variableArgs: false,
  13843. };
  13844. t.j = {
  13845. id: _util.OPS.setLineJoin,
  13846. numArgs: 1,
  13847. variableArgs: false,
  13848. };
  13849. t.M = {
  13850. id: _util.OPS.setMiterLimit,
  13851. numArgs: 1,
  13852. variableArgs: false,
  13853. };
  13854. t.d = {
  13855. id: _util.OPS.setDash,
  13856. numArgs: 2,
  13857. variableArgs: false,
  13858. };
  13859. t.ri = {
  13860. id: _util.OPS.setRenderingIntent,
  13861. numArgs: 1,
  13862. variableArgs: false,
  13863. };
  13864. t.i = {
  13865. id: _util.OPS.setFlatness,
  13866. numArgs: 1,
  13867. variableArgs: false,
  13868. };
  13869. t.gs = {
  13870. id: _util.OPS.setGState,
  13871. numArgs: 1,
  13872. variableArgs: false,
  13873. };
  13874. t.q = {
  13875. id: _util.OPS.save,
  13876. numArgs: 0,
  13877. variableArgs: false,
  13878. };
  13879. t.Q = {
  13880. id: _util.OPS.restore,
  13881. numArgs: 0,
  13882. variableArgs: false,
  13883. };
  13884. t.cm = {
  13885. id: _util.OPS.transform,
  13886. numArgs: 6,
  13887. variableArgs: false,
  13888. };
  13889. t.m = {
  13890. id: _util.OPS.moveTo,
  13891. numArgs: 2,
  13892. variableArgs: false,
  13893. };
  13894. t.l = {
  13895. id: _util.OPS.lineTo,
  13896. numArgs: 2,
  13897. variableArgs: false,
  13898. };
  13899. t.c = {
  13900. id: _util.OPS.curveTo,
  13901. numArgs: 6,
  13902. variableArgs: false,
  13903. };
  13904. t.v = {
  13905. id: _util.OPS.curveTo2,
  13906. numArgs: 4,
  13907. variableArgs: false,
  13908. };
  13909. t.y = {
  13910. id: _util.OPS.curveTo3,
  13911. numArgs: 4,
  13912. variableArgs: false,
  13913. };
  13914. t.h = {
  13915. id: _util.OPS.closePath,
  13916. numArgs: 0,
  13917. variableArgs: false,
  13918. };
  13919. t.re = {
  13920. id: _util.OPS.rectangle,
  13921. numArgs: 4,
  13922. variableArgs: false,
  13923. };
  13924. t.S = {
  13925. id: _util.OPS.stroke,
  13926. numArgs: 0,
  13927. variableArgs: false,
  13928. };
  13929. t.s = {
  13930. id: _util.OPS.closeStroke,
  13931. numArgs: 0,
  13932. variableArgs: false,
  13933. };
  13934. t.f = {
  13935. id: _util.OPS.fill,
  13936. numArgs: 0,
  13937. variableArgs: false,
  13938. };
  13939. t.F = {
  13940. id: _util.OPS.fill,
  13941. numArgs: 0,
  13942. variableArgs: false,
  13943. };
  13944. t["f*"] = {
  13945. id: _util.OPS.eoFill,
  13946. numArgs: 0,
  13947. variableArgs: false,
  13948. };
  13949. t.B = {
  13950. id: _util.OPS.fillStroke,
  13951. numArgs: 0,
  13952. variableArgs: false,
  13953. };
  13954. t["B*"] = {
  13955. id: _util.OPS.eoFillStroke,
  13956. numArgs: 0,
  13957. variableArgs: false,
  13958. };
  13959. t.b = {
  13960. id: _util.OPS.closeFillStroke,
  13961. numArgs: 0,
  13962. variableArgs: false,
  13963. };
  13964. t["b*"] = {
  13965. id: _util.OPS.closeEOFillStroke,
  13966. numArgs: 0,
  13967. variableArgs: false,
  13968. };
  13969. t.n = {
  13970. id: _util.OPS.endPath,
  13971. numArgs: 0,
  13972. variableArgs: false,
  13973. };
  13974. t.W = {
  13975. id: _util.OPS.clip,
  13976. numArgs: 0,
  13977. variableArgs: false,
  13978. };
  13979. t["W*"] = {
  13980. id: _util.OPS.eoClip,
  13981. numArgs: 0,
  13982. variableArgs: false,
  13983. };
  13984. t.BT = {
  13985. id: _util.OPS.beginText,
  13986. numArgs: 0,
  13987. variableArgs: false,
  13988. };
  13989. t.ET = {
  13990. id: _util.OPS.endText,
  13991. numArgs: 0,
  13992. variableArgs: false,
  13993. };
  13994. t.Tc = {
  13995. id: _util.OPS.setCharSpacing,
  13996. numArgs: 1,
  13997. variableArgs: false,
  13998. };
  13999. t.Tw = {
  14000. id: _util.OPS.setWordSpacing,
  14001. numArgs: 1,
  14002. variableArgs: false,
  14003. };
  14004. t.Tz = {
  14005. id: _util.OPS.setHScale,
  14006. numArgs: 1,
  14007. variableArgs: false,
  14008. };
  14009. t.TL = {
  14010. id: _util.OPS.setLeading,
  14011. numArgs: 1,
  14012. variableArgs: false,
  14013. };
  14014. t.Tf = {
  14015. id: _util.OPS.setFont,
  14016. numArgs: 2,
  14017. variableArgs: false,
  14018. };
  14019. t.Tr = {
  14020. id: _util.OPS.setTextRenderingMode,
  14021. numArgs: 1,
  14022. variableArgs: false,
  14023. };
  14024. t.Ts = {
  14025. id: _util.OPS.setTextRise,
  14026. numArgs: 1,
  14027. variableArgs: false,
  14028. };
  14029. t.Td = {
  14030. id: _util.OPS.moveText,
  14031. numArgs: 2,
  14032. variableArgs: false,
  14033. };
  14034. t.TD = {
  14035. id: _util.OPS.setLeadingMoveText,
  14036. numArgs: 2,
  14037. variableArgs: false,
  14038. };
  14039. t.Tm = {
  14040. id: _util.OPS.setTextMatrix,
  14041. numArgs: 6,
  14042. variableArgs: false,
  14043. };
  14044. t["T*"] = {
  14045. id: _util.OPS.nextLine,
  14046. numArgs: 0,
  14047. variableArgs: false,
  14048. };
  14049. t.Tj = {
  14050. id: _util.OPS.showText,
  14051. numArgs: 1,
  14052. variableArgs: false,
  14053. };
  14054. t.TJ = {
  14055. id: _util.OPS.showSpacedText,
  14056. numArgs: 1,
  14057. variableArgs: false,
  14058. };
  14059. t["'"] = {
  14060. id: _util.OPS.nextLineShowText,
  14061. numArgs: 1,
  14062. variableArgs: false,
  14063. };
  14064. t['"'] = {
  14065. id: _util.OPS.nextLineSetSpacingShowText,
  14066. numArgs: 3,
  14067. variableArgs: false,
  14068. };
  14069. t.d0 = {
  14070. id: _util.OPS.setCharWidth,
  14071. numArgs: 2,
  14072. variableArgs: false,
  14073. };
  14074. t.d1 = {
  14075. id: _util.OPS.setCharWidthAndBounds,
  14076. numArgs: 6,
  14077. variableArgs: false,
  14078. };
  14079. t.CS = {
  14080. id: _util.OPS.setStrokeColorSpace,
  14081. numArgs: 1,
  14082. variableArgs: false,
  14083. };
  14084. t.cs = {
  14085. id: _util.OPS.setFillColorSpace,
  14086. numArgs: 1,
  14087. variableArgs: false,
  14088. };
  14089. t.SC = {
  14090. id: _util.OPS.setStrokeColor,
  14091. numArgs: 4,
  14092. variableArgs: true,
  14093. };
  14094. t.SCN = {
  14095. id: _util.OPS.setStrokeColorN,
  14096. numArgs: 33,
  14097. variableArgs: true,
  14098. };
  14099. t.sc = {
  14100. id: _util.OPS.setFillColor,
  14101. numArgs: 4,
  14102. variableArgs: true,
  14103. };
  14104. t.scn = {
  14105. id: _util.OPS.setFillColorN,
  14106. numArgs: 33,
  14107. variableArgs: true,
  14108. };
  14109. t.G = {
  14110. id: _util.OPS.setStrokeGray,
  14111. numArgs: 1,
  14112. variableArgs: false,
  14113. };
  14114. t.g = {
  14115. id: _util.OPS.setFillGray,
  14116. numArgs: 1,
  14117. variableArgs: false,
  14118. };
  14119. t.RG = {
  14120. id: _util.OPS.setStrokeRGBColor,
  14121. numArgs: 3,
  14122. variableArgs: false,
  14123. };
  14124. t.rg = {
  14125. id: _util.OPS.setFillRGBColor,
  14126. numArgs: 3,
  14127. variableArgs: false,
  14128. };
  14129. t.K = {
  14130. id: _util.OPS.setStrokeCMYKColor,
  14131. numArgs: 4,
  14132. variableArgs: false,
  14133. };
  14134. t.k = {
  14135. id: _util.OPS.setFillCMYKColor,
  14136. numArgs: 4,
  14137. variableArgs: false,
  14138. };
  14139. t.sh = {
  14140. id: _util.OPS.shadingFill,
  14141. numArgs: 1,
  14142. variableArgs: false,
  14143. };
  14144. t.BI = {
  14145. id: _util.OPS.beginInlineImage,
  14146. numArgs: 0,
  14147. variableArgs: false,
  14148. };
  14149. t.ID = {
  14150. id: _util.OPS.beginImageData,
  14151. numArgs: 0,
  14152. variableArgs: false,
  14153. };
  14154. t.EI = {
  14155. id: _util.OPS.endInlineImage,
  14156. numArgs: 1,
  14157. variableArgs: false,
  14158. };
  14159. t.Do = {
  14160. id: _util.OPS.paintXObject,
  14161. numArgs: 1,
  14162. variableArgs: false,
  14163. };
  14164. t.MP = {
  14165. id: _util.OPS.markPoint,
  14166. numArgs: 1,
  14167. variableArgs: false,
  14168. };
  14169. t.DP = {
  14170. id: _util.OPS.markPointProps,
  14171. numArgs: 2,
  14172. variableArgs: false,
  14173. };
  14174. t.BMC = {
  14175. id: _util.OPS.beginMarkedContent,
  14176. numArgs: 1,
  14177. variableArgs: false,
  14178. };
  14179. t.BDC = {
  14180. id: _util.OPS.beginMarkedContentProps,
  14181. numArgs: 2,
  14182. variableArgs: false,
  14183. };
  14184. t.EMC = {
  14185. id: _util.OPS.endMarkedContent,
  14186. numArgs: 0,
  14187. variableArgs: false,
  14188. };
  14189. t.BX = {
  14190. id: _util.OPS.beginCompat,
  14191. numArgs: 0,
  14192. variableArgs: false,
  14193. };
  14194. t.EX = {
  14195. id: _util.OPS.endCompat,
  14196. numArgs: 0,
  14197. variableArgs: false,
  14198. };
  14199. t.BM = null;
  14200. t.BD = null;
  14201. t.true = null;
  14202. t.fa = null;
  14203. t.fal = null;
  14204. t.fals = null;
  14205. t.false = null;
  14206. t.nu = null;
  14207. t.nul = null;
  14208. t.null = null;
  14209. });
  14210. return (0, _util.shadow)(this, "opMap", getOPMap());
  14211. }
  14212. static get MAX_INVALID_PATH_OPS() {
  14213. return (0, _util.shadow)(this, "MAX_INVALID_PATH_OPS", 10);
  14214. }
  14215. constructor(stream, xref, stateManager = new StateManager()) {
  14216. this.parser = new _parser.Parser({
  14217. lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap),
  14218. xref,
  14219. });
  14220. this.stateManager = stateManager;
  14221. this.nonProcessedArgs = [];
  14222. this._isPathOp = false;
  14223. this._numInvalidPathOPS = 0;
  14224. }
  14225. get savedStatesDepth() {
  14226. return this.stateManager.stateStack.length;
  14227. }
  14228. read(operation) {
  14229. let args = operation.args;
  14230. while (true) {
  14231. const obj = this.parser.getObj();
  14232. if (obj instanceof _primitives.Cmd) {
  14233. const cmd = obj.cmd;
  14234. const opSpec = EvaluatorPreprocessor.opMap[cmd];
  14235. if (!opSpec) {
  14236. (0, _util.warn)(`Unknown command "${cmd}".`);
  14237. continue;
  14238. }
  14239. const fn = opSpec.id;
  14240. const numArgs = opSpec.numArgs;
  14241. let argsLength = args !== null ? args.length : 0;
  14242. if (!this._isPathOp) {
  14243. this._numInvalidPathOPS = 0;
  14244. }
  14245. this._isPathOp =
  14246. fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath;
  14247. if (!opSpec.variableArgs) {
  14248. if (argsLength !== numArgs) {
  14249. const nonProcessedArgs = this.nonProcessedArgs;
  14250. while (argsLength > numArgs) {
  14251. nonProcessedArgs.push(args.shift());
  14252. argsLength--;
  14253. }
  14254. while (
  14255. argsLength < numArgs &&
  14256. nonProcessedArgs.length !== 0
  14257. ) {
  14258. if (args === null) {
  14259. args = [];
  14260. }
  14261. args.unshift(nonProcessedArgs.pop());
  14262. argsLength++;
  14263. }
  14264. }
  14265. if (argsLength < numArgs) {
  14266. const partialMsg =
  14267. `command ${cmd}: expected ${numArgs} args, ` +
  14268. `but received ${argsLength} args.`;
  14269. if (
  14270. this._isPathOp &&
  14271. ++this._numInvalidPathOPS >
  14272. EvaluatorPreprocessor.MAX_INVALID_PATH_OPS
  14273. ) {
  14274. throw new _util.FormatError(`Invalid ${partialMsg}`);
  14275. }
  14276. (0, _util.warn)(`Skipping ${partialMsg}`);
  14277. if (args !== null) {
  14278. args.length = 0;
  14279. }
  14280. continue;
  14281. }
  14282. } else if (argsLength > numArgs) {
  14283. (0, _util.info)(
  14284. `Command ${cmd}: expected [0, ${numArgs}] args, ` +
  14285. `but received ${argsLength} args.`
  14286. );
  14287. }
  14288. this.preprocessCommand(fn, args);
  14289. operation.fn = fn;
  14290. operation.args = args;
  14291. return true;
  14292. }
  14293. if (obj === _primitives.EOF) {
  14294. return false;
  14295. }
  14296. if (obj !== null) {
  14297. if (args === null) {
  14298. args = [];
  14299. }
  14300. args.push(obj);
  14301. if (args.length > 33) {
  14302. throw new _util.FormatError("Too many arguments");
  14303. }
  14304. }
  14305. }
  14306. }
  14307. preprocessCommand(fn, args) {
  14308. switch (fn | 0) {
  14309. case _util.OPS.save:
  14310. this.stateManager.save();
  14311. break;
  14312. case _util.OPS.restore:
  14313. this.stateManager.restore();
  14314. break;
  14315. case _util.OPS.transform:
  14316. this.stateManager.transform(args);
  14317. break;
  14318. }
  14319. }
  14320. }
  14321. exports.EvaluatorPreprocessor = EvaluatorPreprocessor;
  14322. /***/
  14323. },
  14324. /* 16 */
  14325. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14326. Object.defineProperty(exports, "__esModule", {
  14327. value: true,
  14328. });
  14329. exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0;
  14330. var _util = __w_pdfjs_require__(2);
  14331. var _primitives = __w_pdfjs_require__(5);
  14332. var _base_stream = __w_pdfjs_require__(7);
  14333. var _parser = __w_pdfjs_require__(17);
  14334. var _core_utils = __w_pdfjs_require__(6);
  14335. var _stream = __w_pdfjs_require__(10);
  14336. const BUILT_IN_CMAPS = [
  14337. "Adobe-GB1-UCS2",
  14338. "Adobe-CNS1-UCS2",
  14339. "Adobe-Japan1-UCS2",
  14340. "Adobe-Korea1-UCS2",
  14341. "78-EUC-H",
  14342. "78-EUC-V",
  14343. "78-H",
  14344. "78-RKSJ-H",
  14345. "78-RKSJ-V",
  14346. "78-V",
  14347. "78ms-RKSJ-H",
  14348. "78ms-RKSJ-V",
  14349. "83pv-RKSJ-H",
  14350. "90ms-RKSJ-H",
  14351. "90ms-RKSJ-V",
  14352. "90msp-RKSJ-H",
  14353. "90msp-RKSJ-V",
  14354. "90pv-RKSJ-H",
  14355. "90pv-RKSJ-V",
  14356. "Add-H",
  14357. "Add-RKSJ-H",
  14358. "Add-RKSJ-V",
  14359. "Add-V",
  14360. "Adobe-CNS1-0",
  14361. "Adobe-CNS1-1",
  14362. "Adobe-CNS1-2",
  14363. "Adobe-CNS1-3",
  14364. "Adobe-CNS1-4",
  14365. "Adobe-CNS1-5",
  14366. "Adobe-CNS1-6",
  14367. "Adobe-GB1-0",
  14368. "Adobe-GB1-1",
  14369. "Adobe-GB1-2",
  14370. "Adobe-GB1-3",
  14371. "Adobe-GB1-4",
  14372. "Adobe-GB1-5",
  14373. "Adobe-Japan1-0",
  14374. "Adobe-Japan1-1",
  14375. "Adobe-Japan1-2",
  14376. "Adobe-Japan1-3",
  14377. "Adobe-Japan1-4",
  14378. "Adobe-Japan1-5",
  14379. "Adobe-Japan1-6",
  14380. "Adobe-Korea1-0",
  14381. "Adobe-Korea1-1",
  14382. "Adobe-Korea1-2",
  14383. "B5-H",
  14384. "B5-V",
  14385. "B5pc-H",
  14386. "B5pc-V",
  14387. "CNS-EUC-H",
  14388. "CNS-EUC-V",
  14389. "CNS1-H",
  14390. "CNS1-V",
  14391. "CNS2-H",
  14392. "CNS2-V",
  14393. "ETHK-B5-H",
  14394. "ETHK-B5-V",
  14395. "ETen-B5-H",
  14396. "ETen-B5-V",
  14397. "ETenms-B5-H",
  14398. "ETenms-B5-V",
  14399. "EUC-H",
  14400. "EUC-V",
  14401. "Ext-H",
  14402. "Ext-RKSJ-H",
  14403. "Ext-RKSJ-V",
  14404. "Ext-V",
  14405. "GB-EUC-H",
  14406. "GB-EUC-V",
  14407. "GB-H",
  14408. "GB-V",
  14409. "GBK-EUC-H",
  14410. "GBK-EUC-V",
  14411. "GBK2K-H",
  14412. "GBK2K-V",
  14413. "GBKp-EUC-H",
  14414. "GBKp-EUC-V",
  14415. "GBT-EUC-H",
  14416. "GBT-EUC-V",
  14417. "GBT-H",
  14418. "GBT-V",
  14419. "GBTpc-EUC-H",
  14420. "GBTpc-EUC-V",
  14421. "GBpc-EUC-H",
  14422. "GBpc-EUC-V",
  14423. "H",
  14424. "HKdla-B5-H",
  14425. "HKdla-B5-V",
  14426. "HKdlb-B5-H",
  14427. "HKdlb-B5-V",
  14428. "HKgccs-B5-H",
  14429. "HKgccs-B5-V",
  14430. "HKm314-B5-H",
  14431. "HKm314-B5-V",
  14432. "HKm471-B5-H",
  14433. "HKm471-B5-V",
  14434. "HKscs-B5-H",
  14435. "HKscs-B5-V",
  14436. "Hankaku",
  14437. "Hiragana",
  14438. "KSC-EUC-H",
  14439. "KSC-EUC-V",
  14440. "KSC-H",
  14441. "KSC-Johab-H",
  14442. "KSC-Johab-V",
  14443. "KSC-V",
  14444. "KSCms-UHC-H",
  14445. "KSCms-UHC-HW-H",
  14446. "KSCms-UHC-HW-V",
  14447. "KSCms-UHC-V",
  14448. "KSCpc-EUC-H",
  14449. "KSCpc-EUC-V",
  14450. "Katakana",
  14451. "NWP-H",
  14452. "NWP-V",
  14453. "RKSJ-H",
  14454. "RKSJ-V",
  14455. "Roman",
  14456. "UniCNS-UCS2-H",
  14457. "UniCNS-UCS2-V",
  14458. "UniCNS-UTF16-H",
  14459. "UniCNS-UTF16-V",
  14460. "UniCNS-UTF32-H",
  14461. "UniCNS-UTF32-V",
  14462. "UniCNS-UTF8-H",
  14463. "UniCNS-UTF8-V",
  14464. "UniGB-UCS2-H",
  14465. "UniGB-UCS2-V",
  14466. "UniGB-UTF16-H",
  14467. "UniGB-UTF16-V",
  14468. "UniGB-UTF32-H",
  14469. "UniGB-UTF32-V",
  14470. "UniGB-UTF8-H",
  14471. "UniGB-UTF8-V",
  14472. "UniJIS-UCS2-H",
  14473. "UniJIS-UCS2-HW-H",
  14474. "UniJIS-UCS2-HW-V",
  14475. "UniJIS-UCS2-V",
  14476. "UniJIS-UTF16-H",
  14477. "UniJIS-UTF16-V",
  14478. "UniJIS-UTF32-H",
  14479. "UniJIS-UTF32-V",
  14480. "UniJIS-UTF8-H",
  14481. "UniJIS-UTF8-V",
  14482. "UniJIS2004-UTF16-H",
  14483. "UniJIS2004-UTF16-V",
  14484. "UniJIS2004-UTF32-H",
  14485. "UniJIS2004-UTF32-V",
  14486. "UniJIS2004-UTF8-H",
  14487. "UniJIS2004-UTF8-V",
  14488. "UniJISPro-UCS2-HW-V",
  14489. "UniJISPro-UCS2-V",
  14490. "UniJISPro-UTF8-V",
  14491. "UniJISX0213-UTF32-H",
  14492. "UniJISX0213-UTF32-V",
  14493. "UniJISX02132004-UTF32-H",
  14494. "UniJISX02132004-UTF32-V",
  14495. "UniKS-UCS2-H",
  14496. "UniKS-UCS2-V",
  14497. "UniKS-UTF16-H",
  14498. "UniKS-UTF16-V",
  14499. "UniKS-UTF32-H",
  14500. "UniKS-UTF32-V",
  14501. "UniKS-UTF8-H",
  14502. "UniKS-UTF8-V",
  14503. "V",
  14504. "WP-Symbol",
  14505. ];
  14506. const MAX_MAP_RANGE = 2 ** 24 - 1;
  14507. class CMap {
  14508. constructor(builtInCMap = false) {
  14509. this.codespaceRanges = [[], [], [], []];
  14510. this.numCodespaceRanges = 0;
  14511. this._map = [];
  14512. this.name = "";
  14513. this.vertical = false;
  14514. this.useCMap = null;
  14515. this.builtInCMap = builtInCMap;
  14516. }
  14517. addCodespaceRange(n, low, high) {
  14518. this.codespaceRanges[n - 1].push(low, high);
  14519. this.numCodespaceRanges++;
  14520. }
  14521. mapCidRange(low, high, dstLow) {
  14522. if (high - low > MAX_MAP_RANGE) {
  14523. throw new Error(
  14524. "mapCidRange - ignoring data above MAX_MAP_RANGE."
  14525. );
  14526. }
  14527. while (low <= high) {
  14528. this._map[low++] = dstLow++;
  14529. }
  14530. }
  14531. mapBfRange(low, high, dstLow) {
  14532. if (high - low > MAX_MAP_RANGE) {
  14533. throw new Error(
  14534. "mapBfRange - ignoring data above MAX_MAP_RANGE."
  14535. );
  14536. }
  14537. const lastByte = dstLow.length - 1;
  14538. while (low <= high) {
  14539. this._map[low++] = dstLow;
  14540. const nextCharCode = dstLow.charCodeAt(lastByte) + 1;
  14541. if (nextCharCode > 0xff) {
  14542. dstLow =
  14543. dstLow.substring(0, lastByte - 1) +
  14544. String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 1) +
  14545. "\x00";
  14546. continue;
  14547. }
  14548. dstLow =
  14549. dstLow.substring(0, lastByte) +
  14550. String.fromCharCode(nextCharCode);
  14551. }
  14552. }
  14553. mapBfRangeToArray(low, high, array) {
  14554. if (high - low > MAX_MAP_RANGE) {
  14555. throw new Error(
  14556. "mapBfRangeToArray - ignoring data above MAX_MAP_RANGE."
  14557. );
  14558. }
  14559. const ii = array.length;
  14560. let i = 0;
  14561. while (low <= high && i < ii) {
  14562. this._map[low] = array[i++];
  14563. ++low;
  14564. }
  14565. }
  14566. mapOne(src, dst) {
  14567. this._map[src] = dst;
  14568. }
  14569. lookup(code) {
  14570. return this._map[code];
  14571. }
  14572. contains(code) {
  14573. return this._map[code] !== undefined;
  14574. }
  14575. forEach(callback) {
  14576. const map = this._map;
  14577. const length = map.length;
  14578. if (length <= 0x10000) {
  14579. for (let i = 0; i < length; i++) {
  14580. if (map[i] !== undefined) {
  14581. callback(i, map[i]);
  14582. }
  14583. }
  14584. } else {
  14585. for (const i in map) {
  14586. callback(i, map[i]);
  14587. }
  14588. }
  14589. }
  14590. charCodeOf(value) {
  14591. const map = this._map;
  14592. if (map.length <= 0x10000) {
  14593. return map.indexOf(value);
  14594. }
  14595. for (const charCode in map) {
  14596. if (map[charCode] === value) {
  14597. return charCode | 0;
  14598. }
  14599. }
  14600. return -1;
  14601. }
  14602. getMap() {
  14603. return this._map;
  14604. }
  14605. readCharCode(str, offset, out) {
  14606. let c = 0;
  14607. const codespaceRanges = this.codespaceRanges;
  14608. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  14609. c = ((c << 8) | str.charCodeAt(offset + n)) >>> 0;
  14610. const codespaceRange = codespaceRanges[n];
  14611. for (let k = 0, kk = codespaceRange.length; k < kk; ) {
  14612. const low = codespaceRange[k++];
  14613. const high = codespaceRange[k++];
  14614. if (c >= low && c <= high) {
  14615. out.charcode = c;
  14616. out.length = n + 1;
  14617. return;
  14618. }
  14619. }
  14620. }
  14621. out.charcode = 0;
  14622. out.length = 1;
  14623. }
  14624. getCharCodeLength(charCode) {
  14625. const codespaceRanges = this.codespaceRanges;
  14626. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  14627. const codespaceRange = codespaceRanges[n];
  14628. for (let k = 0, kk = codespaceRange.length; k < kk; ) {
  14629. const low = codespaceRange[k++];
  14630. const high = codespaceRange[k++];
  14631. if (charCode >= low && charCode <= high) {
  14632. return n + 1;
  14633. }
  14634. }
  14635. }
  14636. return 1;
  14637. }
  14638. get length() {
  14639. return this._map.length;
  14640. }
  14641. get isIdentityCMap() {
  14642. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  14643. return false;
  14644. }
  14645. if (this._map.length !== 0x10000) {
  14646. return false;
  14647. }
  14648. for (let i = 0; i < 0x10000; i++) {
  14649. if (this._map[i] !== i) {
  14650. return false;
  14651. }
  14652. }
  14653. return true;
  14654. }
  14655. }
  14656. exports.CMap = CMap;
  14657. class IdentityCMap extends CMap {
  14658. constructor(vertical, n) {
  14659. super();
  14660. this.vertical = vertical;
  14661. this.addCodespaceRange(n, 0, 0xffff);
  14662. }
  14663. mapCidRange(low, high, dstLow) {
  14664. (0, _util.unreachable)("should not call mapCidRange");
  14665. }
  14666. mapBfRange(low, high, dstLow) {
  14667. (0, _util.unreachable)("should not call mapBfRange");
  14668. }
  14669. mapBfRangeToArray(low, high, array) {
  14670. (0, _util.unreachable)("should not call mapBfRangeToArray");
  14671. }
  14672. mapOne(src, dst) {
  14673. (0, _util.unreachable)("should not call mapCidOne");
  14674. }
  14675. lookup(code) {
  14676. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  14677. }
  14678. contains(code) {
  14679. return Number.isInteger(code) && code <= 0xffff;
  14680. }
  14681. forEach(callback) {
  14682. for (let i = 0; i <= 0xffff; i++) {
  14683. callback(i, i);
  14684. }
  14685. }
  14686. charCodeOf(value) {
  14687. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  14688. }
  14689. getMap() {
  14690. const map = new Array(0x10000);
  14691. for (let i = 0; i <= 0xffff; i++) {
  14692. map[i] = i;
  14693. }
  14694. return map;
  14695. }
  14696. get length() {
  14697. return 0x10000;
  14698. }
  14699. get isIdentityCMap() {
  14700. (0, _util.unreachable)("should not access .isIdentityCMap");
  14701. }
  14702. }
  14703. exports.IdentityCMap = IdentityCMap;
  14704. const BinaryCMapReader = (function BinaryCMapReaderClosure() {
  14705. function hexToInt(a, size) {
  14706. let n = 0;
  14707. for (let i = 0; i <= size; i++) {
  14708. n = (n << 8) | a[i];
  14709. }
  14710. return n >>> 0;
  14711. }
  14712. function hexToStr(a, size) {
  14713. if (size === 1) {
  14714. return String.fromCharCode(a[0], a[1]);
  14715. }
  14716. if (size === 3) {
  14717. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  14718. }
  14719. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  14720. }
  14721. function addHex(a, b, size) {
  14722. let c = 0;
  14723. for (let i = size; i >= 0; i--) {
  14724. c += a[i] + b[i];
  14725. a[i] = c & 255;
  14726. c >>= 8;
  14727. }
  14728. }
  14729. function incHex(a, size) {
  14730. let c = 1;
  14731. for (let i = size; i >= 0 && c > 0; i--) {
  14732. c += a[i];
  14733. a[i] = c & 255;
  14734. c >>= 8;
  14735. }
  14736. }
  14737. const MAX_NUM_SIZE = 16;
  14738. const MAX_ENCODED_NUM_SIZE = 19;
  14739. class BinaryCMapStream {
  14740. constructor(data) {
  14741. this.buffer = data;
  14742. this.pos = 0;
  14743. this.end = data.length;
  14744. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  14745. }
  14746. readByte() {
  14747. if (this.pos >= this.end) {
  14748. return -1;
  14749. }
  14750. return this.buffer[this.pos++];
  14751. }
  14752. readNumber() {
  14753. let n = 0;
  14754. let last;
  14755. do {
  14756. const b = this.readByte();
  14757. if (b < 0) {
  14758. throw new _util.FormatError("unexpected EOF in bcmap");
  14759. }
  14760. last = !(b & 0x80);
  14761. n = (n << 7) | (b & 0x7f);
  14762. } while (!last);
  14763. return n;
  14764. }
  14765. readSigned() {
  14766. const n = this.readNumber();
  14767. return n & 1 ? ~(n >>> 1) : n >>> 1;
  14768. }
  14769. readHex(num, size) {
  14770. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  14771. this.pos += size + 1;
  14772. }
  14773. readHexNumber(num, size) {
  14774. let last;
  14775. const stack = this.tmpBuf;
  14776. let sp = 0;
  14777. do {
  14778. const b = this.readByte();
  14779. if (b < 0) {
  14780. throw new _util.FormatError("unexpected EOF in bcmap");
  14781. }
  14782. last = !(b & 0x80);
  14783. stack[sp++] = b & 0x7f;
  14784. } while (!last);
  14785. let i = size,
  14786. buffer = 0,
  14787. bufferSize = 0;
  14788. while (i >= 0) {
  14789. while (bufferSize < 8 && stack.length > 0) {
  14790. buffer |= stack[--sp] << bufferSize;
  14791. bufferSize += 7;
  14792. }
  14793. num[i] = buffer & 255;
  14794. i--;
  14795. buffer >>= 8;
  14796. bufferSize -= 8;
  14797. }
  14798. }
  14799. readHexSigned(num, size) {
  14800. this.readHexNumber(num, size);
  14801. const sign = num[size] & 1 ? 255 : 0;
  14802. let c = 0;
  14803. for (let i = 0; i <= size; i++) {
  14804. c = ((c & 1) << 8) | num[i];
  14805. num[i] = (c >> 1) ^ sign;
  14806. }
  14807. }
  14808. readString() {
  14809. const len = this.readNumber();
  14810. let s = "";
  14811. for (let i = 0; i < len; i++) {
  14812. s += String.fromCharCode(this.readNumber());
  14813. }
  14814. return s;
  14815. }
  14816. }
  14817. class BinaryCMapReader {
  14818. async process(data, cMap, extend) {
  14819. const stream = new BinaryCMapStream(data);
  14820. const header = stream.readByte();
  14821. cMap.vertical = !!(header & 1);
  14822. let useCMap = null;
  14823. const start = new Uint8Array(MAX_NUM_SIZE);
  14824. const end = new Uint8Array(MAX_NUM_SIZE);
  14825. const char = new Uint8Array(MAX_NUM_SIZE);
  14826. const charCode = new Uint8Array(MAX_NUM_SIZE);
  14827. const tmp = new Uint8Array(MAX_NUM_SIZE);
  14828. let code;
  14829. let b;
  14830. while ((b = stream.readByte()) >= 0) {
  14831. const type = b >> 5;
  14832. if (type === 7) {
  14833. switch (b & 0x1f) {
  14834. case 0:
  14835. stream.readString();
  14836. break;
  14837. case 1:
  14838. useCMap = stream.readString();
  14839. break;
  14840. }
  14841. continue;
  14842. }
  14843. const sequence = !!(b & 0x10);
  14844. const dataSize = b & 15;
  14845. if (dataSize + 1 > MAX_NUM_SIZE) {
  14846. throw new Error(
  14847. "BinaryCMapReader.process: Invalid dataSize."
  14848. );
  14849. }
  14850. const ucs2DataSize = 1;
  14851. const subitemsCount = stream.readNumber();
  14852. switch (type) {
  14853. case 0:
  14854. stream.readHex(start, dataSize);
  14855. stream.readHexNumber(end, dataSize);
  14856. addHex(end, start, dataSize);
  14857. cMap.addCodespaceRange(
  14858. dataSize + 1,
  14859. hexToInt(start, dataSize),
  14860. hexToInt(end, dataSize)
  14861. );
  14862. for (let i = 1; i < subitemsCount; i++) {
  14863. incHex(end, dataSize);
  14864. stream.readHexNumber(start, dataSize);
  14865. addHex(start, end, dataSize);
  14866. stream.readHexNumber(end, dataSize);
  14867. addHex(end, start, dataSize);
  14868. cMap.addCodespaceRange(
  14869. dataSize + 1,
  14870. hexToInt(start, dataSize),
  14871. hexToInt(end, dataSize)
  14872. );
  14873. }
  14874. break;
  14875. case 1:
  14876. stream.readHex(start, dataSize);
  14877. stream.readHexNumber(end, dataSize);
  14878. addHex(end, start, dataSize);
  14879. stream.readNumber();
  14880. for (let i = 1; i < subitemsCount; i++) {
  14881. incHex(end, dataSize);
  14882. stream.readHexNumber(start, dataSize);
  14883. addHex(start, end, dataSize);
  14884. stream.readHexNumber(end, dataSize);
  14885. addHex(end, start, dataSize);
  14886. stream.readNumber();
  14887. }
  14888. break;
  14889. case 2:
  14890. stream.readHex(char, dataSize);
  14891. code = stream.readNumber();
  14892. cMap.mapOne(hexToInt(char, dataSize), code);
  14893. for (let i = 1; i < subitemsCount; i++) {
  14894. incHex(char, dataSize);
  14895. if (!sequence) {
  14896. stream.readHexNumber(tmp, dataSize);
  14897. addHex(char, tmp, dataSize);
  14898. }
  14899. code = stream.readSigned() + (code + 1);
  14900. cMap.mapOne(hexToInt(char, dataSize), code);
  14901. }
  14902. break;
  14903. case 3:
  14904. stream.readHex(start, dataSize);
  14905. stream.readHexNumber(end, dataSize);
  14906. addHex(end, start, dataSize);
  14907. code = stream.readNumber();
  14908. cMap.mapCidRange(
  14909. hexToInt(start, dataSize),
  14910. hexToInt(end, dataSize),
  14911. code
  14912. );
  14913. for (let i = 1; i < subitemsCount; i++) {
  14914. incHex(end, dataSize);
  14915. if (!sequence) {
  14916. stream.readHexNumber(start, dataSize);
  14917. addHex(start, end, dataSize);
  14918. } else {
  14919. start.set(end);
  14920. }
  14921. stream.readHexNumber(end, dataSize);
  14922. addHex(end, start, dataSize);
  14923. code = stream.readNumber();
  14924. cMap.mapCidRange(
  14925. hexToInt(start, dataSize),
  14926. hexToInt(end, dataSize),
  14927. code
  14928. );
  14929. }
  14930. break;
  14931. case 4:
  14932. stream.readHex(char, ucs2DataSize);
  14933. stream.readHex(charCode, dataSize);
  14934. cMap.mapOne(
  14935. hexToInt(char, ucs2DataSize),
  14936. hexToStr(charCode, dataSize)
  14937. );
  14938. for (let i = 1; i < subitemsCount; i++) {
  14939. incHex(char, ucs2DataSize);
  14940. if (!sequence) {
  14941. stream.readHexNumber(tmp, ucs2DataSize);
  14942. addHex(char, tmp, ucs2DataSize);
  14943. }
  14944. incHex(charCode, dataSize);
  14945. stream.readHexSigned(tmp, dataSize);
  14946. addHex(charCode, tmp, dataSize);
  14947. cMap.mapOne(
  14948. hexToInt(char, ucs2DataSize),
  14949. hexToStr(charCode, dataSize)
  14950. );
  14951. }
  14952. break;
  14953. case 5:
  14954. stream.readHex(start, ucs2DataSize);
  14955. stream.readHexNumber(end, ucs2DataSize);
  14956. addHex(end, start, ucs2DataSize);
  14957. stream.readHex(charCode, dataSize);
  14958. cMap.mapBfRange(
  14959. hexToInt(start, ucs2DataSize),
  14960. hexToInt(end, ucs2DataSize),
  14961. hexToStr(charCode, dataSize)
  14962. );
  14963. for (let i = 1; i < subitemsCount; i++) {
  14964. incHex(end, ucs2DataSize);
  14965. if (!sequence) {
  14966. stream.readHexNumber(start, ucs2DataSize);
  14967. addHex(start, end, ucs2DataSize);
  14968. } else {
  14969. start.set(end);
  14970. }
  14971. stream.readHexNumber(end, ucs2DataSize);
  14972. addHex(end, start, ucs2DataSize);
  14973. stream.readHex(charCode, dataSize);
  14974. cMap.mapBfRange(
  14975. hexToInt(start, ucs2DataSize),
  14976. hexToInt(end, ucs2DataSize),
  14977. hexToStr(charCode, dataSize)
  14978. );
  14979. }
  14980. break;
  14981. default:
  14982. throw new Error(
  14983. `BinaryCMapReader.process - unknown type: ${type}`
  14984. );
  14985. }
  14986. }
  14987. if (useCMap) {
  14988. return extend(useCMap);
  14989. }
  14990. return cMap;
  14991. }
  14992. }
  14993. return BinaryCMapReader;
  14994. })();
  14995. const CMapFactory = (function CMapFactoryClosure() {
  14996. function strToInt(str) {
  14997. let a = 0;
  14998. for (let i = 0; i < str.length; i++) {
  14999. a = (a << 8) | str.charCodeAt(i);
  15000. }
  15001. return a >>> 0;
  15002. }
  15003. function expectString(obj) {
  15004. if (typeof obj !== "string") {
  15005. throw new _util.FormatError("Malformed CMap: expected string.");
  15006. }
  15007. }
  15008. function expectInt(obj) {
  15009. if (!Number.isInteger(obj)) {
  15010. throw new _util.FormatError("Malformed CMap: expected int.");
  15011. }
  15012. }
  15013. function parseBfChar(cMap, lexer) {
  15014. while (true) {
  15015. let obj = lexer.getObj();
  15016. if (obj === _primitives.EOF) {
  15017. break;
  15018. }
  15019. if ((0, _primitives.isCmd)(obj, "endbfchar")) {
  15020. return;
  15021. }
  15022. expectString(obj);
  15023. const src = strToInt(obj);
  15024. obj = lexer.getObj();
  15025. expectString(obj);
  15026. const dst = obj;
  15027. cMap.mapOne(src, dst);
  15028. }
  15029. }
  15030. function parseBfRange(cMap, lexer) {
  15031. while (true) {
  15032. let obj = lexer.getObj();
  15033. if (obj === _primitives.EOF) {
  15034. break;
  15035. }
  15036. if ((0, _primitives.isCmd)(obj, "endbfrange")) {
  15037. return;
  15038. }
  15039. expectString(obj);
  15040. const low = strToInt(obj);
  15041. obj = lexer.getObj();
  15042. expectString(obj);
  15043. const high = strToInt(obj);
  15044. obj = lexer.getObj();
  15045. if (Number.isInteger(obj) || typeof obj === "string") {
  15046. const dstLow = Number.isInteger(obj)
  15047. ? String.fromCharCode(obj)
  15048. : obj;
  15049. cMap.mapBfRange(low, high, dstLow);
  15050. } else if ((0, _primitives.isCmd)(obj, "[")) {
  15051. obj = lexer.getObj();
  15052. const array = [];
  15053. while (
  15054. !(0, _primitives.isCmd)(obj, "]") &&
  15055. obj !== _primitives.EOF
  15056. ) {
  15057. array.push(obj);
  15058. obj = lexer.getObj();
  15059. }
  15060. cMap.mapBfRangeToArray(low, high, array);
  15061. } else {
  15062. break;
  15063. }
  15064. }
  15065. throw new _util.FormatError("Invalid bf range.");
  15066. }
  15067. function parseCidChar(cMap, lexer) {
  15068. while (true) {
  15069. let obj = lexer.getObj();
  15070. if (obj === _primitives.EOF) {
  15071. break;
  15072. }
  15073. if ((0, _primitives.isCmd)(obj, "endcidchar")) {
  15074. return;
  15075. }
  15076. expectString(obj);
  15077. const src = strToInt(obj);
  15078. obj = lexer.getObj();
  15079. expectInt(obj);
  15080. const dst = obj;
  15081. cMap.mapOne(src, dst);
  15082. }
  15083. }
  15084. function parseCidRange(cMap, lexer) {
  15085. while (true) {
  15086. let obj = lexer.getObj();
  15087. if (obj === _primitives.EOF) {
  15088. break;
  15089. }
  15090. if ((0, _primitives.isCmd)(obj, "endcidrange")) {
  15091. return;
  15092. }
  15093. expectString(obj);
  15094. const low = strToInt(obj);
  15095. obj = lexer.getObj();
  15096. expectString(obj);
  15097. const high = strToInt(obj);
  15098. obj = lexer.getObj();
  15099. expectInt(obj);
  15100. const dstLow = obj;
  15101. cMap.mapCidRange(low, high, dstLow);
  15102. }
  15103. }
  15104. function parseCodespaceRange(cMap, lexer) {
  15105. while (true) {
  15106. let obj = lexer.getObj();
  15107. if (obj === _primitives.EOF) {
  15108. break;
  15109. }
  15110. if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
  15111. return;
  15112. }
  15113. if (typeof obj !== "string") {
  15114. break;
  15115. }
  15116. const low = strToInt(obj);
  15117. obj = lexer.getObj();
  15118. if (typeof obj !== "string") {
  15119. break;
  15120. }
  15121. const high = strToInt(obj);
  15122. cMap.addCodespaceRange(obj.length, low, high);
  15123. }
  15124. throw new _util.FormatError("Invalid codespace range.");
  15125. }
  15126. function parseWMode(cMap, lexer) {
  15127. const obj = lexer.getObj();
  15128. if (Number.isInteger(obj)) {
  15129. cMap.vertical = !!obj;
  15130. }
  15131. }
  15132. function parseCMapName(cMap, lexer) {
  15133. const obj = lexer.getObj();
  15134. if (obj instanceof _primitives.Name) {
  15135. cMap.name = obj.name;
  15136. }
  15137. }
  15138. async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  15139. let previous, embeddedUseCMap;
  15140. objLoop: while (true) {
  15141. try {
  15142. const obj = lexer.getObj();
  15143. if (obj === _primitives.EOF) {
  15144. break;
  15145. } else if (obj instanceof _primitives.Name) {
  15146. if (obj.name === "WMode") {
  15147. parseWMode(cMap, lexer);
  15148. } else if (obj.name === "CMapName") {
  15149. parseCMapName(cMap, lexer);
  15150. }
  15151. previous = obj;
  15152. } else if (obj instanceof _primitives.Cmd) {
  15153. switch (obj.cmd) {
  15154. case "endcmap":
  15155. break objLoop;
  15156. case "usecmap":
  15157. if (previous instanceof _primitives.Name) {
  15158. embeddedUseCMap = previous.name;
  15159. }
  15160. break;
  15161. case "begincodespacerange":
  15162. parseCodespaceRange(cMap, lexer);
  15163. break;
  15164. case "beginbfchar":
  15165. parseBfChar(cMap, lexer);
  15166. break;
  15167. case "begincidchar":
  15168. parseCidChar(cMap, lexer);
  15169. break;
  15170. case "beginbfrange":
  15171. parseBfRange(cMap, lexer);
  15172. break;
  15173. case "begincidrange":
  15174. parseCidRange(cMap, lexer);
  15175. break;
  15176. }
  15177. }
  15178. } catch (ex) {
  15179. if (ex instanceof _core_utils.MissingDataException) {
  15180. throw ex;
  15181. }
  15182. (0, _util.warn)("Invalid cMap data: " + ex);
  15183. continue;
  15184. }
  15185. }
  15186. if (!useCMap && embeddedUseCMap) {
  15187. useCMap = embeddedUseCMap;
  15188. }
  15189. if (useCMap) {
  15190. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  15191. }
  15192. return cMap;
  15193. }
  15194. async function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  15195. cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap);
  15196. if (cMap.numCodespaceRanges === 0) {
  15197. const useCodespaceRanges = cMap.useCMap.codespaceRanges;
  15198. for (let i = 0; i < useCodespaceRanges.length; i++) {
  15199. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  15200. }
  15201. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  15202. }
  15203. cMap.useCMap.forEach(function (key, value) {
  15204. if (!cMap.contains(key)) {
  15205. cMap.mapOne(key, cMap.useCMap.lookup(key));
  15206. }
  15207. });
  15208. return cMap;
  15209. }
  15210. async function createBuiltInCMap(name, fetchBuiltInCMap) {
  15211. if (name === "Identity-H") {
  15212. return new IdentityCMap(false, 2);
  15213. } else if (name === "Identity-V") {
  15214. return new IdentityCMap(true, 2);
  15215. }
  15216. if (!BUILT_IN_CMAPS.includes(name)) {
  15217. throw new Error("Unknown CMap name: " + name);
  15218. }
  15219. if (!fetchBuiltInCMap) {
  15220. throw new Error("Built-in CMap parameters are not provided.");
  15221. }
  15222. const { cMapData, compressionType } = await fetchBuiltInCMap(name);
  15223. const cMap = new CMap(true);
  15224. if (compressionType === _util.CMapCompressionType.BINARY) {
  15225. return new BinaryCMapReader().process(
  15226. cMapData,
  15227. cMap,
  15228. (useCMap) => {
  15229. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  15230. }
  15231. );
  15232. }
  15233. if (compressionType === _util.CMapCompressionType.NONE) {
  15234. const lexer = new _parser.Lexer(new _stream.Stream(cMapData));
  15235. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  15236. }
  15237. throw new Error(
  15238. "TODO: Only BINARY/NONE CMap compression is currently supported."
  15239. );
  15240. }
  15241. return {
  15242. async create(params) {
  15243. const encoding = params.encoding;
  15244. const fetchBuiltInCMap = params.fetchBuiltInCMap;
  15245. const useCMap = params.useCMap;
  15246. if (encoding instanceof _primitives.Name) {
  15247. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  15248. } else if (encoding instanceof _base_stream.BaseStream) {
  15249. const parsedCMap = await parseCMap(
  15250. new CMap(),
  15251. new _parser.Lexer(encoding),
  15252. fetchBuiltInCMap,
  15253. useCMap
  15254. );
  15255. if (parsedCMap.isIdentityCMap) {
  15256. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  15257. }
  15258. return parsedCMap;
  15259. }
  15260. throw new Error("Encoding required.");
  15261. },
  15262. };
  15263. })();
  15264. exports.CMapFactory = CMapFactory;
  15265. /***/
  15266. },
  15267. /* 17 */
  15268. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  15269. Object.defineProperty(exports, "__esModule", {
  15270. value: true,
  15271. });
  15272. exports.Parser = exports.Linearization = exports.Lexer = void 0;
  15273. var _util = __w_pdfjs_require__(2);
  15274. var _primitives = __w_pdfjs_require__(5);
  15275. var _core_utils = __w_pdfjs_require__(6);
  15276. var _ascii_85_stream = __w_pdfjs_require__(18);
  15277. var _ascii_hex_stream = __w_pdfjs_require__(20);
  15278. var _ccitt_stream = __w_pdfjs_require__(21);
  15279. var _flate_stream = __w_pdfjs_require__(23);
  15280. var _jbig2_stream = __w_pdfjs_require__(24);
  15281. var _jpeg_stream = __w_pdfjs_require__(27);
  15282. var _jpx_stream = __w_pdfjs_require__(29);
  15283. var _lzw_stream = __w_pdfjs_require__(31);
  15284. var _stream = __w_pdfjs_require__(10);
  15285. var _predictor_stream = __w_pdfjs_require__(32);
  15286. var _run_length_stream = __w_pdfjs_require__(33);
  15287. const MAX_LENGTH_TO_CACHE = 1000;
  15288. const MAX_ADLER32_LENGTH = 5552;
  15289. function computeAdler32(bytes) {
  15290. const bytesLength = bytes.length;
  15291. let a = 1,
  15292. b = 0;
  15293. for (let i = 0; i < bytesLength; ++i) {
  15294. a += bytes[i] & 0xff;
  15295. b += a;
  15296. }
  15297. return (b % 65521 << 16) | a % 65521;
  15298. }
  15299. class Parser {
  15300. constructor({
  15301. lexer,
  15302. xref,
  15303. allowStreams = false,
  15304. recoveryMode = false,
  15305. }) {
  15306. this.lexer = lexer;
  15307. this.xref = xref;
  15308. this.allowStreams = allowStreams;
  15309. this.recoveryMode = recoveryMode;
  15310. this.imageCache = Object.create(null);
  15311. this.refill();
  15312. }
  15313. refill() {
  15314. this.buf1 = this.lexer.getObj();
  15315. this.buf2 = this.lexer.getObj();
  15316. }
  15317. shift() {
  15318. if (
  15319. this.buf2 instanceof _primitives.Cmd &&
  15320. this.buf2.cmd === "ID"
  15321. ) {
  15322. this.buf1 = this.buf2;
  15323. this.buf2 = null;
  15324. } else {
  15325. this.buf1 = this.buf2;
  15326. this.buf2 = this.lexer.getObj();
  15327. }
  15328. }
  15329. tryShift() {
  15330. try {
  15331. this.shift();
  15332. return true;
  15333. } catch (e) {
  15334. if (e instanceof _core_utils.MissingDataException) {
  15335. throw e;
  15336. }
  15337. return false;
  15338. }
  15339. }
  15340. getObj(cipherTransform = null) {
  15341. const buf1 = this.buf1;
  15342. this.shift();
  15343. if (buf1 instanceof _primitives.Cmd) {
  15344. switch (buf1.cmd) {
  15345. case "BI":
  15346. return this.makeInlineImage(cipherTransform);
  15347. case "[":
  15348. const array = [];
  15349. while (
  15350. !(0, _primitives.isCmd)(this.buf1, "]") &&
  15351. this.buf1 !== _primitives.EOF
  15352. ) {
  15353. array.push(this.getObj(cipherTransform));
  15354. }
  15355. if (this.buf1 === _primitives.EOF) {
  15356. if (this.recoveryMode) {
  15357. return array;
  15358. }
  15359. throw new _core_utils.ParserEOFException(
  15360. "End of file inside array."
  15361. );
  15362. }
  15363. this.shift();
  15364. return array;
  15365. case "<<":
  15366. const dict = new _primitives.Dict(this.xref);
  15367. while (
  15368. !(0, _primitives.isCmd)(this.buf1, ">>") &&
  15369. this.buf1 !== _primitives.EOF
  15370. ) {
  15371. if (!(this.buf1 instanceof _primitives.Name)) {
  15372. (0, _util.info)(
  15373. "Malformed dictionary: key must be a name object"
  15374. );
  15375. this.shift();
  15376. continue;
  15377. }
  15378. const key = this.buf1.name;
  15379. this.shift();
  15380. if (this.buf1 === _primitives.EOF) {
  15381. break;
  15382. }
  15383. dict.set(key, this.getObj(cipherTransform));
  15384. }
  15385. if (this.buf1 === _primitives.EOF) {
  15386. if (this.recoveryMode) {
  15387. return dict;
  15388. }
  15389. throw new _core_utils.ParserEOFException(
  15390. "End of file inside dictionary."
  15391. );
  15392. }
  15393. if ((0, _primitives.isCmd)(this.buf2, "stream")) {
  15394. return this.allowStreams
  15395. ? this.makeStream(dict, cipherTransform)
  15396. : dict;
  15397. }
  15398. this.shift();
  15399. return dict;
  15400. default:
  15401. return buf1;
  15402. }
  15403. }
  15404. if (Number.isInteger(buf1)) {
  15405. if (
  15406. Number.isInteger(this.buf1) &&
  15407. (0, _primitives.isCmd)(this.buf2, "R")
  15408. ) {
  15409. const ref = _primitives.Ref.get(buf1, this.buf1);
  15410. this.shift();
  15411. this.shift();
  15412. return ref;
  15413. }
  15414. return buf1;
  15415. }
  15416. if (typeof buf1 === "string") {
  15417. if (cipherTransform) {
  15418. return cipherTransform.decryptString(buf1);
  15419. }
  15420. return buf1;
  15421. }
  15422. return buf1;
  15423. }
  15424. findDefaultInlineStreamEnd(stream) {
  15425. const E = 0x45,
  15426. I = 0x49,
  15427. SPACE = 0x20,
  15428. LF = 0xa,
  15429. CR = 0xd,
  15430. NUL = 0x0;
  15431. const lexer = this.lexer,
  15432. startPos = stream.pos,
  15433. n = 10;
  15434. let state = 0,
  15435. ch,
  15436. maybeEIPos;
  15437. while ((ch = stream.getByte()) !== -1) {
  15438. if (state === 0) {
  15439. state = ch === E ? 1 : 0;
  15440. } else if (state === 1) {
  15441. state = ch === I ? 2 : 0;
  15442. } else {
  15443. (0, _util.assert)(
  15444. state === 2,
  15445. "findDefaultInlineStreamEnd - invalid state."
  15446. );
  15447. if (ch === SPACE || ch === LF || ch === CR) {
  15448. maybeEIPos = stream.pos;
  15449. const followingBytes = stream.peekBytes(n);
  15450. for (let i = 0, ii = followingBytes.length; i < ii; i++) {
  15451. ch = followingBytes[i];
  15452. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  15453. continue;
  15454. }
  15455. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  15456. state = 0;
  15457. break;
  15458. }
  15459. }
  15460. if (state !== 2) {
  15461. continue;
  15462. }
  15463. if (lexer.knownCommands) {
  15464. const nextObj = lexer.peekObj();
  15465. if (
  15466. nextObj instanceof _primitives.Cmd &&
  15467. !lexer.knownCommands[nextObj.cmd]
  15468. ) {
  15469. state = 0;
  15470. }
  15471. } else {
  15472. (0, _util.warn)(
  15473. "findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined."
  15474. );
  15475. }
  15476. if (state === 2) {
  15477. break;
  15478. }
  15479. } else {
  15480. state = 0;
  15481. }
  15482. }
  15483. }
  15484. if (ch === -1) {
  15485. (0, _util.warn)(
  15486. "findDefaultInlineStreamEnd: " +
  15487. "Reached the end of the stream without finding a valid EI marker"
  15488. );
  15489. if (maybeEIPos) {
  15490. (0, _util.warn)(
  15491. '... trying to recover by using the last "EI" occurrence.'
  15492. );
  15493. stream.skip(-(stream.pos - maybeEIPos));
  15494. }
  15495. }
  15496. let endOffset = 4;
  15497. stream.skip(-endOffset);
  15498. ch = stream.peekByte();
  15499. stream.skip(endOffset);
  15500. if (!(0, _core_utils.isWhiteSpace)(ch)) {
  15501. endOffset--;
  15502. }
  15503. return stream.pos - endOffset - startPos;
  15504. }
  15505. findDCTDecodeInlineStreamEnd(stream) {
  15506. const startPos = stream.pos;
  15507. let foundEOI = false,
  15508. b,
  15509. markerLength;
  15510. while ((b = stream.getByte()) !== -1) {
  15511. if (b !== 0xff) {
  15512. continue;
  15513. }
  15514. switch (stream.getByte()) {
  15515. case 0x00:
  15516. break;
  15517. case 0xff:
  15518. stream.skip(-1);
  15519. break;
  15520. case 0xd9:
  15521. foundEOI = true;
  15522. break;
  15523. case 0xc0:
  15524. case 0xc1:
  15525. case 0xc2:
  15526. case 0xc3:
  15527. case 0xc5:
  15528. case 0xc6:
  15529. case 0xc7:
  15530. case 0xc9:
  15531. case 0xca:
  15532. case 0xcb:
  15533. case 0xcd:
  15534. case 0xce:
  15535. case 0xcf:
  15536. case 0xc4:
  15537. case 0xcc:
  15538. case 0xda:
  15539. case 0xdb:
  15540. case 0xdc:
  15541. case 0xdd:
  15542. case 0xde:
  15543. case 0xdf:
  15544. case 0xe0:
  15545. case 0xe1:
  15546. case 0xe2:
  15547. case 0xe3:
  15548. case 0xe4:
  15549. case 0xe5:
  15550. case 0xe6:
  15551. case 0xe7:
  15552. case 0xe8:
  15553. case 0xe9:
  15554. case 0xea:
  15555. case 0xeb:
  15556. case 0xec:
  15557. case 0xed:
  15558. case 0xee:
  15559. case 0xef:
  15560. case 0xfe:
  15561. markerLength = stream.getUint16();
  15562. if (markerLength > 2) {
  15563. stream.skip(markerLength - 2);
  15564. } else {
  15565. stream.skip(-2);
  15566. }
  15567. break;
  15568. }
  15569. if (foundEOI) {
  15570. break;
  15571. }
  15572. }
  15573. const length = stream.pos - startPos;
  15574. if (b === -1) {
  15575. (0, _util.warn)(
  15576. "Inline DCTDecode image stream: " +
  15577. "EOI marker not found, searching for /EI/ instead."
  15578. );
  15579. stream.skip(-length);
  15580. return this.findDefaultInlineStreamEnd(stream);
  15581. }
  15582. this.inlineStreamSkipEI(stream);
  15583. return length;
  15584. }
  15585. findASCII85DecodeInlineStreamEnd(stream) {
  15586. const TILDE = 0x7e,
  15587. GT = 0x3e;
  15588. const startPos = stream.pos;
  15589. let ch;
  15590. while ((ch = stream.getByte()) !== -1) {
  15591. if (ch === TILDE) {
  15592. const tildePos = stream.pos;
  15593. ch = stream.peekByte();
  15594. while ((0, _core_utils.isWhiteSpace)(ch)) {
  15595. stream.skip();
  15596. ch = stream.peekByte();
  15597. }
  15598. if (ch === GT) {
  15599. stream.skip();
  15600. break;
  15601. }
  15602. if (stream.pos > tildePos) {
  15603. const maybeEI = stream.peekBytes(2);
  15604. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  15605. break;
  15606. }
  15607. }
  15608. }
  15609. }
  15610. const length = stream.pos - startPos;
  15611. if (ch === -1) {
  15612. (0, _util.warn)(
  15613. "Inline ASCII85Decode image stream: " +
  15614. "EOD marker not found, searching for /EI/ instead."
  15615. );
  15616. stream.skip(-length);
  15617. return this.findDefaultInlineStreamEnd(stream);
  15618. }
  15619. this.inlineStreamSkipEI(stream);
  15620. return length;
  15621. }
  15622. findASCIIHexDecodeInlineStreamEnd(stream) {
  15623. const GT = 0x3e;
  15624. const startPos = stream.pos;
  15625. let ch;
  15626. while ((ch = stream.getByte()) !== -1) {
  15627. if (ch === GT) {
  15628. break;
  15629. }
  15630. }
  15631. const length = stream.pos - startPos;
  15632. if (ch === -1) {
  15633. (0, _util.warn)(
  15634. "Inline ASCIIHexDecode image stream: " +
  15635. "EOD marker not found, searching for /EI/ instead."
  15636. );
  15637. stream.skip(-length);
  15638. return this.findDefaultInlineStreamEnd(stream);
  15639. }
  15640. this.inlineStreamSkipEI(stream);
  15641. return length;
  15642. }
  15643. inlineStreamSkipEI(stream) {
  15644. const E = 0x45,
  15645. I = 0x49;
  15646. let state = 0,
  15647. ch;
  15648. while ((ch = stream.getByte()) !== -1) {
  15649. if (state === 0) {
  15650. state = ch === E ? 1 : 0;
  15651. } else if (state === 1) {
  15652. state = ch === I ? 2 : 0;
  15653. } else if (state === 2) {
  15654. break;
  15655. }
  15656. }
  15657. }
  15658. makeInlineImage(cipherTransform) {
  15659. const lexer = this.lexer;
  15660. const stream = lexer.stream;
  15661. const dict = new _primitives.Dict(this.xref);
  15662. let dictLength;
  15663. while (
  15664. !(0, _primitives.isCmd)(this.buf1, "ID") &&
  15665. this.buf1 !== _primitives.EOF
  15666. ) {
  15667. if (!(this.buf1 instanceof _primitives.Name)) {
  15668. throw new _util.FormatError(
  15669. "Dictionary key must be a name object"
  15670. );
  15671. }
  15672. const key = this.buf1.name;
  15673. this.shift();
  15674. if (this.buf1 === _primitives.EOF) {
  15675. break;
  15676. }
  15677. dict.set(key, this.getObj(cipherTransform));
  15678. }
  15679. if (lexer.beginInlineImagePos !== -1) {
  15680. dictLength = stream.pos - lexer.beginInlineImagePos;
  15681. }
  15682. const filter = dict.get("F", "Filter");
  15683. let filterName;
  15684. if (filter instanceof _primitives.Name) {
  15685. filterName = filter.name;
  15686. } else if (Array.isArray(filter)) {
  15687. const filterZero = this.xref.fetchIfRef(filter[0]);
  15688. if (filterZero instanceof _primitives.Name) {
  15689. filterName = filterZero.name;
  15690. }
  15691. }
  15692. const startPos = stream.pos;
  15693. let length;
  15694. switch (filterName) {
  15695. case "DCT":
  15696. case "DCTDecode":
  15697. length = this.findDCTDecodeInlineStreamEnd(stream);
  15698. break;
  15699. case "A85":
  15700. case "ASCII85Decode":
  15701. length = this.findASCII85DecodeInlineStreamEnd(stream);
  15702. break;
  15703. case "AHx":
  15704. case "ASCIIHexDecode":
  15705. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  15706. break;
  15707. default:
  15708. length = this.findDefaultInlineStreamEnd(stream);
  15709. }
  15710. let imageStream = stream.makeSubStream(startPos, length, dict);
  15711. let cacheKey;
  15712. if (
  15713. length < MAX_LENGTH_TO_CACHE &&
  15714. dictLength < MAX_ADLER32_LENGTH
  15715. ) {
  15716. const imageBytes = imageStream.getBytes();
  15717. imageStream.reset();
  15718. const initialStreamPos = stream.pos;
  15719. stream.pos = lexer.beginInlineImagePos;
  15720. const dictBytes = stream.getBytes(dictLength);
  15721. stream.pos = initialStreamPos;
  15722. cacheKey =
  15723. computeAdler32(imageBytes) + "_" + computeAdler32(dictBytes);
  15724. const cacheEntry = this.imageCache[cacheKey];
  15725. if (cacheEntry !== undefined) {
  15726. this.buf2 = _primitives.Cmd.get("EI");
  15727. this.shift();
  15728. cacheEntry.reset();
  15729. return cacheEntry;
  15730. }
  15731. }
  15732. if (cipherTransform) {
  15733. imageStream = cipherTransform.createStream(imageStream, length);
  15734. }
  15735. imageStream = this.filter(imageStream, dict, length);
  15736. imageStream.dict = dict;
  15737. if (cacheKey !== undefined) {
  15738. imageStream.cacheKey = `inline_${length}_${cacheKey}`;
  15739. this.imageCache[cacheKey] = imageStream;
  15740. }
  15741. this.buf2 = _primitives.Cmd.get("EI");
  15742. this.shift();
  15743. return imageStream;
  15744. }
  15745. _findStreamLength(startPos, signature) {
  15746. const { stream } = this.lexer;
  15747. stream.pos = startPos;
  15748. const SCAN_BLOCK_LENGTH = 2048;
  15749. const signatureLength = signature.length;
  15750. while (stream.pos < stream.end) {
  15751. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  15752. const scanLength = scanBytes.length - signatureLength;
  15753. if (scanLength <= 0) {
  15754. break;
  15755. }
  15756. let pos = 0;
  15757. while (pos < scanLength) {
  15758. let j = 0;
  15759. while (
  15760. j < signatureLength &&
  15761. scanBytes[pos + j] === signature[j]
  15762. ) {
  15763. j++;
  15764. }
  15765. if (j >= signatureLength) {
  15766. stream.pos += pos;
  15767. return stream.pos - startPos;
  15768. }
  15769. pos++;
  15770. }
  15771. stream.pos += scanLength;
  15772. }
  15773. return -1;
  15774. }
  15775. makeStream(dict, cipherTransform) {
  15776. const lexer = this.lexer;
  15777. let stream = lexer.stream;
  15778. lexer.skipToNextLine();
  15779. const startPos = stream.pos - 1;
  15780. let length = dict.get("Length");
  15781. if (!Number.isInteger(length)) {
  15782. (0, _util.info)(
  15783. `Bad length "${length && length.toString()}" in stream.`
  15784. );
  15785. length = 0;
  15786. }
  15787. stream.pos = startPos + length;
  15788. lexer.nextChar();
  15789. if (
  15790. this.tryShift() &&
  15791. (0, _primitives.isCmd)(this.buf2, "endstream")
  15792. ) {
  15793. this.shift();
  15794. } else {
  15795. const ENDSTREAM_SIGNATURE = new Uint8Array([
  15796. 0x65, 0x6e, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d,
  15797. ]);
  15798. let actualLength = this._findStreamLength(
  15799. startPos,
  15800. ENDSTREAM_SIGNATURE
  15801. );
  15802. if (actualLength < 0) {
  15803. const MAX_TRUNCATION = 1;
  15804. for (let i = 1; i <= MAX_TRUNCATION; i++) {
  15805. const end = ENDSTREAM_SIGNATURE.length - i;
  15806. const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
  15807. const maybeLength = this._findStreamLength(
  15808. startPos,
  15809. TRUNCATED_SIGNATURE
  15810. );
  15811. if (maybeLength >= 0) {
  15812. const lastByte = stream.peekBytes(end + 1)[end];
  15813. if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
  15814. break;
  15815. }
  15816. (0, _util.info)(
  15817. `Found "${(0, _util.bytesToString)(
  15818. TRUNCATED_SIGNATURE
  15819. )}" when ` + "searching for endstream command."
  15820. );
  15821. actualLength = maybeLength;
  15822. break;
  15823. }
  15824. }
  15825. if (actualLength < 0) {
  15826. throw new _util.FormatError("Missing endstream command.");
  15827. }
  15828. }
  15829. length = actualLength;
  15830. lexer.nextChar();
  15831. this.shift();
  15832. this.shift();
  15833. }
  15834. this.shift();
  15835. stream = stream.makeSubStream(startPos, length, dict);
  15836. if (cipherTransform) {
  15837. stream = cipherTransform.createStream(stream, length);
  15838. }
  15839. stream = this.filter(stream, dict, length);
  15840. stream.dict = dict;
  15841. return stream;
  15842. }
  15843. filter(stream, dict, length) {
  15844. let filter = dict.get("F", "Filter");
  15845. let params = dict.get("DP", "DecodeParms");
  15846. if (filter instanceof _primitives.Name) {
  15847. if (Array.isArray(params)) {
  15848. (0, _util.warn)(
  15849. "/DecodeParms should not be an Array, when /Filter is a Name."
  15850. );
  15851. }
  15852. return this.makeFilter(stream, filter.name, length, params);
  15853. }
  15854. let maybeLength = length;
  15855. if (Array.isArray(filter)) {
  15856. const filterArray = filter;
  15857. const paramsArray = params;
  15858. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  15859. filter = this.xref.fetchIfRef(filterArray[i]);
  15860. if (!(filter instanceof _primitives.Name)) {
  15861. throw new _util.FormatError(`Bad filter name "${filter}"`);
  15862. }
  15863. params = null;
  15864. if (Array.isArray(paramsArray) && i in paramsArray) {
  15865. params = this.xref.fetchIfRef(paramsArray[i]);
  15866. }
  15867. stream = this.makeFilter(
  15868. stream,
  15869. filter.name,
  15870. maybeLength,
  15871. params
  15872. );
  15873. maybeLength = null;
  15874. }
  15875. }
  15876. return stream;
  15877. }
  15878. makeFilter(stream, name, maybeLength, params) {
  15879. if (maybeLength === 0) {
  15880. (0, _util.warn)(`Empty "${name}" stream.`);
  15881. return new _stream.NullStream();
  15882. }
  15883. const xrefStats = this.xref.stats;
  15884. try {
  15885. switch (name) {
  15886. case "Fl":
  15887. case "FlateDecode":
  15888. xrefStats.addStreamType(_util.StreamType.FLATE);
  15889. if (params) {
  15890. return new _predictor_stream.PredictorStream(
  15891. new _flate_stream.FlateStream(stream, maybeLength),
  15892. maybeLength,
  15893. params
  15894. );
  15895. }
  15896. return new _flate_stream.FlateStream(stream, maybeLength);
  15897. case "LZW":
  15898. case "LZWDecode":
  15899. xrefStats.addStreamType(_util.StreamType.LZW);
  15900. let earlyChange = 1;
  15901. if (params) {
  15902. if (params.has("EarlyChange")) {
  15903. earlyChange = params.get("EarlyChange");
  15904. }
  15905. return new _predictor_stream.PredictorStream(
  15906. new _lzw_stream.LZWStream(
  15907. stream,
  15908. maybeLength,
  15909. earlyChange
  15910. ),
  15911. maybeLength,
  15912. params
  15913. );
  15914. }
  15915. return new _lzw_stream.LZWStream(
  15916. stream,
  15917. maybeLength,
  15918. earlyChange
  15919. );
  15920. case "DCT":
  15921. case "DCTDecode":
  15922. xrefStats.addStreamType(_util.StreamType.DCT);
  15923. return new _jpeg_stream.JpegStream(
  15924. stream,
  15925. maybeLength,
  15926. params
  15927. );
  15928. case "JPX":
  15929. case "JPXDecode":
  15930. xrefStats.addStreamType(_util.StreamType.JPX);
  15931. return new _jpx_stream.JpxStream(stream, maybeLength, params);
  15932. case "A85":
  15933. case "ASCII85Decode":
  15934. xrefStats.addStreamType(_util.StreamType.A85);
  15935. return new _ascii_85_stream.Ascii85Stream(
  15936. stream,
  15937. maybeLength
  15938. );
  15939. case "AHx":
  15940. case "ASCIIHexDecode":
  15941. xrefStats.addStreamType(_util.StreamType.AHX);
  15942. return new _ascii_hex_stream.AsciiHexStream(
  15943. stream,
  15944. maybeLength
  15945. );
  15946. case "CCF":
  15947. case "CCITTFaxDecode":
  15948. xrefStats.addStreamType(_util.StreamType.CCF);
  15949. return new _ccitt_stream.CCITTFaxStream(
  15950. stream,
  15951. maybeLength,
  15952. params
  15953. );
  15954. case "RL":
  15955. case "RunLengthDecode":
  15956. xrefStats.addStreamType(_util.StreamType.RLX);
  15957. return new _run_length_stream.RunLengthStream(
  15958. stream,
  15959. maybeLength
  15960. );
  15961. case "JBIG2Decode":
  15962. xrefStats.addStreamType(_util.StreamType.JBIG);
  15963. return new _jbig2_stream.Jbig2Stream(
  15964. stream,
  15965. maybeLength,
  15966. params
  15967. );
  15968. }
  15969. (0, _util.warn)(`Filter "${name}" is not supported.`);
  15970. return stream;
  15971. } catch (ex) {
  15972. if (ex instanceof _core_utils.MissingDataException) {
  15973. throw ex;
  15974. }
  15975. (0, _util.warn)(`Invalid stream: "${ex}"`);
  15976. return new _stream.NullStream();
  15977. }
  15978. }
  15979. }
  15980. exports.Parser = Parser;
  15981. const specialChars = [
  15982. 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  15983. 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0,
  15984. 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0,
  15985. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
  15986. 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  15987. 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  15988. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  15989. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  15990. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  15991. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  15992. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  15993. 0, 0, 0,
  15994. ];
  15995. function toHexDigit(ch) {
  15996. if (ch >= 0x30 && ch <= 0x39) {
  15997. return ch & 0x0f;
  15998. }
  15999. if ((ch >= 0x41 && ch <= 0x46) || (ch >= 0x61 && ch <= 0x66)) {
  16000. return (ch & 0x0f) + 9;
  16001. }
  16002. return -1;
  16003. }
  16004. class Lexer {
  16005. constructor(stream, knownCommands = null) {
  16006. this.stream = stream;
  16007. this.nextChar();
  16008. this.strBuf = [];
  16009. this.knownCommands = knownCommands;
  16010. this._hexStringNumWarn = 0;
  16011. this.beginInlineImagePos = -1;
  16012. }
  16013. nextChar() {
  16014. return (this.currentChar = this.stream.getByte());
  16015. }
  16016. peekChar() {
  16017. return this.stream.peekByte();
  16018. }
  16019. getNumber() {
  16020. let ch = this.currentChar;
  16021. let eNotation = false;
  16022. let divideBy = 0;
  16023. let sign = 0;
  16024. if (ch === 0x2d) {
  16025. sign = -1;
  16026. ch = this.nextChar();
  16027. if (ch === 0x2d) {
  16028. ch = this.nextChar();
  16029. }
  16030. } else if (ch === 0x2b) {
  16031. sign = 1;
  16032. ch = this.nextChar();
  16033. }
  16034. if (ch === 0x0a || ch === 0x0d) {
  16035. do {
  16036. ch = this.nextChar();
  16037. } while (ch === 0x0a || ch === 0x0d);
  16038. }
  16039. if (ch === 0x2e) {
  16040. divideBy = 10;
  16041. ch = this.nextChar();
  16042. }
  16043. if (ch < 0x30 || ch > 0x39) {
  16044. if ((0, _core_utils.isWhiteSpace)(ch) || ch === -1) {
  16045. if (divideBy === 10 && sign === 0) {
  16046. (0, _util.warn)(
  16047. "Lexer.getNumber - treating a single decimal point as zero."
  16048. );
  16049. return 0;
  16050. }
  16051. if (divideBy === 0 && sign === -1) {
  16052. (0, _util.warn)(
  16053. "Lexer.getNumber - treating a single minus sign as zero."
  16054. );
  16055. return 0;
  16056. }
  16057. }
  16058. throw new _util.FormatError(
  16059. `Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`
  16060. );
  16061. }
  16062. sign = sign || 1;
  16063. let baseValue = ch - 0x30;
  16064. let powerValue = 0;
  16065. let powerValueSign = 1;
  16066. while ((ch = this.nextChar()) >= 0) {
  16067. if (ch >= 0x30 && ch <= 0x39) {
  16068. const currentDigit = ch - 0x30;
  16069. if (eNotation) {
  16070. powerValue = powerValue * 10 + currentDigit;
  16071. } else {
  16072. if (divideBy !== 0) {
  16073. divideBy *= 10;
  16074. }
  16075. baseValue = baseValue * 10 + currentDigit;
  16076. }
  16077. } else if (ch === 0x2e) {
  16078. if (divideBy === 0) {
  16079. divideBy = 1;
  16080. } else {
  16081. break;
  16082. }
  16083. } else if (ch === 0x2d) {
  16084. (0, _util.warn)(
  16085. "Badly formatted number: minus sign in the middle"
  16086. );
  16087. } else if (ch === 0x45 || ch === 0x65) {
  16088. ch = this.peekChar();
  16089. if (ch === 0x2b || ch === 0x2d) {
  16090. powerValueSign = ch === 0x2d ? -1 : 1;
  16091. this.nextChar();
  16092. } else if (ch < 0x30 || ch > 0x39) {
  16093. break;
  16094. }
  16095. eNotation = true;
  16096. } else {
  16097. break;
  16098. }
  16099. }
  16100. if (divideBy !== 0) {
  16101. baseValue /= divideBy;
  16102. }
  16103. if (eNotation) {
  16104. baseValue *= 10 ** (powerValueSign * powerValue);
  16105. }
  16106. return sign * baseValue;
  16107. }
  16108. getString() {
  16109. let numParen = 1;
  16110. let done = false;
  16111. const strBuf = this.strBuf;
  16112. strBuf.length = 0;
  16113. let ch = this.nextChar();
  16114. while (true) {
  16115. let charBuffered = false;
  16116. switch (ch | 0) {
  16117. case -1:
  16118. (0, _util.warn)("Unterminated string");
  16119. done = true;
  16120. break;
  16121. case 0x28:
  16122. ++numParen;
  16123. strBuf.push("(");
  16124. break;
  16125. case 0x29:
  16126. if (--numParen === 0) {
  16127. this.nextChar();
  16128. done = true;
  16129. } else {
  16130. strBuf.push(")");
  16131. }
  16132. break;
  16133. case 0x5c:
  16134. ch = this.nextChar();
  16135. switch (ch) {
  16136. case -1:
  16137. (0, _util.warn)("Unterminated string");
  16138. done = true;
  16139. break;
  16140. case 0x6e:
  16141. strBuf.push("\n");
  16142. break;
  16143. case 0x72:
  16144. strBuf.push("\r");
  16145. break;
  16146. case 0x74:
  16147. strBuf.push("\t");
  16148. break;
  16149. case 0x62:
  16150. strBuf.push("\b");
  16151. break;
  16152. case 0x66:
  16153. strBuf.push("\f");
  16154. break;
  16155. case 0x5c:
  16156. case 0x28:
  16157. case 0x29:
  16158. strBuf.push(String.fromCharCode(ch));
  16159. break;
  16160. case 0x30:
  16161. case 0x31:
  16162. case 0x32:
  16163. case 0x33:
  16164. case 0x34:
  16165. case 0x35:
  16166. case 0x36:
  16167. case 0x37:
  16168. let x = ch & 0x0f;
  16169. ch = this.nextChar();
  16170. charBuffered = true;
  16171. if (ch >= 0x30 && ch <= 0x37) {
  16172. x = (x << 3) + (ch & 0x0f);
  16173. ch = this.nextChar();
  16174. if (ch >= 0x30 && ch <= 0x37) {
  16175. charBuffered = false;
  16176. x = (x << 3) + (ch & 0x0f);
  16177. }
  16178. }
  16179. strBuf.push(String.fromCharCode(x));
  16180. break;
  16181. case 0x0d:
  16182. if (this.peekChar() === 0x0a) {
  16183. this.nextChar();
  16184. }
  16185. break;
  16186. case 0x0a:
  16187. break;
  16188. default:
  16189. strBuf.push(String.fromCharCode(ch));
  16190. break;
  16191. }
  16192. break;
  16193. default:
  16194. strBuf.push(String.fromCharCode(ch));
  16195. break;
  16196. }
  16197. if (done) {
  16198. break;
  16199. }
  16200. if (!charBuffered) {
  16201. ch = this.nextChar();
  16202. }
  16203. }
  16204. return strBuf.join("");
  16205. }
  16206. getName() {
  16207. let ch, previousCh;
  16208. const strBuf = this.strBuf;
  16209. strBuf.length = 0;
  16210. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  16211. if (ch === 0x23) {
  16212. ch = this.nextChar();
  16213. if (specialChars[ch]) {
  16214. (0, _util.warn)(
  16215. "Lexer_getName: " +
  16216. "NUMBER SIGN (#) should be followed by a hexadecimal number."
  16217. );
  16218. strBuf.push("#");
  16219. break;
  16220. }
  16221. const x = toHexDigit(ch);
  16222. if (x !== -1) {
  16223. previousCh = ch;
  16224. ch = this.nextChar();
  16225. const x2 = toHexDigit(ch);
  16226. if (x2 === -1) {
  16227. (0, _util.warn)(
  16228. `Lexer_getName: Illegal digit (${String.fromCharCode(
  16229. ch
  16230. )}) ` + "in hexadecimal number."
  16231. );
  16232. strBuf.push("#", String.fromCharCode(previousCh));
  16233. if (specialChars[ch]) {
  16234. break;
  16235. }
  16236. strBuf.push(String.fromCharCode(ch));
  16237. continue;
  16238. }
  16239. strBuf.push(String.fromCharCode((x << 4) | x2));
  16240. } else {
  16241. strBuf.push("#", String.fromCharCode(ch));
  16242. }
  16243. } else {
  16244. strBuf.push(String.fromCharCode(ch));
  16245. }
  16246. }
  16247. if (strBuf.length > 127) {
  16248. (0, _util.warn)(
  16249. `Name token is longer than allowed by the spec: ${strBuf.length}`
  16250. );
  16251. }
  16252. return _primitives.Name.get(strBuf.join(""));
  16253. }
  16254. _hexStringWarn(ch) {
  16255. const MAX_HEX_STRING_NUM_WARN = 5;
  16256. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  16257. (0, _util.warn)(
  16258. "getHexString - ignoring additional invalid characters."
  16259. );
  16260. return;
  16261. }
  16262. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  16263. return;
  16264. }
  16265. (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
  16266. }
  16267. getHexString() {
  16268. const strBuf = this.strBuf;
  16269. strBuf.length = 0;
  16270. let ch = this.currentChar;
  16271. let isFirstHex = true;
  16272. let firstDigit, secondDigit;
  16273. this._hexStringNumWarn = 0;
  16274. while (true) {
  16275. if (ch < 0) {
  16276. (0, _util.warn)("Unterminated hex string");
  16277. break;
  16278. } else if (ch === 0x3e) {
  16279. this.nextChar();
  16280. break;
  16281. } else if (specialChars[ch] === 1) {
  16282. ch = this.nextChar();
  16283. continue;
  16284. } else {
  16285. if (isFirstHex) {
  16286. firstDigit = toHexDigit(ch);
  16287. if (firstDigit === -1) {
  16288. this._hexStringWarn(ch);
  16289. ch = this.nextChar();
  16290. continue;
  16291. }
  16292. } else {
  16293. secondDigit = toHexDigit(ch);
  16294. if (secondDigit === -1) {
  16295. this._hexStringWarn(ch);
  16296. ch = this.nextChar();
  16297. continue;
  16298. }
  16299. strBuf.push(
  16300. String.fromCharCode((firstDigit << 4) | secondDigit)
  16301. );
  16302. }
  16303. isFirstHex = !isFirstHex;
  16304. ch = this.nextChar();
  16305. }
  16306. }
  16307. return strBuf.join("");
  16308. }
  16309. getObj() {
  16310. let comment = false;
  16311. let ch = this.currentChar;
  16312. while (true) {
  16313. if (ch < 0) {
  16314. return _primitives.EOF;
  16315. }
  16316. if (comment) {
  16317. if (ch === 0x0a || ch === 0x0d) {
  16318. comment = false;
  16319. }
  16320. } else if (ch === 0x25) {
  16321. comment = true;
  16322. } else if (specialChars[ch] !== 1) {
  16323. break;
  16324. }
  16325. ch = this.nextChar();
  16326. }
  16327. switch (ch | 0) {
  16328. case 0x30:
  16329. case 0x31:
  16330. case 0x32:
  16331. case 0x33:
  16332. case 0x34:
  16333. case 0x35:
  16334. case 0x36:
  16335. case 0x37:
  16336. case 0x38:
  16337. case 0x39:
  16338. case 0x2b:
  16339. case 0x2d:
  16340. case 0x2e:
  16341. return this.getNumber();
  16342. case 0x28:
  16343. return this.getString();
  16344. case 0x2f:
  16345. return this.getName();
  16346. case 0x5b:
  16347. this.nextChar();
  16348. return _primitives.Cmd.get("[");
  16349. case 0x5d:
  16350. this.nextChar();
  16351. return _primitives.Cmd.get("]");
  16352. case 0x3c:
  16353. ch = this.nextChar();
  16354. if (ch === 0x3c) {
  16355. this.nextChar();
  16356. return _primitives.Cmd.get("<<");
  16357. }
  16358. return this.getHexString();
  16359. case 0x3e:
  16360. ch = this.nextChar();
  16361. if (ch === 0x3e) {
  16362. this.nextChar();
  16363. return _primitives.Cmd.get(">>");
  16364. }
  16365. return _primitives.Cmd.get(">");
  16366. case 0x7b:
  16367. this.nextChar();
  16368. return _primitives.Cmd.get("{");
  16369. case 0x7d:
  16370. this.nextChar();
  16371. return _primitives.Cmd.get("}");
  16372. case 0x29:
  16373. this.nextChar();
  16374. throw new _util.FormatError(`Illegal character: ${ch}`);
  16375. }
  16376. let str = String.fromCharCode(ch);
  16377. if (ch < 0x20 || ch > 0x7f) {
  16378. const nextCh = this.peekChar();
  16379. if (nextCh >= 0x20 && nextCh <= 0x7f) {
  16380. this.nextChar();
  16381. return _primitives.Cmd.get(str);
  16382. }
  16383. }
  16384. const knownCommands = this.knownCommands;
  16385. let knownCommandFound =
  16386. knownCommands && knownCommands[str] !== undefined;
  16387. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  16388. const possibleCommand = str + String.fromCharCode(ch);
  16389. if (
  16390. knownCommandFound &&
  16391. knownCommands[possibleCommand] === undefined
  16392. ) {
  16393. break;
  16394. }
  16395. if (str.length === 128) {
  16396. throw new _util.FormatError(
  16397. `Command token too long: ${str.length}`
  16398. );
  16399. }
  16400. str = possibleCommand;
  16401. knownCommandFound =
  16402. knownCommands && knownCommands[str] !== undefined;
  16403. }
  16404. if (str === "true") {
  16405. return true;
  16406. }
  16407. if (str === "false") {
  16408. return false;
  16409. }
  16410. if (str === "null") {
  16411. return null;
  16412. }
  16413. if (str === "BI") {
  16414. this.beginInlineImagePos = this.stream.pos;
  16415. }
  16416. return _primitives.Cmd.get(str);
  16417. }
  16418. peekObj() {
  16419. const streamPos = this.stream.pos,
  16420. currentChar = this.currentChar,
  16421. beginInlineImagePos = this.beginInlineImagePos;
  16422. let nextObj;
  16423. try {
  16424. nextObj = this.getObj();
  16425. } catch (ex) {
  16426. if (ex instanceof _core_utils.MissingDataException) {
  16427. throw ex;
  16428. }
  16429. (0, _util.warn)(`peekObj: ${ex}`);
  16430. }
  16431. this.stream.pos = streamPos;
  16432. this.currentChar = currentChar;
  16433. this.beginInlineImagePos = beginInlineImagePos;
  16434. return nextObj;
  16435. }
  16436. skipToNextLine() {
  16437. let ch = this.currentChar;
  16438. while (ch >= 0) {
  16439. if (ch === 0x0d) {
  16440. ch = this.nextChar();
  16441. if (ch === 0x0a) {
  16442. this.nextChar();
  16443. }
  16444. break;
  16445. } else if (ch === 0x0a) {
  16446. this.nextChar();
  16447. break;
  16448. }
  16449. ch = this.nextChar();
  16450. }
  16451. }
  16452. }
  16453. exports.Lexer = Lexer;
  16454. class Linearization {
  16455. static create(stream) {
  16456. function getInt(linDict, name, allowZeroValue = false) {
  16457. const obj = linDict.get(name);
  16458. if (
  16459. Number.isInteger(obj) &&
  16460. (allowZeroValue ? obj >= 0 : obj > 0)
  16461. ) {
  16462. return obj;
  16463. }
  16464. throw new Error(
  16465. `The "${name}" parameter in the linearization ` +
  16466. "dictionary is invalid."
  16467. );
  16468. }
  16469. function getHints(linDict) {
  16470. const hints = linDict.get("H");
  16471. let hintsLength;
  16472. if (
  16473. Array.isArray(hints) &&
  16474. ((hintsLength = hints.length) === 2 || hintsLength === 4)
  16475. ) {
  16476. for (let index = 0; index < hintsLength; index++) {
  16477. const hint = hints[index];
  16478. if (!(Number.isInteger(hint) && hint > 0)) {
  16479. throw new Error(
  16480. `Hint (${index}) in the linearization dictionary is invalid.`
  16481. );
  16482. }
  16483. }
  16484. return hints;
  16485. }
  16486. throw new Error(
  16487. "Hint array in the linearization dictionary is invalid."
  16488. );
  16489. }
  16490. const parser = new Parser({
  16491. lexer: new Lexer(stream),
  16492. xref: null,
  16493. });
  16494. const obj1 = parser.getObj();
  16495. const obj2 = parser.getObj();
  16496. const obj3 = parser.getObj();
  16497. const linDict = parser.getObj();
  16498. let obj, length;
  16499. if (
  16500. !(
  16501. Number.isInteger(obj1) &&
  16502. Number.isInteger(obj2) &&
  16503. (0, _primitives.isCmd)(obj3, "obj") &&
  16504. linDict instanceof _primitives.Dict &&
  16505. typeof (obj = linDict.get("Linearized")) === "number" &&
  16506. obj > 0
  16507. )
  16508. ) {
  16509. return null;
  16510. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  16511. throw new Error(
  16512. 'The "L" parameter in the linearization dictionary ' +
  16513. "does not equal the stream length."
  16514. );
  16515. }
  16516. return {
  16517. length,
  16518. hints: getHints(linDict),
  16519. objectNumberFirst: getInt(linDict, "O"),
  16520. endFirst: getInt(linDict, "E"),
  16521. numPages: getInt(linDict, "N"),
  16522. mainXRefEntriesOffset: getInt(linDict, "T"),
  16523. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0,
  16524. };
  16525. }
  16526. }
  16527. exports.Linearization = Linearization;
  16528. /***/
  16529. },
  16530. /* 18 */
  16531. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16532. Object.defineProperty(exports, "__esModule", {
  16533. value: true,
  16534. });
  16535. exports.Ascii85Stream = void 0;
  16536. var _decode_stream = __w_pdfjs_require__(19);
  16537. var _core_utils = __w_pdfjs_require__(6);
  16538. class Ascii85Stream extends _decode_stream.DecodeStream {
  16539. constructor(str, maybeLength) {
  16540. if (maybeLength) {
  16541. maybeLength *= 0.8;
  16542. }
  16543. super(maybeLength);
  16544. this.str = str;
  16545. this.dict = str.dict;
  16546. this.input = new Uint8Array(5);
  16547. }
  16548. readBlock() {
  16549. const TILDA_CHAR = 0x7e;
  16550. const Z_LOWER_CHAR = 0x7a;
  16551. const EOF = -1;
  16552. const str = this.str;
  16553. let c = str.getByte();
  16554. while ((0, _core_utils.isWhiteSpace)(c)) {
  16555. c = str.getByte();
  16556. }
  16557. if (c === EOF || c === TILDA_CHAR) {
  16558. this.eof = true;
  16559. return;
  16560. }
  16561. const bufferLength = this.bufferLength;
  16562. let buffer, i;
  16563. if (c === Z_LOWER_CHAR) {
  16564. buffer = this.ensureBuffer(bufferLength + 4);
  16565. for (i = 0; i < 4; ++i) {
  16566. buffer[bufferLength + i] = 0;
  16567. }
  16568. this.bufferLength += 4;
  16569. } else {
  16570. const input = this.input;
  16571. input[0] = c;
  16572. for (i = 1; i < 5; ++i) {
  16573. c = str.getByte();
  16574. while ((0, _core_utils.isWhiteSpace)(c)) {
  16575. c = str.getByte();
  16576. }
  16577. input[i] = c;
  16578. if (c === EOF || c === TILDA_CHAR) {
  16579. break;
  16580. }
  16581. }
  16582. buffer = this.ensureBuffer(bufferLength + i - 1);
  16583. this.bufferLength += i - 1;
  16584. if (i < 5) {
  16585. for (; i < 5; ++i) {
  16586. input[i] = 0x21 + 84;
  16587. }
  16588. this.eof = true;
  16589. }
  16590. let t = 0;
  16591. for (i = 0; i < 5; ++i) {
  16592. t = t * 85 + (input[i] - 0x21);
  16593. }
  16594. for (i = 3; i >= 0; --i) {
  16595. buffer[bufferLength + i] = t & 0xff;
  16596. t >>= 8;
  16597. }
  16598. }
  16599. }
  16600. }
  16601. exports.Ascii85Stream = Ascii85Stream;
  16602. /***/
  16603. },
  16604. /* 19 */
  16605. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16606. Object.defineProperty(exports, "__esModule", {
  16607. value: true,
  16608. });
  16609. exports.StreamsSequenceStream = exports.DecodeStream = void 0;
  16610. var _base_stream = __w_pdfjs_require__(7);
  16611. var _stream = __w_pdfjs_require__(10);
  16612. const emptyBuffer = new Uint8Array(0);
  16613. class DecodeStream extends _base_stream.BaseStream {
  16614. constructor(maybeMinBufferLength) {
  16615. super();
  16616. this._rawMinBufferLength = maybeMinBufferLength || 0;
  16617. this.pos = 0;
  16618. this.bufferLength = 0;
  16619. this.eof = false;
  16620. this.buffer = emptyBuffer;
  16621. this.minBufferLength = 512;
  16622. if (maybeMinBufferLength) {
  16623. while (this.minBufferLength < maybeMinBufferLength) {
  16624. this.minBufferLength *= 2;
  16625. }
  16626. }
  16627. }
  16628. get isEmpty() {
  16629. while (!this.eof && this.bufferLength === 0) {
  16630. this.readBlock();
  16631. }
  16632. return this.bufferLength === 0;
  16633. }
  16634. ensureBuffer(requested) {
  16635. const buffer = this.buffer;
  16636. if (requested <= buffer.byteLength) {
  16637. return buffer;
  16638. }
  16639. let size = this.minBufferLength;
  16640. while (size < requested) {
  16641. size *= 2;
  16642. }
  16643. const buffer2 = new Uint8Array(size);
  16644. buffer2.set(buffer);
  16645. return (this.buffer = buffer2);
  16646. }
  16647. getByte() {
  16648. const pos = this.pos;
  16649. while (this.bufferLength <= pos) {
  16650. if (this.eof) {
  16651. return -1;
  16652. }
  16653. this.readBlock();
  16654. }
  16655. return this.buffer[this.pos++];
  16656. }
  16657. getBytes(length) {
  16658. const pos = this.pos;
  16659. let end;
  16660. if (length) {
  16661. this.ensureBuffer(pos + length);
  16662. end = pos + length;
  16663. while (!this.eof && this.bufferLength < end) {
  16664. this.readBlock();
  16665. }
  16666. const bufEnd = this.bufferLength;
  16667. if (end > bufEnd) {
  16668. end = bufEnd;
  16669. }
  16670. } else {
  16671. while (!this.eof) {
  16672. this.readBlock();
  16673. }
  16674. end = this.bufferLength;
  16675. }
  16676. this.pos = end;
  16677. return this.buffer.subarray(pos, end);
  16678. }
  16679. reset() {
  16680. this.pos = 0;
  16681. }
  16682. makeSubStream(start, length, dict = null) {
  16683. if (length === undefined) {
  16684. while (!this.eof) {
  16685. this.readBlock();
  16686. }
  16687. } else {
  16688. const end = start + length;
  16689. while (this.bufferLength <= end && !this.eof) {
  16690. this.readBlock();
  16691. }
  16692. }
  16693. return new _stream.Stream(this.buffer, start, length, dict);
  16694. }
  16695. getBaseStreams() {
  16696. return this.str ? this.str.getBaseStreams() : null;
  16697. }
  16698. }
  16699. exports.DecodeStream = DecodeStream;
  16700. class StreamsSequenceStream extends DecodeStream {
  16701. constructor(streams, onError = null) {
  16702. let maybeLength = 0;
  16703. for (const stream of streams) {
  16704. maybeLength +=
  16705. stream instanceof DecodeStream
  16706. ? stream._rawMinBufferLength
  16707. : stream.length;
  16708. }
  16709. super(maybeLength);
  16710. this.streams = streams;
  16711. this._onError = onError;
  16712. }
  16713. readBlock() {
  16714. const streams = this.streams;
  16715. if (streams.length === 0) {
  16716. this.eof = true;
  16717. return;
  16718. }
  16719. const stream = streams.shift();
  16720. let chunk;
  16721. try {
  16722. chunk = stream.getBytes();
  16723. } catch (reason) {
  16724. if (this._onError) {
  16725. this._onError(reason, stream.dict && stream.dict.objId);
  16726. return;
  16727. }
  16728. throw reason;
  16729. }
  16730. const bufferLength = this.bufferLength;
  16731. const newLength = bufferLength + chunk.length;
  16732. const buffer = this.ensureBuffer(newLength);
  16733. buffer.set(chunk, bufferLength);
  16734. this.bufferLength = newLength;
  16735. }
  16736. getBaseStreams() {
  16737. const baseStreamsBuf = [];
  16738. for (const stream of this.streams) {
  16739. const baseStreams = stream.getBaseStreams();
  16740. if (baseStreams) {
  16741. baseStreamsBuf.push(...baseStreams);
  16742. }
  16743. }
  16744. return baseStreamsBuf.length > 0 ? baseStreamsBuf : null;
  16745. }
  16746. }
  16747. exports.StreamsSequenceStream = StreamsSequenceStream;
  16748. /***/
  16749. },
  16750. /* 20 */
  16751. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16752. Object.defineProperty(exports, "__esModule", {
  16753. value: true,
  16754. });
  16755. exports.AsciiHexStream = void 0;
  16756. var _decode_stream = __w_pdfjs_require__(19);
  16757. class AsciiHexStream extends _decode_stream.DecodeStream {
  16758. constructor(str, maybeLength) {
  16759. if (maybeLength) {
  16760. maybeLength *= 0.5;
  16761. }
  16762. super(maybeLength);
  16763. this.str = str;
  16764. this.dict = str.dict;
  16765. this.firstDigit = -1;
  16766. }
  16767. readBlock() {
  16768. const UPSTREAM_BLOCK_SIZE = 8000;
  16769. const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  16770. if (!bytes.length) {
  16771. this.eof = true;
  16772. return;
  16773. }
  16774. const maxDecodeLength = (bytes.length + 1) >> 1;
  16775. const buffer = this.ensureBuffer(
  16776. this.bufferLength + maxDecodeLength
  16777. );
  16778. let bufferLength = this.bufferLength;
  16779. let firstDigit = this.firstDigit;
  16780. for (const ch of bytes) {
  16781. let digit;
  16782. if (ch >= 0x30 && ch <= 0x39) {
  16783. digit = ch & 0x0f;
  16784. } else if (
  16785. (ch >= 0x41 && ch <= 0x46) ||
  16786. (ch >= 0x61 && ch <= 0x66)
  16787. ) {
  16788. digit = (ch & 0x0f) + 9;
  16789. } else if (ch === 0x3e) {
  16790. this.eof = true;
  16791. break;
  16792. } else {
  16793. continue;
  16794. }
  16795. if (firstDigit < 0) {
  16796. firstDigit = digit;
  16797. } else {
  16798. buffer[bufferLength++] = (firstDigit << 4) | digit;
  16799. firstDigit = -1;
  16800. }
  16801. }
  16802. if (firstDigit >= 0 && this.eof) {
  16803. buffer[bufferLength++] = firstDigit << 4;
  16804. firstDigit = -1;
  16805. }
  16806. this.firstDigit = firstDigit;
  16807. this.bufferLength = bufferLength;
  16808. }
  16809. }
  16810. exports.AsciiHexStream = AsciiHexStream;
  16811. /***/
  16812. },
  16813. /* 21 */
  16814. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16815. Object.defineProperty(exports, "__esModule", {
  16816. value: true,
  16817. });
  16818. exports.CCITTFaxStream = void 0;
  16819. var _ccitt = __w_pdfjs_require__(22);
  16820. var _decode_stream = __w_pdfjs_require__(19);
  16821. var _primitives = __w_pdfjs_require__(5);
  16822. class CCITTFaxStream extends _decode_stream.DecodeStream {
  16823. constructor(str, maybeLength, params) {
  16824. super(maybeLength);
  16825. this.str = str;
  16826. this.dict = str.dict;
  16827. if (!(params instanceof _primitives.Dict)) {
  16828. params = _primitives.Dict.empty;
  16829. }
  16830. const source = {
  16831. next() {
  16832. return str.getByte();
  16833. },
  16834. };
  16835. this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
  16836. K: params.get("K"),
  16837. EndOfLine: params.get("EndOfLine"),
  16838. EncodedByteAlign: params.get("EncodedByteAlign"),
  16839. Columns: params.get("Columns"),
  16840. Rows: params.get("Rows"),
  16841. EndOfBlock: params.get("EndOfBlock"),
  16842. BlackIs1: params.get("BlackIs1"),
  16843. });
  16844. }
  16845. readBlock() {
  16846. while (!this.eof) {
  16847. const c = this.ccittFaxDecoder.readNextChar();
  16848. if (c === -1) {
  16849. this.eof = true;
  16850. return;
  16851. }
  16852. this.ensureBuffer(this.bufferLength + 1);
  16853. this.buffer[this.bufferLength++] = c;
  16854. }
  16855. }
  16856. }
  16857. exports.CCITTFaxStream = CCITTFaxStream;
  16858. /***/
  16859. },
  16860. /* 22 */
  16861. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16862. Object.defineProperty(exports, "__esModule", {
  16863. value: true,
  16864. });
  16865. exports.CCITTFaxDecoder = void 0;
  16866. var _util = __w_pdfjs_require__(2);
  16867. const ccittEOL = -2;
  16868. const ccittEOF = -1;
  16869. const twoDimPass = 0;
  16870. const twoDimHoriz = 1;
  16871. const twoDimVert0 = 2;
  16872. const twoDimVertR1 = 3;
  16873. const twoDimVertL1 = 4;
  16874. const twoDimVertR2 = 5;
  16875. const twoDimVertL2 = 6;
  16876. const twoDimVertR3 = 7;
  16877. const twoDimVertL3 = 8;
  16878. const twoDimTable = [
  16879. [-1, -1],
  16880. [-1, -1],
  16881. [7, twoDimVertL3],
  16882. [7, twoDimVertR3],
  16883. [6, twoDimVertL2],
  16884. [6, twoDimVertL2],
  16885. [6, twoDimVertR2],
  16886. [6, twoDimVertR2],
  16887. [4, twoDimPass],
  16888. [4, twoDimPass],
  16889. [4, twoDimPass],
  16890. [4, twoDimPass],
  16891. [4, twoDimPass],
  16892. [4, twoDimPass],
  16893. [4, twoDimPass],
  16894. [4, twoDimPass],
  16895. [3, twoDimHoriz],
  16896. [3, twoDimHoriz],
  16897. [3, twoDimHoriz],
  16898. [3, twoDimHoriz],
  16899. [3, twoDimHoriz],
  16900. [3, twoDimHoriz],
  16901. [3, twoDimHoriz],
  16902. [3, twoDimHoriz],
  16903. [3, twoDimHoriz],
  16904. [3, twoDimHoriz],
  16905. [3, twoDimHoriz],
  16906. [3, twoDimHoriz],
  16907. [3, twoDimHoriz],
  16908. [3, twoDimHoriz],
  16909. [3, twoDimHoriz],
  16910. [3, twoDimHoriz],
  16911. [3, twoDimVertL1],
  16912. [3, twoDimVertL1],
  16913. [3, twoDimVertL1],
  16914. [3, twoDimVertL1],
  16915. [3, twoDimVertL1],
  16916. [3, twoDimVertL1],
  16917. [3, twoDimVertL1],
  16918. [3, twoDimVertL1],
  16919. [3, twoDimVertL1],
  16920. [3, twoDimVertL1],
  16921. [3, twoDimVertL1],
  16922. [3, twoDimVertL1],
  16923. [3, twoDimVertL1],
  16924. [3, twoDimVertL1],
  16925. [3, twoDimVertL1],
  16926. [3, twoDimVertL1],
  16927. [3, twoDimVertR1],
  16928. [3, twoDimVertR1],
  16929. [3, twoDimVertR1],
  16930. [3, twoDimVertR1],
  16931. [3, twoDimVertR1],
  16932. [3, twoDimVertR1],
  16933. [3, twoDimVertR1],
  16934. [3, twoDimVertR1],
  16935. [3, twoDimVertR1],
  16936. [3, twoDimVertR1],
  16937. [3, twoDimVertR1],
  16938. [3, twoDimVertR1],
  16939. [3, twoDimVertR1],
  16940. [3, twoDimVertR1],
  16941. [3, twoDimVertR1],
  16942. [3, twoDimVertR1],
  16943. [1, twoDimVert0],
  16944. [1, twoDimVert0],
  16945. [1, twoDimVert0],
  16946. [1, twoDimVert0],
  16947. [1, twoDimVert0],
  16948. [1, twoDimVert0],
  16949. [1, twoDimVert0],
  16950. [1, twoDimVert0],
  16951. [1, twoDimVert0],
  16952. [1, twoDimVert0],
  16953. [1, twoDimVert0],
  16954. [1, twoDimVert0],
  16955. [1, twoDimVert0],
  16956. [1, twoDimVert0],
  16957. [1, twoDimVert0],
  16958. [1, twoDimVert0],
  16959. [1, twoDimVert0],
  16960. [1, twoDimVert0],
  16961. [1, twoDimVert0],
  16962. [1, twoDimVert0],
  16963. [1, twoDimVert0],
  16964. [1, twoDimVert0],
  16965. [1, twoDimVert0],
  16966. [1, twoDimVert0],
  16967. [1, twoDimVert0],
  16968. [1, twoDimVert0],
  16969. [1, twoDimVert0],
  16970. [1, twoDimVert0],
  16971. [1, twoDimVert0],
  16972. [1, twoDimVert0],
  16973. [1, twoDimVert0],
  16974. [1, twoDimVert0],
  16975. [1, twoDimVert0],
  16976. [1, twoDimVert0],
  16977. [1, twoDimVert0],
  16978. [1, twoDimVert0],
  16979. [1, twoDimVert0],
  16980. [1, twoDimVert0],
  16981. [1, twoDimVert0],
  16982. [1, twoDimVert0],
  16983. [1, twoDimVert0],
  16984. [1, twoDimVert0],
  16985. [1, twoDimVert0],
  16986. [1, twoDimVert0],
  16987. [1, twoDimVert0],
  16988. [1, twoDimVert0],
  16989. [1, twoDimVert0],
  16990. [1, twoDimVert0],
  16991. [1, twoDimVert0],
  16992. [1, twoDimVert0],
  16993. [1, twoDimVert0],
  16994. [1, twoDimVert0],
  16995. [1, twoDimVert0],
  16996. [1, twoDimVert0],
  16997. [1, twoDimVert0],
  16998. [1, twoDimVert0],
  16999. [1, twoDimVert0],
  17000. [1, twoDimVert0],
  17001. [1, twoDimVert0],
  17002. [1, twoDimVert0],
  17003. [1, twoDimVert0],
  17004. [1, twoDimVert0],
  17005. [1, twoDimVert0],
  17006. [1, twoDimVert0],
  17007. ];
  17008. const whiteTable1 = [
  17009. [-1, -1],
  17010. [12, ccittEOL],
  17011. [-1, -1],
  17012. [-1, -1],
  17013. [-1, -1],
  17014. [-1, -1],
  17015. [-1, -1],
  17016. [-1, -1],
  17017. [-1, -1],
  17018. [-1, -1],
  17019. [-1, -1],
  17020. [-1, -1],
  17021. [-1, -1],
  17022. [-1, -1],
  17023. [-1, -1],
  17024. [-1, -1],
  17025. [11, 1792],
  17026. [11, 1792],
  17027. [12, 1984],
  17028. [12, 2048],
  17029. [12, 2112],
  17030. [12, 2176],
  17031. [12, 2240],
  17032. [12, 2304],
  17033. [11, 1856],
  17034. [11, 1856],
  17035. [11, 1920],
  17036. [11, 1920],
  17037. [12, 2368],
  17038. [12, 2432],
  17039. [12, 2496],
  17040. [12, 2560],
  17041. ];
  17042. const whiteTable2 = [
  17043. [-1, -1],
  17044. [-1, -1],
  17045. [-1, -1],
  17046. [-1, -1],
  17047. [8, 29],
  17048. [8, 29],
  17049. [8, 30],
  17050. [8, 30],
  17051. [8, 45],
  17052. [8, 45],
  17053. [8, 46],
  17054. [8, 46],
  17055. [7, 22],
  17056. [7, 22],
  17057. [7, 22],
  17058. [7, 22],
  17059. [7, 23],
  17060. [7, 23],
  17061. [7, 23],
  17062. [7, 23],
  17063. [8, 47],
  17064. [8, 47],
  17065. [8, 48],
  17066. [8, 48],
  17067. [6, 13],
  17068. [6, 13],
  17069. [6, 13],
  17070. [6, 13],
  17071. [6, 13],
  17072. [6, 13],
  17073. [6, 13],
  17074. [6, 13],
  17075. [7, 20],
  17076. [7, 20],
  17077. [7, 20],
  17078. [7, 20],
  17079. [8, 33],
  17080. [8, 33],
  17081. [8, 34],
  17082. [8, 34],
  17083. [8, 35],
  17084. [8, 35],
  17085. [8, 36],
  17086. [8, 36],
  17087. [8, 37],
  17088. [8, 37],
  17089. [8, 38],
  17090. [8, 38],
  17091. [7, 19],
  17092. [7, 19],
  17093. [7, 19],
  17094. [7, 19],
  17095. [8, 31],
  17096. [8, 31],
  17097. [8, 32],
  17098. [8, 32],
  17099. [6, 1],
  17100. [6, 1],
  17101. [6, 1],
  17102. [6, 1],
  17103. [6, 1],
  17104. [6, 1],
  17105. [6, 1],
  17106. [6, 1],
  17107. [6, 12],
  17108. [6, 12],
  17109. [6, 12],
  17110. [6, 12],
  17111. [6, 12],
  17112. [6, 12],
  17113. [6, 12],
  17114. [6, 12],
  17115. [8, 53],
  17116. [8, 53],
  17117. [8, 54],
  17118. [8, 54],
  17119. [7, 26],
  17120. [7, 26],
  17121. [7, 26],
  17122. [7, 26],
  17123. [8, 39],
  17124. [8, 39],
  17125. [8, 40],
  17126. [8, 40],
  17127. [8, 41],
  17128. [8, 41],
  17129. [8, 42],
  17130. [8, 42],
  17131. [8, 43],
  17132. [8, 43],
  17133. [8, 44],
  17134. [8, 44],
  17135. [7, 21],
  17136. [7, 21],
  17137. [7, 21],
  17138. [7, 21],
  17139. [7, 28],
  17140. [7, 28],
  17141. [7, 28],
  17142. [7, 28],
  17143. [8, 61],
  17144. [8, 61],
  17145. [8, 62],
  17146. [8, 62],
  17147. [8, 63],
  17148. [8, 63],
  17149. [8, 0],
  17150. [8, 0],
  17151. [8, 320],
  17152. [8, 320],
  17153. [8, 384],
  17154. [8, 384],
  17155. [5, 10],
  17156. [5, 10],
  17157. [5, 10],
  17158. [5, 10],
  17159. [5, 10],
  17160. [5, 10],
  17161. [5, 10],
  17162. [5, 10],
  17163. [5, 10],
  17164. [5, 10],
  17165. [5, 10],
  17166. [5, 10],
  17167. [5, 10],
  17168. [5, 10],
  17169. [5, 10],
  17170. [5, 10],
  17171. [5, 11],
  17172. [5, 11],
  17173. [5, 11],
  17174. [5, 11],
  17175. [5, 11],
  17176. [5, 11],
  17177. [5, 11],
  17178. [5, 11],
  17179. [5, 11],
  17180. [5, 11],
  17181. [5, 11],
  17182. [5, 11],
  17183. [5, 11],
  17184. [5, 11],
  17185. [5, 11],
  17186. [5, 11],
  17187. [7, 27],
  17188. [7, 27],
  17189. [7, 27],
  17190. [7, 27],
  17191. [8, 59],
  17192. [8, 59],
  17193. [8, 60],
  17194. [8, 60],
  17195. [9, 1472],
  17196. [9, 1536],
  17197. [9, 1600],
  17198. [9, 1728],
  17199. [7, 18],
  17200. [7, 18],
  17201. [7, 18],
  17202. [7, 18],
  17203. [7, 24],
  17204. [7, 24],
  17205. [7, 24],
  17206. [7, 24],
  17207. [8, 49],
  17208. [8, 49],
  17209. [8, 50],
  17210. [8, 50],
  17211. [8, 51],
  17212. [8, 51],
  17213. [8, 52],
  17214. [8, 52],
  17215. [7, 25],
  17216. [7, 25],
  17217. [7, 25],
  17218. [7, 25],
  17219. [8, 55],
  17220. [8, 55],
  17221. [8, 56],
  17222. [8, 56],
  17223. [8, 57],
  17224. [8, 57],
  17225. [8, 58],
  17226. [8, 58],
  17227. [6, 192],
  17228. [6, 192],
  17229. [6, 192],
  17230. [6, 192],
  17231. [6, 192],
  17232. [6, 192],
  17233. [6, 192],
  17234. [6, 192],
  17235. [6, 1664],
  17236. [6, 1664],
  17237. [6, 1664],
  17238. [6, 1664],
  17239. [6, 1664],
  17240. [6, 1664],
  17241. [6, 1664],
  17242. [6, 1664],
  17243. [8, 448],
  17244. [8, 448],
  17245. [8, 512],
  17246. [8, 512],
  17247. [9, 704],
  17248. [9, 768],
  17249. [8, 640],
  17250. [8, 640],
  17251. [8, 576],
  17252. [8, 576],
  17253. [9, 832],
  17254. [9, 896],
  17255. [9, 960],
  17256. [9, 1024],
  17257. [9, 1088],
  17258. [9, 1152],
  17259. [9, 1216],
  17260. [9, 1280],
  17261. [9, 1344],
  17262. [9, 1408],
  17263. [7, 256],
  17264. [7, 256],
  17265. [7, 256],
  17266. [7, 256],
  17267. [4, 2],
  17268. [4, 2],
  17269. [4, 2],
  17270. [4, 2],
  17271. [4, 2],
  17272. [4, 2],
  17273. [4, 2],
  17274. [4, 2],
  17275. [4, 2],
  17276. [4, 2],
  17277. [4, 2],
  17278. [4, 2],
  17279. [4, 2],
  17280. [4, 2],
  17281. [4, 2],
  17282. [4, 2],
  17283. [4, 2],
  17284. [4, 2],
  17285. [4, 2],
  17286. [4, 2],
  17287. [4, 2],
  17288. [4, 2],
  17289. [4, 2],
  17290. [4, 2],
  17291. [4, 2],
  17292. [4, 2],
  17293. [4, 2],
  17294. [4, 2],
  17295. [4, 2],
  17296. [4, 2],
  17297. [4, 2],
  17298. [4, 2],
  17299. [4, 3],
  17300. [4, 3],
  17301. [4, 3],
  17302. [4, 3],
  17303. [4, 3],
  17304. [4, 3],
  17305. [4, 3],
  17306. [4, 3],
  17307. [4, 3],
  17308. [4, 3],
  17309. [4, 3],
  17310. [4, 3],
  17311. [4, 3],
  17312. [4, 3],
  17313. [4, 3],
  17314. [4, 3],
  17315. [4, 3],
  17316. [4, 3],
  17317. [4, 3],
  17318. [4, 3],
  17319. [4, 3],
  17320. [4, 3],
  17321. [4, 3],
  17322. [4, 3],
  17323. [4, 3],
  17324. [4, 3],
  17325. [4, 3],
  17326. [4, 3],
  17327. [4, 3],
  17328. [4, 3],
  17329. [4, 3],
  17330. [4, 3],
  17331. [5, 128],
  17332. [5, 128],
  17333. [5, 128],
  17334. [5, 128],
  17335. [5, 128],
  17336. [5, 128],
  17337. [5, 128],
  17338. [5, 128],
  17339. [5, 128],
  17340. [5, 128],
  17341. [5, 128],
  17342. [5, 128],
  17343. [5, 128],
  17344. [5, 128],
  17345. [5, 128],
  17346. [5, 128],
  17347. [5, 8],
  17348. [5, 8],
  17349. [5, 8],
  17350. [5, 8],
  17351. [5, 8],
  17352. [5, 8],
  17353. [5, 8],
  17354. [5, 8],
  17355. [5, 8],
  17356. [5, 8],
  17357. [5, 8],
  17358. [5, 8],
  17359. [5, 8],
  17360. [5, 8],
  17361. [5, 8],
  17362. [5, 8],
  17363. [5, 9],
  17364. [5, 9],
  17365. [5, 9],
  17366. [5, 9],
  17367. [5, 9],
  17368. [5, 9],
  17369. [5, 9],
  17370. [5, 9],
  17371. [5, 9],
  17372. [5, 9],
  17373. [5, 9],
  17374. [5, 9],
  17375. [5, 9],
  17376. [5, 9],
  17377. [5, 9],
  17378. [5, 9],
  17379. [6, 16],
  17380. [6, 16],
  17381. [6, 16],
  17382. [6, 16],
  17383. [6, 16],
  17384. [6, 16],
  17385. [6, 16],
  17386. [6, 16],
  17387. [6, 17],
  17388. [6, 17],
  17389. [6, 17],
  17390. [6, 17],
  17391. [6, 17],
  17392. [6, 17],
  17393. [6, 17],
  17394. [6, 17],
  17395. [4, 4],
  17396. [4, 4],
  17397. [4, 4],
  17398. [4, 4],
  17399. [4, 4],
  17400. [4, 4],
  17401. [4, 4],
  17402. [4, 4],
  17403. [4, 4],
  17404. [4, 4],
  17405. [4, 4],
  17406. [4, 4],
  17407. [4, 4],
  17408. [4, 4],
  17409. [4, 4],
  17410. [4, 4],
  17411. [4, 4],
  17412. [4, 4],
  17413. [4, 4],
  17414. [4, 4],
  17415. [4, 4],
  17416. [4, 4],
  17417. [4, 4],
  17418. [4, 4],
  17419. [4, 4],
  17420. [4, 4],
  17421. [4, 4],
  17422. [4, 4],
  17423. [4, 4],
  17424. [4, 4],
  17425. [4, 4],
  17426. [4, 4],
  17427. [4, 5],
  17428. [4, 5],
  17429. [4, 5],
  17430. [4, 5],
  17431. [4, 5],
  17432. [4, 5],
  17433. [4, 5],
  17434. [4, 5],
  17435. [4, 5],
  17436. [4, 5],
  17437. [4, 5],
  17438. [4, 5],
  17439. [4, 5],
  17440. [4, 5],
  17441. [4, 5],
  17442. [4, 5],
  17443. [4, 5],
  17444. [4, 5],
  17445. [4, 5],
  17446. [4, 5],
  17447. [4, 5],
  17448. [4, 5],
  17449. [4, 5],
  17450. [4, 5],
  17451. [4, 5],
  17452. [4, 5],
  17453. [4, 5],
  17454. [4, 5],
  17455. [4, 5],
  17456. [4, 5],
  17457. [4, 5],
  17458. [4, 5],
  17459. [6, 14],
  17460. [6, 14],
  17461. [6, 14],
  17462. [6, 14],
  17463. [6, 14],
  17464. [6, 14],
  17465. [6, 14],
  17466. [6, 14],
  17467. [6, 15],
  17468. [6, 15],
  17469. [6, 15],
  17470. [6, 15],
  17471. [6, 15],
  17472. [6, 15],
  17473. [6, 15],
  17474. [6, 15],
  17475. [5, 64],
  17476. [5, 64],
  17477. [5, 64],
  17478. [5, 64],
  17479. [5, 64],
  17480. [5, 64],
  17481. [5, 64],
  17482. [5, 64],
  17483. [5, 64],
  17484. [5, 64],
  17485. [5, 64],
  17486. [5, 64],
  17487. [5, 64],
  17488. [5, 64],
  17489. [5, 64],
  17490. [5, 64],
  17491. [4, 6],
  17492. [4, 6],
  17493. [4, 6],
  17494. [4, 6],
  17495. [4, 6],
  17496. [4, 6],
  17497. [4, 6],
  17498. [4, 6],
  17499. [4, 6],
  17500. [4, 6],
  17501. [4, 6],
  17502. [4, 6],
  17503. [4, 6],
  17504. [4, 6],
  17505. [4, 6],
  17506. [4, 6],
  17507. [4, 6],
  17508. [4, 6],
  17509. [4, 6],
  17510. [4, 6],
  17511. [4, 6],
  17512. [4, 6],
  17513. [4, 6],
  17514. [4, 6],
  17515. [4, 6],
  17516. [4, 6],
  17517. [4, 6],
  17518. [4, 6],
  17519. [4, 6],
  17520. [4, 6],
  17521. [4, 6],
  17522. [4, 6],
  17523. [4, 7],
  17524. [4, 7],
  17525. [4, 7],
  17526. [4, 7],
  17527. [4, 7],
  17528. [4, 7],
  17529. [4, 7],
  17530. [4, 7],
  17531. [4, 7],
  17532. [4, 7],
  17533. [4, 7],
  17534. [4, 7],
  17535. [4, 7],
  17536. [4, 7],
  17537. [4, 7],
  17538. [4, 7],
  17539. [4, 7],
  17540. [4, 7],
  17541. [4, 7],
  17542. [4, 7],
  17543. [4, 7],
  17544. [4, 7],
  17545. [4, 7],
  17546. [4, 7],
  17547. [4, 7],
  17548. [4, 7],
  17549. [4, 7],
  17550. [4, 7],
  17551. [4, 7],
  17552. [4, 7],
  17553. [4, 7],
  17554. [4, 7],
  17555. ];
  17556. const blackTable1 = [
  17557. [-1, -1],
  17558. [-1, -1],
  17559. [12, ccittEOL],
  17560. [12, ccittEOL],
  17561. [-1, -1],
  17562. [-1, -1],
  17563. [-1, -1],
  17564. [-1, -1],
  17565. [-1, -1],
  17566. [-1, -1],
  17567. [-1, -1],
  17568. [-1, -1],
  17569. [-1, -1],
  17570. [-1, -1],
  17571. [-1, -1],
  17572. [-1, -1],
  17573. [-1, -1],
  17574. [-1, -1],
  17575. [-1, -1],
  17576. [-1, -1],
  17577. [-1, -1],
  17578. [-1, -1],
  17579. [-1, -1],
  17580. [-1, -1],
  17581. [-1, -1],
  17582. [-1, -1],
  17583. [-1, -1],
  17584. [-1, -1],
  17585. [-1, -1],
  17586. [-1, -1],
  17587. [-1, -1],
  17588. [-1, -1],
  17589. [11, 1792],
  17590. [11, 1792],
  17591. [11, 1792],
  17592. [11, 1792],
  17593. [12, 1984],
  17594. [12, 1984],
  17595. [12, 2048],
  17596. [12, 2048],
  17597. [12, 2112],
  17598. [12, 2112],
  17599. [12, 2176],
  17600. [12, 2176],
  17601. [12, 2240],
  17602. [12, 2240],
  17603. [12, 2304],
  17604. [12, 2304],
  17605. [11, 1856],
  17606. [11, 1856],
  17607. [11, 1856],
  17608. [11, 1856],
  17609. [11, 1920],
  17610. [11, 1920],
  17611. [11, 1920],
  17612. [11, 1920],
  17613. [12, 2368],
  17614. [12, 2368],
  17615. [12, 2432],
  17616. [12, 2432],
  17617. [12, 2496],
  17618. [12, 2496],
  17619. [12, 2560],
  17620. [12, 2560],
  17621. [10, 18],
  17622. [10, 18],
  17623. [10, 18],
  17624. [10, 18],
  17625. [10, 18],
  17626. [10, 18],
  17627. [10, 18],
  17628. [10, 18],
  17629. [12, 52],
  17630. [12, 52],
  17631. [13, 640],
  17632. [13, 704],
  17633. [13, 768],
  17634. [13, 832],
  17635. [12, 55],
  17636. [12, 55],
  17637. [12, 56],
  17638. [12, 56],
  17639. [13, 1280],
  17640. [13, 1344],
  17641. [13, 1408],
  17642. [13, 1472],
  17643. [12, 59],
  17644. [12, 59],
  17645. [12, 60],
  17646. [12, 60],
  17647. [13, 1536],
  17648. [13, 1600],
  17649. [11, 24],
  17650. [11, 24],
  17651. [11, 24],
  17652. [11, 24],
  17653. [11, 25],
  17654. [11, 25],
  17655. [11, 25],
  17656. [11, 25],
  17657. [13, 1664],
  17658. [13, 1728],
  17659. [12, 320],
  17660. [12, 320],
  17661. [12, 384],
  17662. [12, 384],
  17663. [12, 448],
  17664. [12, 448],
  17665. [13, 512],
  17666. [13, 576],
  17667. [12, 53],
  17668. [12, 53],
  17669. [12, 54],
  17670. [12, 54],
  17671. [13, 896],
  17672. [13, 960],
  17673. [13, 1024],
  17674. [13, 1088],
  17675. [13, 1152],
  17676. [13, 1216],
  17677. [10, 64],
  17678. [10, 64],
  17679. [10, 64],
  17680. [10, 64],
  17681. [10, 64],
  17682. [10, 64],
  17683. [10, 64],
  17684. [10, 64],
  17685. ];
  17686. const blackTable2 = [
  17687. [8, 13],
  17688. [8, 13],
  17689. [8, 13],
  17690. [8, 13],
  17691. [8, 13],
  17692. [8, 13],
  17693. [8, 13],
  17694. [8, 13],
  17695. [8, 13],
  17696. [8, 13],
  17697. [8, 13],
  17698. [8, 13],
  17699. [8, 13],
  17700. [8, 13],
  17701. [8, 13],
  17702. [8, 13],
  17703. [11, 23],
  17704. [11, 23],
  17705. [12, 50],
  17706. [12, 51],
  17707. [12, 44],
  17708. [12, 45],
  17709. [12, 46],
  17710. [12, 47],
  17711. [12, 57],
  17712. [12, 58],
  17713. [12, 61],
  17714. [12, 256],
  17715. [10, 16],
  17716. [10, 16],
  17717. [10, 16],
  17718. [10, 16],
  17719. [10, 17],
  17720. [10, 17],
  17721. [10, 17],
  17722. [10, 17],
  17723. [12, 48],
  17724. [12, 49],
  17725. [12, 62],
  17726. [12, 63],
  17727. [12, 30],
  17728. [12, 31],
  17729. [12, 32],
  17730. [12, 33],
  17731. [12, 40],
  17732. [12, 41],
  17733. [11, 22],
  17734. [11, 22],
  17735. [8, 14],
  17736. [8, 14],
  17737. [8, 14],
  17738. [8, 14],
  17739. [8, 14],
  17740. [8, 14],
  17741. [8, 14],
  17742. [8, 14],
  17743. [8, 14],
  17744. [8, 14],
  17745. [8, 14],
  17746. [8, 14],
  17747. [8, 14],
  17748. [8, 14],
  17749. [8, 14],
  17750. [8, 14],
  17751. [7, 10],
  17752. [7, 10],
  17753. [7, 10],
  17754. [7, 10],
  17755. [7, 10],
  17756. [7, 10],
  17757. [7, 10],
  17758. [7, 10],
  17759. [7, 10],
  17760. [7, 10],
  17761. [7, 10],
  17762. [7, 10],
  17763. [7, 10],
  17764. [7, 10],
  17765. [7, 10],
  17766. [7, 10],
  17767. [7, 10],
  17768. [7, 10],
  17769. [7, 10],
  17770. [7, 10],
  17771. [7, 10],
  17772. [7, 10],
  17773. [7, 10],
  17774. [7, 10],
  17775. [7, 10],
  17776. [7, 10],
  17777. [7, 10],
  17778. [7, 10],
  17779. [7, 10],
  17780. [7, 10],
  17781. [7, 10],
  17782. [7, 10],
  17783. [7, 11],
  17784. [7, 11],
  17785. [7, 11],
  17786. [7, 11],
  17787. [7, 11],
  17788. [7, 11],
  17789. [7, 11],
  17790. [7, 11],
  17791. [7, 11],
  17792. [7, 11],
  17793. [7, 11],
  17794. [7, 11],
  17795. [7, 11],
  17796. [7, 11],
  17797. [7, 11],
  17798. [7, 11],
  17799. [7, 11],
  17800. [7, 11],
  17801. [7, 11],
  17802. [7, 11],
  17803. [7, 11],
  17804. [7, 11],
  17805. [7, 11],
  17806. [7, 11],
  17807. [7, 11],
  17808. [7, 11],
  17809. [7, 11],
  17810. [7, 11],
  17811. [7, 11],
  17812. [7, 11],
  17813. [7, 11],
  17814. [7, 11],
  17815. [9, 15],
  17816. [9, 15],
  17817. [9, 15],
  17818. [9, 15],
  17819. [9, 15],
  17820. [9, 15],
  17821. [9, 15],
  17822. [9, 15],
  17823. [12, 128],
  17824. [12, 192],
  17825. [12, 26],
  17826. [12, 27],
  17827. [12, 28],
  17828. [12, 29],
  17829. [11, 19],
  17830. [11, 19],
  17831. [11, 20],
  17832. [11, 20],
  17833. [12, 34],
  17834. [12, 35],
  17835. [12, 36],
  17836. [12, 37],
  17837. [12, 38],
  17838. [12, 39],
  17839. [11, 21],
  17840. [11, 21],
  17841. [12, 42],
  17842. [12, 43],
  17843. [10, 0],
  17844. [10, 0],
  17845. [10, 0],
  17846. [10, 0],
  17847. [7, 12],
  17848. [7, 12],
  17849. [7, 12],
  17850. [7, 12],
  17851. [7, 12],
  17852. [7, 12],
  17853. [7, 12],
  17854. [7, 12],
  17855. [7, 12],
  17856. [7, 12],
  17857. [7, 12],
  17858. [7, 12],
  17859. [7, 12],
  17860. [7, 12],
  17861. [7, 12],
  17862. [7, 12],
  17863. [7, 12],
  17864. [7, 12],
  17865. [7, 12],
  17866. [7, 12],
  17867. [7, 12],
  17868. [7, 12],
  17869. [7, 12],
  17870. [7, 12],
  17871. [7, 12],
  17872. [7, 12],
  17873. [7, 12],
  17874. [7, 12],
  17875. [7, 12],
  17876. [7, 12],
  17877. [7, 12],
  17878. [7, 12],
  17879. ];
  17880. const blackTable3 = [
  17881. [-1, -1],
  17882. [-1, -1],
  17883. [-1, -1],
  17884. [-1, -1],
  17885. [6, 9],
  17886. [6, 8],
  17887. [5, 7],
  17888. [5, 7],
  17889. [4, 6],
  17890. [4, 6],
  17891. [4, 6],
  17892. [4, 6],
  17893. [4, 5],
  17894. [4, 5],
  17895. [4, 5],
  17896. [4, 5],
  17897. [3, 1],
  17898. [3, 1],
  17899. [3, 1],
  17900. [3, 1],
  17901. [3, 1],
  17902. [3, 1],
  17903. [3, 1],
  17904. [3, 1],
  17905. [3, 4],
  17906. [3, 4],
  17907. [3, 4],
  17908. [3, 4],
  17909. [3, 4],
  17910. [3, 4],
  17911. [3, 4],
  17912. [3, 4],
  17913. [2, 3],
  17914. [2, 3],
  17915. [2, 3],
  17916. [2, 3],
  17917. [2, 3],
  17918. [2, 3],
  17919. [2, 3],
  17920. [2, 3],
  17921. [2, 3],
  17922. [2, 3],
  17923. [2, 3],
  17924. [2, 3],
  17925. [2, 3],
  17926. [2, 3],
  17927. [2, 3],
  17928. [2, 3],
  17929. [2, 2],
  17930. [2, 2],
  17931. [2, 2],
  17932. [2, 2],
  17933. [2, 2],
  17934. [2, 2],
  17935. [2, 2],
  17936. [2, 2],
  17937. [2, 2],
  17938. [2, 2],
  17939. [2, 2],
  17940. [2, 2],
  17941. [2, 2],
  17942. [2, 2],
  17943. [2, 2],
  17944. [2, 2],
  17945. ];
  17946. class CCITTFaxDecoder {
  17947. constructor(source, options = {}) {
  17948. if (!source || typeof source.next !== "function") {
  17949. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  17950. }
  17951. this.source = source;
  17952. this.eof = false;
  17953. this.encoding = options.K || 0;
  17954. this.eoline = options.EndOfLine || false;
  17955. this.byteAlign = options.EncodedByteAlign || false;
  17956. this.columns = options.Columns || 1728;
  17957. this.rows = options.Rows || 0;
  17958. let eoblock = options.EndOfBlock;
  17959. if (eoblock === null || eoblock === undefined) {
  17960. eoblock = true;
  17961. }
  17962. this.eoblock = eoblock;
  17963. this.black = options.BlackIs1 || false;
  17964. this.codingLine = new Uint32Array(this.columns + 1);
  17965. this.refLine = new Uint32Array(this.columns + 2);
  17966. this.codingLine[0] = this.columns;
  17967. this.codingPos = 0;
  17968. this.row = 0;
  17969. this.nextLine2D = this.encoding < 0;
  17970. this.inputBits = 0;
  17971. this.inputBuf = 0;
  17972. this.outputBits = 0;
  17973. this.rowsDone = false;
  17974. let code1;
  17975. while ((code1 = this._lookBits(12)) === 0) {
  17976. this._eatBits(1);
  17977. }
  17978. if (code1 === 1) {
  17979. this._eatBits(12);
  17980. }
  17981. if (this.encoding > 0) {
  17982. this.nextLine2D = !this._lookBits(1);
  17983. this._eatBits(1);
  17984. }
  17985. }
  17986. readNextChar() {
  17987. if (this.eof) {
  17988. return -1;
  17989. }
  17990. const refLine = this.refLine;
  17991. const codingLine = this.codingLine;
  17992. const columns = this.columns;
  17993. let refPos, blackPixels, bits, i;
  17994. if (this.outputBits === 0) {
  17995. if (this.rowsDone) {
  17996. this.eof = true;
  17997. }
  17998. if (this.eof) {
  17999. return -1;
  18000. }
  18001. this.err = false;
  18002. let code1, code2, code3;
  18003. if (this.nextLine2D) {
  18004. for (i = 0; codingLine[i] < columns; ++i) {
  18005. refLine[i] = codingLine[i];
  18006. }
  18007. refLine[i++] = columns;
  18008. refLine[i] = columns;
  18009. codingLine[0] = 0;
  18010. this.codingPos = 0;
  18011. refPos = 0;
  18012. blackPixels = 0;
  18013. while (codingLine[this.codingPos] < columns) {
  18014. code1 = this._getTwoDimCode();
  18015. switch (code1) {
  18016. case twoDimPass:
  18017. this._addPixels(refLine[refPos + 1], blackPixels);
  18018. if (refLine[refPos + 1] < columns) {
  18019. refPos += 2;
  18020. }
  18021. break;
  18022. case twoDimHoriz:
  18023. code1 = code2 = 0;
  18024. if (blackPixels) {
  18025. do {
  18026. code1 += code3 = this._getBlackCode();
  18027. } while (code3 >= 64);
  18028. do {
  18029. code2 += code3 = this._getWhiteCode();
  18030. } while (code3 >= 64);
  18031. } else {
  18032. do {
  18033. code1 += code3 = this._getWhiteCode();
  18034. } while (code3 >= 64);
  18035. do {
  18036. code2 += code3 = this._getBlackCode();
  18037. } while (code3 >= 64);
  18038. }
  18039. this._addPixels(
  18040. codingLine[this.codingPos] + code1,
  18041. blackPixels
  18042. );
  18043. if (codingLine[this.codingPos] < columns) {
  18044. this._addPixels(
  18045. codingLine[this.codingPos] + code2,
  18046. blackPixels ^ 1
  18047. );
  18048. }
  18049. while (
  18050. refLine[refPos] <= codingLine[this.codingPos] &&
  18051. refLine[refPos] < columns
  18052. ) {
  18053. refPos += 2;
  18054. }
  18055. break;
  18056. case twoDimVertR3:
  18057. this._addPixels(refLine[refPos] + 3, blackPixels);
  18058. blackPixels ^= 1;
  18059. if (codingLine[this.codingPos] < columns) {
  18060. ++refPos;
  18061. while (
  18062. refLine[refPos] <= codingLine[this.codingPos] &&
  18063. refLine[refPos] < columns
  18064. ) {
  18065. refPos += 2;
  18066. }
  18067. }
  18068. break;
  18069. case twoDimVertR2:
  18070. this._addPixels(refLine[refPos] + 2, blackPixels);
  18071. blackPixels ^= 1;
  18072. if (codingLine[this.codingPos] < columns) {
  18073. ++refPos;
  18074. while (
  18075. refLine[refPos] <= codingLine[this.codingPos] &&
  18076. refLine[refPos] < columns
  18077. ) {
  18078. refPos += 2;
  18079. }
  18080. }
  18081. break;
  18082. case twoDimVertR1:
  18083. this._addPixels(refLine[refPos] + 1, blackPixels);
  18084. blackPixels ^= 1;
  18085. if (codingLine[this.codingPos] < columns) {
  18086. ++refPos;
  18087. while (
  18088. refLine[refPos] <= codingLine[this.codingPos] &&
  18089. refLine[refPos] < columns
  18090. ) {
  18091. refPos += 2;
  18092. }
  18093. }
  18094. break;
  18095. case twoDimVert0:
  18096. this._addPixels(refLine[refPos], blackPixels);
  18097. blackPixels ^= 1;
  18098. if (codingLine[this.codingPos] < columns) {
  18099. ++refPos;
  18100. while (
  18101. refLine[refPos] <= codingLine[this.codingPos] &&
  18102. refLine[refPos] < columns
  18103. ) {
  18104. refPos += 2;
  18105. }
  18106. }
  18107. break;
  18108. case twoDimVertL3:
  18109. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  18110. blackPixels ^= 1;
  18111. if (codingLine[this.codingPos] < columns) {
  18112. if (refPos > 0) {
  18113. --refPos;
  18114. } else {
  18115. ++refPos;
  18116. }
  18117. while (
  18118. refLine[refPos] <= codingLine[this.codingPos] &&
  18119. refLine[refPos] < columns
  18120. ) {
  18121. refPos += 2;
  18122. }
  18123. }
  18124. break;
  18125. case twoDimVertL2:
  18126. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  18127. blackPixels ^= 1;
  18128. if (codingLine[this.codingPos] < columns) {
  18129. if (refPos > 0) {
  18130. --refPos;
  18131. } else {
  18132. ++refPos;
  18133. }
  18134. while (
  18135. refLine[refPos] <= codingLine[this.codingPos] &&
  18136. refLine[refPos] < columns
  18137. ) {
  18138. refPos += 2;
  18139. }
  18140. }
  18141. break;
  18142. case twoDimVertL1:
  18143. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  18144. blackPixels ^= 1;
  18145. if (codingLine[this.codingPos] < columns) {
  18146. if (refPos > 0) {
  18147. --refPos;
  18148. } else {
  18149. ++refPos;
  18150. }
  18151. while (
  18152. refLine[refPos] <= codingLine[this.codingPos] &&
  18153. refLine[refPos] < columns
  18154. ) {
  18155. refPos += 2;
  18156. }
  18157. }
  18158. break;
  18159. case ccittEOF:
  18160. this._addPixels(columns, 0);
  18161. this.eof = true;
  18162. break;
  18163. default:
  18164. (0, _util.info)("bad 2d code");
  18165. this._addPixels(columns, 0);
  18166. this.err = true;
  18167. }
  18168. }
  18169. } else {
  18170. codingLine[0] = 0;
  18171. this.codingPos = 0;
  18172. blackPixels = 0;
  18173. while (codingLine[this.codingPos] < columns) {
  18174. code1 = 0;
  18175. if (blackPixels) {
  18176. do {
  18177. code1 += code3 = this._getBlackCode();
  18178. } while (code3 >= 64);
  18179. } else {
  18180. do {
  18181. code1 += code3 = this._getWhiteCode();
  18182. } while (code3 >= 64);
  18183. }
  18184. this._addPixels(
  18185. codingLine[this.codingPos] + code1,
  18186. blackPixels
  18187. );
  18188. blackPixels ^= 1;
  18189. }
  18190. }
  18191. let gotEOL = false;
  18192. if (this.byteAlign) {
  18193. this.inputBits &= ~7;
  18194. }
  18195. if (!this.eoblock && this.row === this.rows - 1) {
  18196. this.rowsDone = true;
  18197. } else {
  18198. code1 = this._lookBits(12);
  18199. if (this.eoline) {
  18200. while (code1 !== ccittEOF && code1 !== 1) {
  18201. this._eatBits(1);
  18202. code1 = this._lookBits(12);
  18203. }
  18204. } else {
  18205. while (code1 === 0) {
  18206. this._eatBits(1);
  18207. code1 = this._lookBits(12);
  18208. }
  18209. }
  18210. if (code1 === 1) {
  18211. this._eatBits(12);
  18212. gotEOL = true;
  18213. } else if (code1 === ccittEOF) {
  18214. this.eof = true;
  18215. }
  18216. }
  18217. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  18218. this.nextLine2D = !this._lookBits(1);
  18219. this._eatBits(1);
  18220. }
  18221. if (this.eoblock && gotEOL && this.byteAlign) {
  18222. code1 = this._lookBits(12);
  18223. if (code1 === 1) {
  18224. this._eatBits(12);
  18225. if (this.encoding > 0) {
  18226. this._lookBits(1);
  18227. this._eatBits(1);
  18228. }
  18229. if (this.encoding >= 0) {
  18230. for (i = 0; i < 4; ++i) {
  18231. code1 = this._lookBits(12);
  18232. if (code1 !== 1) {
  18233. (0, _util.info)("bad rtc code: " + code1);
  18234. }
  18235. this._eatBits(12);
  18236. if (this.encoding > 0) {
  18237. this._lookBits(1);
  18238. this._eatBits(1);
  18239. }
  18240. }
  18241. }
  18242. this.eof = true;
  18243. }
  18244. } else if (this.err && this.eoline) {
  18245. while (true) {
  18246. code1 = this._lookBits(13);
  18247. if (code1 === ccittEOF) {
  18248. this.eof = true;
  18249. return -1;
  18250. }
  18251. if (code1 >> 1 === 1) {
  18252. break;
  18253. }
  18254. this._eatBits(1);
  18255. }
  18256. this._eatBits(12);
  18257. if (this.encoding > 0) {
  18258. this._eatBits(1);
  18259. this.nextLine2D = !(code1 & 1);
  18260. }
  18261. }
  18262. if (codingLine[0] > 0) {
  18263. this.outputBits = codingLine[(this.codingPos = 0)];
  18264. } else {
  18265. this.outputBits = codingLine[(this.codingPos = 1)];
  18266. }
  18267. this.row++;
  18268. }
  18269. let c;
  18270. if (this.outputBits >= 8) {
  18271. c = this.codingPos & 1 ? 0 : 0xff;
  18272. this.outputBits -= 8;
  18273. if (
  18274. this.outputBits === 0 &&
  18275. codingLine[this.codingPos] < columns
  18276. ) {
  18277. this.codingPos++;
  18278. this.outputBits =
  18279. codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  18280. }
  18281. } else {
  18282. bits = 8;
  18283. c = 0;
  18284. do {
  18285. if (typeof this.outputBits !== "number") {
  18286. throw new _util.FormatError(
  18287. 'Invalid /CCITTFaxDecode data, "outputBits" must be a number.'
  18288. );
  18289. }
  18290. if (this.outputBits > bits) {
  18291. c <<= bits;
  18292. if (!(this.codingPos & 1)) {
  18293. c |= 0xff >> (8 - bits);
  18294. }
  18295. this.outputBits -= bits;
  18296. bits = 0;
  18297. } else {
  18298. c <<= this.outputBits;
  18299. if (!(this.codingPos & 1)) {
  18300. c |= 0xff >> (8 - this.outputBits);
  18301. }
  18302. bits -= this.outputBits;
  18303. this.outputBits = 0;
  18304. if (codingLine[this.codingPos] < columns) {
  18305. this.codingPos++;
  18306. this.outputBits =
  18307. codingLine[this.codingPos] -
  18308. codingLine[this.codingPos - 1];
  18309. } else if (bits > 0) {
  18310. c <<= bits;
  18311. bits = 0;
  18312. }
  18313. }
  18314. } while (bits);
  18315. }
  18316. if (this.black) {
  18317. c ^= 0xff;
  18318. }
  18319. return c;
  18320. }
  18321. _addPixels(a1, blackPixels) {
  18322. const codingLine = this.codingLine;
  18323. let codingPos = this.codingPos;
  18324. if (a1 > codingLine[codingPos]) {
  18325. if (a1 > this.columns) {
  18326. (0, _util.info)("row is wrong length");
  18327. this.err = true;
  18328. a1 = this.columns;
  18329. }
  18330. if ((codingPos & 1) ^ blackPixels) {
  18331. ++codingPos;
  18332. }
  18333. codingLine[codingPos] = a1;
  18334. }
  18335. this.codingPos = codingPos;
  18336. }
  18337. _addPixelsNeg(a1, blackPixels) {
  18338. const codingLine = this.codingLine;
  18339. let codingPos = this.codingPos;
  18340. if (a1 > codingLine[codingPos]) {
  18341. if (a1 > this.columns) {
  18342. (0, _util.info)("row is wrong length");
  18343. this.err = true;
  18344. a1 = this.columns;
  18345. }
  18346. if ((codingPos & 1) ^ blackPixels) {
  18347. ++codingPos;
  18348. }
  18349. codingLine[codingPos] = a1;
  18350. } else if (a1 < codingLine[codingPos]) {
  18351. if (a1 < 0) {
  18352. (0, _util.info)("invalid code");
  18353. this.err = true;
  18354. a1 = 0;
  18355. }
  18356. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  18357. --codingPos;
  18358. }
  18359. codingLine[codingPos] = a1;
  18360. }
  18361. this.codingPos = codingPos;
  18362. }
  18363. _findTableCode(start, end, table, limit) {
  18364. const limitValue = limit || 0;
  18365. for (let i = start; i <= end; ++i) {
  18366. let code = this._lookBits(i);
  18367. if (code === ccittEOF) {
  18368. return [true, 1, false];
  18369. }
  18370. if (i < end) {
  18371. code <<= end - i;
  18372. }
  18373. if (!limitValue || code >= limitValue) {
  18374. const p = table[code - limitValue];
  18375. if (p[0] === i) {
  18376. this._eatBits(i);
  18377. return [true, p[1], true];
  18378. }
  18379. }
  18380. }
  18381. return [false, 0, false];
  18382. }
  18383. _getTwoDimCode() {
  18384. let code = 0;
  18385. let p;
  18386. if (this.eoblock) {
  18387. code = this._lookBits(7);
  18388. p = twoDimTable[code];
  18389. if (p && p[0] > 0) {
  18390. this._eatBits(p[0]);
  18391. return p[1];
  18392. }
  18393. } else {
  18394. const result = this._findTableCode(1, 7, twoDimTable);
  18395. if (result[0] && result[2]) {
  18396. return result[1];
  18397. }
  18398. }
  18399. (0, _util.info)("Bad two dim code");
  18400. return ccittEOF;
  18401. }
  18402. _getWhiteCode() {
  18403. let code = 0;
  18404. let p;
  18405. if (this.eoblock) {
  18406. code = this._lookBits(12);
  18407. if (code === ccittEOF) {
  18408. return 1;
  18409. }
  18410. if (code >> 5 === 0) {
  18411. p = whiteTable1[code];
  18412. } else {
  18413. p = whiteTable2[code >> 3];
  18414. }
  18415. if (p[0] > 0) {
  18416. this._eatBits(p[0]);
  18417. return p[1];
  18418. }
  18419. } else {
  18420. let result = this._findTableCode(1, 9, whiteTable2);
  18421. if (result[0]) {
  18422. return result[1];
  18423. }
  18424. result = this._findTableCode(11, 12, whiteTable1);
  18425. if (result[0]) {
  18426. return result[1];
  18427. }
  18428. }
  18429. (0, _util.info)("bad white code");
  18430. this._eatBits(1);
  18431. return 1;
  18432. }
  18433. _getBlackCode() {
  18434. let code, p;
  18435. if (this.eoblock) {
  18436. code = this._lookBits(13);
  18437. if (code === ccittEOF) {
  18438. return 1;
  18439. }
  18440. if (code >> 7 === 0) {
  18441. p = blackTable1[code];
  18442. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  18443. p = blackTable2[(code >> 1) - 64];
  18444. } else {
  18445. p = blackTable3[code >> 7];
  18446. }
  18447. if (p[0] > 0) {
  18448. this._eatBits(p[0]);
  18449. return p[1];
  18450. }
  18451. } else {
  18452. let result = this._findTableCode(2, 6, blackTable3);
  18453. if (result[0]) {
  18454. return result[1];
  18455. }
  18456. result = this._findTableCode(7, 12, blackTable2, 64);
  18457. if (result[0]) {
  18458. return result[1];
  18459. }
  18460. result = this._findTableCode(10, 13, blackTable1);
  18461. if (result[0]) {
  18462. return result[1];
  18463. }
  18464. }
  18465. (0, _util.info)("bad black code");
  18466. this._eatBits(1);
  18467. return 1;
  18468. }
  18469. _lookBits(n) {
  18470. let c;
  18471. while (this.inputBits < n) {
  18472. if ((c = this.source.next()) === -1) {
  18473. if (this.inputBits === 0) {
  18474. return ccittEOF;
  18475. }
  18476. return (
  18477. (this.inputBuf << (n - this.inputBits)) & (0xffff >> (16 - n))
  18478. );
  18479. }
  18480. this.inputBuf = (this.inputBuf << 8) | c;
  18481. this.inputBits += 8;
  18482. }
  18483. return (
  18484. (this.inputBuf >> (this.inputBits - n)) & (0xffff >> (16 - n))
  18485. );
  18486. }
  18487. _eatBits(n) {
  18488. if ((this.inputBits -= n) < 0) {
  18489. this.inputBits = 0;
  18490. }
  18491. }
  18492. }
  18493. exports.CCITTFaxDecoder = CCITTFaxDecoder;
  18494. /***/
  18495. },
  18496. /* 23 */
  18497. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18498. Object.defineProperty(exports, "__esModule", {
  18499. value: true,
  18500. });
  18501. exports.FlateStream = void 0;
  18502. var _decode_stream = __w_pdfjs_require__(19);
  18503. var _util = __w_pdfjs_require__(2);
  18504. const codeLenCodeMap = new Int32Array([
  18505. 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15,
  18506. ]);
  18507. const lengthDecode = new Int32Array([
  18508. 0x00003, 0x00004, 0x00005, 0x00006, 0x00007, 0x00008, 0x00009,
  18509. 0x0000a, 0x1000b, 0x1000d, 0x1000f, 0x10011, 0x20013, 0x20017,
  18510. 0x2001b, 0x2001f, 0x30023, 0x3002b, 0x30033, 0x3003b, 0x40043,
  18511. 0x40053, 0x40063, 0x40073, 0x50083, 0x500a3, 0x500c3, 0x500e3,
  18512. 0x00102, 0x00102, 0x00102,
  18513. ]);
  18514. const distDecode = new Int32Array([
  18515. 0x00001, 0x00002, 0x00003, 0x00004, 0x10005, 0x10007, 0x20009,
  18516. 0x2000d, 0x30011, 0x30019, 0x40021, 0x40031, 0x50041, 0x50061,
  18517. 0x60081, 0x600c1, 0x70101, 0x70181, 0x80201, 0x80301, 0x90401,
  18518. 0x90601, 0xa0801, 0xa0c01, 0xb1001, 0xb1801, 0xc2001, 0xc3001,
  18519. 0xd4001, 0xd6001,
  18520. ]);
  18521. const fixedLitCodeTab = [
  18522. new Int32Array([
  18523. 0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030,
  18524. 0x900c0, 0x70108, 0x80060, 0x80020, 0x900a0, 0x80000, 0x80080,
  18525. 0x80040, 0x900e0, 0x70104, 0x80058, 0x80018, 0x90090, 0x70114,
  18526. 0x80078, 0x80038, 0x900d0, 0x7010c, 0x80068, 0x80028, 0x900b0,
  18527. 0x80008, 0x80088, 0x80048, 0x900f0, 0x70102, 0x80054, 0x80014,
  18528. 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c8, 0x7010a, 0x80064,
  18529. 0x80024, 0x900a8, 0x80004, 0x80084, 0x80044, 0x900e8, 0x70106,
  18530. 0x8005c, 0x8001c, 0x90098, 0x70116, 0x8007c, 0x8003c, 0x900d8,
  18531. 0x7010e, 0x8006c, 0x8002c, 0x900b8, 0x8000c, 0x8008c, 0x8004c,
  18532. 0x900f8, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072,
  18533. 0x80032, 0x900c4, 0x70109, 0x80062, 0x80022, 0x900a4, 0x80002,
  18534. 0x80082, 0x80042, 0x900e4, 0x70105, 0x8005a, 0x8001a, 0x90094,
  18535. 0x70115, 0x8007a, 0x8003a, 0x900d4, 0x7010d, 0x8006a, 0x8002a,
  18536. 0x900b4, 0x8000a, 0x8008a, 0x8004a, 0x900f4, 0x70103, 0x80056,
  18537. 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cc, 0x7010b,
  18538. 0x80066, 0x80026, 0x900ac, 0x80006, 0x80086, 0x80046, 0x900ec,
  18539. 0x70107, 0x8005e, 0x8001e, 0x9009c, 0x70117, 0x8007e, 0x8003e,
  18540. 0x900dc, 0x7010f, 0x8006e, 0x8002e, 0x900bc, 0x8000e, 0x8008e,
  18541. 0x8004e, 0x900fc, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110,
  18542. 0x80071, 0x80031, 0x900c2, 0x70108, 0x80061, 0x80021, 0x900a2,
  18543. 0x80001, 0x80081, 0x80041, 0x900e2, 0x70104, 0x80059, 0x80019,
  18544. 0x90092, 0x70114, 0x80079, 0x80039, 0x900d2, 0x7010c, 0x80069,
  18545. 0x80029, 0x900b2, 0x80009, 0x80089, 0x80049, 0x900f2, 0x70102,
  18546. 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900ca,
  18547. 0x7010a, 0x80065, 0x80025, 0x900aa, 0x80005, 0x80085, 0x80045,
  18548. 0x900ea, 0x70106, 0x8005d, 0x8001d, 0x9009a, 0x70116, 0x8007d,
  18549. 0x8003d, 0x900da, 0x7010e, 0x8006d, 0x8002d, 0x900ba, 0x8000d,
  18550. 0x8008d, 0x8004d, 0x900fa, 0x70101, 0x80053, 0x80013, 0x8011b,
  18551. 0x70111, 0x80073, 0x80033, 0x900c6, 0x70109, 0x80063, 0x80023,
  18552. 0x900a6, 0x80003, 0x80083, 0x80043, 0x900e6, 0x70105, 0x8005b,
  18553. 0x8001b, 0x90096, 0x70115, 0x8007b, 0x8003b, 0x900d6, 0x7010d,
  18554. 0x8006b, 0x8002b, 0x900b6, 0x8000b, 0x8008b, 0x8004b, 0x900f6,
  18555. 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037,
  18556. 0x900ce, 0x7010b, 0x80067, 0x80027, 0x900ae, 0x80007, 0x80087,
  18557. 0x80047, 0x900ee, 0x70107, 0x8005f, 0x8001f, 0x9009e, 0x70117,
  18558. 0x8007f, 0x8003f, 0x900de, 0x7010f, 0x8006f, 0x8002f, 0x900be,
  18559. 0x8000f, 0x8008f, 0x8004f, 0x900fe, 0x70100, 0x80050, 0x80010,
  18560. 0x80118, 0x70110, 0x80070, 0x80030, 0x900c1, 0x70108, 0x80060,
  18561. 0x80020, 0x900a1, 0x80000, 0x80080, 0x80040, 0x900e1, 0x70104,
  18562. 0x80058, 0x80018, 0x90091, 0x70114, 0x80078, 0x80038, 0x900d1,
  18563. 0x7010c, 0x80068, 0x80028, 0x900b1, 0x80008, 0x80088, 0x80048,
  18564. 0x900f1, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074,
  18565. 0x80034, 0x900c9, 0x7010a, 0x80064, 0x80024, 0x900a9, 0x80004,
  18566. 0x80084, 0x80044, 0x900e9, 0x70106, 0x8005c, 0x8001c, 0x90099,
  18567. 0x70116, 0x8007c, 0x8003c, 0x900d9, 0x7010e, 0x8006c, 0x8002c,
  18568. 0x900b9, 0x8000c, 0x8008c, 0x8004c, 0x900f9, 0x70101, 0x80052,
  18569. 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c5, 0x70109,
  18570. 0x80062, 0x80022, 0x900a5, 0x80002, 0x80082, 0x80042, 0x900e5,
  18571. 0x70105, 0x8005a, 0x8001a, 0x90095, 0x70115, 0x8007a, 0x8003a,
  18572. 0x900d5, 0x7010d, 0x8006a, 0x8002a, 0x900b5, 0x8000a, 0x8008a,
  18573. 0x8004a, 0x900f5, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113,
  18574. 0x80076, 0x80036, 0x900cd, 0x7010b, 0x80066, 0x80026, 0x900ad,
  18575. 0x80006, 0x80086, 0x80046, 0x900ed, 0x70107, 0x8005e, 0x8001e,
  18576. 0x9009d, 0x70117, 0x8007e, 0x8003e, 0x900dd, 0x7010f, 0x8006e,
  18577. 0x8002e, 0x900bd, 0x8000e, 0x8008e, 0x8004e, 0x900fd, 0x70100,
  18578. 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c3,
  18579. 0x70108, 0x80061, 0x80021, 0x900a3, 0x80001, 0x80081, 0x80041,
  18580. 0x900e3, 0x70104, 0x80059, 0x80019, 0x90093, 0x70114, 0x80079,
  18581. 0x80039, 0x900d3, 0x7010c, 0x80069, 0x80029, 0x900b3, 0x80009,
  18582. 0x80089, 0x80049, 0x900f3, 0x70102, 0x80055, 0x80015, 0x8011d,
  18583. 0x70112, 0x80075, 0x80035, 0x900cb, 0x7010a, 0x80065, 0x80025,
  18584. 0x900ab, 0x80005, 0x80085, 0x80045, 0x900eb, 0x70106, 0x8005d,
  18585. 0x8001d, 0x9009b, 0x70116, 0x8007d, 0x8003d, 0x900db, 0x7010e,
  18586. 0x8006d, 0x8002d, 0x900bb, 0x8000d, 0x8008d, 0x8004d, 0x900fb,
  18587. 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033,
  18588. 0x900c7, 0x70109, 0x80063, 0x80023, 0x900a7, 0x80003, 0x80083,
  18589. 0x80043, 0x900e7, 0x70105, 0x8005b, 0x8001b, 0x90097, 0x70115,
  18590. 0x8007b, 0x8003b, 0x900d7, 0x7010d, 0x8006b, 0x8002b, 0x900b7,
  18591. 0x8000b, 0x8008b, 0x8004b, 0x900f7, 0x70103, 0x80057, 0x80017,
  18592. 0x8011f, 0x70113, 0x80077, 0x80037, 0x900cf, 0x7010b, 0x80067,
  18593. 0x80027, 0x900af, 0x80007, 0x80087, 0x80047, 0x900ef, 0x70107,
  18594. 0x8005f, 0x8001f, 0x9009f, 0x70117, 0x8007f, 0x8003f, 0x900df,
  18595. 0x7010f, 0x8006f, 0x8002f, 0x900bf, 0x8000f, 0x8008f, 0x8004f,
  18596. 0x900ff,
  18597. ]),
  18598. 9,
  18599. ];
  18600. const fixedDistCodeTab = [
  18601. new Int32Array([
  18602. 0x50000, 0x50010, 0x50008, 0x50018, 0x50004, 0x50014, 0x5000c,
  18603. 0x5001c, 0x50002, 0x50012, 0x5000a, 0x5001a, 0x50006, 0x50016,
  18604. 0x5000e, 0x00000, 0x50001, 0x50011, 0x50009, 0x50019, 0x50005,
  18605. 0x50015, 0x5000d, 0x5001d, 0x50003, 0x50013, 0x5000b, 0x5001b,
  18606. 0x50007, 0x50017, 0x5000f, 0x00000,
  18607. ]),
  18608. 5,
  18609. ];
  18610. class FlateStream extends _decode_stream.DecodeStream {
  18611. constructor(str, maybeLength) {
  18612. super(maybeLength);
  18613. this.str = str;
  18614. this.dict = str.dict;
  18615. const cmf = str.getByte();
  18616. const flg = str.getByte();
  18617. if (cmf === -1 || flg === -1) {
  18618. throw new _util.FormatError(
  18619. `Invalid header in flate stream: ${cmf}, ${flg}`
  18620. );
  18621. }
  18622. if ((cmf & 0x0f) !== 0x08) {
  18623. throw new _util.FormatError(
  18624. `Unknown compression method in flate stream: ${cmf}, ${flg}`
  18625. );
  18626. }
  18627. if (((cmf << 8) + flg) % 31 !== 0) {
  18628. throw new _util.FormatError(
  18629. `Bad FCHECK in flate stream: ${cmf}, ${flg}`
  18630. );
  18631. }
  18632. if (flg & 0x20) {
  18633. throw new _util.FormatError(
  18634. `FDICT bit set in flate stream: ${cmf}, ${flg}`
  18635. );
  18636. }
  18637. this.codeSize = 0;
  18638. this.codeBuf = 0;
  18639. }
  18640. getBits(bits) {
  18641. const str = this.str;
  18642. let codeSize = this.codeSize;
  18643. let codeBuf = this.codeBuf;
  18644. let b;
  18645. while (codeSize < bits) {
  18646. if ((b = str.getByte()) === -1) {
  18647. throw new _util.FormatError("Bad encoding in flate stream");
  18648. }
  18649. codeBuf |= b << codeSize;
  18650. codeSize += 8;
  18651. }
  18652. b = codeBuf & ((1 << bits) - 1);
  18653. this.codeBuf = codeBuf >> bits;
  18654. this.codeSize = codeSize -= bits;
  18655. return b;
  18656. }
  18657. getCode(table) {
  18658. const str = this.str;
  18659. const codes = table[0];
  18660. const maxLen = table[1];
  18661. let codeSize = this.codeSize;
  18662. let codeBuf = this.codeBuf;
  18663. let b;
  18664. while (codeSize < maxLen) {
  18665. if ((b = str.getByte()) === -1) {
  18666. break;
  18667. }
  18668. codeBuf |= b << codeSize;
  18669. codeSize += 8;
  18670. }
  18671. const code = codes[codeBuf & ((1 << maxLen) - 1)];
  18672. const codeLen = code >> 16;
  18673. const codeVal = code & 0xffff;
  18674. if (codeLen < 1 || codeSize < codeLen) {
  18675. throw new _util.FormatError("Bad encoding in flate stream");
  18676. }
  18677. this.codeBuf = codeBuf >> codeLen;
  18678. this.codeSize = codeSize - codeLen;
  18679. return codeVal;
  18680. }
  18681. generateHuffmanTable(lengths) {
  18682. const n = lengths.length;
  18683. let maxLen = 0;
  18684. let i;
  18685. for (i = 0; i < n; ++i) {
  18686. if (lengths[i] > maxLen) {
  18687. maxLen = lengths[i];
  18688. }
  18689. }
  18690. const size = 1 << maxLen;
  18691. const codes = new Int32Array(size);
  18692. for (
  18693. let len = 1, code = 0, skip = 2;
  18694. len <= maxLen;
  18695. ++len, code <<= 1, skip <<= 1
  18696. ) {
  18697. for (let val = 0; val < n; ++val) {
  18698. if (lengths[val] === len) {
  18699. let code2 = 0;
  18700. let t = code;
  18701. for (i = 0; i < len; ++i) {
  18702. code2 = (code2 << 1) | (t & 1);
  18703. t >>= 1;
  18704. }
  18705. for (i = code2; i < size; i += skip) {
  18706. codes[i] = (len << 16) | val;
  18707. }
  18708. ++code;
  18709. }
  18710. }
  18711. }
  18712. return [codes, maxLen];
  18713. }
  18714. readBlock() {
  18715. let buffer, len;
  18716. const str = this.str;
  18717. let hdr = this.getBits(3);
  18718. if (hdr & 1) {
  18719. this.eof = true;
  18720. }
  18721. hdr >>= 1;
  18722. if (hdr === 0) {
  18723. let b;
  18724. if ((b = str.getByte()) === -1) {
  18725. throw new _util.FormatError("Bad block header in flate stream");
  18726. }
  18727. let blockLen = b;
  18728. if ((b = str.getByte()) === -1) {
  18729. throw new _util.FormatError("Bad block header in flate stream");
  18730. }
  18731. blockLen |= b << 8;
  18732. if ((b = str.getByte()) === -1) {
  18733. throw new _util.FormatError("Bad block header in flate stream");
  18734. }
  18735. let check = b;
  18736. if ((b = str.getByte()) === -1) {
  18737. throw new _util.FormatError("Bad block header in flate stream");
  18738. }
  18739. check |= b << 8;
  18740. if (
  18741. check !== (~blockLen & 0xffff) &&
  18742. (blockLen !== 0 || check !== 0)
  18743. ) {
  18744. throw new _util.FormatError(
  18745. "Bad uncompressed block length in flate stream"
  18746. );
  18747. }
  18748. this.codeBuf = 0;
  18749. this.codeSize = 0;
  18750. const bufferLength = this.bufferLength,
  18751. end = bufferLength + blockLen;
  18752. buffer = this.ensureBuffer(end);
  18753. this.bufferLength = end;
  18754. if (blockLen === 0) {
  18755. if (str.peekByte() === -1) {
  18756. this.eof = true;
  18757. }
  18758. } else {
  18759. const block = str.getBytes(blockLen);
  18760. buffer.set(block, bufferLength);
  18761. if (block.length < blockLen) {
  18762. this.eof = true;
  18763. }
  18764. }
  18765. return;
  18766. }
  18767. let litCodeTable;
  18768. let distCodeTable;
  18769. if (hdr === 1) {
  18770. litCodeTable = fixedLitCodeTab;
  18771. distCodeTable = fixedDistCodeTab;
  18772. } else if (hdr === 2) {
  18773. const numLitCodes = this.getBits(5) + 257;
  18774. const numDistCodes = this.getBits(5) + 1;
  18775. const numCodeLenCodes = this.getBits(4) + 4;
  18776. const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  18777. let i;
  18778. for (i = 0; i < numCodeLenCodes; ++i) {
  18779. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  18780. }
  18781. const codeLenCodeTab =
  18782. this.generateHuffmanTable(codeLenCodeLengths);
  18783. len = 0;
  18784. i = 0;
  18785. const codes = numLitCodes + numDistCodes;
  18786. const codeLengths = new Uint8Array(codes);
  18787. let bitsLength, bitsOffset, what;
  18788. while (i < codes) {
  18789. const code = this.getCode(codeLenCodeTab);
  18790. if (code === 16) {
  18791. bitsLength = 2;
  18792. bitsOffset = 3;
  18793. what = len;
  18794. } else if (code === 17) {
  18795. bitsLength = 3;
  18796. bitsOffset = 3;
  18797. what = len = 0;
  18798. } else if (code === 18) {
  18799. bitsLength = 7;
  18800. bitsOffset = 11;
  18801. what = len = 0;
  18802. } else {
  18803. codeLengths[i++] = len = code;
  18804. continue;
  18805. }
  18806. let repeatLength = this.getBits(bitsLength) + bitsOffset;
  18807. while (repeatLength-- > 0) {
  18808. codeLengths[i++] = what;
  18809. }
  18810. }
  18811. litCodeTable = this.generateHuffmanTable(
  18812. codeLengths.subarray(0, numLitCodes)
  18813. );
  18814. distCodeTable = this.generateHuffmanTable(
  18815. codeLengths.subarray(numLitCodes, codes)
  18816. );
  18817. } else {
  18818. throw new _util.FormatError("Unknown block type in flate stream");
  18819. }
  18820. buffer = this.buffer;
  18821. let limit = buffer ? buffer.length : 0;
  18822. let pos = this.bufferLength;
  18823. while (true) {
  18824. let code1 = this.getCode(litCodeTable);
  18825. if (code1 < 256) {
  18826. if (pos + 1 >= limit) {
  18827. buffer = this.ensureBuffer(pos + 1);
  18828. limit = buffer.length;
  18829. }
  18830. buffer[pos++] = code1;
  18831. continue;
  18832. }
  18833. if (code1 === 256) {
  18834. this.bufferLength = pos;
  18835. return;
  18836. }
  18837. code1 -= 257;
  18838. code1 = lengthDecode[code1];
  18839. let code2 = code1 >> 16;
  18840. if (code2 > 0) {
  18841. code2 = this.getBits(code2);
  18842. }
  18843. len = (code1 & 0xffff) + code2;
  18844. code1 = this.getCode(distCodeTable);
  18845. code1 = distDecode[code1];
  18846. code2 = code1 >> 16;
  18847. if (code2 > 0) {
  18848. code2 = this.getBits(code2);
  18849. }
  18850. const dist = (code1 & 0xffff) + code2;
  18851. if (pos + len >= limit) {
  18852. buffer = this.ensureBuffer(pos + len);
  18853. limit = buffer.length;
  18854. }
  18855. for (let k = 0; k < len; ++k, ++pos) {
  18856. buffer[pos] = buffer[pos - dist];
  18857. }
  18858. }
  18859. }
  18860. }
  18861. exports.FlateStream = FlateStream;
  18862. /***/
  18863. },
  18864. /* 24 */
  18865. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18866. Object.defineProperty(exports, "__esModule", {
  18867. value: true,
  18868. });
  18869. exports.Jbig2Stream = void 0;
  18870. var _base_stream = __w_pdfjs_require__(7);
  18871. var _decode_stream = __w_pdfjs_require__(19);
  18872. var _primitives = __w_pdfjs_require__(5);
  18873. var _jbig = __w_pdfjs_require__(25);
  18874. var _util = __w_pdfjs_require__(2);
  18875. class Jbig2Stream extends _decode_stream.DecodeStream {
  18876. constructor(stream, maybeLength, params) {
  18877. super(maybeLength);
  18878. this.stream = stream;
  18879. this.dict = stream.dict;
  18880. this.maybeLength = maybeLength;
  18881. this.params = params;
  18882. }
  18883. get bytes() {
  18884. return (0, _util.shadow)(
  18885. this,
  18886. "bytes",
  18887. this.stream.getBytes(this.maybeLength)
  18888. );
  18889. }
  18890. ensureBuffer(requested) {}
  18891. readBlock() {
  18892. if (this.eof) {
  18893. return;
  18894. }
  18895. const jbig2Image = new _jbig.Jbig2Image();
  18896. const chunks = [];
  18897. if (this.params instanceof _primitives.Dict) {
  18898. const globalsStream = this.params.get("JBIG2Globals");
  18899. if (globalsStream instanceof _base_stream.BaseStream) {
  18900. const globals = globalsStream.getBytes();
  18901. chunks.push({
  18902. data: globals,
  18903. start: 0,
  18904. end: globals.length,
  18905. });
  18906. }
  18907. }
  18908. chunks.push({
  18909. data: this.bytes,
  18910. start: 0,
  18911. end: this.bytes.length,
  18912. });
  18913. const data = jbig2Image.parseChunks(chunks);
  18914. const dataLength = data.length;
  18915. for (let i = 0; i < dataLength; i++) {
  18916. data[i] ^= 0xff;
  18917. }
  18918. this.buffer = data;
  18919. this.bufferLength = dataLength;
  18920. this.eof = true;
  18921. }
  18922. }
  18923. exports.Jbig2Stream = Jbig2Stream;
  18924. /***/
  18925. },
  18926. /* 25 */
  18927. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18928. Object.defineProperty(exports, "__esModule", {
  18929. value: true,
  18930. });
  18931. exports.Jbig2Image = void 0;
  18932. var _util = __w_pdfjs_require__(2);
  18933. var _core_utils = __w_pdfjs_require__(6);
  18934. var _arithmetic_decoder = __w_pdfjs_require__(26);
  18935. var _ccitt = __w_pdfjs_require__(22);
  18936. class Jbig2Error extends _util.BaseException {
  18937. constructor(msg) {
  18938. super(`JBIG2 error: ${msg}`, "Jbig2Error");
  18939. }
  18940. }
  18941. class ContextCache {
  18942. getContexts(id) {
  18943. if (id in this) {
  18944. return this[id];
  18945. }
  18946. return (this[id] = new Int8Array(1 << 16));
  18947. }
  18948. }
  18949. class DecodingContext {
  18950. constructor(data, start, end) {
  18951. this.data = data;
  18952. this.start = start;
  18953. this.end = end;
  18954. }
  18955. get decoder() {
  18956. const decoder = new _arithmetic_decoder.ArithmeticDecoder(
  18957. this.data,
  18958. this.start,
  18959. this.end
  18960. );
  18961. return (0, _util.shadow)(this, "decoder", decoder);
  18962. }
  18963. get contextCache() {
  18964. const cache = new ContextCache();
  18965. return (0, _util.shadow)(this, "contextCache", cache);
  18966. }
  18967. }
  18968. function decodeInteger(contextCache, procedure, decoder) {
  18969. const contexts = contextCache.getContexts(procedure);
  18970. let prev = 1;
  18971. function readBits(length) {
  18972. let v = 0;
  18973. for (let i = 0; i < length; i++) {
  18974. const bit = decoder.readBit(contexts, prev);
  18975. prev =
  18976. prev < 256
  18977. ? (prev << 1) | bit
  18978. : (((prev << 1) | bit) & 511) | 256;
  18979. v = (v << 1) | bit;
  18980. }
  18981. return v >>> 0;
  18982. }
  18983. const sign = readBits(1);
  18984. const value = readBits(1)
  18985. ? readBits(1)
  18986. ? readBits(1)
  18987. ? readBits(1)
  18988. ? readBits(1)
  18989. ? readBits(32) + 4436
  18990. : readBits(12) + 340
  18991. : readBits(8) + 84
  18992. : readBits(6) + 20
  18993. : readBits(4) + 4
  18994. : readBits(2);
  18995. if (sign === 0) {
  18996. return value;
  18997. } else if (value > 0) {
  18998. return -value;
  18999. }
  19000. return null;
  19001. }
  19002. function decodeIAID(contextCache, decoder, codeLength) {
  19003. const contexts = contextCache.getContexts("IAID");
  19004. let prev = 1;
  19005. for (let i = 0; i < codeLength; i++) {
  19006. const bit = decoder.readBit(contexts, prev);
  19007. prev = (prev << 1) | bit;
  19008. }
  19009. if (codeLength < 31) {
  19010. return prev & ((1 << codeLength) - 1);
  19011. }
  19012. return prev & 0x7fffffff;
  19013. }
  19014. const SegmentTypes = [
  19015. "SymbolDictionary",
  19016. null,
  19017. null,
  19018. null,
  19019. "IntermediateTextRegion",
  19020. null,
  19021. "ImmediateTextRegion",
  19022. "ImmediateLosslessTextRegion",
  19023. null,
  19024. null,
  19025. null,
  19026. null,
  19027. null,
  19028. null,
  19029. null,
  19030. null,
  19031. "PatternDictionary",
  19032. null,
  19033. null,
  19034. null,
  19035. "IntermediateHalftoneRegion",
  19036. null,
  19037. "ImmediateHalftoneRegion",
  19038. "ImmediateLosslessHalftoneRegion",
  19039. null,
  19040. null,
  19041. null,
  19042. null,
  19043. null,
  19044. null,
  19045. null,
  19046. null,
  19047. null,
  19048. null,
  19049. null,
  19050. null,
  19051. "IntermediateGenericRegion",
  19052. null,
  19053. "ImmediateGenericRegion",
  19054. "ImmediateLosslessGenericRegion",
  19055. "IntermediateGenericRefinementRegion",
  19056. null,
  19057. "ImmediateGenericRefinementRegion",
  19058. "ImmediateLosslessGenericRefinementRegion",
  19059. null,
  19060. null,
  19061. null,
  19062. null,
  19063. "PageInformation",
  19064. "EndOfPage",
  19065. "EndOfStripe",
  19066. "EndOfFile",
  19067. "Profiles",
  19068. "Tables",
  19069. null,
  19070. null,
  19071. null,
  19072. null,
  19073. null,
  19074. null,
  19075. null,
  19076. null,
  19077. "Extension",
  19078. ];
  19079. const CodingTemplates = [
  19080. [
  19081. {
  19082. x: -1,
  19083. y: -2,
  19084. },
  19085. {
  19086. x: 0,
  19087. y: -2,
  19088. },
  19089. {
  19090. x: 1,
  19091. y: -2,
  19092. },
  19093. {
  19094. x: -2,
  19095. y: -1,
  19096. },
  19097. {
  19098. x: -1,
  19099. y: -1,
  19100. },
  19101. {
  19102. x: 0,
  19103. y: -1,
  19104. },
  19105. {
  19106. x: 1,
  19107. y: -1,
  19108. },
  19109. {
  19110. x: 2,
  19111. y: -1,
  19112. },
  19113. {
  19114. x: -4,
  19115. y: 0,
  19116. },
  19117. {
  19118. x: -3,
  19119. y: 0,
  19120. },
  19121. {
  19122. x: -2,
  19123. y: 0,
  19124. },
  19125. {
  19126. x: -1,
  19127. y: 0,
  19128. },
  19129. ],
  19130. [
  19131. {
  19132. x: -1,
  19133. y: -2,
  19134. },
  19135. {
  19136. x: 0,
  19137. y: -2,
  19138. },
  19139. {
  19140. x: 1,
  19141. y: -2,
  19142. },
  19143. {
  19144. x: 2,
  19145. y: -2,
  19146. },
  19147. {
  19148. x: -2,
  19149. y: -1,
  19150. },
  19151. {
  19152. x: -1,
  19153. y: -1,
  19154. },
  19155. {
  19156. x: 0,
  19157. y: -1,
  19158. },
  19159. {
  19160. x: 1,
  19161. y: -1,
  19162. },
  19163. {
  19164. x: 2,
  19165. y: -1,
  19166. },
  19167. {
  19168. x: -3,
  19169. y: 0,
  19170. },
  19171. {
  19172. x: -2,
  19173. y: 0,
  19174. },
  19175. {
  19176. x: -1,
  19177. y: 0,
  19178. },
  19179. ],
  19180. [
  19181. {
  19182. x: -1,
  19183. y: -2,
  19184. },
  19185. {
  19186. x: 0,
  19187. y: -2,
  19188. },
  19189. {
  19190. x: 1,
  19191. y: -2,
  19192. },
  19193. {
  19194. x: -2,
  19195. y: -1,
  19196. },
  19197. {
  19198. x: -1,
  19199. y: -1,
  19200. },
  19201. {
  19202. x: 0,
  19203. y: -1,
  19204. },
  19205. {
  19206. x: 1,
  19207. y: -1,
  19208. },
  19209. {
  19210. x: -2,
  19211. y: 0,
  19212. },
  19213. {
  19214. x: -1,
  19215. y: 0,
  19216. },
  19217. ],
  19218. [
  19219. {
  19220. x: -3,
  19221. y: -1,
  19222. },
  19223. {
  19224. x: -2,
  19225. y: -1,
  19226. },
  19227. {
  19228. x: -1,
  19229. y: -1,
  19230. },
  19231. {
  19232. x: 0,
  19233. y: -1,
  19234. },
  19235. {
  19236. x: 1,
  19237. y: -1,
  19238. },
  19239. {
  19240. x: -4,
  19241. y: 0,
  19242. },
  19243. {
  19244. x: -3,
  19245. y: 0,
  19246. },
  19247. {
  19248. x: -2,
  19249. y: 0,
  19250. },
  19251. {
  19252. x: -1,
  19253. y: 0,
  19254. },
  19255. ],
  19256. ];
  19257. const RefinementTemplates = [
  19258. {
  19259. coding: [
  19260. {
  19261. x: 0,
  19262. y: -1,
  19263. },
  19264. {
  19265. x: 1,
  19266. y: -1,
  19267. },
  19268. {
  19269. x: -1,
  19270. y: 0,
  19271. },
  19272. ],
  19273. reference: [
  19274. {
  19275. x: 0,
  19276. y: -1,
  19277. },
  19278. {
  19279. x: 1,
  19280. y: -1,
  19281. },
  19282. {
  19283. x: -1,
  19284. y: 0,
  19285. },
  19286. {
  19287. x: 0,
  19288. y: 0,
  19289. },
  19290. {
  19291. x: 1,
  19292. y: 0,
  19293. },
  19294. {
  19295. x: -1,
  19296. y: 1,
  19297. },
  19298. {
  19299. x: 0,
  19300. y: 1,
  19301. },
  19302. {
  19303. x: 1,
  19304. y: 1,
  19305. },
  19306. ],
  19307. },
  19308. {
  19309. coding: [
  19310. {
  19311. x: -1,
  19312. y: -1,
  19313. },
  19314. {
  19315. x: 0,
  19316. y: -1,
  19317. },
  19318. {
  19319. x: 1,
  19320. y: -1,
  19321. },
  19322. {
  19323. x: -1,
  19324. y: 0,
  19325. },
  19326. ],
  19327. reference: [
  19328. {
  19329. x: 0,
  19330. y: -1,
  19331. },
  19332. {
  19333. x: -1,
  19334. y: 0,
  19335. },
  19336. {
  19337. x: 0,
  19338. y: 0,
  19339. },
  19340. {
  19341. x: 1,
  19342. y: 0,
  19343. },
  19344. {
  19345. x: 0,
  19346. y: 1,
  19347. },
  19348. {
  19349. x: 1,
  19350. y: 1,
  19351. },
  19352. ],
  19353. },
  19354. ];
  19355. const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  19356. const RefinementReusedContexts = [0x0020, 0x0008];
  19357. function decodeBitmapTemplate0(width, height, decodingContext) {
  19358. const decoder = decodingContext.decoder;
  19359. const contexts = decodingContext.contextCache.getContexts("GB");
  19360. const bitmap = [];
  19361. let contextLabel, i, j, pixel, row, row1, row2;
  19362. const OLD_PIXEL_MASK = 0x7bf7;
  19363. for (i = 0; i < height; i++) {
  19364. row = bitmap[i] = new Uint8Array(width);
  19365. row1 = i < 1 ? row : bitmap[i - 1];
  19366. row2 = i < 2 ? row : bitmap[i - 2];
  19367. contextLabel =
  19368. (row2[0] << 13) |
  19369. (row2[1] << 12) |
  19370. (row2[2] << 11) |
  19371. (row1[0] << 7) |
  19372. (row1[1] << 6) |
  19373. (row1[2] << 5) |
  19374. (row1[3] << 4);
  19375. for (j = 0; j < width; j++) {
  19376. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  19377. contextLabel =
  19378. ((contextLabel & OLD_PIXEL_MASK) << 1) |
  19379. (j + 3 < width ? row2[j + 3] << 11 : 0) |
  19380. (j + 4 < width ? row1[j + 4] << 4 : 0) |
  19381. pixel;
  19382. }
  19383. }
  19384. return bitmap;
  19385. }
  19386. function decodeBitmap(
  19387. mmr,
  19388. width,
  19389. height,
  19390. templateIndex,
  19391. prediction,
  19392. skip,
  19393. at,
  19394. decodingContext
  19395. ) {
  19396. if (mmr) {
  19397. const input = new Reader(
  19398. decodingContext.data,
  19399. decodingContext.start,
  19400. decodingContext.end
  19401. );
  19402. return decodeMMRBitmap(input, width, height, false);
  19403. }
  19404. if (
  19405. templateIndex === 0 &&
  19406. !skip &&
  19407. !prediction &&
  19408. at.length === 4 &&
  19409. at[0].x === 3 &&
  19410. at[0].y === -1 &&
  19411. at[1].x === -3 &&
  19412. at[1].y === -1 &&
  19413. at[2].x === 2 &&
  19414. at[2].y === -2 &&
  19415. at[3].x === -2 &&
  19416. at[3].y === -2
  19417. ) {
  19418. return decodeBitmapTemplate0(width, height, decodingContext);
  19419. }
  19420. const useskip = !!skip;
  19421. const template = CodingTemplates[templateIndex].concat(at);
  19422. template.sort(function (a, b) {
  19423. return a.y - b.y || a.x - b.x;
  19424. });
  19425. const templateLength = template.length;
  19426. const templateX = new Int8Array(templateLength);
  19427. const templateY = new Int8Array(templateLength);
  19428. const changingTemplateEntries = [];
  19429. let reuseMask = 0,
  19430. minX = 0,
  19431. maxX = 0,
  19432. minY = 0;
  19433. let c, k;
  19434. for (k = 0; k < templateLength; k++) {
  19435. templateX[k] = template[k].x;
  19436. templateY[k] = template[k].y;
  19437. minX = Math.min(minX, template[k].x);
  19438. maxX = Math.max(maxX, template[k].x);
  19439. minY = Math.min(minY, template[k].y);
  19440. if (
  19441. k < templateLength - 1 &&
  19442. template[k].y === template[k + 1].y &&
  19443. template[k].x === template[k + 1].x - 1
  19444. ) {
  19445. reuseMask |= 1 << (templateLength - 1 - k);
  19446. } else {
  19447. changingTemplateEntries.push(k);
  19448. }
  19449. }
  19450. const changingEntriesLength = changingTemplateEntries.length;
  19451. const changingTemplateX = new Int8Array(changingEntriesLength);
  19452. const changingTemplateY = new Int8Array(changingEntriesLength);
  19453. const changingTemplateBit = new Uint16Array(changingEntriesLength);
  19454. for (c = 0; c < changingEntriesLength; c++) {
  19455. k = changingTemplateEntries[c];
  19456. changingTemplateX[c] = template[k].x;
  19457. changingTemplateY[c] = template[k].y;
  19458. changingTemplateBit[c] = 1 << (templateLength - 1 - k);
  19459. }
  19460. const sbb_left = -minX;
  19461. const sbb_top = -minY;
  19462. const sbb_right = width - maxX;
  19463. const pseudoPixelContext = ReusedContexts[templateIndex];
  19464. let row = new Uint8Array(width);
  19465. const bitmap = [];
  19466. const decoder = decodingContext.decoder;
  19467. const contexts = decodingContext.contextCache.getContexts("GB");
  19468. let ltp = 0,
  19469. j,
  19470. i0,
  19471. j0,
  19472. contextLabel = 0,
  19473. bit,
  19474. shift;
  19475. for (let i = 0; i < height; i++) {
  19476. if (prediction) {
  19477. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  19478. ltp ^= sltp;
  19479. if (ltp) {
  19480. bitmap.push(row);
  19481. continue;
  19482. }
  19483. }
  19484. row = new Uint8Array(row);
  19485. bitmap.push(row);
  19486. for (j = 0; j < width; j++) {
  19487. if (useskip && skip[i][j]) {
  19488. row[j] = 0;
  19489. continue;
  19490. }
  19491. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  19492. contextLabel = (contextLabel << 1) & reuseMask;
  19493. for (k = 0; k < changingEntriesLength; k++) {
  19494. i0 = i + changingTemplateY[k];
  19495. j0 = j + changingTemplateX[k];
  19496. bit = bitmap[i0][j0];
  19497. if (bit) {
  19498. bit = changingTemplateBit[k];
  19499. contextLabel |= bit;
  19500. }
  19501. }
  19502. } else {
  19503. contextLabel = 0;
  19504. shift = templateLength - 1;
  19505. for (k = 0; k < templateLength; k++, shift--) {
  19506. j0 = j + templateX[k];
  19507. if (j0 >= 0 && j0 < width) {
  19508. i0 = i + templateY[k];
  19509. if (i0 >= 0) {
  19510. bit = bitmap[i0][j0];
  19511. if (bit) {
  19512. contextLabel |= bit << shift;
  19513. }
  19514. }
  19515. }
  19516. }
  19517. }
  19518. const pixel = decoder.readBit(contexts, contextLabel);
  19519. row[j] = pixel;
  19520. }
  19521. }
  19522. return bitmap;
  19523. }
  19524. function decodeRefinement(
  19525. width,
  19526. height,
  19527. templateIndex,
  19528. referenceBitmap,
  19529. offsetX,
  19530. offsetY,
  19531. prediction,
  19532. at,
  19533. decodingContext
  19534. ) {
  19535. let codingTemplate = RefinementTemplates[templateIndex].coding;
  19536. if (templateIndex === 0) {
  19537. codingTemplate = codingTemplate.concat([at[0]]);
  19538. }
  19539. const codingTemplateLength = codingTemplate.length;
  19540. const codingTemplateX = new Int32Array(codingTemplateLength);
  19541. const codingTemplateY = new Int32Array(codingTemplateLength);
  19542. let k;
  19543. for (k = 0; k < codingTemplateLength; k++) {
  19544. codingTemplateX[k] = codingTemplate[k].x;
  19545. codingTemplateY[k] = codingTemplate[k].y;
  19546. }
  19547. let referenceTemplate = RefinementTemplates[templateIndex].reference;
  19548. if (templateIndex === 0) {
  19549. referenceTemplate = referenceTemplate.concat([at[1]]);
  19550. }
  19551. const referenceTemplateLength = referenceTemplate.length;
  19552. const referenceTemplateX = new Int32Array(referenceTemplateLength);
  19553. const referenceTemplateY = new Int32Array(referenceTemplateLength);
  19554. for (k = 0; k < referenceTemplateLength; k++) {
  19555. referenceTemplateX[k] = referenceTemplate[k].x;
  19556. referenceTemplateY[k] = referenceTemplate[k].y;
  19557. }
  19558. const referenceWidth = referenceBitmap[0].length;
  19559. const referenceHeight = referenceBitmap.length;
  19560. const pseudoPixelContext = RefinementReusedContexts[templateIndex];
  19561. const bitmap = [];
  19562. const decoder = decodingContext.decoder;
  19563. const contexts = decodingContext.contextCache.getContexts("GR");
  19564. let ltp = 0;
  19565. for (let i = 0; i < height; i++) {
  19566. if (prediction) {
  19567. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  19568. ltp ^= sltp;
  19569. if (ltp) {
  19570. throw new Jbig2Error("prediction is not supported");
  19571. }
  19572. }
  19573. const row = new Uint8Array(width);
  19574. bitmap.push(row);
  19575. for (let j = 0; j < width; j++) {
  19576. let i0, j0;
  19577. let contextLabel = 0;
  19578. for (k = 0; k < codingTemplateLength; k++) {
  19579. i0 = i + codingTemplateY[k];
  19580. j0 = j + codingTemplateX[k];
  19581. if (i0 < 0 || j0 < 0 || j0 >= width) {
  19582. contextLabel <<= 1;
  19583. } else {
  19584. contextLabel = (contextLabel << 1) | bitmap[i0][j0];
  19585. }
  19586. }
  19587. for (k = 0; k < referenceTemplateLength; k++) {
  19588. i0 = i + referenceTemplateY[k] - offsetY;
  19589. j0 = j + referenceTemplateX[k] - offsetX;
  19590. if (
  19591. i0 < 0 ||
  19592. i0 >= referenceHeight ||
  19593. j0 < 0 ||
  19594. j0 >= referenceWidth
  19595. ) {
  19596. contextLabel <<= 1;
  19597. } else {
  19598. contextLabel = (contextLabel << 1) | referenceBitmap[i0][j0];
  19599. }
  19600. }
  19601. const pixel = decoder.readBit(contexts, contextLabel);
  19602. row[j] = pixel;
  19603. }
  19604. }
  19605. return bitmap;
  19606. }
  19607. function decodeSymbolDictionary(
  19608. huffman,
  19609. refinement,
  19610. symbols,
  19611. numberOfNewSymbols,
  19612. numberOfExportedSymbols,
  19613. huffmanTables,
  19614. templateIndex,
  19615. at,
  19616. refinementTemplateIndex,
  19617. refinementAt,
  19618. decodingContext,
  19619. huffmanInput
  19620. ) {
  19621. if (huffman && refinement) {
  19622. throw new Jbig2Error(
  19623. "symbol refinement with Huffman is not supported"
  19624. );
  19625. }
  19626. const newSymbols = [];
  19627. let currentHeight = 0;
  19628. let symbolCodeLength = (0, _core_utils.log2)(
  19629. symbols.length + numberOfNewSymbols
  19630. );
  19631. const decoder = decodingContext.decoder;
  19632. const contextCache = decodingContext.contextCache;
  19633. let tableB1, symbolWidths;
  19634. if (huffman) {
  19635. tableB1 = getStandardTable(1);
  19636. symbolWidths = [];
  19637. symbolCodeLength = Math.max(symbolCodeLength, 1);
  19638. }
  19639. while (newSymbols.length < numberOfNewSymbols) {
  19640. const deltaHeight = huffman
  19641. ? huffmanTables.tableDeltaHeight.decode(huffmanInput)
  19642. : decodeInteger(contextCache, "IADH", decoder);
  19643. currentHeight += deltaHeight;
  19644. let currentWidth = 0,
  19645. totalWidth = 0;
  19646. const firstSymbol = huffman ? symbolWidths.length : 0;
  19647. while (true) {
  19648. const deltaWidth = huffman
  19649. ? huffmanTables.tableDeltaWidth.decode(huffmanInput)
  19650. : decodeInteger(contextCache, "IADW", decoder);
  19651. if (deltaWidth === null) {
  19652. break;
  19653. }
  19654. currentWidth += deltaWidth;
  19655. totalWidth += currentWidth;
  19656. let bitmap;
  19657. if (refinement) {
  19658. const numberOfInstances = decodeInteger(
  19659. contextCache,
  19660. "IAAI",
  19661. decoder
  19662. );
  19663. if (numberOfInstances > 1) {
  19664. bitmap = decodeTextRegion(
  19665. huffman,
  19666. refinement,
  19667. currentWidth,
  19668. currentHeight,
  19669. 0,
  19670. numberOfInstances,
  19671. 1,
  19672. symbols.concat(newSymbols),
  19673. symbolCodeLength,
  19674. 0,
  19675. 0,
  19676. 1,
  19677. 0,
  19678. huffmanTables,
  19679. refinementTemplateIndex,
  19680. refinementAt,
  19681. decodingContext,
  19682. 0,
  19683. huffmanInput
  19684. );
  19685. } else {
  19686. const symbolId = decodeIAID(
  19687. contextCache,
  19688. decoder,
  19689. symbolCodeLength
  19690. );
  19691. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  19692. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  19693. const symbol =
  19694. symbolId < symbols.length
  19695. ? symbols[symbolId]
  19696. : newSymbols[symbolId - symbols.length];
  19697. bitmap = decodeRefinement(
  19698. currentWidth,
  19699. currentHeight,
  19700. refinementTemplateIndex,
  19701. symbol,
  19702. rdx,
  19703. rdy,
  19704. false,
  19705. refinementAt,
  19706. decodingContext
  19707. );
  19708. }
  19709. newSymbols.push(bitmap);
  19710. } else if (huffman) {
  19711. symbolWidths.push(currentWidth);
  19712. } else {
  19713. bitmap = decodeBitmap(
  19714. false,
  19715. currentWidth,
  19716. currentHeight,
  19717. templateIndex,
  19718. false,
  19719. null,
  19720. at,
  19721. decodingContext
  19722. );
  19723. newSymbols.push(bitmap);
  19724. }
  19725. }
  19726. if (huffman && !refinement) {
  19727. const bitmapSize =
  19728. huffmanTables.tableBitmapSize.decode(huffmanInput);
  19729. huffmanInput.byteAlign();
  19730. let collectiveBitmap;
  19731. if (bitmapSize === 0) {
  19732. collectiveBitmap = readUncompressedBitmap(
  19733. huffmanInput,
  19734. totalWidth,
  19735. currentHeight
  19736. );
  19737. } else {
  19738. const originalEnd = huffmanInput.end;
  19739. const bitmapEnd = huffmanInput.position + bitmapSize;
  19740. huffmanInput.end = bitmapEnd;
  19741. collectiveBitmap = decodeMMRBitmap(
  19742. huffmanInput,
  19743. totalWidth,
  19744. currentHeight,
  19745. false
  19746. );
  19747. huffmanInput.end = originalEnd;
  19748. huffmanInput.position = bitmapEnd;
  19749. }
  19750. const numberOfSymbolsDecoded = symbolWidths.length;
  19751. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  19752. newSymbols.push(collectiveBitmap);
  19753. } else {
  19754. let i,
  19755. y,
  19756. xMin = 0,
  19757. xMax,
  19758. bitmapWidth,
  19759. symbolBitmap;
  19760. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  19761. bitmapWidth = symbolWidths[i];
  19762. xMax = xMin + bitmapWidth;
  19763. symbolBitmap = [];
  19764. for (y = 0; y < currentHeight; y++) {
  19765. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  19766. }
  19767. newSymbols.push(symbolBitmap);
  19768. xMin = xMax;
  19769. }
  19770. }
  19771. }
  19772. }
  19773. const exportedSymbols = [],
  19774. flags = [];
  19775. let currentFlag = false,
  19776. i,
  19777. ii;
  19778. const totalSymbolsLength = symbols.length + numberOfNewSymbols;
  19779. while (flags.length < totalSymbolsLength) {
  19780. let runLength = huffman
  19781. ? tableB1.decode(huffmanInput)
  19782. : decodeInteger(contextCache, "IAEX", decoder);
  19783. while (runLength--) {
  19784. flags.push(currentFlag);
  19785. }
  19786. currentFlag = !currentFlag;
  19787. }
  19788. for (i = 0, ii = symbols.length; i < ii; i++) {
  19789. if (flags[i]) {
  19790. exportedSymbols.push(symbols[i]);
  19791. }
  19792. }
  19793. for (let j = 0; j < numberOfNewSymbols; i++, j++) {
  19794. if (flags[i]) {
  19795. exportedSymbols.push(newSymbols[j]);
  19796. }
  19797. }
  19798. return exportedSymbols;
  19799. }
  19800. function decodeTextRegion(
  19801. huffman,
  19802. refinement,
  19803. width,
  19804. height,
  19805. defaultPixelValue,
  19806. numberOfSymbolInstances,
  19807. stripSize,
  19808. inputSymbols,
  19809. symbolCodeLength,
  19810. transposed,
  19811. dsOffset,
  19812. referenceCorner,
  19813. combinationOperator,
  19814. huffmanTables,
  19815. refinementTemplateIndex,
  19816. refinementAt,
  19817. decodingContext,
  19818. logStripSize,
  19819. huffmanInput
  19820. ) {
  19821. if (huffman && refinement) {
  19822. throw new Jbig2Error("refinement with Huffman is not supported");
  19823. }
  19824. const bitmap = [];
  19825. let i, row;
  19826. for (i = 0; i < height; i++) {
  19827. row = new Uint8Array(width);
  19828. if (defaultPixelValue) {
  19829. for (let j = 0; j < width; j++) {
  19830. row[j] = defaultPixelValue;
  19831. }
  19832. }
  19833. bitmap.push(row);
  19834. }
  19835. const decoder = decodingContext.decoder;
  19836. const contextCache = decodingContext.contextCache;
  19837. let stripT = huffman
  19838. ? -huffmanTables.tableDeltaT.decode(huffmanInput)
  19839. : -decodeInteger(contextCache, "IADT", decoder);
  19840. let firstS = 0;
  19841. i = 0;
  19842. while (i < numberOfSymbolInstances) {
  19843. const deltaT = huffman
  19844. ? huffmanTables.tableDeltaT.decode(huffmanInput)
  19845. : decodeInteger(contextCache, "IADT", decoder);
  19846. stripT += deltaT;
  19847. const deltaFirstS = huffman
  19848. ? huffmanTables.tableFirstS.decode(huffmanInput)
  19849. : decodeInteger(contextCache, "IAFS", decoder);
  19850. firstS += deltaFirstS;
  19851. let currentS = firstS;
  19852. do {
  19853. let currentT = 0;
  19854. if (stripSize > 1) {
  19855. currentT = huffman
  19856. ? huffmanInput.readBits(logStripSize)
  19857. : decodeInteger(contextCache, "IAIT", decoder);
  19858. }
  19859. const t = stripSize * stripT + currentT;
  19860. const symbolId = huffman
  19861. ? huffmanTables.symbolIDTable.decode(huffmanInput)
  19862. : decodeIAID(contextCache, decoder, symbolCodeLength);
  19863. const applyRefinement =
  19864. refinement &&
  19865. (huffman
  19866. ? huffmanInput.readBit()
  19867. : decodeInteger(contextCache, "IARI", decoder));
  19868. let symbolBitmap = inputSymbols[symbolId];
  19869. let symbolWidth = symbolBitmap[0].length;
  19870. let symbolHeight = symbolBitmap.length;
  19871. if (applyRefinement) {
  19872. const rdw = decodeInteger(contextCache, "IARDW", decoder);
  19873. const rdh = decodeInteger(contextCache, "IARDH", decoder);
  19874. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  19875. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  19876. symbolWidth += rdw;
  19877. symbolHeight += rdh;
  19878. symbolBitmap = decodeRefinement(
  19879. symbolWidth,
  19880. symbolHeight,
  19881. refinementTemplateIndex,
  19882. symbolBitmap,
  19883. (rdw >> 1) + rdx,
  19884. (rdh >> 1) + rdy,
  19885. false,
  19886. refinementAt,
  19887. decodingContext
  19888. );
  19889. }
  19890. const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  19891. const offsetS =
  19892. currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  19893. let s2, t2, symbolRow;
  19894. if (transposed) {
  19895. for (s2 = 0; s2 < symbolHeight; s2++) {
  19896. row = bitmap[offsetS + s2];
  19897. if (!row) {
  19898. continue;
  19899. }
  19900. symbolRow = symbolBitmap[s2];
  19901. const maxWidth = Math.min(width - offsetT, symbolWidth);
  19902. switch (combinationOperator) {
  19903. case 0:
  19904. for (t2 = 0; t2 < maxWidth; t2++) {
  19905. row[offsetT + t2] |= symbolRow[t2];
  19906. }
  19907. break;
  19908. case 2:
  19909. for (t2 = 0; t2 < maxWidth; t2++) {
  19910. row[offsetT + t2] ^= symbolRow[t2];
  19911. }
  19912. break;
  19913. default:
  19914. throw new Jbig2Error(
  19915. `operator ${combinationOperator} is not supported`
  19916. );
  19917. }
  19918. }
  19919. currentS += symbolHeight - 1;
  19920. } else {
  19921. for (t2 = 0; t2 < symbolHeight; t2++) {
  19922. row = bitmap[offsetT + t2];
  19923. if (!row) {
  19924. continue;
  19925. }
  19926. symbolRow = symbolBitmap[t2];
  19927. switch (combinationOperator) {
  19928. case 0:
  19929. for (s2 = 0; s2 < symbolWidth; s2++) {
  19930. row[offsetS + s2] |= symbolRow[s2];
  19931. }
  19932. break;
  19933. case 2:
  19934. for (s2 = 0; s2 < symbolWidth; s2++) {
  19935. row[offsetS + s2] ^= symbolRow[s2];
  19936. }
  19937. break;
  19938. default:
  19939. throw new Jbig2Error(
  19940. `operator ${combinationOperator} is not supported`
  19941. );
  19942. }
  19943. }
  19944. currentS += symbolWidth - 1;
  19945. }
  19946. i++;
  19947. const deltaS = huffman
  19948. ? huffmanTables.tableDeltaS.decode(huffmanInput)
  19949. : decodeInteger(contextCache, "IADS", decoder);
  19950. if (deltaS === null) {
  19951. break;
  19952. }
  19953. currentS += deltaS + dsOffset;
  19954. } while (true);
  19955. }
  19956. return bitmap;
  19957. }
  19958. function decodePatternDictionary(
  19959. mmr,
  19960. patternWidth,
  19961. patternHeight,
  19962. maxPatternIndex,
  19963. template,
  19964. decodingContext
  19965. ) {
  19966. const at = [];
  19967. if (!mmr) {
  19968. at.push({
  19969. x: -patternWidth,
  19970. y: 0,
  19971. });
  19972. if (template === 0) {
  19973. at.push(
  19974. {
  19975. x: -3,
  19976. y: -1,
  19977. },
  19978. {
  19979. x: 2,
  19980. y: -2,
  19981. },
  19982. {
  19983. x: -2,
  19984. y: -2,
  19985. }
  19986. );
  19987. }
  19988. }
  19989. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  19990. const collectiveBitmap = decodeBitmap(
  19991. mmr,
  19992. collectiveWidth,
  19993. patternHeight,
  19994. template,
  19995. false,
  19996. null,
  19997. at,
  19998. decodingContext
  19999. );
  20000. const patterns = [];
  20001. for (let i = 0; i <= maxPatternIndex; i++) {
  20002. const patternBitmap = [];
  20003. const xMin = patternWidth * i;
  20004. const xMax = xMin + patternWidth;
  20005. for (let y = 0; y < patternHeight; y++) {
  20006. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  20007. }
  20008. patterns.push(patternBitmap);
  20009. }
  20010. return patterns;
  20011. }
  20012. function decodeHalftoneRegion(
  20013. mmr,
  20014. patterns,
  20015. template,
  20016. regionWidth,
  20017. regionHeight,
  20018. defaultPixelValue,
  20019. enableSkip,
  20020. combinationOperator,
  20021. gridWidth,
  20022. gridHeight,
  20023. gridOffsetX,
  20024. gridOffsetY,
  20025. gridVectorX,
  20026. gridVectorY,
  20027. decodingContext
  20028. ) {
  20029. const skip = null;
  20030. if (enableSkip) {
  20031. throw new Jbig2Error("skip is not supported");
  20032. }
  20033. if (combinationOperator !== 0) {
  20034. throw new Jbig2Error(
  20035. `operator "${combinationOperator}" is not supported in halftone region`
  20036. );
  20037. }
  20038. const regionBitmap = [];
  20039. let i, j, row;
  20040. for (i = 0; i < regionHeight; i++) {
  20041. row = new Uint8Array(regionWidth);
  20042. if (defaultPixelValue) {
  20043. for (j = 0; j < regionWidth; j++) {
  20044. row[j] = defaultPixelValue;
  20045. }
  20046. }
  20047. regionBitmap.push(row);
  20048. }
  20049. const numberOfPatterns = patterns.length;
  20050. const pattern0 = patterns[0];
  20051. const patternWidth = pattern0[0].length,
  20052. patternHeight = pattern0.length;
  20053. const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
  20054. const at = [];
  20055. if (!mmr) {
  20056. at.push({
  20057. x: template <= 1 ? 3 : 2,
  20058. y: -1,
  20059. });
  20060. if (template === 0) {
  20061. at.push(
  20062. {
  20063. x: -3,
  20064. y: -1,
  20065. },
  20066. {
  20067. x: 2,
  20068. y: -2,
  20069. },
  20070. {
  20071. x: -2,
  20072. y: -2,
  20073. }
  20074. );
  20075. }
  20076. }
  20077. const grayScaleBitPlanes = [];
  20078. let mmrInput, bitmap;
  20079. if (mmr) {
  20080. mmrInput = new Reader(
  20081. decodingContext.data,
  20082. decodingContext.start,
  20083. decodingContext.end
  20084. );
  20085. }
  20086. for (i = bitsPerValue - 1; i >= 0; i--) {
  20087. if (mmr) {
  20088. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  20089. } else {
  20090. bitmap = decodeBitmap(
  20091. false,
  20092. gridWidth,
  20093. gridHeight,
  20094. template,
  20095. false,
  20096. skip,
  20097. at,
  20098. decodingContext
  20099. );
  20100. }
  20101. grayScaleBitPlanes[i] = bitmap;
  20102. }
  20103. let mg,
  20104. ng,
  20105. bit,
  20106. patternIndex,
  20107. patternBitmap,
  20108. x,
  20109. y,
  20110. patternRow,
  20111. regionRow;
  20112. for (mg = 0; mg < gridHeight; mg++) {
  20113. for (ng = 0; ng < gridWidth; ng++) {
  20114. bit = 0;
  20115. patternIndex = 0;
  20116. for (j = bitsPerValue - 1; j >= 0; j--) {
  20117. bit ^= grayScaleBitPlanes[j][mg][ng];
  20118. patternIndex |= bit << j;
  20119. }
  20120. patternBitmap = patterns[patternIndex];
  20121. x = (gridOffsetX + mg * gridVectorY + ng * gridVectorX) >> 8;
  20122. y = (gridOffsetY + mg * gridVectorX - ng * gridVectorY) >> 8;
  20123. if (
  20124. x >= 0 &&
  20125. x + patternWidth <= regionWidth &&
  20126. y >= 0 &&
  20127. y + patternHeight <= regionHeight
  20128. ) {
  20129. for (i = 0; i < patternHeight; i++) {
  20130. regionRow = regionBitmap[y + i];
  20131. patternRow = patternBitmap[i];
  20132. for (j = 0; j < patternWidth; j++) {
  20133. regionRow[x + j] |= patternRow[j];
  20134. }
  20135. }
  20136. } else {
  20137. let regionX, regionY;
  20138. for (i = 0; i < patternHeight; i++) {
  20139. regionY = y + i;
  20140. if (regionY < 0 || regionY >= regionHeight) {
  20141. continue;
  20142. }
  20143. regionRow = regionBitmap[regionY];
  20144. patternRow = patternBitmap[i];
  20145. for (j = 0; j < patternWidth; j++) {
  20146. regionX = x + j;
  20147. if (regionX >= 0 && regionX < regionWidth) {
  20148. regionRow[regionX] |= patternRow[j];
  20149. }
  20150. }
  20151. }
  20152. }
  20153. }
  20154. }
  20155. return regionBitmap;
  20156. }
  20157. function readSegmentHeader(data, start) {
  20158. const segmentHeader = {};
  20159. segmentHeader.number = (0, _core_utils.readUint32)(data, start);
  20160. const flags = data[start + 4];
  20161. const segmentType = flags & 0x3f;
  20162. if (!SegmentTypes[segmentType]) {
  20163. throw new Jbig2Error("invalid segment type: " + segmentType);
  20164. }
  20165. segmentHeader.type = segmentType;
  20166. segmentHeader.typeName = SegmentTypes[segmentType];
  20167. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  20168. const pageAssociationFieldSize = !!(flags & 0x40);
  20169. const referredFlags = data[start + 5];
  20170. let referredToCount = (referredFlags >> 5) & 7;
  20171. const retainBits = [referredFlags & 31];
  20172. let position = start + 6;
  20173. if (referredFlags === 7) {
  20174. referredToCount =
  20175. (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;
  20176. position += 3;
  20177. let bytes = (referredToCount + 7) >> 3;
  20178. retainBits[0] = data[position++];
  20179. while (--bytes > 0) {
  20180. retainBits.push(data[position++]);
  20181. }
  20182. } else if (referredFlags === 5 || referredFlags === 6) {
  20183. throw new Jbig2Error("invalid referred-to flags");
  20184. }
  20185. segmentHeader.retainBits = retainBits;
  20186. let referredToSegmentNumberSize = 4;
  20187. if (segmentHeader.number <= 256) {
  20188. referredToSegmentNumberSize = 1;
  20189. } else if (segmentHeader.number <= 65536) {
  20190. referredToSegmentNumberSize = 2;
  20191. }
  20192. const referredTo = [];
  20193. let i, ii;
  20194. for (i = 0; i < referredToCount; i++) {
  20195. let number;
  20196. if (referredToSegmentNumberSize === 1) {
  20197. number = data[position];
  20198. } else if (referredToSegmentNumberSize === 2) {
  20199. number = (0, _core_utils.readUint16)(data, position);
  20200. } else {
  20201. number = (0, _core_utils.readUint32)(data, position);
  20202. }
  20203. referredTo.push(number);
  20204. position += referredToSegmentNumberSize;
  20205. }
  20206. segmentHeader.referredTo = referredTo;
  20207. if (!pageAssociationFieldSize) {
  20208. segmentHeader.pageAssociation = data[position++];
  20209. } else {
  20210. segmentHeader.pageAssociation = (0, _core_utils.readUint32)(
  20211. data,
  20212. position
  20213. );
  20214. position += 4;
  20215. }
  20216. segmentHeader.length = (0, _core_utils.readUint32)(data, position);
  20217. position += 4;
  20218. if (segmentHeader.length === 0xffffffff) {
  20219. if (segmentType === 38) {
  20220. const genericRegionInfo = readRegionSegmentInformation(
  20221. data,
  20222. position
  20223. );
  20224. const genericRegionSegmentFlags =
  20225. data[position + RegionSegmentInformationFieldLength];
  20226. const genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  20227. const searchPatternLength = 6;
  20228. const searchPattern = new Uint8Array(searchPatternLength);
  20229. if (!genericRegionMmr) {
  20230. searchPattern[0] = 0xff;
  20231. searchPattern[1] = 0xac;
  20232. }
  20233. searchPattern[2] = (genericRegionInfo.height >>> 24) & 0xff;
  20234. searchPattern[3] = (genericRegionInfo.height >> 16) & 0xff;
  20235. searchPattern[4] = (genericRegionInfo.height >> 8) & 0xff;
  20236. searchPattern[5] = genericRegionInfo.height & 0xff;
  20237. for (i = position, ii = data.length; i < ii; i++) {
  20238. let j = 0;
  20239. while (
  20240. j < searchPatternLength &&
  20241. searchPattern[j] === data[i + j]
  20242. ) {
  20243. j++;
  20244. }
  20245. if (j === searchPatternLength) {
  20246. segmentHeader.length = i + searchPatternLength;
  20247. break;
  20248. }
  20249. }
  20250. if (segmentHeader.length === 0xffffffff) {
  20251. throw new Jbig2Error("segment end was not found");
  20252. }
  20253. } else {
  20254. throw new Jbig2Error("invalid unknown segment length");
  20255. }
  20256. }
  20257. segmentHeader.headerEnd = position;
  20258. return segmentHeader;
  20259. }
  20260. function readSegments(header, data, start, end) {
  20261. const segments = [];
  20262. let position = start;
  20263. while (position < end) {
  20264. const segmentHeader = readSegmentHeader(data, position);
  20265. position = segmentHeader.headerEnd;
  20266. const segment = {
  20267. header: segmentHeader,
  20268. data,
  20269. };
  20270. if (!header.randomAccess) {
  20271. segment.start = position;
  20272. position += segmentHeader.length;
  20273. segment.end = position;
  20274. }
  20275. segments.push(segment);
  20276. if (segmentHeader.type === 51) {
  20277. break;
  20278. }
  20279. }
  20280. if (header.randomAccess) {
  20281. for (let i = 0, ii = segments.length; i < ii; i++) {
  20282. segments[i].start = position;
  20283. position += segments[i].header.length;
  20284. segments[i].end = position;
  20285. }
  20286. }
  20287. return segments;
  20288. }
  20289. function readRegionSegmentInformation(data, start) {
  20290. return {
  20291. width: (0, _core_utils.readUint32)(data, start),
  20292. height: (0, _core_utils.readUint32)(data, start + 4),
  20293. x: (0, _core_utils.readUint32)(data, start + 8),
  20294. y: (0, _core_utils.readUint32)(data, start + 12),
  20295. combinationOperator: data[start + 16] & 7,
  20296. };
  20297. }
  20298. const RegionSegmentInformationFieldLength = 17;
  20299. function processSegment(segment, visitor) {
  20300. const header = segment.header;
  20301. const data = segment.data,
  20302. end = segment.end;
  20303. let position = segment.start;
  20304. let args, at, i, atLength;
  20305. switch (header.type) {
  20306. case 0:
  20307. const dictionary = {};
  20308. const dictionaryFlags = (0, _core_utils.readUint16)(
  20309. data,
  20310. position
  20311. );
  20312. dictionary.huffman = !!(dictionaryFlags & 1);
  20313. dictionary.refinement = !!(dictionaryFlags & 2);
  20314. dictionary.huffmanDHSelector = (dictionaryFlags >> 2) & 3;
  20315. dictionary.huffmanDWSelector = (dictionaryFlags >> 4) & 3;
  20316. dictionary.bitmapSizeSelector = (dictionaryFlags >> 6) & 1;
  20317. dictionary.aggregationInstancesSelector =
  20318. (dictionaryFlags >> 7) & 1;
  20319. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  20320. dictionary.bitmapCodingContextRetained = !!(
  20321. dictionaryFlags & 512
  20322. );
  20323. dictionary.template = (dictionaryFlags >> 10) & 3;
  20324. dictionary.refinementTemplate = (dictionaryFlags >> 12) & 1;
  20325. position += 2;
  20326. if (!dictionary.huffman) {
  20327. atLength = dictionary.template === 0 ? 4 : 1;
  20328. at = [];
  20329. for (i = 0; i < atLength; i++) {
  20330. at.push({
  20331. x: (0, _core_utils.readInt8)(data, position),
  20332. y: (0, _core_utils.readInt8)(data, position + 1),
  20333. });
  20334. position += 2;
  20335. }
  20336. dictionary.at = at;
  20337. }
  20338. if (dictionary.refinement && !dictionary.refinementTemplate) {
  20339. at = [];
  20340. for (i = 0; i < 2; i++) {
  20341. at.push({
  20342. x: (0, _core_utils.readInt8)(data, position),
  20343. y: (0, _core_utils.readInt8)(data, position + 1),
  20344. });
  20345. position += 2;
  20346. }
  20347. dictionary.refinementAt = at;
  20348. }
  20349. dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(
  20350. data,
  20351. position
  20352. );
  20353. position += 4;
  20354. dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(
  20355. data,
  20356. position
  20357. );
  20358. position += 4;
  20359. args = [
  20360. dictionary,
  20361. header.number,
  20362. header.referredTo,
  20363. data,
  20364. position,
  20365. end,
  20366. ];
  20367. break;
  20368. case 6:
  20369. case 7:
  20370. const textRegion = {};
  20371. textRegion.info = readRegionSegmentInformation(data, position);
  20372. position += RegionSegmentInformationFieldLength;
  20373. const textRegionSegmentFlags = (0, _core_utils.readUint16)(
  20374. data,
  20375. position
  20376. );
  20377. position += 2;
  20378. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  20379. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  20380. textRegion.logStripSize = (textRegionSegmentFlags >> 2) & 3;
  20381. textRegion.stripSize = 1 << textRegion.logStripSize;
  20382. textRegion.referenceCorner = (textRegionSegmentFlags >> 4) & 3;
  20383. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  20384. textRegion.combinationOperator =
  20385. (textRegionSegmentFlags >> 7) & 3;
  20386. textRegion.defaultPixelValue = (textRegionSegmentFlags >> 9) & 1;
  20387. textRegion.dsOffset = (textRegionSegmentFlags << 17) >> 27;
  20388. textRegion.refinementTemplate =
  20389. (textRegionSegmentFlags >> 15) & 1;
  20390. if (textRegion.huffman) {
  20391. const textRegionHuffmanFlags = (0, _core_utils.readUint16)(
  20392. data,
  20393. position
  20394. );
  20395. position += 2;
  20396. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  20397. textRegion.huffmanDS = (textRegionHuffmanFlags >> 2) & 3;
  20398. textRegion.huffmanDT = (textRegionHuffmanFlags >> 4) & 3;
  20399. textRegion.huffmanRefinementDW =
  20400. (textRegionHuffmanFlags >> 6) & 3;
  20401. textRegion.huffmanRefinementDH =
  20402. (textRegionHuffmanFlags >> 8) & 3;
  20403. textRegion.huffmanRefinementDX =
  20404. (textRegionHuffmanFlags >> 10) & 3;
  20405. textRegion.huffmanRefinementDY =
  20406. (textRegionHuffmanFlags >> 12) & 3;
  20407. textRegion.huffmanRefinementSizeSelector = !!(
  20408. textRegionHuffmanFlags & 0x4000
  20409. );
  20410. }
  20411. if (textRegion.refinement && !textRegion.refinementTemplate) {
  20412. at = [];
  20413. for (i = 0; i < 2; i++) {
  20414. at.push({
  20415. x: (0, _core_utils.readInt8)(data, position),
  20416. y: (0, _core_utils.readInt8)(data, position + 1),
  20417. });
  20418. position += 2;
  20419. }
  20420. textRegion.refinementAt = at;
  20421. }
  20422. textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(
  20423. data,
  20424. position
  20425. );
  20426. position += 4;
  20427. args = [textRegion, header.referredTo, data, position, end];
  20428. break;
  20429. case 16:
  20430. const patternDictionary = {};
  20431. const patternDictionaryFlags = data[position++];
  20432. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  20433. patternDictionary.template = (patternDictionaryFlags >> 1) & 3;
  20434. patternDictionary.patternWidth = data[position++];
  20435. patternDictionary.patternHeight = data[position++];
  20436. patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(
  20437. data,
  20438. position
  20439. );
  20440. position += 4;
  20441. args = [patternDictionary, header.number, data, position, end];
  20442. break;
  20443. case 22:
  20444. case 23:
  20445. const halftoneRegion = {};
  20446. halftoneRegion.info = readRegionSegmentInformation(
  20447. data,
  20448. position
  20449. );
  20450. position += RegionSegmentInformationFieldLength;
  20451. const halftoneRegionFlags = data[position++];
  20452. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  20453. halftoneRegion.template = (halftoneRegionFlags >> 1) & 3;
  20454. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  20455. halftoneRegion.combinationOperator =
  20456. (halftoneRegionFlags >> 4) & 7;
  20457. halftoneRegion.defaultPixelValue = (halftoneRegionFlags >> 7) & 1;
  20458. halftoneRegion.gridWidth = (0, _core_utils.readUint32)(
  20459. data,
  20460. position
  20461. );
  20462. position += 4;
  20463. halftoneRegion.gridHeight = (0, _core_utils.readUint32)(
  20464. data,
  20465. position
  20466. );
  20467. position += 4;
  20468. halftoneRegion.gridOffsetX =
  20469. (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  20470. position += 4;
  20471. halftoneRegion.gridOffsetY =
  20472. (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  20473. position += 4;
  20474. halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(
  20475. data,
  20476. position
  20477. );
  20478. position += 2;
  20479. halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(
  20480. data,
  20481. position
  20482. );
  20483. position += 2;
  20484. args = [halftoneRegion, header.referredTo, data, position, end];
  20485. break;
  20486. case 38:
  20487. case 39:
  20488. const genericRegion = {};
  20489. genericRegion.info = readRegionSegmentInformation(data, position);
  20490. position += RegionSegmentInformationFieldLength;
  20491. const genericRegionSegmentFlags = data[position++];
  20492. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  20493. genericRegion.template = (genericRegionSegmentFlags >> 1) & 3;
  20494. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  20495. if (!genericRegion.mmr) {
  20496. atLength = genericRegion.template === 0 ? 4 : 1;
  20497. at = [];
  20498. for (i = 0; i < atLength; i++) {
  20499. at.push({
  20500. x: (0, _core_utils.readInt8)(data, position),
  20501. y: (0, _core_utils.readInt8)(data, position + 1),
  20502. });
  20503. position += 2;
  20504. }
  20505. genericRegion.at = at;
  20506. }
  20507. args = [genericRegion, data, position, end];
  20508. break;
  20509. case 48:
  20510. const pageInfo = {
  20511. width: (0, _core_utils.readUint32)(data, position),
  20512. height: (0, _core_utils.readUint32)(data, position + 4),
  20513. resolutionX: (0, _core_utils.readUint32)(data, position + 8),
  20514. resolutionY: (0, _core_utils.readUint32)(data, position + 12),
  20515. };
  20516. if (pageInfo.height === 0xffffffff) {
  20517. delete pageInfo.height;
  20518. }
  20519. const pageSegmentFlags = data[position + 16];
  20520. (0, _core_utils.readUint16)(data, position + 17);
  20521. pageInfo.lossless = !!(pageSegmentFlags & 1);
  20522. pageInfo.refinement = !!(pageSegmentFlags & 2);
  20523. pageInfo.defaultPixelValue = (pageSegmentFlags >> 2) & 1;
  20524. pageInfo.combinationOperator = (pageSegmentFlags >> 3) & 3;
  20525. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  20526. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  20527. args = [pageInfo];
  20528. break;
  20529. case 49:
  20530. break;
  20531. case 50:
  20532. break;
  20533. case 51:
  20534. break;
  20535. case 53:
  20536. args = [header.number, data, position, end];
  20537. break;
  20538. case 62:
  20539. break;
  20540. default:
  20541. throw new Jbig2Error(
  20542. `segment type ${header.typeName}(${header.type}) is not implemented`
  20543. );
  20544. }
  20545. const callbackName = "on" + header.typeName;
  20546. if (callbackName in visitor) {
  20547. visitor[callbackName].apply(visitor, args);
  20548. }
  20549. }
  20550. function processSegments(segments, visitor) {
  20551. for (let i = 0, ii = segments.length; i < ii; i++) {
  20552. processSegment(segments[i], visitor);
  20553. }
  20554. }
  20555. function parseJbig2Chunks(chunks) {
  20556. const visitor = new SimpleSegmentVisitor();
  20557. for (let i = 0, ii = chunks.length; i < ii; i++) {
  20558. const chunk = chunks[i];
  20559. const segments = readSegments(
  20560. {},
  20561. chunk.data,
  20562. chunk.start,
  20563. chunk.end
  20564. );
  20565. processSegments(segments, visitor);
  20566. }
  20567. return visitor.buffer;
  20568. }
  20569. function parseJbig2(data) {
  20570. throw new Error("Not implemented: parseJbig2");
  20571. }
  20572. class SimpleSegmentVisitor {
  20573. onPageInformation(info) {
  20574. this.currentPageInfo = info;
  20575. const rowSize = (info.width + 7) >> 3;
  20576. const buffer = new Uint8ClampedArray(rowSize * info.height);
  20577. if (info.defaultPixelValue) {
  20578. buffer.fill(0xff);
  20579. }
  20580. this.buffer = buffer;
  20581. }
  20582. drawBitmap(regionInfo, bitmap) {
  20583. const pageInfo = this.currentPageInfo;
  20584. const width = regionInfo.width,
  20585. height = regionInfo.height;
  20586. const rowSize = (pageInfo.width + 7) >> 3;
  20587. const combinationOperator = pageInfo.combinationOperatorOverride
  20588. ? regionInfo.combinationOperator
  20589. : pageInfo.combinationOperator;
  20590. const buffer = this.buffer;
  20591. const mask0 = 128 >> (regionInfo.x & 7);
  20592. let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  20593. let i, j, mask, offset;
  20594. switch (combinationOperator) {
  20595. case 0:
  20596. for (i = 0; i < height; i++) {
  20597. mask = mask0;
  20598. offset = offset0;
  20599. for (j = 0; j < width; j++) {
  20600. if (bitmap[i][j]) {
  20601. buffer[offset] |= mask;
  20602. }
  20603. mask >>= 1;
  20604. if (!mask) {
  20605. mask = 128;
  20606. offset++;
  20607. }
  20608. }
  20609. offset0 += rowSize;
  20610. }
  20611. break;
  20612. case 2:
  20613. for (i = 0; i < height; i++) {
  20614. mask = mask0;
  20615. offset = offset0;
  20616. for (j = 0; j < width; j++) {
  20617. if (bitmap[i][j]) {
  20618. buffer[offset] ^= mask;
  20619. }
  20620. mask >>= 1;
  20621. if (!mask) {
  20622. mask = 128;
  20623. offset++;
  20624. }
  20625. }
  20626. offset0 += rowSize;
  20627. }
  20628. break;
  20629. default:
  20630. throw new Jbig2Error(
  20631. `operator ${combinationOperator} is not supported`
  20632. );
  20633. }
  20634. }
  20635. onImmediateGenericRegion(region, data, start, end) {
  20636. const regionInfo = region.info;
  20637. const decodingContext = new DecodingContext(data, start, end);
  20638. const bitmap = decodeBitmap(
  20639. region.mmr,
  20640. regionInfo.width,
  20641. regionInfo.height,
  20642. region.template,
  20643. region.prediction,
  20644. null,
  20645. region.at,
  20646. decodingContext
  20647. );
  20648. this.drawBitmap(regionInfo, bitmap);
  20649. }
  20650. onImmediateLosslessGenericRegion() {
  20651. this.onImmediateGenericRegion(...arguments);
  20652. }
  20653. onSymbolDictionary(
  20654. dictionary,
  20655. currentSegment,
  20656. referredSegments,
  20657. data,
  20658. start,
  20659. end
  20660. ) {
  20661. let huffmanTables, huffmanInput;
  20662. if (dictionary.huffman) {
  20663. huffmanTables = getSymbolDictionaryHuffmanTables(
  20664. dictionary,
  20665. referredSegments,
  20666. this.customTables
  20667. );
  20668. huffmanInput = new Reader(data, start, end);
  20669. }
  20670. let symbols = this.symbols;
  20671. if (!symbols) {
  20672. this.symbols = symbols = {};
  20673. }
  20674. const inputSymbols = [];
  20675. for (const referredSegment of referredSegments) {
  20676. const referredSymbols = symbols[referredSegment];
  20677. if (referredSymbols) {
  20678. inputSymbols.push(...referredSymbols);
  20679. }
  20680. }
  20681. const decodingContext = new DecodingContext(data, start, end);
  20682. symbols[currentSegment] = decodeSymbolDictionary(
  20683. dictionary.huffman,
  20684. dictionary.refinement,
  20685. inputSymbols,
  20686. dictionary.numberOfNewSymbols,
  20687. dictionary.numberOfExportedSymbols,
  20688. huffmanTables,
  20689. dictionary.template,
  20690. dictionary.at,
  20691. dictionary.refinementTemplate,
  20692. dictionary.refinementAt,
  20693. decodingContext,
  20694. huffmanInput
  20695. );
  20696. }
  20697. onImmediateTextRegion(region, referredSegments, data, start, end) {
  20698. const regionInfo = region.info;
  20699. let huffmanTables, huffmanInput;
  20700. const symbols = this.symbols;
  20701. const inputSymbols = [];
  20702. for (const referredSegment of referredSegments) {
  20703. const referredSymbols = symbols[referredSegment];
  20704. if (referredSymbols) {
  20705. inputSymbols.push(...referredSymbols);
  20706. }
  20707. }
  20708. const symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);
  20709. if (region.huffman) {
  20710. huffmanInput = new Reader(data, start, end);
  20711. huffmanTables = getTextRegionHuffmanTables(
  20712. region,
  20713. referredSegments,
  20714. this.customTables,
  20715. inputSymbols.length,
  20716. huffmanInput
  20717. );
  20718. }
  20719. const decodingContext = new DecodingContext(data, start, end);
  20720. const bitmap = decodeTextRegion(
  20721. region.huffman,
  20722. region.refinement,
  20723. regionInfo.width,
  20724. regionInfo.height,
  20725. region.defaultPixelValue,
  20726. region.numberOfSymbolInstances,
  20727. region.stripSize,
  20728. inputSymbols,
  20729. symbolCodeLength,
  20730. region.transposed,
  20731. region.dsOffset,
  20732. region.referenceCorner,
  20733. region.combinationOperator,
  20734. huffmanTables,
  20735. region.refinementTemplate,
  20736. region.refinementAt,
  20737. decodingContext,
  20738. region.logStripSize,
  20739. huffmanInput
  20740. );
  20741. this.drawBitmap(regionInfo, bitmap);
  20742. }
  20743. onImmediateLosslessTextRegion() {
  20744. this.onImmediateTextRegion(...arguments);
  20745. }
  20746. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  20747. let patterns = this.patterns;
  20748. if (!patterns) {
  20749. this.patterns = patterns = {};
  20750. }
  20751. const decodingContext = new DecodingContext(data, start, end);
  20752. patterns[currentSegment] = decodePatternDictionary(
  20753. dictionary.mmr,
  20754. dictionary.patternWidth,
  20755. dictionary.patternHeight,
  20756. dictionary.maxPatternIndex,
  20757. dictionary.template,
  20758. decodingContext
  20759. );
  20760. }
  20761. onImmediateHalftoneRegion(
  20762. region,
  20763. referredSegments,
  20764. data,
  20765. start,
  20766. end
  20767. ) {
  20768. const patterns = this.patterns[referredSegments[0]];
  20769. const regionInfo = region.info;
  20770. const decodingContext = new DecodingContext(data, start, end);
  20771. const bitmap = decodeHalftoneRegion(
  20772. region.mmr,
  20773. patterns,
  20774. region.template,
  20775. regionInfo.width,
  20776. regionInfo.height,
  20777. region.defaultPixelValue,
  20778. region.enableSkip,
  20779. region.combinationOperator,
  20780. region.gridWidth,
  20781. region.gridHeight,
  20782. region.gridOffsetX,
  20783. region.gridOffsetY,
  20784. region.gridVectorX,
  20785. region.gridVectorY,
  20786. decodingContext
  20787. );
  20788. this.drawBitmap(regionInfo, bitmap);
  20789. }
  20790. onImmediateLosslessHalftoneRegion() {
  20791. this.onImmediateHalftoneRegion(...arguments);
  20792. }
  20793. onTables(currentSegment, data, start, end) {
  20794. let customTables = this.customTables;
  20795. if (!customTables) {
  20796. this.customTables = customTables = {};
  20797. }
  20798. customTables[currentSegment] = decodeTablesSegment(
  20799. data,
  20800. start,
  20801. end
  20802. );
  20803. }
  20804. }
  20805. class HuffmanLine {
  20806. constructor(lineData) {
  20807. if (lineData.length === 2) {
  20808. this.isOOB = true;
  20809. this.rangeLow = 0;
  20810. this.prefixLength = lineData[0];
  20811. this.rangeLength = 0;
  20812. this.prefixCode = lineData[1];
  20813. this.isLowerRange = false;
  20814. } else {
  20815. this.isOOB = false;
  20816. this.rangeLow = lineData[0];
  20817. this.prefixLength = lineData[1];
  20818. this.rangeLength = lineData[2];
  20819. this.prefixCode = lineData[3];
  20820. this.isLowerRange = lineData[4] === "lower";
  20821. }
  20822. }
  20823. }
  20824. class HuffmanTreeNode {
  20825. constructor(line) {
  20826. this.children = [];
  20827. if (line) {
  20828. this.isLeaf = true;
  20829. this.rangeLength = line.rangeLength;
  20830. this.rangeLow = line.rangeLow;
  20831. this.isLowerRange = line.isLowerRange;
  20832. this.isOOB = line.isOOB;
  20833. } else {
  20834. this.isLeaf = false;
  20835. }
  20836. }
  20837. buildTree(line, shift) {
  20838. const bit = (line.prefixCode >> shift) & 1;
  20839. if (shift <= 0) {
  20840. this.children[bit] = new HuffmanTreeNode(line);
  20841. } else {
  20842. let node = this.children[bit];
  20843. if (!node) {
  20844. this.children[bit] = node = new HuffmanTreeNode(null);
  20845. }
  20846. node.buildTree(line, shift - 1);
  20847. }
  20848. }
  20849. decodeNode(reader) {
  20850. if (this.isLeaf) {
  20851. if (this.isOOB) {
  20852. return null;
  20853. }
  20854. const htOffset = reader.readBits(this.rangeLength);
  20855. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  20856. }
  20857. const node = this.children[reader.readBit()];
  20858. if (!node) {
  20859. throw new Jbig2Error("invalid Huffman data");
  20860. }
  20861. return node.decodeNode(reader);
  20862. }
  20863. }
  20864. class HuffmanTable {
  20865. constructor(lines, prefixCodesDone) {
  20866. if (!prefixCodesDone) {
  20867. this.assignPrefixCodes(lines);
  20868. }
  20869. this.rootNode = new HuffmanTreeNode(null);
  20870. for (let i = 0, ii = lines.length; i < ii; i++) {
  20871. const line = lines[i];
  20872. if (line.prefixLength > 0) {
  20873. this.rootNode.buildTree(line, line.prefixLength - 1);
  20874. }
  20875. }
  20876. }
  20877. decode(reader) {
  20878. return this.rootNode.decodeNode(reader);
  20879. }
  20880. assignPrefixCodes(lines) {
  20881. const linesLength = lines.length;
  20882. let prefixLengthMax = 0;
  20883. for (let i = 0; i < linesLength; i++) {
  20884. prefixLengthMax = Math.max(
  20885. prefixLengthMax,
  20886. lines[i].prefixLength
  20887. );
  20888. }
  20889. const histogram = new Uint32Array(prefixLengthMax + 1);
  20890. for (let i = 0; i < linesLength; i++) {
  20891. histogram[lines[i].prefixLength]++;
  20892. }
  20893. let currentLength = 1,
  20894. firstCode = 0,
  20895. currentCode,
  20896. currentTemp,
  20897. line;
  20898. histogram[0] = 0;
  20899. while (currentLength <= prefixLengthMax) {
  20900. firstCode = (firstCode + histogram[currentLength - 1]) << 1;
  20901. currentCode = firstCode;
  20902. currentTemp = 0;
  20903. while (currentTemp < linesLength) {
  20904. line = lines[currentTemp];
  20905. if (line.prefixLength === currentLength) {
  20906. line.prefixCode = currentCode;
  20907. currentCode++;
  20908. }
  20909. currentTemp++;
  20910. }
  20911. currentLength++;
  20912. }
  20913. }
  20914. }
  20915. function decodeTablesSegment(data, start, end) {
  20916. const flags = data[start];
  20917. const lowestValue =
  20918. (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
  20919. const highestValue =
  20920. (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
  20921. const reader = new Reader(data, start + 9, end);
  20922. const prefixSizeBits = ((flags >> 1) & 7) + 1;
  20923. const rangeSizeBits = ((flags >> 4) & 7) + 1;
  20924. const lines = [];
  20925. let prefixLength,
  20926. rangeLength,
  20927. currentRangeLow = lowestValue;
  20928. do {
  20929. prefixLength = reader.readBits(prefixSizeBits);
  20930. rangeLength = reader.readBits(rangeSizeBits);
  20931. lines.push(
  20932. new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0])
  20933. );
  20934. currentRangeLow += 1 << rangeLength;
  20935. } while (currentRangeLow < highestValue);
  20936. prefixLength = reader.readBits(prefixSizeBits);
  20937. lines.push(
  20938. new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"])
  20939. );
  20940. prefixLength = reader.readBits(prefixSizeBits);
  20941. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  20942. if (flags & 1) {
  20943. prefixLength = reader.readBits(prefixSizeBits);
  20944. lines.push(new HuffmanLine([prefixLength, 0]));
  20945. }
  20946. return new HuffmanTable(lines, false);
  20947. }
  20948. const standardTablesCache = {};
  20949. function getStandardTable(number) {
  20950. let table = standardTablesCache[number];
  20951. if (table) {
  20952. return table;
  20953. }
  20954. let lines;
  20955. switch (number) {
  20956. case 1:
  20957. lines = [
  20958. [0, 1, 4, 0x0],
  20959. [16, 2, 8, 0x2],
  20960. [272, 3, 16, 0x6],
  20961. [65808, 3, 32, 0x7],
  20962. ];
  20963. break;
  20964. case 2:
  20965. lines = [
  20966. [0, 1, 0, 0x0],
  20967. [1, 2, 0, 0x2],
  20968. [2, 3, 0, 0x6],
  20969. [3, 4, 3, 0xe],
  20970. [11, 5, 6, 0x1e],
  20971. [75, 6, 32, 0x3e],
  20972. [6, 0x3f],
  20973. ];
  20974. break;
  20975. case 3:
  20976. lines = [
  20977. [-256, 8, 8, 0xfe],
  20978. [0, 1, 0, 0x0],
  20979. [1, 2, 0, 0x2],
  20980. [2, 3, 0, 0x6],
  20981. [3, 4, 3, 0xe],
  20982. [11, 5, 6, 0x1e],
  20983. [-257, 8, 32, 0xff, "lower"],
  20984. [75, 7, 32, 0x7e],
  20985. [6, 0x3e],
  20986. ];
  20987. break;
  20988. case 4:
  20989. lines = [
  20990. [1, 1, 0, 0x0],
  20991. [2, 2, 0, 0x2],
  20992. [3, 3, 0, 0x6],
  20993. [4, 4, 3, 0xe],
  20994. [12, 5, 6, 0x1e],
  20995. [76, 5, 32, 0x1f],
  20996. ];
  20997. break;
  20998. case 5:
  20999. lines = [
  21000. [-255, 7, 8, 0x7e],
  21001. [1, 1, 0, 0x0],
  21002. [2, 2, 0, 0x2],
  21003. [3, 3, 0, 0x6],
  21004. [4, 4, 3, 0xe],
  21005. [12, 5, 6, 0x1e],
  21006. [-256, 7, 32, 0x7f, "lower"],
  21007. [76, 6, 32, 0x3e],
  21008. ];
  21009. break;
  21010. case 6:
  21011. lines = [
  21012. [-2048, 5, 10, 0x1c],
  21013. [-1024, 4, 9, 0x8],
  21014. [-512, 4, 8, 0x9],
  21015. [-256, 4, 7, 0xa],
  21016. [-128, 5, 6, 0x1d],
  21017. [-64, 5, 5, 0x1e],
  21018. [-32, 4, 5, 0xb],
  21019. [0, 2, 7, 0x0],
  21020. [128, 3, 7, 0x2],
  21021. [256, 3, 8, 0x3],
  21022. [512, 4, 9, 0xc],
  21023. [1024, 4, 10, 0xd],
  21024. [-2049, 6, 32, 0x3e, "lower"],
  21025. [2048, 6, 32, 0x3f],
  21026. ];
  21027. break;
  21028. case 7:
  21029. lines = [
  21030. [-1024, 4, 9, 0x8],
  21031. [-512, 3, 8, 0x0],
  21032. [-256, 4, 7, 0x9],
  21033. [-128, 5, 6, 0x1a],
  21034. [-64, 5, 5, 0x1b],
  21035. [-32, 4, 5, 0xa],
  21036. [0, 4, 5, 0xb],
  21037. [32, 5, 5, 0x1c],
  21038. [64, 5, 6, 0x1d],
  21039. [128, 4, 7, 0xc],
  21040. [256, 3, 8, 0x1],
  21041. [512, 3, 9, 0x2],
  21042. [1024, 3, 10, 0x3],
  21043. [-1025, 5, 32, 0x1e, "lower"],
  21044. [2048, 5, 32, 0x1f],
  21045. ];
  21046. break;
  21047. case 8:
  21048. lines = [
  21049. [-15, 8, 3, 0xfc],
  21050. [-7, 9, 1, 0x1fc],
  21051. [-5, 8, 1, 0xfd],
  21052. [-3, 9, 0, 0x1fd],
  21053. [-2, 7, 0, 0x7c],
  21054. [-1, 4, 0, 0xa],
  21055. [0, 2, 1, 0x0],
  21056. [2, 5, 0, 0x1a],
  21057. [3, 6, 0, 0x3a],
  21058. [4, 3, 4, 0x4],
  21059. [20, 6, 1, 0x3b],
  21060. [22, 4, 4, 0xb],
  21061. [38, 4, 5, 0xc],
  21062. [70, 5, 6, 0x1b],
  21063. [134, 5, 7, 0x1c],
  21064. [262, 6, 7, 0x3c],
  21065. [390, 7, 8, 0x7d],
  21066. [646, 6, 10, 0x3d],
  21067. [-16, 9, 32, 0x1fe, "lower"],
  21068. [1670, 9, 32, 0x1ff],
  21069. [2, 0x1],
  21070. ];
  21071. break;
  21072. case 9:
  21073. lines = [
  21074. [-31, 8, 4, 0xfc],
  21075. [-15, 9, 2, 0x1fc],
  21076. [-11, 8, 2, 0xfd],
  21077. [-7, 9, 1, 0x1fd],
  21078. [-5, 7, 1, 0x7c],
  21079. [-3, 4, 1, 0xa],
  21080. [-1, 3, 1, 0x2],
  21081. [1, 3, 1, 0x3],
  21082. [3, 5, 1, 0x1a],
  21083. [5, 6, 1, 0x3a],
  21084. [7, 3, 5, 0x4],
  21085. [39, 6, 2, 0x3b],
  21086. [43, 4, 5, 0xb],
  21087. [75, 4, 6, 0xc],
  21088. [139, 5, 7, 0x1b],
  21089. [267, 5, 8, 0x1c],
  21090. [523, 6, 8, 0x3c],
  21091. [779, 7, 9, 0x7d],
  21092. [1291, 6, 11, 0x3d],
  21093. [-32, 9, 32, 0x1fe, "lower"],
  21094. [3339, 9, 32, 0x1ff],
  21095. [2, 0x0],
  21096. ];
  21097. break;
  21098. case 10:
  21099. lines = [
  21100. [-21, 7, 4, 0x7a],
  21101. [-5, 8, 0, 0xfc],
  21102. [-4, 7, 0, 0x7b],
  21103. [-3, 5, 0, 0x18],
  21104. [-2, 2, 2, 0x0],
  21105. [2, 5, 0, 0x19],
  21106. [3, 6, 0, 0x36],
  21107. [4, 7, 0, 0x7c],
  21108. [5, 8, 0, 0xfd],
  21109. [6, 2, 6, 0x1],
  21110. [70, 5, 5, 0x1a],
  21111. [102, 6, 5, 0x37],
  21112. [134, 6, 6, 0x38],
  21113. [198, 6, 7, 0x39],
  21114. [326, 6, 8, 0x3a],
  21115. [582, 6, 9, 0x3b],
  21116. [1094, 6, 10, 0x3c],
  21117. [2118, 7, 11, 0x7d],
  21118. [-22, 8, 32, 0xfe, "lower"],
  21119. [4166, 8, 32, 0xff],
  21120. [2, 0x2],
  21121. ];
  21122. break;
  21123. case 11:
  21124. lines = [
  21125. [1, 1, 0, 0x0],
  21126. [2, 2, 1, 0x2],
  21127. [4, 4, 0, 0xc],
  21128. [5, 4, 1, 0xd],
  21129. [7, 5, 1, 0x1c],
  21130. [9, 5, 2, 0x1d],
  21131. [13, 6, 2, 0x3c],
  21132. [17, 7, 2, 0x7a],
  21133. [21, 7, 3, 0x7b],
  21134. [29, 7, 4, 0x7c],
  21135. [45, 7, 5, 0x7d],
  21136. [77, 7, 6, 0x7e],
  21137. [141, 7, 32, 0x7f],
  21138. ];
  21139. break;
  21140. case 12:
  21141. lines = [
  21142. [1, 1, 0, 0x0],
  21143. [2, 2, 0, 0x2],
  21144. [3, 3, 1, 0x6],
  21145. [5, 5, 0, 0x1c],
  21146. [6, 5, 1, 0x1d],
  21147. [8, 6, 1, 0x3c],
  21148. [10, 7, 0, 0x7a],
  21149. [11, 7, 1, 0x7b],
  21150. [13, 7, 2, 0x7c],
  21151. [17, 7, 3, 0x7d],
  21152. [25, 7, 4, 0x7e],
  21153. [41, 8, 5, 0xfe],
  21154. [73, 8, 32, 0xff],
  21155. ];
  21156. break;
  21157. case 13:
  21158. lines = [
  21159. [1, 1, 0, 0x0],
  21160. [2, 3, 0, 0x4],
  21161. [3, 4, 0, 0xc],
  21162. [4, 5, 0, 0x1c],
  21163. [5, 4, 1, 0xd],
  21164. [7, 3, 3, 0x5],
  21165. [15, 6, 1, 0x3a],
  21166. [17, 6, 2, 0x3b],
  21167. [21, 6, 3, 0x3c],
  21168. [29, 6, 4, 0x3d],
  21169. [45, 6, 5, 0x3e],
  21170. [77, 7, 6, 0x7e],
  21171. [141, 7, 32, 0x7f],
  21172. ];
  21173. break;
  21174. case 14:
  21175. lines = [
  21176. [-2, 3, 0, 0x4],
  21177. [-1, 3, 0, 0x5],
  21178. [0, 1, 0, 0x0],
  21179. [1, 3, 0, 0x6],
  21180. [2, 3, 0, 0x7],
  21181. ];
  21182. break;
  21183. case 15:
  21184. lines = [
  21185. [-24, 7, 4, 0x7c],
  21186. [-8, 6, 2, 0x3c],
  21187. [-4, 5, 1, 0x1c],
  21188. [-2, 4, 0, 0xc],
  21189. [-1, 3, 0, 0x4],
  21190. [0, 1, 0, 0x0],
  21191. [1, 3, 0, 0x5],
  21192. [2, 4, 0, 0xd],
  21193. [3, 5, 1, 0x1d],
  21194. [5, 6, 2, 0x3d],
  21195. [9, 7, 4, 0x7d],
  21196. [-25, 7, 32, 0x7e, "lower"],
  21197. [25, 7, 32, 0x7f],
  21198. ];
  21199. break;
  21200. default:
  21201. throw new Jbig2Error(`standard table B.${number} does not exist`);
  21202. }
  21203. for (let i = 0, ii = lines.length; i < ii; i++) {
  21204. lines[i] = new HuffmanLine(lines[i]);
  21205. }
  21206. table = new HuffmanTable(lines, true);
  21207. standardTablesCache[number] = table;
  21208. return table;
  21209. }
  21210. class Reader {
  21211. constructor(data, start, end) {
  21212. this.data = data;
  21213. this.start = start;
  21214. this.end = end;
  21215. this.position = start;
  21216. this.shift = -1;
  21217. this.currentByte = 0;
  21218. }
  21219. readBit() {
  21220. if (this.shift < 0) {
  21221. if (this.position >= this.end) {
  21222. throw new Jbig2Error("end of data while reading bit");
  21223. }
  21224. this.currentByte = this.data[this.position++];
  21225. this.shift = 7;
  21226. }
  21227. const bit = (this.currentByte >> this.shift) & 1;
  21228. this.shift--;
  21229. return bit;
  21230. }
  21231. readBits(numBits) {
  21232. let result = 0,
  21233. i;
  21234. for (i = numBits - 1; i >= 0; i--) {
  21235. result |= this.readBit() << i;
  21236. }
  21237. return result;
  21238. }
  21239. byteAlign() {
  21240. this.shift = -1;
  21241. }
  21242. next() {
  21243. if (this.position >= this.end) {
  21244. return -1;
  21245. }
  21246. return this.data[this.position++];
  21247. }
  21248. }
  21249. function getCustomHuffmanTable(index, referredTo, customTables) {
  21250. let currentIndex = 0;
  21251. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  21252. const table = customTables[referredTo[i]];
  21253. if (table) {
  21254. if (index === currentIndex) {
  21255. return table;
  21256. }
  21257. currentIndex++;
  21258. }
  21259. }
  21260. throw new Jbig2Error("can't find custom Huffman table");
  21261. }
  21262. function getTextRegionHuffmanTables(
  21263. textRegion,
  21264. referredTo,
  21265. customTables,
  21266. numberOfSymbols,
  21267. reader
  21268. ) {
  21269. const codes = [];
  21270. for (let i = 0; i <= 34; i++) {
  21271. const codeLength = reader.readBits(4);
  21272. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  21273. }
  21274. const runCodesTable = new HuffmanTable(codes, false);
  21275. codes.length = 0;
  21276. for (let i = 0; i < numberOfSymbols; ) {
  21277. const codeLength = runCodesTable.decode(reader);
  21278. if (codeLength >= 32) {
  21279. let repeatedLength, numberOfRepeats, j;
  21280. switch (codeLength) {
  21281. case 32:
  21282. if (i === 0) {
  21283. throw new Jbig2Error(
  21284. "no previous value in symbol ID table"
  21285. );
  21286. }
  21287. numberOfRepeats = reader.readBits(2) + 3;
  21288. repeatedLength = codes[i - 1].prefixLength;
  21289. break;
  21290. case 33:
  21291. numberOfRepeats = reader.readBits(3) + 3;
  21292. repeatedLength = 0;
  21293. break;
  21294. case 34:
  21295. numberOfRepeats = reader.readBits(7) + 11;
  21296. repeatedLength = 0;
  21297. break;
  21298. default:
  21299. throw new Jbig2Error(
  21300. "invalid code length in symbol ID table"
  21301. );
  21302. }
  21303. for (j = 0; j < numberOfRepeats; j++) {
  21304. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  21305. i++;
  21306. }
  21307. } else {
  21308. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  21309. i++;
  21310. }
  21311. }
  21312. reader.byteAlign();
  21313. const symbolIDTable = new HuffmanTable(codes, false);
  21314. let customIndex = 0,
  21315. tableFirstS,
  21316. tableDeltaS,
  21317. tableDeltaT;
  21318. switch (textRegion.huffmanFS) {
  21319. case 0:
  21320. case 1:
  21321. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  21322. break;
  21323. case 3:
  21324. tableFirstS = getCustomHuffmanTable(
  21325. customIndex,
  21326. referredTo,
  21327. customTables
  21328. );
  21329. customIndex++;
  21330. break;
  21331. default:
  21332. throw new Jbig2Error("invalid Huffman FS selector");
  21333. }
  21334. switch (textRegion.huffmanDS) {
  21335. case 0:
  21336. case 1:
  21337. case 2:
  21338. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  21339. break;
  21340. case 3:
  21341. tableDeltaS = getCustomHuffmanTable(
  21342. customIndex,
  21343. referredTo,
  21344. customTables
  21345. );
  21346. customIndex++;
  21347. break;
  21348. default:
  21349. throw new Jbig2Error("invalid Huffman DS selector");
  21350. }
  21351. switch (textRegion.huffmanDT) {
  21352. case 0:
  21353. case 1:
  21354. case 2:
  21355. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  21356. break;
  21357. case 3:
  21358. tableDeltaT = getCustomHuffmanTable(
  21359. customIndex,
  21360. referredTo,
  21361. customTables
  21362. );
  21363. customIndex++;
  21364. break;
  21365. default:
  21366. throw new Jbig2Error("invalid Huffman DT selector");
  21367. }
  21368. if (textRegion.refinement) {
  21369. throw new Jbig2Error("refinement with Huffman is not supported");
  21370. }
  21371. return {
  21372. symbolIDTable,
  21373. tableFirstS,
  21374. tableDeltaS,
  21375. tableDeltaT,
  21376. };
  21377. }
  21378. function getSymbolDictionaryHuffmanTables(
  21379. dictionary,
  21380. referredTo,
  21381. customTables
  21382. ) {
  21383. let customIndex = 0,
  21384. tableDeltaHeight,
  21385. tableDeltaWidth;
  21386. switch (dictionary.huffmanDHSelector) {
  21387. case 0:
  21388. case 1:
  21389. tableDeltaHeight = getStandardTable(
  21390. dictionary.huffmanDHSelector + 4
  21391. );
  21392. break;
  21393. case 3:
  21394. tableDeltaHeight = getCustomHuffmanTable(
  21395. customIndex,
  21396. referredTo,
  21397. customTables
  21398. );
  21399. customIndex++;
  21400. break;
  21401. default:
  21402. throw new Jbig2Error("invalid Huffman DH selector");
  21403. }
  21404. switch (dictionary.huffmanDWSelector) {
  21405. case 0:
  21406. case 1:
  21407. tableDeltaWidth = getStandardTable(
  21408. dictionary.huffmanDWSelector + 2
  21409. );
  21410. break;
  21411. case 3:
  21412. tableDeltaWidth = getCustomHuffmanTable(
  21413. customIndex,
  21414. referredTo,
  21415. customTables
  21416. );
  21417. customIndex++;
  21418. break;
  21419. default:
  21420. throw new Jbig2Error("invalid Huffman DW selector");
  21421. }
  21422. let tableBitmapSize, tableAggregateInstances;
  21423. if (dictionary.bitmapSizeSelector) {
  21424. tableBitmapSize = getCustomHuffmanTable(
  21425. customIndex,
  21426. referredTo,
  21427. customTables
  21428. );
  21429. customIndex++;
  21430. } else {
  21431. tableBitmapSize = getStandardTable(1);
  21432. }
  21433. if (dictionary.aggregationInstancesSelector) {
  21434. tableAggregateInstances = getCustomHuffmanTable(
  21435. customIndex,
  21436. referredTo,
  21437. customTables
  21438. );
  21439. } else {
  21440. tableAggregateInstances = getStandardTable(1);
  21441. }
  21442. return {
  21443. tableDeltaHeight,
  21444. tableDeltaWidth,
  21445. tableBitmapSize,
  21446. tableAggregateInstances,
  21447. };
  21448. }
  21449. function readUncompressedBitmap(reader, width, height) {
  21450. const bitmap = [];
  21451. for (let y = 0; y < height; y++) {
  21452. const row = new Uint8Array(width);
  21453. bitmap.push(row);
  21454. for (let x = 0; x < width; x++) {
  21455. row[x] = reader.readBit();
  21456. }
  21457. reader.byteAlign();
  21458. }
  21459. return bitmap;
  21460. }
  21461. function decodeMMRBitmap(input, width, height, endOfBlock) {
  21462. const params = {
  21463. K: -1,
  21464. Columns: width,
  21465. Rows: height,
  21466. BlackIs1: true,
  21467. EndOfBlock: endOfBlock,
  21468. };
  21469. const decoder = new _ccitt.CCITTFaxDecoder(input, params);
  21470. const bitmap = [];
  21471. let currentByte,
  21472. eof = false;
  21473. for (let y = 0; y < height; y++) {
  21474. const row = new Uint8Array(width);
  21475. bitmap.push(row);
  21476. let shift = -1;
  21477. for (let x = 0; x < width; x++) {
  21478. if (shift < 0) {
  21479. currentByte = decoder.readNextChar();
  21480. if (currentByte === -1) {
  21481. currentByte = 0;
  21482. eof = true;
  21483. }
  21484. shift = 7;
  21485. }
  21486. row[x] = (currentByte >> shift) & 1;
  21487. shift--;
  21488. }
  21489. }
  21490. if (endOfBlock && !eof) {
  21491. const lookForEOFLimit = 5;
  21492. for (let i = 0; i < lookForEOFLimit; i++) {
  21493. if (decoder.readNextChar() === -1) {
  21494. break;
  21495. }
  21496. }
  21497. }
  21498. return bitmap;
  21499. }
  21500. class Jbig2Image {
  21501. parseChunks(chunks) {
  21502. return parseJbig2Chunks(chunks);
  21503. }
  21504. parse(data) {
  21505. throw new Error("Not implemented: Jbig2Image.parse");
  21506. }
  21507. }
  21508. exports.Jbig2Image = Jbig2Image;
  21509. /***/
  21510. },
  21511. /* 26 */
  21512. /***/ (__unused_webpack_module, exports) => {
  21513. Object.defineProperty(exports, "__esModule", {
  21514. value: true,
  21515. });
  21516. exports.ArithmeticDecoder = void 0;
  21517. const QeTable = [
  21518. {
  21519. qe: 0x5601,
  21520. nmps: 1,
  21521. nlps: 1,
  21522. switchFlag: 1,
  21523. },
  21524. {
  21525. qe: 0x3401,
  21526. nmps: 2,
  21527. nlps: 6,
  21528. switchFlag: 0,
  21529. },
  21530. {
  21531. qe: 0x1801,
  21532. nmps: 3,
  21533. nlps: 9,
  21534. switchFlag: 0,
  21535. },
  21536. {
  21537. qe: 0x0ac1,
  21538. nmps: 4,
  21539. nlps: 12,
  21540. switchFlag: 0,
  21541. },
  21542. {
  21543. qe: 0x0521,
  21544. nmps: 5,
  21545. nlps: 29,
  21546. switchFlag: 0,
  21547. },
  21548. {
  21549. qe: 0x0221,
  21550. nmps: 38,
  21551. nlps: 33,
  21552. switchFlag: 0,
  21553. },
  21554. {
  21555. qe: 0x5601,
  21556. nmps: 7,
  21557. nlps: 6,
  21558. switchFlag: 1,
  21559. },
  21560. {
  21561. qe: 0x5401,
  21562. nmps: 8,
  21563. nlps: 14,
  21564. switchFlag: 0,
  21565. },
  21566. {
  21567. qe: 0x4801,
  21568. nmps: 9,
  21569. nlps: 14,
  21570. switchFlag: 0,
  21571. },
  21572. {
  21573. qe: 0x3801,
  21574. nmps: 10,
  21575. nlps: 14,
  21576. switchFlag: 0,
  21577. },
  21578. {
  21579. qe: 0x3001,
  21580. nmps: 11,
  21581. nlps: 17,
  21582. switchFlag: 0,
  21583. },
  21584. {
  21585. qe: 0x2401,
  21586. nmps: 12,
  21587. nlps: 18,
  21588. switchFlag: 0,
  21589. },
  21590. {
  21591. qe: 0x1c01,
  21592. nmps: 13,
  21593. nlps: 20,
  21594. switchFlag: 0,
  21595. },
  21596. {
  21597. qe: 0x1601,
  21598. nmps: 29,
  21599. nlps: 21,
  21600. switchFlag: 0,
  21601. },
  21602. {
  21603. qe: 0x5601,
  21604. nmps: 15,
  21605. nlps: 14,
  21606. switchFlag: 1,
  21607. },
  21608. {
  21609. qe: 0x5401,
  21610. nmps: 16,
  21611. nlps: 14,
  21612. switchFlag: 0,
  21613. },
  21614. {
  21615. qe: 0x5101,
  21616. nmps: 17,
  21617. nlps: 15,
  21618. switchFlag: 0,
  21619. },
  21620. {
  21621. qe: 0x4801,
  21622. nmps: 18,
  21623. nlps: 16,
  21624. switchFlag: 0,
  21625. },
  21626. {
  21627. qe: 0x3801,
  21628. nmps: 19,
  21629. nlps: 17,
  21630. switchFlag: 0,
  21631. },
  21632. {
  21633. qe: 0x3401,
  21634. nmps: 20,
  21635. nlps: 18,
  21636. switchFlag: 0,
  21637. },
  21638. {
  21639. qe: 0x3001,
  21640. nmps: 21,
  21641. nlps: 19,
  21642. switchFlag: 0,
  21643. },
  21644. {
  21645. qe: 0x2801,
  21646. nmps: 22,
  21647. nlps: 19,
  21648. switchFlag: 0,
  21649. },
  21650. {
  21651. qe: 0x2401,
  21652. nmps: 23,
  21653. nlps: 20,
  21654. switchFlag: 0,
  21655. },
  21656. {
  21657. qe: 0x2201,
  21658. nmps: 24,
  21659. nlps: 21,
  21660. switchFlag: 0,
  21661. },
  21662. {
  21663. qe: 0x1c01,
  21664. nmps: 25,
  21665. nlps: 22,
  21666. switchFlag: 0,
  21667. },
  21668. {
  21669. qe: 0x1801,
  21670. nmps: 26,
  21671. nlps: 23,
  21672. switchFlag: 0,
  21673. },
  21674. {
  21675. qe: 0x1601,
  21676. nmps: 27,
  21677. nlps: 24,
  21678. switchFlag: 0,
  21679. },
  21680. {
  21681. qe: 0x1401,
  21682. nmps: 28,
  21683. nlps: 25,
  21684. switchFlag: 0,
  21685. },
  21686. {
  21687. qe: 0x1201,
  21688. nmps: 29,
  21689. nlps: 26,
  21690. switchFlag: 0,
  21691. },
  21692. {
  21693. qe: 0x1101,
  21694. nmps: 30,
  21695. nlps: 27,
  21696. switchFlag: 0,
  21697. },
  21698. {
  21699. qe: 0x0ac1,
  21700. nmps: 31,
  21701. nlps: 28,
  21702. switchFlag: 0,
  21703. },
  21704. {
  21705. qe: 0x09c1,
  21706. nmps: 32,
  21707. nlps: 29,
  21708. switchFlag: 0,
  21709. },
  21710. {
  21711. qe: 0x08a1,
  21712. nmps: 33,
  21713. nlps: 30,
  21714. switchFlag: 0,
  21715. },
  21716. {
  21717. qe: 0x0521,
  21718. nmps: 34,
  21719. nlps: 31,
  21720. switchFlag: 0,
  21721. },
  21722. {
  21723. qe: 0x0441,
  21724. nmps: 35,
  21725. nlps: 32,
  21726. switchFlag: 0,
  21727. },
  21728. {
  21729. qe: 0x02a1,
  21730. nmps: 36,
  21731. nlps: 33,
  21732. switchFlag: 0,
  21733. },
  21734. {
  21735. qe: 0x0221,
  21736. nmps: 37,
  21737. nlps: 34,
  21738. switchFlag: 0,
  21739. },
  21740. {
  21741. qe: 0x0141,
  21742. nmps: 38,
  21743. nlps: 35,
  21744. switchFlag: 0,
  21745. },
  21746. {
  21747. qe: 0x0111,
  21748. nmps: 39,
  21749. nlps: 36,
  21750. switchFlag: 0,
  21751. },
  21752. {
  21753. qe: 0x0085,
  21754. nmps: 40,
  21755. nlps: 37,
  21756. switchFlag: 0,
  21757. },
  21758. {
  21759. qe: 0x0049,
  21760. nmps: 41,
  21761. nlps: 38,
  21762. switchFlag: 0,
  21763. },
  21764. {
  21765. qe: 0x0025,
  21766. nmps: 42,
  21767. nlps: 39,
  21768. switchFlag: 0,
  21769. },
  21770. {
  21771. qe: 0x0015,
  21772. nmps: 43,
  21773. nlps: 40,
  21774. switchFlag: 0,
  21775. },
  21776. {
  21777. qe: 0x0009,
  21778. nmps: 44,
  21779. nlps: 41,
  21780. switchFlag: 0,
  21781. },
  21782. {
  21783. qe: 0x0005,
  21784. nmps: 45,
  21785. nlps: 42,
  21786. switchFlag: 0,
  21787. },
  21788. {
  21789. qe: 0x0001,
  21790. nmps: 45,
  21791. nlps: 43,
  21792. switchFlag: 0,
  21793. },
  21794. {
  21795. qe: 0x5601,
  21796. nmps: 46,
  21797. nlps: 46,
  21798. switchFlag: 0,
  21799. },
  21800. ];
  21801. class ArithmeticDecoder {
  21802. constructor(data, start, end) {
  21803. this.data = data;
  21804. this.bp = start;
  21805. this.dataEnd = end;
  21806. this.chigh = data[start];
  21807. this.clow = 0;
  21808. this.byteIn();
  21809. this.chigh =
  21810. ((this.chigh << 7) & 0xffff) | ((this.clow >> 9) & 0x7f);
  21811. this.clow = (this.clow << 7) & 0xffff;
  21812. this.ct -= 7;
  21813. this.a = 0x8000;
  21814. }
  21815. byteIn() {
  21816. const data = this.data;
  21817. let bp = this.bp;
  21818. if (data[bp] === 0xff) {
  21819. if (data[bp + 1] > 0x8f) {
  21820. this.clow += 0xff00;
  21821. this.ct = 8;
  21822. } else {
  21823. bp++;
  21824. this.clow += data[bp] << 9;
  21825. this.ct = 7;
  21826. this.bp = bp;
  21827. }
  21828. } else {
  21829. bp++;
  21830. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  21831. this.ct = 8;
  21832. this.bp = bp;
  21833. }
  21834. if (this.clow > 0xffff) {
  21835. this.chigh += this.clow >> 16;
  21836. this.clow &= 0xffff;
  21837. }
  21838. }
  21839. readBit(contexts, pos) {
  21840. let cx_index = contexts[pos] >> 1,
  21841. cx_mps = contexts[pos] & 1;
  21842. const qeTableIcx = QeTable[cx_index];
  21843. const qeIcx = qeTableIcx.qe;
  21844. let d;
  21845. let a = this.a - qeIcx;
  21846. if (this.chigh < qeIcx) {
  21847. if (a < qeIcx) {
  21848. a = qeIcx;
  21849. d = cx_mps;
  21850. cx_index = qeTableIcx.nmps;
  21851. } else {
  21852. a = qeIcx;
  21853. d = 1 ^ cx_mps;
  21854. if (qeTableIcx.switchFlag === 1) {
  21855. cx_mps = d;
  21856. }
  21857. cx_index = qeTableIcx.nlps;
  21858. }
  21859. } else {
  21860. this.chigh -= qeIcx;
  21861. if ((a & 0x8000) !== 0) {
  21862. this.a = a;
  21863. return cx_mps;
  21864. }
  21865. if (a < qeIcx) {
  21866. d = 1 ^ cx_mps;
  21867. if (qeTableIcx.switchFlag === 1) {
  21868. cx_mps = d;
  21869. }
  21870. cx_index = qeTableIcx.nlps;
  21871. } else {
  21872. d = cx_mps;
  21873. cx_index = qeTableIcx.nmps;
  21874. }
  21875. }
  21876. do {
  21877. if (this.ct === 0) {
  21878. this.byteIn();
  21879. }
  21880. a <<= 1;
  21881. this.chigh =
  21882. ((this.chigh << 1) & 0xffff) | ((this.clow >> 15) & 1);
  21883. this.clow = (this.clow << 1) & 0xffff;
  21884. this.ct--;
  21885. } while ((a & 0x8000) === 0);
  21886. this.a = a;
  21887. contexts[pos] = (cx_index << 1) | cx_mps;
  21888. return d;
  21889. }
  21890. }
  21891. exports.ArithmeticDecoder = ArithmeticDecoder;
  21892. /***/
  21893. },
  21894. /* 27 */
  21895. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  21896. Object.defineProperty(exports, "__esModule", {
  21897. value: true,
  21898. });
  21899. exports.JpegStream = void 0;
  21900. var _decode_stream = __w_pdfjs_require__(19);
  21901. var _primitives = __w_pdfjs_require__(5);
  21902. var _jpg = __w_pdfjs_require__(28);
  21903. var _util = __w_pdfjs_require__(2);
  21904. class JpegStream extends _decode_stream.DecodeStream {
  21905. constructor(stream, maybeLength, params) {
  21906. let ch;
  21907. while ((ch = stream.getByte()) !== -1) {
  21908. if (ch === 0xff) {
  21909. stream.skip(-1);
  21910. break;
  21911. }
  21912. }
  21913. super(maybeLength);
  21914. this.stream = stream;
  21915. this.dict = stream.dict;
  21916. this.maybeLength = maybeLength;
  21917. this.params = params;
  21918. }
  21919. get bytes() {
  21920. return (0, _util.shadow)(
  21921. this,
  21922. "bytes",
  21923. this.stream.getBytes(this.maybeLength)
  21924. );
  21925. }
  21926. ensureBuffer(requested) {}
  21927. readBlock() {
  21928. if (this.eof) {
  21929. return;
  21930. }
  21931. const jpegOptions = {
  21932. decodeTransform: undefined,
  21933. colorTransform: undefined,
  21934. };
  21935. const decodeArr = this.dict.getArray("D", "Decode");
  21936. if (this.forceRGB && Array.isArray(decodeArr)) {
  21937. const bitsPerComponent =
  21938. this.dict.get("BPC", "BitsPerComponent") || 8;
  21939. const decodeArrLength = decodeArr.length;
  21940. const transform = new Int32Array(decodeArrLength);
  21941. let transformNeeded = false;
  21942. const maxValue = (1 << bitsPerComponent) - 1;
  21943. for (let i = 0; i < decodeArrLength; i += 2) {
  21944. transform[i] = ((decodeArr[i + 1] - decodeArr[i]) * 256) | 0;
  21945. transform[i + 1] = (decodeArr[i] * maxValue) | 0;
  21946. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  21947. transformNeeded = true;
  21948. }
  21949. }
  21950. if (transformNeeded) {
  21951. jpegOptions.decodeTransform = transform;
  21952. }
  21953. }
  21954. if (this.params instanceof _primitives.Dict) {
  21955. const colorTransform = this.params.get("ColorTransform");
  21956. if (Number.isInteger(colorTransform)) {
  21957. jpegOptions.colorTransform = colorTransform;
  21958. }
  21959. }
  21960. const jpegImage = new _jpg.JpegImage(jpegOptions);
  21961. jpegImage.parse(this.bytes);
  21962. const data = jpegImage.getData({
  21963. width: this.drawWidth,
  21964. height: this.drawHeight,
  21965. forceRGB: this.forceRGB,
  21966. isSourcePDF: true,
  21967. });
  21968. this.buffer = data;
  21969. this.bufferLength = data.length;
  21970. this.eof = true;
  21971. }
  21972. }
  21973. exports.JpegStream = JpegStream;
  21974. /***/
  21975. },
  21976. /* 28 */
  21977. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  21978. Object.defineProperty(exports, "__esModule", {
  21979. value: true,
  21980. });
  21981. exports.JpegImage = void 0;
  21982. var _util = __w_pdfjs_require__(2);
  21983. var _core_utils = __w_pdfjs_require__(6);
  21984. class JpegError extends _util.BaseException {
  21985. constructor(msg) {
  21986. super(`JPEG error: ${msg}`, "JpegError");
  21987. }
  21988. }
  21989. class DNLMarkerError extends _util.BaseException {
  21990. constructor(message, scanLines) {
  21991. super(message, "DNLMarkerError");
  21992. this.scanLines = scanLines;
  21993. }
  21994. }
  21995. class EOIMarkerError extends _util.BaseException {
  21996. constructor(msg) {
  21997. super(msg, "EOIMarkerError");
  21998. }
  21999. }
  22000. const dctZigZag = new Uint8Array([
  22001. 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26,
  22002. 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57,
  22003. 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31,
  22004. 39, 46, 53, 60, 61, 54, 47, 55, 62, 63,
  22005. ]);
  22006. const dctCos1 = 4017;
  22007. const dctSin1 = 799;
  22008. const dctCos3 = 3406;
  22009. const dctSin3 = 2276;
  22010. const dctCos6 = 1567;
  22011. const dctSin6 = 3784;
  22012. const dctSqrt2 = 5793;
  22013. const dctSqrt1d2 = 2896;
  22014. function buildHuffmanTable(codeLengths, values) {
  22015. let k = 0,
  22016. i,
  22017. j,
  22018. length = 16;
  22019. while (length > 0 && !codeLengths[length - 1]) {
  22020. length--;
  22021. }
  22022. const code = [
  22023. {
  22024. children: [],
  22025. index: 0,
  22026. },
  22027. ];
  22028. let p = code[0],
  22029. q;
  22030. for (i = 0; i < length; i++) {
  22031. for (j = 0; j < codeLengths[i]; j++) {
  22032. p = code.pop();
  22033. p.children[p.index] = values[k];
  22034. while (p.index > 0) {
  22035. p = code.pop();
  22036. }
  22037. p.index++;
  22038. code.push(p);
  22039. while (code.length <= i) {
  22040. code.push(
  22041. (q = {
  22042. children: [],
  22043. index: 0,
  22044. })
  22045. );
  22046. p.children[p.index] = q.children;
  22047. p = q;
  22048. }
  22049. k++;
  22050. }
  22051. if (i + 1 < length) {
  22052. code.push(
  22053. (q = {
  22054. children: [],
  22055. index: 0,
  22056. })
  22057. );
  22058. p.children[p.index] = q.children;
  22059. p = q;
  22060. }
  22061. }
  22062. return code[0].children;
  22063. }
  22064. function getBlockBufferOffset(component, row, col) {
  22065. return 64 * ((component.blocksPerLine + 1) * row + col);
  22066. }
  22067. function decodeScan(
  22068. data,
  22069. offset,
  22070. frame,
  22071. components,
  22072. resetInterval,
  22073. spectralStart,
  22074. spectralEnd,
  22075. successivePrev,
  22076. successive,
  22077. parseDNLMarker = false
  22078. ) {
  22079. const mcusPerLine = frame.mcusPerLine;
  22080. const progressive = frame.progressive;
  22081. const startOffset = offset;
  22082. let bitsData = 0,
  22083. bitsCount = 0;
  22084. function readBit() {
  22085. if (bitsCount > 0) {
  22086. bitsCount--;
  22087. return (bitsData >> bitsCount) & 1;
  22088. }
  22089. bitsData = data[offset++];
  22090. if (bitsData === 0xff) {
  22091. const nextByte = data[offset++];
  22092. if (nextByte) {
  22093. if (nextByte === 0xdc && parseDNLMarker) {
  22094. offset += 2;
  22095. const scanLines = (0, _core_utils.readUint16)(data, offset);
  22096. offset += 2;
  22097. if (scanLines > 0 && scanLines !== frame.scanLines) {
  22098. throw new DNLMarkerError(
  22099. "Found DNL marker (0xFFDC) while parsing scan data",
  22100. scanLines
  22101. );
  22102. }
  22103. } else if (nextByte === 0xd9) {
  22104. if (parseDNLMarker) {
  22105. const maybeScanLines =
  22106. blockRow * (frame.precision === 8 ? 8 : 0);
  22107. if (
  22108. maybeScanLines > 0 &&
  22109. Math.round(frame.scanLines / maybeScanLines) >= 10
  22110. ) {
  22111. throw new DNLMarkerError(
  22112. "Found EOI marker (0xFFD9) while parsing scan data, " +
  22113. "possibly caused by incorrect `scanLines` parameter",
  22114. maybeScanLines
  22115. );
  22116. }
  22117. }
  22118. throw new EOIMarkerError(
  22119. "Found EOI marker (0xFFD9) while parsing scan data"
  22120. );
  22121. }
  22122. throw new JpegError(
  22123. `unexpected marker ${((bitsData << 8) | nextByte).toString(
  22124. 16
  22125. )}`
  22126. );
  22127. }
  22128. }
  22129. bitsCount = 7;
  22130. return bitsData >>> 7;
  22131. }
  22132. function decodeHuffman(tree) {
  22133. let node = tree;
  22134. while (true) {
  22135. node = node[readBit()];
  22136. switch (typeof node) {
  22137. case "number":
  22138. return node;
  22139. case "object":
  22140. continue;
  22141. }
  22142. throw new JpegError("invalid huffman sequence");
  22143. }
  22144. }
  22145. function receive(length) {
  22146. let n = 0;
  22147. while (length > 0) {
  22148. n = (n << 1) | readBit();
  22149. length--;
  22150. }
  22151. return n;
  22152. }
  22153. function receiveAndExtend(length) {
  22154. if (length === 1) {
  22155. return readBit() === 1 ? 1 : -1;
  22156. }
  22157. const n = receive(length);
  22158. if (n >= 1 << (length - 1)) {
  22159. return n;
  22160. }
  22161. return n + (-1 << length) + 1;
  22162. }
  22163. function decodeBaseline(component, blockOffset) {
  22164. const t = decodeHuffman(component.huffmanTableDC);
  22165. const diff = t === 0 ? 0 : receiveAndExtend(t);
  22166. component.blockData[blockOffset] = component.pred += diff;
  22167. let k = 1;
  22168. while (k < 64) {
  22169. const rs = decodeHuffman(component.huffmanTableAC);
  22170. const s = rs & 15,
  22171. r = rs >> 4;
  22172. if (s === 0) {
  22173. if (r < 15) {
  22174. break;
  22175. }
  22176. k += 16;
  22177. continue;
  22178. }
  22179. k += r;
  22180. const z = dctZigZag[k];
  22181. component.blockData[blockOffset + z] = receiveAndExtend(s);
  22182. k++;
  22183. }
  22184. }
  22185. function decodeDCFirst(component, blockOffset) {
  22186. const t = decodeHuffman(component.huffmanTableDC);
  22187. const diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  22188. component.blockData[blockOffset] = component.pred += diff;
  22189. }
  22190. function decodeDCSuccessive(component, blockOffset) {
  22191. component.blockData[blockOffset] |= readBit() << successive;
  22192. }
  22193. let eobrun = 0;
  22194. function decodeACFirst(component, blockOffset) {
  22195. if (eobrun > 0) {
  22196. eobrun--;
  22197. return;
  22198. }
  22199. let k = spectralStart;
  22200. const e = spectralEnd;
  22201. while (k <= e) {
  22202. const rs = decodeHuffman(component.huffmanTableAC);
  22203. const s = rs & 15,
  22204. r = rs >> 4;
  22205. if (s === 0) {
  22206. if (r < 15) {
  22207. eobrun = receive(r) + (1 << r) - 1;
  22208. break;
  22209. }
  22210. k += 16;
  22211. continue;
  22212. }
  22213. k += r;
  22214. const z = dctZigZag[k];
  22215. component.blockData[blockOffset + z] =
  22216. receiveAndExtend(s) * (1 << successive);
  22217. k++;
  22218. }
  22219. }
  22220. let successiveACState = 0,
  22221. successiveACNextValue;
  22222. function decodeACSuccessive(component, blockOffset) {
  22223. let k = spectralStart;
  22224. const e = spectralEnd;
  22225. let r = 0;
  22226. let s;
  22227. let rs;
  22228. while (k <= e) {
  22229. const offsetZ = blockOffset + dctZigZag[k];
  22230. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  22231. switch (successiveACState) {
  22232. case 0:
  22233. rs = decodeHuffman(component.huffmanTableAC);
  22234. s = rs & 15;
  22235. r = rs >> 4;
  22236. if (s === 0) {
  22237. if (r < 15) {
  22238. eobrun = receive(r) + (1 << r);
  22239. successiveACState = 4;
  22240. } else {
  22241. r = 16;
  22242. successiveACState = 1;
  22243. }
  22244. } else {
  22245. if (s !== 1) {
  22246. throw new JpegError("invalid ACn encoding");
  22247. }
  22248. successiveACNextValue = receiveAndExtend(s);
  22249. successiveACState = r ? 2 : 3;
  22250. }
  22251. continue;
  22252. case 1:
  22253. case 2:
  22254. if (component.blockData[offsetZ]) {
  22255. component.blockData[offsetZ] +=
  22256. sign * (readBit() << successive);
  22257. } else {
  22258. r--;
  22259. if (r === 0) {
  22260. successiveACState = successiveACState === 2 ? 3 : 0;
  22261. }
  22262. }
  22263. break;
  22264. case 3:
  22265. if (component.blockData[offsetZ]) {
  22266. component.blockData[offsetZ] +=
  22267. sign * (readBit() << successive);
  22268. } else {
  22269. component.blockData[offsetZ] =
  22270. successiveACNextValue << successive;
  22271. successiveACState = 0;
  22272. }
  22273. break;
  22274. case 4:
  22275. if (component.blockData[offsetZ]) {
  22276. component.blockData[offsetZ] +=
  22277. sign * (readBit() << successive);
  22278. }
  22279. break;
  22280. }
  22281. k++;
  22282. }
  22283. if (successiveACState === 4) {
  22284. eobrun--;
  22285. if (eobrun === 0) {
  22286. successiveACState = 0;
  22287. }
  22288. }
  22289. }
  22290. let blockRow = 0;
  22291. function decodeMcu(component, decode, mcu, row, col) {
  22292. const mcuRow = (mcu / mcusPerLine) | 0;
  22293. const mcuCol = mcu % mcusPerLine;
  22294. blockRow = mcuRow * component.v + row;
  22295. const blockCol = mcuCol * component.h + col;
  22296. const blockOffset = getBlockBufferOffset(
  22297. component,
  22298. blockRow,
  22299. blockCol
  22300. );
  22301. decode(component, blockOffset);
  22302. }
  22303. function decodeBlock(component, decode, mcu) {
  22304. blockRow = (mcu / component.blocksPerLine) | 0;
  22305. const blockCol = mcu % component.blocksPerLine;
  22306. const blockOffset = getBlockBufferOffset(
  22307. component,
  22308. blockRow,
  22309. blockCol
  22310. );
  22311. decode(component, blockOffset);
  22312. }
  22313. const componentsLength = components.length;
  22314. let component, i, j, k, n;
  22315. let decodeFn;
  22316. if (progressive) {
  22317. if (spectralStart === 0) {
  22318. decodeFn =
  22319. successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  22320. } else {
  22321. decodeFn =
  22322. successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  22323. }
  22324. } else {
  22325. decodeFn = decodeBaseline;
  22326. }
  22327. let mcu = 0,
  22328. fileMarker;
  22329. let mcuExpected;
  22330. if (componentsLength === 1) {
  22331. mcuExpected =
  22332. components[0].blocksPerLine * components[0].blocksPerColumn;
  22333. } else {
  22334. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  22335. }
  22336. let h, v;
  22337. while (mcu <= mcuExpected) {
  22338. const mcuToRead = resetInterval
  22339. ? Math.min(mcuExpected - mcu, resetInterval)
  22340. : mcuExpected;
  22341. if (mcuToRead > 0) {
  22342. for (i = 0; i < componentsLength; i++) {
  22343. components[i].pred = 0;
  22344. }
  22345. eobrun = 0;
  22346. if (componentsLength === 1) {
  22347. component = components[0];
  22348. for (n = 0; n < mcuToRead; n++) {
  22349. decodeBlock(component, decodeFn, mcu);
  22350. mcu++;
  22351. }
  22352. } else {
  22353. for (n = 0; n < mcuToRead; n++) {
  22354. for (i = 0; i < componentsLength; i++) {
  22355. component = components[i];
  22356. h = component.h;
  22357. v = component.v;
  22358. for (j = 0; j < v; j++) {
  22359. for (k = 0; k < h; k++) {
  22360. decodeMcu(component, decodeFn, mcu, j, k);
  22361. }
  22362. }
  22363. }
  22364. mcu++;
  22365. }
  22366. }
  22367. }
  22368. bitsCount = 0;
  22369. fileMarker = findNextFileMarker(data, offset);
  22370. if (!fileMarker) {
  22371. break;
  22372. }
  22373. if (fileMarker.invalid) {
  22374. const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
  22375. (0, _util.warn)(
  22376. `decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`
  22377. );
  22378. offset = fileMarker.offset;
  22379. }
  22380. if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
  22381. offset += 2;
  22382. } else {
  22383. break;
  22384. }
  22385. }
  22386. return offset - startOffset;
  22387. }
  22388. function quantizeAndInverse(component, blockBufferOffset, p) {
  22389. const qt = component.quantizationTable,
  22390. blockData = component.blockData;
  22391. let v0, v1, v2, v3, v4, v5, v6, v7;
  22392. let p0, p1, p2, p3, p4, p5, p6, p7;
  22393. let t;
  22394. if (!qt) {
  22395. throw new JpegError("missing required Quantization Table.");
  22396. }
  22397. for (let row = 0; row < 64; row += 8) {
  22398. p0 = blockData[blockBufferOffset + row];
  22399. p1 = blockData[blockBufferOffset + row + 1];
  22400. p2 = blockData[blockBufferOffset + row + 2];
  22401. p3 = blockData[blockBufferOffset + row + 3];
  22402. p4 = blockData[blockBufferOffset + row + 4];
  22403. p5 = blockData[blockBufferOffset + row + 5];
  22404. p6 = blockData[blockBufferOffset + row + 6];
  22405. p7 = blockData[blockBufferOffset + row + 7];
  22406. p0 *= qt[row];
  22407. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  22408. t = (dctSqrt2 * p0 + 512) >> 10;
  22409. p[row] = t;
  22410. p[row + 1] = t;
  22411. p[row + 2] = t;
  22412. p[row + 3] = t;
  22413. p[row + 4] = t;
  22414. p[row + 5] = t;
  22415. p[row + 6] = t;
  22416. p[row + 7] = t;
  22417. continue;
  22418. }
  22419. p1 *= qt[row + 1];
  22420. p2 *= qt[row + 2];
  22421. p3 *= qt[row + 3];
  22422. p4 *= qt[row + 4];
  22423. p5 *= qt[row + 5];
  22424. p6 *= qt[row + 6];
  22425. p7 *= qt[row + 7];
  22426. v0 = (dctSqrt2 * p0 + 128) >> 8;
  22427. v1 = (dctSqrt2 * p4 + 128) >> 8;
  22428. v2 = p2;
  22429. v3 = p6;
  22430. v4 = (dctSqrt1d2 * (p1 - p7) + 128) >> 8;
  22431. v7 = (dctSqrt1d2 * (p1 + p7) + 128) >> 8;
  22432. v5 = p3 << 4;
  22433. v6 = p5 << 4;
  22434. v0 = (v0 + v1 + 1) >> 1;
  22435. v1 = v0 - v1;
  22436. t = (v2 * dctSin6 + v3 * dctCos6 + 128) >> 8;
  22437. v2 = (v2 * dctCos6 - v3 * dctSin6 + 128) >> 8;
  22438. v3 = t;
  22439. v4 = (v4 + v6 + 1) >> 1;
  22440. v6 = v4 - v6;
  22441. v7 = (v7 + v5 + 1) >> 1;
  22442. v5 = v7 - v5;
  22443. v0 = (v0 + v3 + 1) >> 1;
  22444. v3 = v0 - v3;
  22445. v1 = (v1 + v2 + 1) >> 1;
  22446. v2 = v1 - v2;
  22447. t = (v4 * dctSin3 + v7 * dctCos3 + 2048) >> 12;
  22448. v4 = (v4 * dctCos3 - v7 * dctSin3 + 2048) >> 12;
  22449. v7 = t;
  22450. t = (v5 * dctSin1 + v6 * dctCos1 + 2048) >> 12;
  22451. v5 = (v5 * dctCos1 - v6 * dctSin1 + 2048) >> 12;
  22452. v6 = t;
  22453. p[row] = v0 + v7;
  22454. p[row + 7] = v0 - v7;
  22455. p[row + 1] = v1 + v6;
  22456. p[row + 6] = v1 - v6;
  22457. p[row + 2] = v2 + v5;
  22458. p[row + 5] = v2 - v5;
  22459. p[row + 3] = v3 + v4;
  22460. p[row + 4] = v3 - v4;
  22461. }
  22462. for (let col = 0; col < 8; ++col) {
  22463. p0 = p[col];
  22464. p1 = p[col + 8];
  22465. p2 = p[col + 16];
  22466. p3 = p[col + 24];
  22467. p4 = p[col + 32];
  22468. p5 = p[col + 40];
  22469. p6 = p[col + 48];
  22470. p7 = p[col + 56];
  22471. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  22472. t = (dctSqrt2 * p0 + 8192) >> 14;
  22473. if (t < -2040) {
  22474. t = 0;
  22475. } else if (t >= 2024) {
  22476. t = 255;
  22477. } else {
  22478. t = (t + 2056) >> 4;
  22479. }
  22480. blockData[blockBufferOffset + col] = t;
  22481. blockData[blockBufferOffset + col + 8] = t;
  22482. blockData[blockBufferOffset + col + 16] = t;
  22483. blockData[blockBufferOffset + col + 24] = t;
  22484. blockData[blockBufferOffset + col + 32] = t;
  22485. blockData[blockBufferOffset + col + 40] = t;
  22486. blockData[blockBufferOffset + col + 48] = t;
  22487. blockData[blockBufferOffset + col + 56] = t;
  22488. continue;
  22489. }
  22490. v0 = (dctSqrt2 * p0 + 2048) >> 12;
  22491. v1 = (dctSqrt2 * p4 + 2048) >> 12;
  22492. v2 = p2;
  22493. v3 = p6;
  22494. v4 = (dctSqrt1d2 * (p1 - p7) + 2048) >> 12;
  22495. v7 = (dctSqrt1d2 * (p1 + p7) + 2048) >> 12;
  22496. v5 = p3;
  22497. v6 = p5;
  22498. v0 = ((v0 + v1 + 1) >> 1) + 4112;
  22499. v1 = v0 - v1;
  22500. t = (v2 * dctSin6 + v3 * dctCos6 + 2048) >> 12;
  22501. v2 = (v2 * dctCos6 - v3 * dctSin6 + 2048) >> 12;
  22502. v3 = t;
  22503. v4 = (v4 + v6 + 1) >> 1;
  22504. v6 = v4 - v6;
  22505. v7 = (v7 + v5 + 1) >> 1;
  22506. v5 = v7 - v5;
  22507. v0 = (v0 + v3 + 1) >> 1;
  22508. v3 = v0 - v3;
  22509. v1 = (v1 + v2 + 1) >> 1;
  22510. v2 = v1 - v2;
  22511. t = (v4 * dctSin3 + v7 * dctCos3 + 2048) >> 12;
  22512. v4 = (v4 * dctCos3 - v7 * dctSin3 + 2048) >> 12;
  22513. v7 = t;
  22514. t = (v5 * dctSin1 + v6 * dctCos1 + 2048) >> 12;
  22515. v5 = (v5 * dctCos1 - v6 * dctSin1 + 2048) >> 12;
  22516. v6 = t;
  22517. p0 = v0 + v7;
  22518. p7 = v0 - v7;
  22519. p1 = v1 + v6;
  22520. p6 = v1 - v6;
  22521. p2 = v2 + v5;
  22522. p5 = v2 - v5;
  22523. p3 = v3 + v4;
  22524. p4 = v3 - v4;
  22525. if (p0 < 16) {
  22526. p0 = 0;
  22527. } else if (p0 >= 4080) {
  22528. p0 = 255;
  22529. } else {
  22530. p0 >>= 4;
  22531. }
  22532. if (p1 < 16) {
  22533. p1 = 0;
  22534. } else if (p1 >= 4080) {
  22535. p1 = 255;
  22536. } else {
  22537. p1 >>= 4;
  22538. }
  22539. if (p2 < 16) {
  22540. p2 = 0;
  22541. } else if (p2 >= 4080) {
  22542. p2 = 255;
  22543. } else {
  22544. p2 >>= 4;
  22545. }
  22546. if (p3 < 16) {
  22547. p3 = 0;
  22548. } else if (p3 >= 4080) {
  22549. p3 = 255;
  22550. } else {
  22551. p3 >>= 4;
  22552. }
  22553. if (p4 < 16) {
  22554. p4 = 0;
  22555. } else if (p4 >= 4080) {
  22556. p4 = 255;
  22557. } else {
  22558. p4 >>= 4;
  22559. }
  22560. if (p5 < 16) {
  22561. p5 = 0;
  22562. } else if (p5 >= 4080) {
  22563. p5 = 255;
  22564. } else {
  22565. p5 >>= 4;
  22566. }
  22567. if (p6 < 16) {
  22568. p6 = 0;
  22569. } else if (p6 >= 4080) {
  22570. p6 = 255;
  22571. } else {
  22572. p6 >>= 4;
  22573. }
  22574. if (p7 < 16) {
  22575. p7 = 0;
  22576. } else if (p7 >= 4080) {
  22577. p7 = 255;
  22578. } else {
  22579. p7 >>= 4;
  22580. }
  22581. blockData[blockBufferOffset + col] = p0;
  22582. blockData[blockBufferOffset + col + 8] = p1;
  22583. blockData[blockBufferOffset + col + 16] = p2;
  22584. blockData[blockBufferOffset + col + 24] = p3;
  22585. blockData[blockBufferOffset + col + 32] = p4;
  22586. blockData[blockBufferOffset + col + 40] = p5;
  22587. blockData[blockBufferOffset + col + 48] = p6;
  22588. blockData[blockBufferOffset + col + 56] = p7;
  22589. }
  22590. }
  22591. function buildComponentData(frame, component) {
  22592. const blocksPerLine = component.blocksPerLine;
  22593. const blocksPerColumn = component.blocksPerColumn;
  22594. const computationBuffer = new Int16Array(64);
  22595. for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  22596. for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  22597. const offset = getBlockBufferOffset(
  22598. component,
  22599. blockRow,
  22600. blockCol
  22601. );
  22602. quantizeAndInverse(component, offset, computationBuffer);
  22603. }
  22604. }
  22605. return component.blockData;
  22606. }
  22607. function findNextFileMarker(data, currentPos, startPos = currentPos) {
  22608. const maxPos = data.length - 1;
  22609. let newPos = startPos < currentPos ? startPos : currentPos;
  22610. if (currentPos >= maxPos) {
  22611. return null;
  22612. }
  22613. const currentMarker = (0, _core_utils.readUint16)(data, currentPos);
  22614. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  22615. return {
  22616. invalid: null,
  22617. marker: currentMarker,
  22618. offset: currentPos,
  22619. };
  22620. }
  22621. let newMarker = (0, _core_utils.readUint16)(data, newPos);
  22622. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  22623. if (++newPos >= maxPos) {
  22624. return null;
  22625. }
  22626. newMarker = (0, _core_utils.readUint16)(data, newPos);
  22627. }
  22628. return {
  22629. invalid: currentMarker.toString(16),
  22630. marker: newMarker,
  22631. offset: newPos,
  22632. };
  22633. }
  22634. class JpegImage {
  22635. constructor({ decodeTransform = null, colorTransform = -1 } = {}) {
  22636. this._decodeTransform = decodeTransform;
  22637. this._colorTransform = colorTransform;
  22638. }
  22639. parse(data, { dnlScanLines = null } = {}) {
  22640. function readDataBlock() {
  22641. const length = (0, _core_utils.readUint16)(data, offset);
  22642. offset += 2;
  22643. let endOffset = offset + length - 2;
  22644. const fileMarker = findNextFileMarker(data, endOffset, offset);
  22645. if (fileMarker && fileMarker.invalid) {
  22646. (0, _util.warn)(
  22647. "readDataBlock - incorrect length, current marker is: " +
  22648. fileMarker.invalid
  22649. );
  22650. endOffset = fileMarker.offset;
  22651. }
  22652. const array = data.subarray(offset, endOffset);
  22653. offset += array.length;
  22654. return array;
  22655. }
  22656. function prepareComponents(frame) {
  22657. const mcusPerLine = Math.ceil(
  22658. frame.samplesPerLine / 8 / frame.maxH
  22659. );
  22660. const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  22661. for (let i = 0, ii = frame.components.length; i < ii; i++) {
  22662. const component = frame.components[i];
  22663. const blocksPerLine = Math.ceil(
  22664. (Math.ceil(frame.samplesPerLine / 8) * component.h) /
  22665. frame.maxH
  22666. );
  22667. const blocksPerColumn = Math.ceil(
  22668. (Math.ceil(frame.scanLines / 8) * component.v) / frame.maxV
  22669. );
  22670. const blocksPerLineForMcu = mcusPerLine * component.h;
  22671. const blocksPerColumnForMcu = mcusPerColumn * component.v;
  22672. const blocksBufferSize =
  22673. 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  22674. component.blockData = new Int16Array(blocksBufferSize);
  22675. component.blocksPerLine = blocksPerLine;
  22676. component.blocksPerColumn = blocksPerColumn;
  22677. }
  22678. frame.mcusPerLine = mcusPerLine;
  22679. frame.mcusPerColumn = mcusPerColumn;
  22680. }
  22681. let offset = 0;
  22682. let jfif = null;
  22683. let adobe = null;
  22684. let frame, resetInterval;
  22685. let numSOSMarkers = 0;
  22686. const quantizationTables = [];
  22687. const huffmanTablesAC = [],
  22688. huffmanTablesDC = [];
  22689. let fileMarker = (0, _core_utils.readUint16)(data, offset);
  22690. offset += 2;
  22691. if (fileMarker !== 0xffd8) {
  22692. throw new JpegError("SOI not found");
  22693. }
  22694. fileMarker = (0, _core_utils.readUint16)(data, offset);
  22695. offset += 2;
  22696. markerLoop: while (fileMarker !== 0xffd9) {
  22697. let i, j, l;
  22698. switch (fileMarker) {
  22699. case 0xffe0:
  22700. case 0xffe1:
  22701. case 0xffe2:
  22702. case 0xffe3:
  22703. case 0xffe4:
  22704. case 0xffe5:
  22705. case 0xffe6:
  22706. case 0xffe7:
  22707. case 0xffe8:
  22708. case 0xffe9:
  22709. case 0xffea:
  22710. case 0xffeb:
  22711. case 0xffec:
  22712. case 0xffed:
  22713. case 0xffee:
  22714. case 0xffef:
  22715. case 0xfffe:
  22716. const appData = readDataBlock();
  22717. if (fileMarker === 0xffe0) {
  22718. if (
  22719. appData[0] === 0x4a &&
  22720. appData[1] === 0x46 &&
  22721. appData[2] === 0x49 &&
  22722. appData[3] === 0x46 &&
  22723. appData[4] === 0
  22724. ) {
  22725. jfif = {
  22726. version: {
  22727. major: appData[5],
  22728. minor: appData[6],
  22729. },
  22730. densityUnits: appData[7],
  22731. xDensity: (appData[8] << 8) | appData[9],
  22732. yDensity: (appData[10] << 8) | appData[11],
  22733. thumbWidth: appData[12],
  22734. thumbHeight: appData[13],
  22735. thumbData: appData.subarray(
  22736. 14,
  22737. 14 + 3 * appData[12] * appData[13]
  22738. ),
  22739. };
  22740. }
  22741. }
  22742. if (fileMarker === 0xffee) {
  22743. if (
  22744. appData[0] === 0x41 &&
  22745. appData[1] === 0x64 &&
  22746. appData[2] === 0x6f &&
  22747. appData[3] === 0x62 &&
  22748. appData[4] === 0x65
  22749. ) {
  22750. adobe = {
  22751. version: (appData[5] << 8) | appData[6],
  22752. flags0: (appData[7] << 8) | appData[8],
  22753. flags1: (appData[9] << 8) | appData[10],
  22754. transformCode: appData[11],
  22755. };
  22756. }
  22757. }
  22758. break;
  22759. case 0xffdb:
  22760. const quantizationTablesLength = (0, _core_utils.readUint16)(
  22761. data,
  22762. offset
  22763. );
  22764. offset += 2;
  22765. const quantizationTablesEnd =
  22766. quantizationTablesLength + offset - 2;
  22767. let z;
  22768. while (offset < quantizationTablesEnd) {
  22769. const quantizationTableSpec = data[offset++];
  22770. const tableData = new Uint16Array(64);
  22771. if (quantizationTableSpec >> 4 === 0) {
  22772. for (j = 0; j < 64; j++) {
  22773. z = dctZigZag[j];
  22774. tableData[z] = data[offset++];
  22775. }
  22776. } else if (quantizationTableSpec >> 4 === 1) {
  22777. for (j = 0; j < 64; j++) {
  22778. z = dctZigZag[j];
  22779. tableData[z] = (0, _core_utils.readUint16)(
  22780. data,
  22781. offset
  22782. );
  22783. offset += 2;
  22784. }
  22785. } else {
  22786. throw new JpegError("DQT - invalid table spec");
  22787. }
  22788. quantizationTables[quantizationTableSpec & 15] = tableData;
  22789. }
  22790. break;
  22791. case 0xffc0:
  22792. case 0xffc1:
  22793. case 0xffc2:
  22794. if (frame) {
  22795. throw new JpegError("Only single frame JPEGs supported");
  22796. }
  22797. offset += 2;
  22798. frame = {};
  22799. frame.extended = fileMarker === 0xffc1;
  22800. frame.progressive = fileMarker === 0xffc2;
  22801. frame.precision = data[offset++];
  22802. const sofScanLines = (0, _core_utils.readUint16)(
  22803. data,
  22804. offset
  22805. );
  22806. offset += 2;
  22807. frame.scanLines = dnlScanLines || sofScanLines;
  22808. frame.samplesPerLine = (0, _core_utils.readUint16)(
  22809. data,
  22810. offset
  22811. );
  22812. offset += 2;
  22813. frame.components = [];
  22814. frame.componentIds = {};
  22815. const componentsCount = data[offset++];
  22816. let maxH = 0,
  22817. maxV = 0;
  22818. for (i = 0; i < componentsCount; i++) {
  22819. const componentId = data[offset];
  22820. const h = data[offset + 1] >> 4;
  22821. const v = data[offset + 1] & 15;
  22822. if (maxH < h) {
  22823. maxH = h;
  22824. }
  22825. if (maxV < v) {
  22826. maxV = v;
  22827. }
  22828. const qId = data[offset + 2];
  22829. l = frame.components.push({
  22830. h,
  22831. v,
  22832. quantizationId: qId,
  22833. quantizationTable: null,
  22834. });
  22835. frame.componentIds[componentId] = l - 1;
  22836. offset += 3;
  22837. }
  22838. frame.maxH = maxH;
  22839. frame.maxV = maxV;
  22840. prepareComponents(frame);
  22841. break;
  22842. case 0xffc4:
  22843. const huffmanLength = (0, _core_utils.readUint16)(
  22844. data,
  22845. offset
  22846. );
  22847. offset += 2;
  22848. for (i = 2; i < huffmanLength; ) {
  22849. const huffmanTableSpec = data[offset++];
  22850. const codeLengths = new Uint8Array(16);
  22851. let codeLengthSum = 0;
  22852. for (j = 0; j < 16; j++, offset++) {
  22853. codeLengthSum += codeLengths[j] = data[offset];
  22854. }
  22855. const huffmanValues = new Uint8Array(codeLengthSum);
  22856. for (j = 0; j < codeLengthSum; j++, offset++) {
  22857. huffmanValues[j] = data[offset];
  22858. }
  22859. i += 17 + codeLengthSum;
  22860. (huffmanTableSpec >> 4 === 0
  22861. ? huffmanTablesDC
  22862. : huffmanTablesAC)[huffmanTableSpec & 15] =
  22863. buildHuffmanTable(codeLengths, huffmanValues);
  22864. }
  22865. break;
  22866. case 0xffdd:
  22867. offset += 2;
  22868. resetInterval = (0, _core_utils.readUint16)(data, offset);
  22869. offset += 2;
  22870. break;
  22871. case 0xffda:
  22872. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  22873. offset += 2;
  22874. const selectorsCount = data[offset++],
  22875. components = [];
  22876. for (i = 0; i < selectorsCount; i++) {
  22877. const index = data[offset++];
  22878. const componentIndex = frame.componentIds[index];
  22879. const component = frame.components[componentIndex];
  22880. component.index = index;
  22881. const tableSpec = data[offset++];
  22882. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  22883. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  22884. components.push(component);
  22885. }
  22886. const spectralStart = data[offset++],
  22887. spectralEnd = data[offset++],
  22888. successiveApproximation = data[offset++];
  22889. try {
  22890. const processed = decodeScan(
  22891. data,
  22892. offset,
  22893. frame,
  22894. components,
  22895. resetInterval,
  22896. spectralStart,
  22897. spectralEnd,
  22898. successiveApproximation >> 4,
  22899. successiveApproximation & 15,
  22900. parseDNLMarker
  22901. );
  22902. offset += processed;
  22903. } catch (ex) {
  22904. if (ex instanceof DNLMarkerError) {
  22905. (0, _util.warn)(
  22906. `${ex.message} -- attempting to re-parse the JPEG image.`
  22907. );
  22908. return this.parse(data, {
  22909. dnlScanLines: ex.scanLines,
  22910. });
  22911. } else if (ex instanceof EOIMarkerError) {
  22912. (0, _util.warn)(
  22913. `${ex.message} -- ignoring the rest of the image data.`
  22914. );
  22915. break markerLoop;
  22916. }
  22917. throw ex;
  22918. }
  22919. break;
  22920. case 0xffdc:
  22921. offset += 4;
  22922. break;
  22923. case 0xffff:
  22924. if (data[offset] !== 0xff) {
  22925. offset--;
  22926. }
  22927. break;
  22928. default:
  22929. const nextFileMarker = findNextFileMarker(
  22930. data,
  22931. offset - 2,
  22932. offset - 3
  22933. );
  22934. if (nextFileMarker && nextFileMarker.invalid) {
  22935. (0, _util.warn)(
  22936. "JpegImage.parse - unexpected data, current marker is: " +
  22937. nextFileMarker.invalid
  22938. );
  22939. offset = nextFileMarker.offset;
  22940. break;
  22941. }
  22942. if (!nextFileMarker || offset >= data.length - 1) {
  22943. (0, _util.warn)(
  22944. "JpegImage.parse - reached the end of the image data " +
  22945. "without finding an EOI marker (0xFFD9)."
  22946. );
  22947. break markerLoop;
  22948. }
  22949. throw new JpegError(
  22950. "JpegImage.parse - unknown marker: " +
  22951. fileMarker.toString(16)
  22952. );
  22953. }
  22954. fileMarker = (0, _core_utils.readUint16)(data, offset);
  22955. offset += 2;
  22956. }
  22957. this.width = frame.samplesPerLine;
  22958. this.height = frame.scanLines;
  22959. this.jfif = jfif;
  22960. this.adobe = adobe;
  22961. this.components = [];
  22962. for (let i = 0, ii = frame.components.length; i < ii; i++) {
  22963. const component = frame.components[i];
  22964. const quantizationTable =
  22965. quantizationTables[component.quantizationId];
  22966. if (quantizationTable) {
  22967. component.quantizationTable = quantizationTable;
  22968. }
  22969. this.components.push({
  22970. index: component.index,
  22971. output: buildComponentData(frame, component),
  22972. scaleX: component.h / frame.maxH,
  22973. scaleY: component.v / frame.maxV,
  22974. blocksPerLine: component.blocksPerLine,
  22975. blocksPerColumn: component.blocksPerColumn,
  22976. });
  22977. }
  22978. this.numComponents = this.components.length;
  22979. return undefined;
  22980. }
  22981. _getLinearizedBlockData(width, height, isSourcePDF = false) {
  22982. const scaleX = this.width / width,
  22983. scaleY = this.height / height;
  22984. let component, componentScaleX, componentScaleY, blocksPerScanline;
  22985. let x, y, i, j, k;
  22986. let index;
  22987. let offset = 0;
  22988. let output;
  22989. const numComponents = this.components.length;
  22990. const dataLength = width * height * numComponents;
  22991. const data = new Uint8ClampedArray(dataLength);
  22992. const xScaleBlockOffset = new Uint32Array(width);
  22993. const mask3LSB = 0xfffffff8;
  22994. let lastComponentScaleX;
  22995. for (i = 0; i < numComponents; i++) {
  22996. component = this.components[i];
  22997. componentScaleX = component.scaleX * scaleX;
  22998. componentScaleY = component.scaleY * scaleY;
  22999. offset = i;
  23000. output = component.output;
  23001. blocksPerScanline = (component.blocksPerLine + 1) << 3;
  23002. if (componentScaleX !== lastComponentScaleX) {
  23003. for (x = 0; x < width; x++) {
  23004. j = 0 | (x * componentScaleX);
  23005. xScaleBlockOffset[x] = ((j & mask3LSB) << 3) | (j & 7);
  23006. }
  23007. lastComponentScaleX = componentScaleX;
  23008. }
  23009. for (y = 0; y < height; y++) {
  23010. j = 0 | (y * componentScaleY);
  23011. index = (blocksPerScanline * (j & mask3LSB)) | ((j & 7) << 3);
  23012. for (x = 0; x < width; x++) {
  23013. data[offset] = output[index + xScaleBlockOffset[x]];
  23014. offset += numComponents;
  23015. }
  23016. }
  23017. }
  23018. let transform = this._decodeTransform;
  23019. if (!isSourcePDF && numComponents === 4 && !transform) {
  23020. transform = new Int32Array([
  23021. -256, 255, -256, 255, -256, 255, -256, 255,
  23022. ]);
  23023. }
  23024. if (transform) {
  23025. for (i = 0; i < dataLength; ) {
  23026. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  23027. data[i] = ((data[i] * transform[k]) >> 8) + transform[k + 1];
  23028. }
  23029. }
  23030. }
  23031. return data;
  23032. }
  23033. get _isColorConversionNeeded() {
  23034. if (this.adobe) {
  23035. return !!this.adobe.transformCode;
  23036. }
  23037. if (this.numComponents === 3) {
  23038. if (this._colorTransform === 0) {
  23039. return false;
  23040. } else if (
  23041. this.components[0].index === 0x52 &&
  23042. this.components[1].index === 0x47 &&
  23043. this.components[2].index === 0x42
  23044. ) {
  23045. return false;
  23046. }
  23047. return true;
  23048. }
  23049. if (this._colorTransform === 1) {
  23050. return true;
  23051. }
  23052. return false;
  23053. }
  23054. _convertYccToRgb(data) {
  23055. let Y, Cb, Cr;
  23056. for (let i = 0, length = data.length; i < length; i += 3) {
  23057. Y = data[i];
  23058. Cb = data[i + 1];
  23059. Cr = data[i + 2];
  23060. data[i] = Y - 179.456 + 1.402 * Cr;
  23061. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  23062. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  23063. }
  23064. return data;
  23065. }
  23066. _convertYcckToRgb(data) {
  23067. let Y, Cb, Cr, k;
  23068. let offset = 0;
  23069. for (let i = 0, length = data.length; i < length; i += 4) {
  23070. Y = data[i];
  23071. Cb = data[i + 1];
  23072. Cr = data[i + 2];
  23073. k = data[i + 3];
  23074. data[offset++] =
  23075. -122.67195406894 +
  23076. Cb *
  23077. (-6.60635669420364e-5 * Cb +
  23078. 0.000437130475926232 * Cr -
  23079. 5.4080610064599e-5 * Y +
  23080. 0.00048449797120281 * k -
  23081. 0.154362151871126) +
  23082. Cr *
  23083. (-0.000957964378445773 * Cr +
  23084. 0.000817076911346625 * Y -
  23085. 0.00477271405408747 * k +
  23086. 1.53380253221734) +
  23087. Y *
  23088. (0.000961250184130688 * Y -
  23089. 0.00266257332283933 * k +
  23090. 0.48357088451265) +
  23091. k * (-0.000336197177618394 * k + 0.484791561490776);
  23092. data[offset++] =
  23093. 107.268039397724 +
  23094. Cb *
  23095. (2.19927104525741e-5 * Cb -
  23096. 0.000640992018297945 * Cr +
  23097. 0.000659397001245577 * Y +
  23098. 0.000426105652938837 * k -
  23099. 0.176491792462875) +
  23100. Cr *
  23101. (-0.000778269941513683 * Cr +
  23102. 0.00130872261408275 * Y +
  23103. 0.000770482631801132 * k -
  23104. 0.151051492775562) +
  23105. Y *
  23106. (0.00126935368114843 * Y -
  23107. 0.00265090189010898 * k +
  23108. 0.25802910206845) +
  23109. k * (-0.000318913117588328 * k - 0.213742400323665);
  23110. data[offset++] =
  23111. -20.810012546947 +
  23112. Cb *
  23113. (-0.000570115196973677 * Cb -
  23114. 2.63409051004589e-5 * Cr +
  23115. 0.0020741088115012 * Y -
  23116. 0.00288260236853442 * k +
  23117. 0.814272968359295) +
  23118. Cr *
  23119. (-1.53496057440975e-5 * Cr -
  23120. 0.000132689043961446 * Y +
  23121. 0.000560833691242812 * k -
  23122. 0.195152027534049) +
  23123. Y *
  23124. (0.00174418132927582 * Y -
  23125. 0.00255243321439347 * k +
  23126. 0.116935020465145) +
  23127. k * (-0.000343531996510555 * k + 0.24165260232407);
  23128. }
  23129. return data.subarray(0, offset);
  23130. }
  23131. _convertYcckToCmyk(data) {
  23132. let Y, Cb, Cr;
  23133. for (let i = 0, length = data.length; i < length; i += 4) {
  23134. Y = data[i];
  23135. Cb = data[i + 1];
  23136. Cr = data[i + 2];
  23137. data[i] = 434.456 - Y - 1.402 * Cr;
  23138. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  23139. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  23140. }
  23141. return data;
  23142. }
  23143. _convertCmykToRgb(data) {
  23144. let c, m, y, k;
  23145. let offset = 0;
  23146. for (let i = 0, length = data.length; i < length; i += 4) {
  23147. c = data[i];
  23148. m = data[i + 1];
  23149. y = data[i + 2];
  23150. k = data[i + 3];
  23151. data[offset++] =
  23152. 255 +
  23153. c *
  23154. (-0.00006747147073602441 * c +
  23155. 0.0008379262121013727 * m +
  23156. 0.0002894718188643294 * y +
  23157. 0.003264231057537806 * k -
  23158. 1.1185611867203937) +
  23159. m *
  23160. (0.000026374107616089405 * m -
  23161. 0.00008626949158638572 * y -
  23162. 0.0002748769067499491 * k -
  23163. 0.02155688794978967) +
  23164. y *
  23165. (-0.00003878099212869363 * y -
  23166. 0.0003267808279485286 * k +
  23167. 0.0686742238595345) -
  23168. k * (0.0003361971776183937 * k + 0.7430659151342254);
  23169. data[offset++] =
  23170. 255 +
  23171. c *
  23172. (0.00013596372813588848 * c +
  23173. 0.000924537132573585 * m +
  23174. 0.00010567359618683593 * y +
  23175. 0.0004791864687436512 * k -
  23176. 0.3109689587515875) +
  23177. m *
  23178. (-0.00023545346108370344 * m +
  23179. 0.0002702845253534714 * y +
  23180. 0.0020200308977307156 * k -
  23181. 0.7488052167015494) +
  23182. y *
  23183. (0.00006834815998235662 * y +
  23184. 0.00015168452363460973 * k -
  23185. 0.09751927774728933) -
  23186. k * (0.0003189131175883281 * k + 0.7364883807733168);
  23187. data[offset++] =
  23188. 255 +
  23189. c *
  23190. (0.000013598650411385307 * c +
  23191. 0.00012423956175490851 * m +
  23192. 0.0004751985097583589 * y -
  23193. 0.0000036729317476630422 * k -
  23194. 0.05562186980264034) +
  23195. m *
  23196. (0.00016141380598724676 * m +
  23197. 0.0009692239130725186 * y +
  23198. 0.0007782692450036253 * k -
  23199. 0.44015232367526463) +
  23200. y *
  23201. (5.068882914068769e-7 * y +
  23202. 0.0017778369011375071 * k -
  23203. 0.7591454649749609) -
  23204. k * (0.0003435319965105553 * k + 0.7063770186160144);
  23205. }
  23206. return data.subarray(0, offset);
  23207. }
  23208. getData({ width, height, forceRGB = false, isSourcePDF = false }) {
  23209. if (this.numComponents > 4) {
  23210. throw new JpegError("Unsupported color mode");
  23211. }
  23212. const data = this._getLinearizedBlockData(
  23213. width,
  23214. height,
  23215. isSourcePDF
  23216. );
  23217. if (this.numComponents === 1 && forceRGB) {
  23218. const dataLength = data.length;
  23219. const rgbData = new Uint8ClampedArray(dataLength * 3);
  23220. let offset = 0;
  23221. for (let i = 0; i < dataLength; i++) {
  23222. const grayColor = data[i];
  23223. rgbData[offset++] = grayColor;
  23224. rgbData[offset++] = grayColor;
  23225. rgbData[offset++] = grayColor;
  23226. }
  23227. return rgbData;
  23228. } else if (
  23229. this.numComponents === 3 &&
  23230. this._isColorConversionNeeded
  23231. ) {
  23232. return this._convertYccToRgb(data);
  23233. } else if (this.numComponents === 4) {
  23234. if (this._isColorConversionNeeded) {
  23235. if (forceRGB) {
  23236. return this._convertYcckToRgb(data);
  23237. }
  23238. return this._convertYcckToCmyk(data);
  23239. } else if (forceRGB) {
  23240. return this._convertCmykToRgb(data);
  23241. }
  23242. }
  23243. return data;
  23244. }
  23245. }
  23246. exports.JpegImage = JpegImage;
  23247. /***/
  23248. },
  23249. /* 29 */
  23250. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23251. Object.defineProperty(exports, "__esModule", {
  23252. value: true,
  23253. });
  23254. exports.JpxStream = void 0;
  23255. var _decode_stream = __w_pdfjs_require__(19);
  23256. var _jpx = __w_pdfjs_require__(30);
  23257. var _util = __w_pdfjs_require__(2);
  23258. class JpxStream extends _decode_stream.DecodeStream {
  23259. constructor(stream, maybeLength, params) {
  23260. super(maybeLength);
  23261. this.stream = stream;
  23262. this.dict = stream.dict;
  23263. this.maybeLength = maybeLength;
  23264. this.params = params;
  23265. }
  23266. get bytes() {
  23267. return (0, _util.shadow)(
  23268. this,
  23269. "bytes",
  23270. this.stream.getBytes(this.maybeLength)
  23271. );
  23272. }
  23273. ensureBuffer(requested) {}
  23274. readBlock() {
  23275. if (this.eof) {
  23276. return;
  23277. }
  23278. const jpxImage = new _jpx.JpxImage();
  23279. jpxImage.parse(this.bytes);
  23280. const width = jpxImage.width;
  23281. const height = jpxImage.height;
  23282. const componentsCount = jpxImage.componentsCount;
  23283. const tileCount = jpxImage.tiles.length;
  23284. if (tileCount === 1) {
  23285. this.buffer = jpxImage.tiles[0].items;
  23286. } else {
  23287. const data = new Uint8ClampedArray(
  23288. width * height * componentsCount
  23289. );
  23290. for (let k = 0; k < tileCount; k++) {
  23291. const tileComponents = jpxImage.tiles[k];
  23292. const tileWidth = tileComponents.width;
  23293. const tileHeight = tileComponents.height;
  23294. const tileLeft = tileComponents.left;
  23295. const tileTop = tileComponents.top;
  23296. const src = tileComponents.items;
  23297. let srcPosition = 0;
  23298. let dataPosition =
  23299. (width * tileTop + tileLeft) * componentsCount;
  23300. const imgRowSize = width * componentsCount;
  23301. const tileRowSize = tileWidth * componentsCount;
  23302. for (let j = 0; j < tileHeight; j++) {
  23303. const rowBytes = src.subarray(
  23304. srcPosition,
  23305. srcPosition + tileRowSize
  23306. );
  23307. data.set(rowBytes, dataPosition);
  23308. srcPosition += tileRowSize;
  23309. dataPosition += imgRowSize;
  23310. }
  23311. }
  23312. this.buffer = data;
  23313. }
  23314. this.bufferLength = this.buffer.length;
  23315. this.eof = true;
  23316. }
  23317. }
  23318. exports.JpxStream = JpxStream;
  23319. /***/
  23320. },
  23321. /* 30 */
  23322. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23323. Object.defineProperty(exports, "__esModule", {
  23324. value: true,
  23325. });
  23326. exports.JpxImage = void 0;
  23327. var _util = __w_pdfjs_require__(2);
  23328. var _core_utils = __w_pdfjs_require__(6);
  23329. var _arithmetic_decoder = __w_pdfjs_require__(26);
  23330. class JpxError extends _util.BaseException {
  23331. constructor(msg) {
  23332. super(`JPX error: ${msg}`, "JpxError");
  23333. }
  23334. }
  23335. const SubbandsGainLog2 = {
  23336. LL: 0,
  23337. LH: 1,
  23338. HL: 1,
  23339. HH: 2,
  23340. };
  23341. class JpxImage {
  23342. constructor() {
  23343. this.failOnCorruptedImage = false;
  23344. }
  23345. parse(data) {
  23346. const head = (0, _core_utils.readUint16)(data, 0);
  23347. if (head === 0xff4f) {
  23348. this.parseCodestream(data, 0, data.length);
  23349. return;
  23350. }
  23351. const length = data.length;
  23352. let position = 0;
  23353. while (position < length) {
  23354. let headerSize = 8;
  23355. let lbox = (0, _core_utils.readUint32)(data, position);
  23356. const tbox = (0, _core_utils.readUint32)(data, position + 4);
  23357. position += headerSize;
  23358. if (lbox === 1) {
  23359. lbox =
  23360. (0, _core_utils.readUint32)(data, position) * 4294967296 +
  23361. (0, _core_utils.readUint32)(data, position + 4);
  23362. position += 8;
  23363. headerSize += 8;
  23364. }
  23365. if (lbox === 0) {
  23366. lbox = length - position + headerSize;
  23367. }
  23368. if (lbox < headerSize) {
  23369. throw new JpxError("Invalid box field size");
  23370. }
  23371. const dataLength = lbox - headerSize;
  23372. let jumpDataLength = true;
  23373. switch (tbox) {
  23374. case 0x6a703268:
  23375. jumpDataLength = false;
  23376. break;
  23377. case 0x636f6c72:
  23378. const method = data[position];
  23379. if (method === 1) {
  23380. const colorspace = (0, _core_utils.readUint32)(
  23381. data,
  23382. position + 3
  23383. );
  23384. switch (colorspace) {
  23385. case 16:
  23386. case 17:
  23387. case 18:
  23388. break;
  23389. default:
  23390. (0, _util.warn)("Unknown colorspace " + colorspace);
  23391. break;
  23392. }
  23393. } else if (method === 2) {
  23394. (0, _util.info)("ICC profile not supported");
  23395. }
  23396. break;
  23397. case 0x6a703263:
  23398. this.parseCodestream(data, position, position + dataLength);
  23399. break;
  23400. case 0x6a502020:
  23401. if (
  23402. (0, _core_utils.readUint32)(data, position) !== 0x0d0a870a
  23403. ) {
  23404. (0, _util.warn)("Invalid JP2 signature");
  23405. }
  23406. break;
  23407. case 0x6a501a1a:
  23408. case 0x66747970:
  23409. case 0x72726571:
  23410. case 0x72657320:
  23411. case 0x69686472:
  23412. break;
  23413. default:
  23414. const headerType = String.fromCharCode(
  23415. (tbox >> 24) & 0xff,
  23416. (tbox >> 16) & 0xff,
  23417. (tbox >> 8) & 0xff,
  23418. tbox & 0xff
  23419. );
  23420. (0, _util.warn)(
  23421. `Unsupported header type ${tbox} (${headerType}).`
  23422. );
  23423. break;
  23424. }
  23425. if (jumpDataLength) {
  23426. position += dataLength;
  23427. }
  23428. }
  23429. }
  23430. parseImageProperties(stream) {
  23431. let newByte = stream.getByte();
  23432. while (newByte >= 0) {
  23433. const oldByte = newByte;
  23434. newByte = stream.getByte();
  23435. const code = (oldByte << 8) | newByte;
  23436. if (code === 0xff51) {
  23437. stream.skip(4);
  23438. const Xsiz = stream.getInt32() >>> 0;
  23439. const Ysiz = stream.getInt32() >>> 0;
  23440. const XOsiz = stream.getInt32() >>> 0;
  23441. const YOsiz = stream.getInt32() >>> 0;
  23442. stream.skip(16);
  23443. const Csiz = stream.getUint16();
  23444. this.width = Xsiz - XOsiz;
  23445. this.height = Ysiz - YOsiz;
  23446. this.componentsCount = Csiz;
  23447. this.bitsPerComponent = 8;
  23448. return;
  23449. }
  23450. }
  23451. throw new JpxError("No size marker found in JPX stream");
  23452. }
  23453. parseCodestream(data, start, end) {
  23454. const context = {};
  23455. let doNotRecover = false;
  23456. try {
  23457. let position = start;
  23458. while (position + 1 < end) {
  23459. const code = (0, _core_utils.readUint16)(data, position);
  23460. position += 2;
  23461. let length = 0,
  23462. j,
  23463. sqcd,
  23464. spqcds,
  23465. spqcdSize,
  23466. scalarExpounded,
  23467. tile;
  23468. switch (code) {
  23469. case 0xff4f:
  23470. context.mainHeader = true;
  23471. break;
  23472. case 0xffd9:
  23473. break;
  23474. case 0xff51:
  23475. length = (0, _core_utils.readUint16)(data, position);
  23476. const siz = {};
  23477. siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);
  23478. siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);
  23479. siz.XOsiz = (0, _core_utils.readUint32)(
  23480. data,
  23481. position + 12
  23482. );
  23483. siz.YOsiz = (0, _core_utils.readUint32)(
  23484. data,
  23485. position + 16
  23486. );
  23487. siz.XTsiz = (0, _core_utils.readUint32)(
  23488. data,
  23489. position + 20
  23490. );
  23491. siz.YTsiz = (0, _core_utils.readUint32)(
  23492. data,
  23493. position + 24
  23494. );
  23495. siz.XTOsiz = (0, _core_utils.readUint32)(
  23496. data,
  23497. position + 28
  23498. );
  23499. siz.YTOsiz = (0, _core_utils.readUint32)(
  23500. data,
  23501. position + 32
  23502. );
  23503. const componentsCount = (0, _core_utils.readUint16)(
  23504. data,
  23505. position + 36
  23506. );
  23507. siz.Csiz = componentsCount;
  23508. const components = [];
  23509. j = position + 38;
  23510. for (let i = 0; i < componentsCount; i++) {
  23511. const component = {
  23512. precision: (data[j] & 0x7f) + 1,
  23513. isSigned: !!(data[j] & 0x80),
  23514. XRsiz: data[j + 1],
  23515. YRsiz: data[j + 2],
  23516. };
  23517. j += 3;
  23518. calculateComponentDimensions(component, siz);
  23519. components.push(component);
  23520. }
  23521. context.SIZ = siz;
  23522. context.components = components;
  23523. calculateTileGrids(context, components);
  23524. context.QCC = [];
  23525. context.COC = [];
  23526. break;
  23527. case 0xff5c:
  23528. length = (0, _core_utils.readUint16)(data, position);
  23529. const qcd = {};
  23530. j = position + 2;
  23531. sqcd = data[j++];
  23532. switch (sqcd & 0x1f) {
  23533. case 0:
  23534. spqcdSize = 8;
  23535. scalarExpounded = true;
  23536. break;
  23537. case 1:
  23538. spqcdSize = 16;
  23539. scalarExpounded = false;
  23540. break;
  23541. case 2:
  23542. spqcdSize = 16;
  23543. scalarExpounded = true;
  23544. break;
  23545. default:
  23546. throw new Error("Invalid SQcd value " + sqcd);
  23547. }
  23548. qcd.noQuantization = spqcdSize === 8;
  23549. qcd.scalarExpounded = scalarExpounded;
  23550. qcd.guardBits = sqcd >> 5;
  23551. spqcds = [];
  23552. while (j < length + position) {
  23553. const spqcd = {};
  23554. if (spqcdSize === 8) {
  23555. spqcd.epsilon = data[j++] >> 3;
  23556. spqcd.mu = 0;
  23557. } else {
  23558. spqcd.epsilon = data[j] >> 3;
  23559. spqcd.mu = ((data[j] & 0x7) << 8) | data[j + 1];
  23560. j += 2;
  23561. }
  23562. spqcds.push(spqcd);
  23563. }
  23564. qcd.SPqcds = spqcds;
  23565. if (context.mainHeader) {
  23566. context.QCD = qcd;
  23567. } else {
  23568. context.currentTile.QCD = qcd;
  23569. context.currentTile.QCC = [];
  23570. }
  23571. break;
  23572. case 0xff5d:
  23573. length = (0, _core_utils.readUint16)(data, position);
  23574. const qcc = {};
  23575. j = position + 2;
  23576. let cqcc;
  23577. if (context.SIZ.Csiz < 257) {
  23578. cqcc = data[j++];
  23579. } else {
  23580. cqcc = (0, _core_utils.readUint16)(data, j);
  23581. j += 2;
  23582. }
  23583. sqcd = data[j++];
  23584. switch (sqcd & 0x1f) {
  23585. case 0:
  23586. spqcdSize = 8;
  23587. scalarExpounded = true;
  23588. break;
  23589. case 1:
  23590. spqcdSize = 16;
  23591. scalarExpounded = false;
  23592. break;
  23593. case 2:
  23594. spqcdSize = 16;
  23595. scalarExpounded = true;
  23596. break;
  23597. default:
  23598. throw new Error("Invalid SQcd value " + sqcd);
  23599. }
  23600. qcc.noQuantization = spqcdSize === 8;
  23601. qcc.scalarExpounded = scalarExpounded;
  23602. qcc.guardBits = sqcd >> 5;
  23603. spqcds = [];
  23604. while (j < length + position) {
  23605. const spqcd = {};
  23606. if (spqcdSize === 8) {
  23607. spqcd.epsilon = data[j++] >> 3;
  23608. spqcd.mu = 0;
  23609. } else {
  23610. spqcd.epsilon = data[j] >> 3;
  23611. spqcd.mu = ((data[j] & 0x7) << 8) | data[j + 1];
  23612. j += 2;
  23613. }
  23614. spqcds.push(spqcd);
  23615. }
  23616. qcc.SPqcds = spqcds;
  23617. if (context.mainHeader) {
  23618. context.QCC[cqcc] = qcc;
  23619. } else {
  23620. context.currentTile.QCC[cqcc] = qcc;
  23621. }
  23622. break;
  23623. case 0xff52:
  23624. length = (0, _core_utils.readUint16)(data, position);
  23625. const cod = {};
  23626. j = position + 2;
  23627. const scod = data[j++];
  23628. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  23629. cod.sopMarkerUsed = !!(scod & 2);
  23630. cod.ephMarkerUsed = !!(scod & 4);
  23631. cod.progressionOrder = data[j++];
  23632. cod.layersCount = (0, _core_utils.readUint16)(data, j);
  23633. j += 2;
  23634. cod.multipleComponentTransform = data[j++];
  23635. cod.decompositionLevelsCount = data[j++];
  23636. cod.xcb = (data[j++] & 0xf) + 2;
  23637. cod.ycb = (data[j++] & 0xf) + 2;
  23638. const blockStyle = data[j++];
  23639. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  23640. cod.resetContextProbabilities = !!(blockStyle & 2);
  23641. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  23642. cod.verticallyStripe = !!(blockStyle & 8);
  23643. cod.predictableTermination = !!(blockStyle & 16);
  23644. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  23645. cod.reversibleTransformation = data[j++];
  23646. if (cod.entropyCoderWithCustomPrecincts) {
  23647. const precinctsSizes = [];
  23648. while (j < length + position) {
  23649. const precinctsSize = data[j++];
  23650. precinctsSizes.push({
  23651. PPx: precinctsSize & 0xf,
  23652. PPy: precinctsSize >> 4,
  23653. });
  23654. }
  23655. cod.precinctsSizes = precinctsSizes;
  23656. }
  23657. const unsupported = [];
  23658. if (cod.selectiveArithmeticCodingBypass) {
  23659. unsupported.push("selectiveArithmeticCodingBypass");
  23660. }
  23661. if (cod.terminationOnEachCodingPass) {
  23662. unsupported.push("terminationOnEachCodingPass");
  23663. }
  23664. if (cod.verticallyStripe) {
  23665. unsupported.push("verticallyStripe");
  23666. }
  23667. if (cod.predictableTermination) {
  23668. unsupported.push("predictableTermination");
  23669. }
  23670. if (unsupported.length > 0) {
  23671. doNotRecover = true;
  23672. (0, _util.warn)(
  23673. `JPX: Unsupported COD options (${unsupported.join(
  23674. ", "
  23675. )}).`
  23676. );
  23677. }
  23678. if (context.mainHeader) {
  23679. context.COD = cod;
  23680. } else {
  23681. context.currentTile.COD = cod;
  23682. context.currentTile.COC = [];
  23683. }
  23684. break;
  23685. case 0xff90:
  23686. length = (0, _core_utils.readUint16)(data, position);
  23687. tile = {};
  23688. tile.index = (0, _core_utils.readUint16)(
  23689. data,
  23690. position + 2
  23691. );
  23692. tile.length = (0, _core_utils.readUint32)(
  23693. data,
  23694. position + 4
  23695. );
  23696. tile.dataEnd = tile.length + position - 2;
  23697. tile.partIndex = data[position + 8];
  23698. tile.partsCount = data[position + 9];
  23699. context.mainHeader = false;
  23700. if (tile.partIndex === 0) {
  23701. tile.COD = context.COD;
  23702. tile.COC = context.COC.slice(0);
  23703. tile.QCD = context.QCD;
  23704. tile.QCC = context.QCC.slice(0);
  23705. }
  23706. context.currentTile = tile;
  23707. break;
  23708. case 0xff93:
  23709. tile = context.currentTile;
  23710. if (tile.partIndex === 0) {
  23711. initializeTile(context, tile.index);
  23712. buildPackets(context);
  23713. }
  23714. length = tile.dataEnd - position;
  23715. parseTilePackets(context, data, position, length);
  23716. break;
  23717. case 0xff53:
  23718. (0, _util.warn)(
  23719. "JPX: Codestream code 0xFF53 (COC) is not implemented."
  23720. );
  23721. case 0xff55:
  23722. case 0xff57:
  23723. case 0xff58:
  23724. case 0xff64:
  23725. length = (0, _core_utils.readUint16)(data, position);
  23726. break;
  23727. default:
  23728. throw new Error(
  23729. "Unknown codestream code: " + code.toString(16)
  23730. );
  23731. }
  23732. position += length;
  23733. }
  23734. } catch (e) {
  23735. if (doNotRecover || this.failOnCorruptedImage) {
  23736. throw new JpxError(e.message);
  23737. } else {
  23738. (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`);
  23739. }
  23740. }
  23741. this.tiles = transformComponents(context);
  23742. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  23743. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  23744. this.componentsCount = context.SIZ.Csiz;
  23745. }
  23746. }
  23747. exports.JpxImage = JpxImage;
  23748. function calculateComponentDimensions(component, siz) {
  23749. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  23750. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  23751. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  23752. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  23753. component.width = component.x1 - component.x0;
  23754. component.height = component.y1 - component.y0;
  23755. }
  23756. function calculateTileGrids(context, components) {
  23757. const siz = context.SIZ;
  23758. const tiles = [];
  23759. let tile;
  23760. const numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  23761. const numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  23762. for (let q = 0; q < numYtiles; q++) {
  23763. for (let p = 0; p < numXtiles; p++) {
  23764. tile = {};
  23765. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  23766. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  23767. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  23768. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  23769. tile.width = tile.tx1 - tile.tx0;
  23770. tile.height = tile.ty1 - tile.ty0;
  23771. tile.components = [];
  23772. tiles.push(tile);
  23773. }
  23774. }
  23775. context.tiles = tiles;
  23776. const componentsCount = siz.Csiz;
  23777. for (let i = 0, ii = componentsCount; i < ii; i++) {
  23778. const component = components[i];
  23779. for (let j = 0, jj = tiles.length; j < jj; j++) {
  23780. const tileComponent = {};
  23781. tile = tiles[j];
  23782. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  23783. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  23784. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  23785. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  23786. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  23787. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  23788. tile.components[i] = tileComponent;
  23789. }
  23790. }
  23791. }
  23792. function getBlocksDimensions(context, component, r) {
  23793. const codOrCoc = component.codingStyleParameters;
  23794. const result = {};
  23795. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  23796. result.PPx = 15;
  23797. result.PPy = 15;
  23798. } else {
  23799. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  23800. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  23801. }
  23802. result.xcb_ =
  23803. r > 0
  23804. ? Math.min(codOrCoc.xcb, result.PPx - 1)
  23805. : Math.min(codOrCoc.xcb, result.PPx);
  23806. result.ycb_ =
  23807. r > 0
  23808. ? Math.min(codOrCoc.ycb, result.PPy - 1)
  23809. : Math.min(codOrCoc.ycb, result.PPy);
  23810. return result;
  23811. }
  23812. function buildPrecincts(context, resolution, dimensions) {
  23813. const precinctWidth = 1 << dimensions.PPx;
  23814. const precinctHeight = 1 << dimensions.PPy;
  23815. const isZeroRes = resolution.resLevel === 0;
  23816. const precinctWidthInSubband =
  23817. 1 << (dimensions.PPx + (isZeroRes ? 0 : -1));
  23818. const precinctHeightInSubband =
  23819. 1 << (dimensions.PPy + (isZeroRes ? 0 : -1));
  23820. const numprecinctswide =
  23821. resolution.trx1 > resolution.trx0
  23822. ? Math.ceil(resolution.trx1 / precinctWidth) -
  23823. Math.floor(resolution.trx0 / precinctWidth)
  23824. : 0;
  23825. const numprecinctshigh =
  23826. resolution.try1 > resolution.try0
  23827. ? Math.ceil(resolution.try1 / precinctHeight) -
  23828. Math.floor(resolution.try0 / precinctHeight)
  23829. : 0;
  23830. const numprecincts = numprecinctswide * numprecinctshigh;
  23831. resolution.precinctParameters = {
  23832. precinctWidth,
  23833. precinctHeight,
  23834. numprecinctswide,
  23835. numprecinctshigh,
  23836. numprecincts,
  23837. precinctWidthInSubband,
  23838. precinctHeightInSubband,
  23839. };
  23840. }
  23841. function buildCodeblocks(context, subband, dimensions) {
  23842. const xcb_ = dimensions.xcb_;
  23843. const ycb_ = dimensions.ycb_;
  23844. const codeblockWidth = 1 << xcb_;
  23845. const codeblockHeight = 1 << ycb_;
  23846. const cbx0 = subband.tbx0 >> xcb_;
  23847. const cby0 = subband.tby0 >> ycb_;
  23848. const cbx1 = (subband.tbx1 + codeblockWidth - 1) >> xcb_;
  23849. const cby1 = (subband.tby1 + codeblockHeight - 1) >> ycb_;
  23850. const precinctParameters = subband.resolution.precinctParameters;
  23851. const codeblocks = [];
  23852. const precincts = [];
  23853. let i, j, codeblock, precinctNumber;
  23854. for (j = cby0; j < cby1; j++) {
  23855. for (i = cbx0; i < cbx1; i++) {
  23856. codeblock = {
  23857. cbx: i,
  23858. cby: j,
  23859. tbx0: codeblockWidth * i,
  23860. tby0: codeblockHeight * j,
  23861. tbx1: codeblockWidth * (i + 1),
  23862. tby1: codeblockHeight * (j + 1),
  23863. };
  23864. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  23865. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  23866. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  23867. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  23868. const pi = Math.floor(
  23869. (codeblock.tbx0_ - subband.tbx0) /
  23870. precinctParameters.precinctWidthInSubband
  23871. );
  23872. const pj = Math.floor(
  23873. (codeblock.tby0_ - subband.tby0) /
  23874. precinctParameters.precinctHeightInSubband
  23875. );
  23876. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  23877. codeblock.precinctNumber = precinctNumber;
  23878. codeblock.subbandType = subband.type;
  23879. codeblock.Lblock = 3;
  23880. if (
  23881. codeblock.tbx1_ <= codeblock.tbx0_ ||
  23882. codeblock.tby1_ <= codeblock.tby0_
  23883. ) {
  23884. continue;
  23885. }
  23886. codeblocks.push(codeblock);
  23887. let precinct = precincts[precinctNumber];
  23888. if (precinct !== undefined) {
  23889. if (i < precinct.cbxMin) {
  23890. precinct.cbxMin = i;
  23891. } else if (i > precinct.cbxMax) {
  23892. precinct.cbxMax = i;
  23893. }
  23894. if (j < precinct.cbyMin) {
  23895. precinct.cbxMin = j;
  23896. } else if (j > precinct.cbyMax) {
  23897. precinct.cbyMax = j;
  23898. }
  23899. } else {
  23900. precincts[precinctNumber] = precinct = {
  23901. cbxMin: i,
  23902. cbyMin: j,
  23903. cbxMax: i,
  23904. cbyMax: j,
  23905. };
  23906. }
  23907. codeblock.precinct = precinct;
  23908. }
  23909. }
  23910. subband.codeblockParameters = {
  23911. codeblockWidth: xcb_,
  23912. codeblockHeight: ycb_,
  23913. numcodeblockwide: cbx1 - cbx0 + 1,
  23914. numcodeblockhigh: cby1 - cby0 + 1,
  23915. };
  23916. subband.codeblocks = codeblocks;
  23917. subband.precincts = precincts;
  23918. }
  23919. function createPacket(resolution, precinctNumber, layerNumber) {
  23920. const precinctCodeblocks = [];
  23921. const subbands = resolution.subbands;
  23922. for (let i = 0, ii = subbands.length; i < ii; i++) {
  23923. const subband = subbands[i];
  23924. const codeblocks = subband.codeblocks;
  23925. for (let j = 0, jj = codeblocks.length; j < jj; j++) {
  23926. const codeblock = codeblocks[j];
  23927. if (codeblock.precinctNumber !== precinctNumber) {
  23928. continue;
  23929. }
  23930. precinctCodeblocks.push(codeblock);
  23931. }
  23932. }
  23933. return {
  23934. layerNumber,
  23935. codeblocks: precinctCodeblocks,
  23936. };
  23937. }
  23938. function LayerResolutionComponentPositionIterator(context) {
  23939. const siz = context.SIZ;
  23940. const tileIndex = context.currentTile.index;
  23941. const tile = context.tiles[tileIndex];
  23942. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  23943. const componentsCount = siz.Csiz;
  23944. let maxDecompositionLevelsCount = 0;
  23945. for (let q = 0; q < componentsCount; q++) {
  23946. maxDecompositionLevelsCount = Math.max(
  23947. maxDecompositionLevelsCount,
  23948. tile.components[q].codingStyleParameters.decompositionLevelsCount
  23949. );
  23950. }
  23951. let l = 0,
  23952. r = 0,
  23953. i = 0,
  23954. k = 0;
  23955. this.nextPacket = function JpxImage_nextPacket() {
  23956. for (; l < layersCount; l++) {
  23957. for (; r <= maxDecompositionLevelsCount; r++) {
  23958. for (; i < componentsCount; i++) {
  23959. const component = tile.components[i];
  23960. if (
  23961. r > component.codingStyleParameters.decompositionLevelsCount
  23962. ) {
  23963. continue;
  23964. }
  23965. const resolution = component.resolutions[r];
  23966. const numprecincts =
  23967. resolution.precinctParameters.numprecincts;
  23968. for (; k < numprecincts; ) {
  23969. const packet = createPacket(resolution, k, l);
  23970. k++;
  23971. return packet;
  23972. }
  23973. k = 0;
  23974. }
  23975. i = 0;
  23976. }
  23977. r = 0;
  23978. }
  23979. throw new JpxError("Out of packets");
  23980. };
  23981. }
  23982. function ResolutionLayerComponentPositionIterator(context) {
  23983. const siz = context.SIZ;
  23984. const tileIndex = context.currentTile.index;
  23985. const tile = context.tiles[tileIndex];
  23986. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  23987. const componentsCount = siz.Csiz;
  23988. let maxDecompositionLevelsCount = 0;
  23989. for (let q = 0; q < componentsCount; q++) {
  23990. maxDecompositionLevelsCount = Math.max(
  23991. maxDecompositionLevelsCount,
  23992. tile.components[q].codingStyleParameters.decompositionLevelsCount
  23993. );
  23994. }
  23995. let r = 0,
  23996. l = 0,
  23997. i = 0,
  23998. k = 0;
  23999. this.nextPacket = function JpxImage_nextPacket() {
  24000. for (; r <= maxDecompositionLevelsCount; r++) {
  24001. for (; l < layersCount; l++) {
  24002. for (; i < componentsCount; i++) {
  24003. const component = tile.components[i];
  24004. if (
  24005. r > component.codingStyleParameters.decompositionLevelsCount
  24006. ) {
  24007. continue;
  24008. }
  24009. const resolution = component.resolutions[r];
  24010. const numprecincts =
  24011. resolution.precinctParameters.numprecincts;
  24012. for (; k < numprecincts; ) {
  24013. const packet = createPacket(resolution, k, l);
  24014. k++;
  24015. return packet;
  24016. }
  24017. k = 0;
  24018. }
  24019. i = 0;
  24020. }
  24021. l = 0;
  24022. }
  24023. throw new JpxError("Out of packets");
  24024. };
  24025. }
  24026. function ResolutionPositionComponentLayerIterator(context) {
  24027. const siz = context.SIZ;
  24028. const tileIndex = context.currentTile.index;
  24029. const tile = context.tiles[tileIndex];
  24030. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  24031. const componentsCount = siz.Csiz;
  24032. let l, r, c, p;
  24033. let maxDecompositionLevelsCount = 0;
  24034. for (c = 0; c < componentsCount; c++) {
  24035. const component = tile.components[c];
  24036. maxDecompositionLevelsCount = Math.max(
  24037. maxDecompositionLevelsCount,
  24038. component.codingStyleParameters.decompositionLevelsCount
  24039. );
  24040. }
  24041. const maxNumPrecinctsInLevel = new Int32Array(
  24042. maxDecompositionLevelsCount + 1
  24043. );
  24044. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  24045. let maxNumPrecincts = 0;
  24046. for (c = 0; c < componentsCount; ++c) {
  24047. const resolutions = tile.components[c].resolutions;
  24048. if (r < resolutions.length) {
  24049. maxNumPrecincts = Math.max(
  24050. maxNumPrecincts,
  24051. resolutions[r].precinctParameters.numprecincts
  24052. );
  24053. }
  24054. }
  24055. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  24056. }
  24057. l = 0;
  24058. r = 0;
  24059. c = 0;
  24060. p = 0;
  24061. this.nextPacket = function JpxImage_nextPacket() {
  24062. for (; r <= maxDecompositionLevelsCount; r++) {
  24063. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  24064. for (; c < componentsCount; c++) {
  24065. const component = tile.components[c];
  24066. if (
  24067. r > component.codingStyleParameters.decompositionLevelsCount
  24068. ) {
  24069. continue;
  24070. }
  24071. const resolution = component.resolutions[r];
  24072. const numprecincts =
  24073. resolution.precinctParameters.numprecincts;
  24074. if (p >= numprecincts) {
  24075. continue;
  24076. }
  24077. for (; l < layersCount; ) {
  24078. const packet = createPacket(resolution, p, l);
  24079. l++;
  24080. return packet;
  24081. }
  24082. l = 0;
  24083. }
  24084. c = 0;
  24085. }
  24086. p = 0;
  24087. }
  24088. throw new JpxError("Out of packets");
  24089. };
  24090. }
  24091. function PositionComponentResolutionLayerIterator(context) {
  24092. const siz = context.SIZ;
  24093. const tileIndex = context.currentTile.index;
  24094. const tile = context.tiles[tileIndex];
  24095. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  24096. const componentsCount = siz.Csiz;
  24097. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  24098. const precinctsIterationSizes = precinctsSizes;
  24099. let l = 0,
  24100. r = 0,
  24101. c = 0,
  24102. px = 0,
  24103. py = 0;
  24104. this.nextPacket = function JpxImage_nextPacket() {
  24105. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  24106. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  24107. for (; c < componentsCount; c++) {
  24108. const component = tile.components[c];
  24109. const decompositionLevelsCount =
  24110. component.codingStyleParameters.decompositionLevelsCount;
  24111. for (; r <= decompositionLevelsCount; r++) {
  24112. const resolution = component.resolutions[r];
  24113. const sizeInImageScale =
  24114. precinctsSizes.components[c].resolutions[r];
  24115. const k = getPrecinctIndexIfExist(
  24116. px,
  24117. py,
  24118. sizeInImageScale,
  24119. precinctsIterationSizes,
  24120. resolution
  24121. );
  24122. if (k === null) {
  24123. continue;
  24124. }
  24125. for (; l < layersCount; ) {
  24126. const packet = createPacket(resolution, k, l);
  24127. l++;
  24128. return packet;
  24129. }
  24130. l = 0;
  24131. }
  24132. r = 0;
  24133. }
  24134. c = 0;
  24135. }
  24136. px = 0;
  24137. }
  24138. throw new JpxError("Out of packets");
  24139. };
  24140. }
  24141. function ComponentPositionResolutionLayerIterator(context) {
  24142. const siz = context.SIZ;
  24143. const tileIndex = context.currentTile.index;
  24144. const tile = context.tiles[tileIndex];
  24145. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  24146. const componentsCount = siz.Csiz;
  24147. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  24148. let l = 0,
  24149. r = 0,
  24150. c = 0,
  24151. px = 0,
  24152. py = 0;
  24153. this.nextPacket = function JpxImage_nextPacket() {
  24154. for (; c < componentsCount; ++c) {
  24155. const component = tile.components[c];
  24156. const precinctsIterationSizes = precinctsSizes.components[c];
  24157. const decompositionLevelsCount =
  24158. component.codingStyleParameters.decompositionLevelsCount;
  24159. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  24160. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  24161. for (; r <= decompositionLevelsCount; r++) {
  24162. const resolution = component.resolutions[r];
  24163. const sizeInImageScale =
  24164. precinctsIterationSizes.resolutions[r];
  24165. const k = getPrecinctIndexIfExist(
  24166. px,
  24167. py,
  24168. sizeInImageScale,
  24169. precinctsIterationSizes,
  24170. resolution
  24171. );
  24172. if (k === null) {
  24173. continue;
  24174. }
  24175. for (; l < layersCount; ) {
  24176. const packet = createPacket(resolution, k, l);
  24177. l++;
  24178. return packet;
  24179. }
  24180. l = 0;
  24181. }
  24182. r = 0;
  24183. }
  24184. px = 0;
  24185. }
  24186. py = 0;
  24187. }
  24188. throw new JpxError("Out of packets");
  24189. };
  24190. }
  24191. function getPrecinctIndexIfExist(
  24192. pxIndex,
  24193. pyIndex,
  24194. sizeInImageScale,
  24195. precinctIterationSizes,
  24196. resolution
  24197. ) {
  24198. const posX = pxIndex * precinctIterationSizes.minWidth;
  24199. const posY = pyIndex * precinctIterationSizes.minHeight;
  24200. if (
  24201. posX % sizeInImageScale.width !== 0 ||
  24202. posY % sizeInImageScale.height !== 0
  24203. ) {
  24204. return null;
  24205. }
  24206. const startPrecinctRowIndex =
  24207. (posY / sizeInImageScale.width) *
  24208. resolution.precinctParameters.numprecinctswide;
  24209. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  24210. }
  24211. function getPrecinctSizesInImageScale(tile) {
  24212. const componentsCount = tile.components.length;
  24213. let minWidth = Number.MAX_VALUE;
  24214. let minHeight = Number.MAX_VALUE;
  24215. let maxNumWide = 0;
  24216. let maxNumHigh = 0;
  24217. const sizePerComponent = new Array(componentsCount);
  24218. for (let c = 0; c < componentsCount; c++) {
  24219. const component = tile.components[c];
  24220. const decompositionLevelsCount =
  24221. component.codingStyleParameters.decompositionLevelsCount;
  24222. const sizePerResolution = new Array(decompositionLevelsCount + 1);
  24223. let minWidthCurrentComponent = Number.MAX_VALUE;
  24224. let minHeightCurrentComponent = Number.MAX_VALUE;
  24225. let maxNumWideCurrentComponent = 0;
  24226. let maxNumHighCurrentComponent = 0;
  24227. let scale = 1;
  24228. for (let r = decompositionLevelsCount; r >= 0; --r) {
  24229. const resolution = component.resolutions[r];
  24230. const widthCurrentResolution =
  24231. scale * resolution.precinctParameters.precinctWidth;
  24232. const heightCurrentResolution =
  24233. scale * resolution.precinctParameters.precinctHeight;
  24234. minWidthCurrentComponent = Math.min(
  24235. minWidthCurrentComponent,
  24236. widthCurrentResolution
  24237. );
  24238. minHeightCurrentComponent = Math.min(
  24239. minHeightCurrentComponent,
  24240. heightCurrentResolution
  24241. );
  24242. maxNumWideCurrentComponent = Math.max(
  24243. maxNumWideCurrentComponent,
  24244. resolution.precinctParameters.numprecinctswide
  24245. );
  24246. maxNumHighCurrentComponent = Math.max(
  24247. maxNumHighCurrentComponent,
  24248. resolution.precinctParameters.numprecinctshigh
  24249. );
  24250. sizePerResolution[r] = {
  24251. width: widthCurrentResolution,
  24252. height: heightCurrentResolution,
  24253. };
  24254. scale <<= 1;
  24255. }
  24256. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  24257. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  24258. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  24259. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  24260. sizePerComponent[c] = {
  24261. resolutions: sizePerResolution,
  24262. minWidth: minWidthCurrentComponent,
  24263. minHeight: minHeightCurrentComponent,
  24264. maxNumWide: maxNumWideCurrentComponent,
  24265. maxNumHigh: maxNumHighCurrentComponent,
  24266. };
  24267. }
  24268. return {
  24269. components: sizePerComponent,
  24270. minWidth,
  24271. minHeight,
  24272. maxNumWide,
  24273. maxNumHigh,
  24274. };
  24275. }
  24276. function buildPackets(context) {
  24277. const siz = context.SIZ;
  24278. const tileIndex = context.currentTile.index;
  24279. const tile = context.tiles[tileIndex];
  24280. const componentsCount = siz.Csiz;
  24281. for (let c = 0; c < componentsCount; c++) {
  24282. const component = tile.components[c];
  24283. const decompositionLevelsCount =
  24284. component.codingStyleParameters.decompositionLevelsCount;
  24285. const resolutions = [];
  24286. const subbands = [];
  24287. for (let r = 0; r <= decompositionLevelsCount; r++) {
  24288. const blocksDimensions = getBlocksDimensions(
  24289. context,
  24290. component,
  24291. r
  24292. );
  24293. const resolution = {};
  24294. const scale = 1 << (decompositionLevelsCount - r);
  24295. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  24296. resolution.try0 = Math.ceil(component.tcy0 / scale);
  24297. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  24298. resolution.try1 = Math.ceil(component.tcy1 / scale);
  24299. resolution.resLevel = r;
  24300. buildPrecincts(context, resolution, blocksDimensions);
  24301. resolutions.push(resolution);
  24302. let subband;
  24303. if (r === 0) {
  24304. subband = {};
  24305. subband.type = "LL";
  24306. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  24307. subband.tby0 = Math.ceil(component.tcy0 / scale);
  24308. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  24309. subband.tby1 = Math.ceil(component.tcy1 / scale);
  24310. subband.resolution = resolution;
  24311. buildCodeblocks(context, subband, blocksDimensions);
  24312. subbands.push(subband);
  24313. resolution.subbands = [subband];
  24314. } else {
  24315. const bscale = 1 << (decompositionLevelsCount - r + 1);
  24316. const resolutionSubbands = [];
  24317. subband = {};
  24318. subband.type = "HL";
  24319. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  24320. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  24321. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  24322. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  24323. subband.resolution = resolution;
  24324. buildCodeblocks(context, subband, blocksDimensions);
  24325. subbands.push(subband);
  24326. resolutionSubbands.push(subband);
  24327. subband = {};
  24328. subband.type = "LH";
  24329. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  24330. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  24331. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  24332. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  24333. subband.resolution = resolution;
  24334. buildCodeblocks(context, subband, blocksDimensions);
  24335. subbands.push(subband);
  24336. resolutionSubbands.push(subband);
  24337. subband = {};
  24338. subband.type = "HH";
  24339. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  24340. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  24341. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  24342. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  24343. subband.resolution = resolution;
  24344. buildCodeblocks(context, subband, blocksDimensions);
  24345. subbands.push(subband);
  24346. resolutionSubbands.push(subband);
  24347. resolution.subbands = resolutionSubbands;
  24348. }
  24349. }
  24350. component.resolutions = resolutions;
  24351. component.subbands = subbands;
  24352. }
  24353. const progressionOrder =
  24354. tile.codingStyleDefaultParameters.progressionOrder;
  24355. switch (progressionOrder) {
  24356. case 0:
  24357. tile.packetsIterator =
  24358. new LayerResolutionComponentPositionIterator(context);
  24359. break;
  24360. case 1:
  24361. tile.packetsIterator =
  24362. new ResolutionLayerComponentPositionIterator(context);
  24363. break;
  24364. case 2:
  24365. tile.packetsIterator =
  24366. new ResolutionPositionComponentLayerIterator(context);
  24367. break;
  24368. case 3:
  24369. tile.packetsIterator =
  24370. new PositionComponentResolutionLayerIterator(context);
  24371. break;
  24372. case 4:
  24373. tile.packetsIterator =
  24374. new ComponentPositionResolutionLayerIterator(context);
  24375. break;
  24376. default:
  24377. throw new JpxError(
  24378. `Unsupported progression order ${progressionOrder}`
  24379. );
  24380. }
  24381. }
  24382. function parseTilePackets(context, data, offset, dataLength) {
  24383. let position = 0;
  24384. let buffer,
  24385. bufferSize = 0,
  24386. skipNextBit = false;
  24387. function readBits(count) {
  24388. while (bufferSize < count) {
  24389. const b = data[offset + position];
  24390. position++;
  24391. if (skipNextBit) {
  24392. buffer = (buffer << 7) | b;
  24393. bufferSize += 7;
  24394. skipNextBit = false;
  24395. } else {
  24396. buffer = (buffer << 8) | b;
  24397. bufferSize += 8;
  24398. }
  24399. if (b === 0xff) {
  24400. skipNextBit = true;
  24401. }
  24402. }
  24403. bufferSize -= count;
  24404. return (buffer >>> bufferSize) & ((1 << count) - 1);
  24405. }
  24406. function skipMarkerIfEqual(value) {
  24407. if (
  24408. data[offset + position - 1] === 0xff &&
  24409. data[offset + position] === value
  24410. ) {
  24411. skipBytes(1);
  24412. return true;
  24413. } else if (
  24414. data[offset + position] === 0xff &&
  24415. data[offset + position + 1] === value
  24416. ) {
  24417. skipBytes(2);
  24418. return true;
  24419. }
  24420. return false;
  24421. }
  24422. function skipBytes(count) {
  24423. position += count;
  24424. }
  24425. function alignToByte() {
  24426. bufferSize = 0;
  24427. if (skipNextBit) {
  24428. position++;
  24429. skipNextBit = false;
  24430. }
  24431. }
  24432. function readCodingpasses() {
  24433. if (readBits(1) === 0) {
  24434. return 1;
  24435. }
  24436. if (readBits(1) === 0) {
  24437. return 2;
  24438. }
  24439. let value = readBits(2);
  24440. if (value < 3) {
  24441. return value + 3;
  24442. }
  24443. value = readBits(5);
  24444. if (value < 31) {
  24445. return value + 6;
  24446. }
  24447. value = readBits(7);
  24448. return value + 37;
  24449. }
  24450. const tileIndex = context.currentTile.index;
  24451. const tile = context.tiles[tileIndex];
  24452. const sopMarkerUsed = context.COD.sopMarkerUsed;
  24453. const ephMarkerUsed = context.COD.ephMarkerUsed;
  24454. const packetsIterator = tile.packetsIterator;
  24455. while (position < dataLength) {
  24456. alignToByte();
  24457. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  24458. skipBytes(4);
  24459. }
  24460. const packet = packetsIterator.nextPacket();
  24461. if (!readBits(1)) {
  24462. continue;
  24463. }
  24464. const layerNumber = packet.layerNumber,
  24465. queue = [];
  24466. let codeblock;
  24467. for (let i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  24468. codeblock = packet.codeblocks[i];
  24469. let precinct = codeblock.precinct;
  24470. const codeblockColumn = codeblock.cbx - precinct.cbxMin;
  24471. const codeblockRow = codeblock.cby - precinct.cbyMin;
  24472. let codeblockIncluded = false;
  24473. let firstTimeInclusion = false;
  24474. let valueReady, zeroBitPlanesTree;
  24475. if (codeblock.included !== undefined) {
  24476. codeblockIncluded = !!readBits(1);
  24477. } else {
  24478. precinct = codeblock.precinct;
  24479. let inclusionTree;
  24480. if (precinct.inclusionTree !== undefined) {
  24481. inclusionTree = precinct.inclusionTree;
  24482. } else {
  24483. const width = precinct.cbxMax - precinct.cbxMin + 1;
  24484. const height = precinct.cbyMax - precinct.cbyMin + 1;
  24485. inclusionTree = new InclusionTree(width, height, layerNumber);
  24486. zeroBitPlanesTree = new TagTree(width, height);
  24487. precinct.inclusionTree = inclusionTree;
  24488. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  24489. for (let l = 0; l < layerNumber; l++) {
  24490. if (readBits(1) !== 0) {
  24491. throw new JpxError("Invalid tag tree");
  24492. }
  24493. }
  24494. }
  24495. if (
  24496. inclusionTree.reset(
  24497. codeblockColumn,
  24498. codeblockRow,
  24499. layerNumber
  24500. )
  24501. ) {
  24502. while (true) {
  24503. if (readBits(1)) {
  24504. valueReady = !inclusionTree.nextLevel();
  24505. if (valueReady) {
  24506. codeblock.included = true;
  24507. codeblockIncluded = firstTimeInclusion = true;
  24508. break;
  24509. }
  24510. } else {
  24511. inclusionTree.incrementValue(layerNumber);
  24512. break;
  24513. }
  24514. }
  24515. }
  24516. }
  24517. if (!codeblockIncluded) {
  24518. continue;
  24519. }
  24520. if (firstTimeInclusion) {
  24521. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  24522. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  24523. while (true) {
  24524. if (readBits(1)) {
  24525. valueReady = !zeroBitPlanesTree.nextLevel();
  24526. if (valueReady) {
  24527. break;
  24528. }
  24529. } else {
  24530. zeroBitPlanesTree.incrementValue();
  24531. }
  24532. }
  24533. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  24534. }
  24535. const codingpasses = readCodingpasses();
  24536. while (readBits(1)) {
  24537. codeblock.Lblock++;
  24538. }
  24539. const codingpassesLog2 = (0, _core_utils.log2)(codingpasses);
  24540. const bits =
  24541. (codingpasses < 1 << codingpassesLog2
  24542. ? codingpassesLog2 - 1
  24543. : codingpassesLog2) + codeblock.Lblock;
  24544. const codedDataLength = readBits(bits);
  24545. queue.push({
  24546. codeblock,
  24547. codingpasses,
  24548. dataLength: codedDataLength,
  24549. });
  24550. }
  24551. alignToByte();
  24552. if (ephMarkerUsed) {
  24553. skipMarkerIfEqual(0x92);
  24554. }
  24555. while (queue.length > 0) {
  24556. const packetItem = queue.shift();
  24557. codeblock = packetItem.codeblock;
  24558. if (codeblock.data === undefined) {
  24559. codeblock.data = [];
  24560. }
  24561. codeblock.data.push({
  24562. data,
  24563. start: offset + position,
  24564. end: offset + position + packetItem.dataLength,
  24565. codingpasses: packetItem.codingpasses,
  24566. });
  24567. position += packetItem.dataLength;
  24568. }
  24569. }
  24570. return position;
  24571. }
  24572. function copyCoefficients(
  24573. coefficients,
  24574. levelWidth,
  24575. levelHeight,
  24576. subband,
  24577. delta,
  24578. mb,
  24579. reversible,
  24580. segmentationSymbolUsed,
  24581. resetContextProbabilities
  24582. ) {
  24583. const x0 = subband.tbx0;
  24584. const y0 = subband.tby0;
  24585. const width = subband.tbx1 - subband.tbx0;
  24586. const codeblocks = subband.codeblocks;
  24587. const right = subband.type.charAt(0) === "H" ? 1 : 0;
  24588. const bottom = subband.type.charAt(1) === "H" ? levelWidth : 0;
  24589. for (let i = 0, ii = codeblocks.length; i < ii; ++i) {
  24590. const codeblock = codeblocks[i];
  24591. const blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  24592. const blockHeight = codeblock.tby1_ - codeblock.tby0_;
  24593. if (blockWidth === 0 || blockHeight === 0) {
  24594. continue;
  24595. }
  24596. if (codeblock.data === undefined) {
  24597. continue;
  24598. }
  24599. const bitModel = new BitModel(
  24600. blockWidth,
  24601. blockHeight,
  24602. codeblock.subbandType,
  24603. codeblock.zeroBitPlanes,
  24604. mb
  24605. );
  24606. let currentCodingpassType = 2;
  24607. const data = codeblock.data;
  24608. let totalLength = 0,
  24609. codingpasses = 0;
  24610. let j, jj, dataItem;
  24611. for (j = 0, jj = data.length; j < jj; j++) {
  24612. dataItem = data[j];
  24613. totalLength += dataItem.end - dataItem.start;
  24614. codingpasses += dataItem.codingpasses;
  24615. }
  24616. const encodedData = new Uint8Array(totalLength);
  24617. let position = 0;
  24618. for (j = 0, jj = data.length; j < jj; j++) {
  24619. dataItem = data[j];
  24620. const chunk = dataItem.data.subarray(
  24621. dataItem.start,
  24622. dataItem.end
  24623. );
  24624. encodedData.set(chunk, position);
  24625. position += chunk.length;
  24626. }
  24627. const decoder = new _arithmetic_decoder.ArithmeticDecoder(
  24628. encodedData,
  24629. 0,
  24630. totalLength
  24631. );
  24632. bitModel.setDecoder(decoder);
  24633. for (j = 0; j < codingpasses; j++) {
  24634. switch (currentCodingpassType) {
  24635. case 0:
  24636. bitModel.runSignificancePropagationPass();
  24637. break;
  24638. case 1:
  24639. bitModel.runMagnitudeRefinementPass();
  24640. break;
  24641. case 2:
  24642. bitModel.runCleanupPass();
  24643. if (segmentationSymbolUsed) {
  24644. bitModel.checkSegmentationSymbol();
  24645. }
  24646. break;
  24647. }
  24648. if (resetContextProbabilities) {
  24649. bitModel.reset();
  24650. }
  24651. currentCodingpassType = (currentCodingpassType + 1) % 3;
  24652. }
  24653. let offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  24654. const sign = bitModel.coefficentsSign;
  24655. const magnitude = bitModel.coefficentsMagnitude;
  24656. const bitsDecoded = bitModel.bitsDecoded;
  24657. const magnitudeCorrection = reversible ? 0 : 0.5;
  24658. let k, n, nb;
  24659. position = 0;
  24660. const interleave = subband.type !== "LL";
  24661. for (j = 0; j < blockHeight; j++) {
  24662. const row = (offset / width) | 0;
  24663. const levelOffset =
  24664. 2 * row * (levelWidth - width) + right + bottom;
  24665. for (k = 0; k < blockWidth; k++) {
  24666. n = magnitude[position];
  24667. if (n !== 0) {
  24668. n = (n + magnitudeCorrection) * delta;
  24669. if (sign[position] !== 0) {
  24670. n = -n;
  24671. }
  24672. nb = bitsDecoded[position];
  24673. const pos = interleave ? levelOffset + (offset << 1) : offset;
  24674. if (reversible && nb >= mb) {
  24675. coefficients[pos] = n;
  24676. } else {
  24677. coefficients[pos] = n * (1 << (mb - nb));
  24678. }
  24679. }
  24680. offset++;
  24681. position++;
  24682. }
  24683. offset += width - blockWidth;
  24684. }
  24685. }
  24686. }
  24687. function transformTile(context, tile, c) {
  24688. const component = tile.components[c];
  24689. const codingStyleParameters = component.codingStyleParameters;
  24690. const quantizationParameters = component.quantizationParameters;
  24691. const decompositionLevelsCount =
  24692. codingStyleParameters.decompositionLevelsCount;
  24693. const spqcds = quantizationParameters.SPqcds;
  24694. const scalarExpounded = quantizationParameters.scalarExpounded;
  24695. const guardBits = quantizationParameters.guardBits;
  24696. const segmentationSymbolUsed =
  24697. codingStyleParameters.segmentationSymbolUsed;
  24698. const resetContextProbabilities =
  24699. codingStyleParameters.resetContextProbabilities;
  24700. const precision = context.components[c].precision;
  24701. const reversible = codingStyleParameters.reversibleTransformation;
  24702. const transform = reversible
  24703. ? new ReversibleTransform()
  24704. : new IrreversibleTransform();
  24705. const subbandCoefficients = [];
  24706. let b = 0;
  24707. for (let i = 0; i <= decompositionLevelsCount; i++) {
  24708. const resolution = component.resolutions[i];
  24709. const width = resolution.trx1 - resolution.trx0;
  24710. const height = resolution.try1 - resolution.try0;
  24711. const coefficients = new Float32Array(width * height);
  24712. for (let j = 0, jj = resolution.subbands.length; j < jj; j++) {
  24713. let mu, epsilon;
  24714. if (!scalarExpounded) {
  24715. mu = spqcds[0].mu;
  24716. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  24717. } else {
  24718. mu = spqcds[b].mu;
  24719. epsilon = spqcds[b].epsilon;
  24720. b++;
  24721. }
  24722. const subband = resolution.subbands[j];
  24723. const gainLog2 = SubbandsGainLog2[subband.type];
  24724. const delta = reversible
  24725. ? 1
  24726. : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
  24727. const mb = guardBits + epsilon - 1;
  24728. copyCoefficients(
  24729. coefficients,
  24730. width,
  24731. height,
  24732. subband,
  24733. delta,
  24734. mb,
  24735. reversible,
  24736. segmentationSymbolUsed,
  24737. resetContextProbabilities
  24738. );
  24739. }
  24740. subbandCoefficients.push({
  24741. width,
  24742. height,
  24743. items: coefficients,
  24744. });
  24745. }
  24746. const result = transform.calculate(
  24747. subbandCoefficients,
  24748. component.tcx0,
  24749. component.tcy0
  24750. );
  24751. return {
  24752. left: component.tcx0,
  24753. top: component.tcy0,
  24754. width: result.width,
  24755. height: result.height,
  24756. items: result.items,
  24757. };
  24758. }
  24759. function transformComponents(context) {
  24760. const siz = context.SIZ;
  24761. const components = context.components;
  24762. const componentsCount = siz.Csiz;
  24763. const resultImages = [];
  24764. for (let i = 0, ii = context.tiles.length; i < ii; i++) {
  24765. const tile = context.tiles[i];
  24766. const transformedTiles = [];
  24767. for (let c = 0; c < componentsCount; c++) {
  24768. transformedTiles[c] = transformTile(context, tile, c);
  24769. }
  24770. const tile0 = transformedTiles[0];
  24771. const out = new Uint8ClampedArray(
  24772. tile0.items.length * componentsCount
  24773. );
  24774. const result = {
  24775. left: tile0.left,
  24776. top: tile0.top,
  24777. width: tile0.width,
  24778. height: tile0.height,
  24779. items: out,
  24780. };
  24781. let shift, offset;
  24782. let pos = 0,
  24783. j,
  24784. jj,
  24785. y0,
  24786. y1,
  24787. y2;
  24788. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  24789. const fourComponents = componentsCount === 4;
  24790. const y0items = transformedTiles[0].items;
  24791. const y1items = transformedTiles[1].items;
  24792. const y2items = transformedTiles[2].items;
  24793. const y3items = fourComponents ? transformedTiles[3].items : null;
  24794. shift = components[0].precision - 8;
  24795. offset = (128 << shift) + 0.5;
  24796. const component0 = tile.components[0];
  24797. const alpha01 = componentsCount - 3;
  24798. jj = y0items.length;
  24799. if (!component0.codingStyleParameters.reversibleTransformation) {
  24800. for (j = 0; j < jj; j++, pos += alpha01) {
  24801. y0 = y0items[j] + offset;
  24802. y1 = y1items[j];
  24803. y2 = y2items[j];
  24804. out[pos++] = (y0 + 1.402 * y2) >> shift;
  24805. out[pos++] = (y0 - 0.34413 * y1 - 0.71414 * y2) >> shift;
  24806. out[pos++] = (y0 + 1.772 * y1) >> shift;
  24807. }
  24808. } else {
  24809. for (j = 0; j < jj; j++, pos += alpha01) {
  24810. y0 = y0items[j] + offset;
  24811. y1 = y1items[j];
  24812. y2 = y2items[j];
  24813. const g = y0 - ((y2 + y1) >> 2);
  24814. out[pos++] = (g + y2) >> shift;
  24815. out[pos++] = g >> shift;
  24816. out[pos++] = (g + y1) >> shift;
  24817. }
  24818. }
  24819. if (fourComponents) {
  24820. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  24821. out[pos] = (y3items[j] + offset) >> shift;
  24822. }
  24823. }
  24824. } else {
  24825. for (let c = 0; c < componentsCount; c++) {
  24826. const items = transformedTiles[c].items;
  24827. shift = components[c].precision - 8;
  24828. offset = (128 << shift) + 0.5;
  24829. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  24830. out[pos] = (items[j] + offset) >> shift;
  24831. pos += componentsCount;
  24832. }
  24833. }
  24834. }
  24835. resultImages.push(result);
  24836. }
  24837. return resultImages;
  24838. }
  24839. function initializeTile(context, tileIndex) {
  24840. const siz = context.SIZ;
  24841. const componentsCount = siz.Csiz;
  24842. const tile = context.tiles[tileIndex];
  24843. for (let c = 0; c < componentsCount; c++) {
  24844. const component = tile.components[c];
  24845. const qcdOrQcc =
  24846. context.currentTile.QCC[c] !== undefined
  24847. ? context.currentTile.QCC[c]
  24848. : context.currentTile.QCD;
  24849. component.quantizationParameters = qcdOrQcc;
  24850. const codOrCoc =
  24851. context.currentTile.COC[c] !== undefined
  24852. ? context.currentTile.COC[c]
  24853. : context.currentTile.COD;
  24854. component.codingStyleParameters = codOrCoc;
  24855. }
  24856. tile.codingStyleDefaultParameters = context.currentTile.COD;
  24857. }
  24858. class TagTree {
  24859. constructor(width, height) {
  24860. const levelsLength =
  24861. (0, _core_utils.log2)(Math.max(width, height)) + 1;
  24862. this.levels = [];
  24863. for (let i = 0; i < levelsLength; i++) {
  24864. const level = {
  24865. width,
  24866. height,
  24867. items: [],
  24868. };
  24869. this.levels.push(level);
  24870. width = Math.ceil(width / 2);
  24871. height = Math.ceil(height / 2);
  24872. }
  24873. }
  24874. reset(i, j) {
  24875. let currentLevel = 0,
  24876. value = 0,
  24877. level;
  24878. while (currentLevel < this.levels.length) {
  24879. level = this.levels[currentLevel];
  24880. const index = i + j * level.width;
  24881. if (level.items[index] !== undefined) {
  24882. value = level.items[index];
  24883. break;
  24884. }
  24885. level.index = index;
  24886. i >>= 1;
  24887. j >>= 1;
  24888. currentLevel++;
  24889. }
  24890. currentLevel--;
  24891. level = this.levels[currentLevel];
  24892. level.items[level.index] = value;
  24893. this.currentLevel = currentLevel;
  24894. delete this.value;
  24895. }
  24896. incrementValue() {
  24897. const level = this.levels[this.currentLevel];
  24898. level.items[level.index]++;
  24899. }
  24900. nextLevel() {
  24901. let currentLevel = this.currentLevel;
  24902. let level = this.levels[currentLevel];
  24903. const value = level.items[level.index];
  24904. currentLevel--;
  24905. if (currentLevel < 0) {
  24906. this.value = value;
  24907. return false;
  24908. }
  24909. this.currentLevel = currentLevel;
  24910. level = this.levels[currentLevel];
  24911. level.items[level.index] = value;
  24912. return true;
  24913. }
  24914. }
  24915. class InclusionTree {
  24916. constructor(width, height, defaultValue) {
  24917. const levelsLength =
  24918. (0, _core_utils.log2)(Math.max(width, height)) + 1;
  24919. this.levels = [];
  24920. for (let i = 0; i < levelsLength; i++) {
  24921. const items = new Uint8Array(width * height);
  24922. for (let j = 0, jj = items.length; j < jj; j++) {
  24923. items[j] = defaultValue;
  24924. }
  24925. const level = {
  24926. width,
  24927. height,
  24928. items,
  24929. };
  24930. this.levels.push(level);
  24931. width = Math.ceil(width / 2);
  24932. height = Math.ceil(height / 2);
  24933. }
  24934. }
  24935. reset(i, j, stopValue) {
  24936. let currentLevel = 0;
  24937. while (currentLevel < this.levels.length) {
  24938. const level = this.levels[currentLevel];
  24939. const index = i + j * level.width;
  24940. level.index = index;
  24941. const value = level.items[index];
  24942. if (value === 0xff) {
  24943. break;
  24944. }
  24945. if (value > stopValue) {
  24946. this.currentLevel = currentLevel;
  24947. this.propagateValues();
  24948. return false;
  24949. }
  24950. i >>= 1;
  24951. j >>= 1;
  24952. currentLevel++;
  24953. }
  24954. this.currentLevel = currentLevel - 1;
  24955. return true;
  24956. }
  24957. incrementValue(stopValue) {
  24958. const level = this.levels[this.currentLevel];
  24959. level.items[level.index] = stopValue + 1;
  24960. this.propagateValues();
  24961. }
  24962. propagateValues() {
  24963. let levelIndex = this.currentLevel;
  24964. let level = this.levels[levelIndex];
  24965. const currentValue = level.items[level.index];
  24966. while (--levelIndex >= 0) {
  24967. level = this.levels[levelIndex];
  24968. level.items[level.index] = currentValue;
  24969. }
  24970. }
  24971. nextLevel() {
  24972. let currentLevel = this.currentLevel;
  24973. let level = this.levels[currentLevel];
  24974. const value = level.items[level.index];
  24975. level.items[level.index] = 0xff;
  24976. currentLevel--;
  24977. if (currentLevel < 0) {
  24978. return false;
  24979. }
  24980. this.currentLevel = currentLevel;
  24981. level = this.levels[currentLevel];
  24982. level.items[level.index] = value;
  24983. return true;
  24984. }
  24985. }
  24986. const BitModel = (function BitModelClosure() {
  24987. const UNIFORM_CONTEXT = 17;
  24988. const RUNLENGTH_CONTEXT = 18;
  24989. const LLAndLHContextsLabel = new Uint8Array([
  24990. 0, 5, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 1, 6, 8, 0, 3, 7, 8,
  24991. 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0,
  24992. 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3,
  24993. 7, 8, 0, 4, 7, 8,
  24994. ]);
  24995. const HLContextLabel = new Uint8Array([
  24996. 0, 3, 4, 0, 5, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 1, 3, 4, 0, 6, 7, 7,
  24997. 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0,
  24998. 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6,
  24999. 7, 7, 0, 8, 8, 8,
  25000. ]);
  25001. const HHContextLabel = new Uint8Array([
  25002. 0, 1, 2, 0, 1, 2, 2, 0, 2, 2, 2, 0, 0, 0, 0, 0, 3, 4, 5, 0, 4, 5, 5,
  25003. 0, 5, 5, 5, 0, 0, 0, 0, 0, 6, 7, 7, 0, 7, 7, 7, 0, 7, 7, 7, 0, 0, 0,
  25004. 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8,
  25005. 8, 8, 0, 8, 8, 8,
  25006. ]);
  25007. class BitModel {
  25008. constructor(width, height, subband, zeroBitPlanes, mb) {
  25009. this.width = width;
  25010. this.height = height;
  25011. let contextLabelTable;
  25012. if (subband === "HH") {
  25013. contextLabelTable = HHContextLabel;
  25014. } else if (subband === "HL") {
  25015. contextLabelTable = HLContextLabel;
  25016. } else {
  25017. contextLabelTable = LLAndLHContextsLabel;
  25018. }
  25019. this.contextLabelTable = contextLabelTable;
  25020. const coefficientCount = width * height;
  25021. this.neighborsSignificance = new Uint8Array(coefficientCount);
  25022. this.coefficentsSign = new Uint8Array(coefficientCount);
  25023. let coefficentsMagnitude;
  25024. if (mb > 14) {
  25025. coefficentsMagnitude = new Uint32Array(coefficientCount);
  25026. } else if (mb > 6) {
  25027. coefficentsMagnitude = new Uint16Array(coefficientCount);
  25028. } else {
  25029. coefficentsMagnitude = new Uint8Array(coefficientCount);
  25030. }
  25031. this.coefficentsMagnitude = coefficentsMagnitude;
  25032. this.processingFlags = new Uint8Array(coefficientCount);
  25033. const bitsDecoded = new Uint8Array(coefficientCount);
  25034. if (zeroBitPlanes !== 0) {
  25035. for (let i = 0; i < coefficientCount; i++) {
  25036. bitsDecoded[i] = zeroBitPlanes;
  25037. }
  25038. }
  25039. this.bitsDecoded = bitsDecoded;
  25040. this.reset();
  25041. }
  25042. setDecoder(decoder) {
  25043. this.decoder = decoder;
  25044. }
  25045. reset() {
  25046. this.contexts = new Int8Array(19);
  25047. this.contexts[0] = (4 << 1) | 0;
  25048. this.contexts[UNIFORM_CONTEXT] = (46 << 1) | 0;
  25049. this.contexts[RUNLENGTH_CONTEXT] = (3 << 1) | 0;
  25050. }
  25051. setNeighborsSignificance(row, column, index) {
  25052. const neighborsSignificance = this.neighborsSignificance;
  25053. const width = this.width,
  25054. height = this.height;
  25055. const left = column > 0;
  25056. const right = column + 1 < width;
  25057. let i;
  25058. if (row > 0) {
  25059. i = index - width;
  25060. if (left) {
  25061. neighborsSignificance[i - 1] += 0x10;
  25062. }
  25063. if (right) {
  25064. neighborsSignificance[i + 1] += 0x10;
  25065. }
  25066. neighborsSignificance[i] += 0x04;
  25067. }
  25068. if (row + 1 < height) {
  25069. i = index + width;
  25070. if (left) {
  25071. neighborsSignificance[i - 1] += 0x10;
  25072. }
  25073. if (right) {
  25074. neighborsSignificance[i + 1] += 0x10;
  25075. }
  25076. neighborsSignificance[i] += 0x04;
  25077. }
  25078. if (left) {
  25079. neighborsSignificance[index - 1] += 0x01;
  25080. }
  25081. if (right) {
  25082. neighborsSignificance[index + 1] += 0x01;
  25083. }
  25084. neighborsSignificance[index] |= 0x80;
  25085. }
  25086. runSignificancePropagationPass() {
  25087. const decoder = this.decoder;
  25088. const width = this.width,
  25089. height = this.height;
  25090. const coefficentsMagnitude = this.coefficentsMagnitude;
  25091. const coefficentsSign = this.coefficentsSign;
  25092. const neighborsSignificance = this.neighborsSignificance;
  25093. const processingFlags = this.processingFlags;
  25094. const contexts = this.contexts;
  25095. const labels = this.contextLabelTable;
  25096. const bitsDecoded = this.bitsDecoded;
  25097. const processedInverseMask = ~1;
  25098. const processedMask = 1;
  25099. const firstMagnitudeBitMask = 2;
  25100. for (let i0 = 0; i0 < height; i0 += 4) {
  25101. for (let j = 0; j < width; j++) {
  25102. let index = i0 * width + j;
  25103. for (let i1 = 0; i1 < 4; i1++, index += width) {
  25104. const i = i0 + i1;
  25105. if (i >= height) {
  25106. break;
  25107. }
  25108. processingFlags[index] &= processedInverseMask;
  25109. if (
  25110. coefficentsMagnitude[index] ||
  25111. !neighborsSignificance[index]
  25112. ) {
  25113. continue;
  25114. }
  25115. const contextLabel = labels[neighborsSignificance[index]];
  25116. const decision = decoder.readBit(contexts, contextLabel);
  25117. if (decision) {
  25118. const sign = this.decodeSignBit(i, j, index);
  25119. coefficentsSign[index] = sign;
  25120. coefficentsMagnitude[index] = 1;
  25121. this.setNeighborsSignificance(i, j, index);
  25122. processingFlags[index] |= firstMagnitudeBitMask;
  25123. }
  25124. bitsDecoded[index]++;
  25125. processingFlags[index] |= processedMask;
  25126. }
  25127. }
  25128. }
  25129. }
  25130. decodeSignBit(row, column, index) {
  25131. const width = this.width,
  25132. height = this.height;
  25133. const coefficentsMagnitude = this.coefficentsMagnitude;
  25134. const coefficentsSign = this.coefficentsSign;
  25135. let contribution, sign0, sign1, significance1;
  25136. let contextLabel, decoded;
  25137. significance1 =
  25138. column > 0 && coefficentsMagnitude[index - 1] !== 0;
  25139. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  25140. sign1 = coefficentsSign[index + 1];
  25141. if (significance1) {
  25142. sign0 = coefficentsSign[index - 1];
  25143. contribution = 1 - sign1 - sign0;
  25144. } else {
  25145. contribution = 1 - sign1 - sign1;
  25146. }
  25147. } else if (significance1) {
  25148. sign0 = coefficentsSign[index - 1];
  25149. contribution = 1 - sign0 - sign0;
  25150. } else {
  25151. contribution = 0;
  25152. }
  25153. const horizontalContribution = 3 * contribution;
  25154. significance1 =
  25155. row > 0 && coefficentsMagnitude[index - width] !== 0;
  25156. if (
  25157. row + 1 < height &&
  25158. coefficentsMagnitude[index + width] !== 0
  25159. ) {
  25160. sign1 = coefficentsSign[index + width];
  25161. if (significance1) {
  25162. sign0 = coefficentsSign[index - width];
  25163. contribution = 1 - sign1 - sign0 + horizontalContribution;
  25164. } else {
  25165. contribution = 1 - sign1 - sign1 + horizontalContribution;
  25166. }
  25167. } else if (significance1) {
  25168. sign0 = coefficentsSign[index - width];
  25169. contribution = 1 - sign0 - sign0 + horizontalContribution;
  25170. } else {
  25171. contribution = horizontalContribution;
  25172. }
  25173. if (contribution >= 0) {
  25174. contextLabel = 9 + contribution;
  25175. decoded = this.decoder.readBit(this.contexts, contextLabel);
  25176. } else {
  25177. contextLabel = 9 - contribution;
  25178. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  25179. }
  25180. return decoded;
  25181. }
  25182. runMagnitudeRefinementPass() {
  25183. const decoder = this.decoder;
  25184. const width = this.width,
  25185. height = this.height;
  25186. const coefficentsMagnitude = this.coefficentsMagnitude;
  25187. const neighborsSignificance = this.neighborsSignificance;
  25188. const contexts = this.contexts;
  25189. const bitsDecoded = this.bitsDecoded;
  25190. const processingFlags = this.processingFlags;
  25191. const processedMask = 1;
  25192. const firstMagnitudeBitMask = 2;
  25193. const length = width * height;
  25194. const width4 = width * 4;
  25195. for (
  25196. let index0 = 0, indexNext;
  25197. index0 < length;
  25198. index0 = indexNext
  25199. ) {
  25200. indexNext = Math.min(length, index0 + width4);
  25201. for (let j = 0; j < width; j++) {
  25202. for (
  25203. let index = index0 + j;
  25204. index < indexNext;
  25205. index += width
  25206. ) {
  25207. if (
  25208. !coefficentsMagnitude[index] ||
  25209. (processingFlags[index] & processedMask) !== 0
  25210. ) {
  25211. continue;
  25212. }
  25213. let contextLabel = 16;
  25214. if (
  25215. (processingFlags[index] & firstMagnitudeBitMask) !==
  25216. 0
  25217. ) {
  25218. processingFlags[index] ^= firstMagnitudeBitMask;
  25219. const significance = neighborsSignificance[index] & 127;
  25220. contextLabel = significance === 0 ? 15 : 14;
  25221. }
  25222. const bit = decoder.readBit(contexts, contextLabel);
  25223. coefficentsMagnitude[index] =
  25224. (coefficentsMagnitude[index] << 1) | bit;
  25225. bitsDecoded[index]++;
  25226. processingFlags[index] |= processedMask;
  25227. }
  25228. }
  25229. }
  25230. }
  25231. runCleanupPass() {
  25232. const decoder = this.decoder;
  25233. const width = this.width,
  25234. height = this.height;
  25235. const neighborsSignificance = this.neighborsSignificance;
  25236. const coefficentsMagnitude = this.coefficentsMagnitude;
  25237. const coefficentsSign = this.coefficentsSign;
  25238. const contexts = this.contexts;
  25239. const labels = this.contextLabelTable;
  25240. const bitsDecoded = this.bitsDecoded;
  25241. const processingFlags = this.processingFlags;
  25242. const processedMask = 1;
  25243. const firstMagnitudeBitMask = 2;
  25244. const oneRowDown = width;
  25245. const twoRowsDown = width * 2;
  25246. const threeRowsDown = width * 3;
  25247. let iNext;
  25248. for (let i0 = 0; i0 < height; i0 = iNext) {
  25249. iNext = Math.min(i0 + 4, height);
  25250. const indexBase = i0 * width;
  25251. const checkAllEmpty = i0 + 3 < height;
  25252. for (let j = 0; j < width; j++) {
  25253. const index0 = indexBase + j;
  25254. const allEmpty =
  25255. checkAllEmpty &&
  25256. processingFlags[index0] === 0 &&
  25257. processingFlags[index0 + oneRowDown] === 0 &&
  25258. processingFlags[index0 + twoRowsDown] === 0 &&
  25259. processingFlags[index0 + threeRowsDown] === 0 &&
  25260. neighborsSignificance[index0] === 0 &&
  25261. neighborsSignificance[index0 + oneRowDown] === 0 &&
  25262. neighborsSignificance[index0 + twoRowsDown] === 0 &&
  25263. neighborsSignificance[index0 + threeRowsDown] === 0;
  25264. let i1 = 0,
  25265. index = index0;
  25266. let i = i0,
  25267. sign;
  25268. if (allEmpty) {
  25269. const hasSignificantCoefficent = decoder.readBit(
  25270. contexts,
  25271. RUNLENGTH_CONTEXT
  25272. );
  25273. if (!hasSignificantCoefficent) {
  25274. bitsDecoded[index0]++;
  25275. bitsDecoded[index0 + oneRowDown]++;
  25276. bitsDecoded[index0 + twoRowsDown]++;
  25277. bitsDecoded[index0 + threeRowsDown]++;
  25278. continue;
  25279. }
  25280. i1 =
  25281. (decoder.readBit(contexts, UNIFORM_CONTEXT) << 1) |
  25282. decoder.readBit(contexts, UNIFORM_CONTEXT);
  25283. if (i1 !== 0) {
  25284. i = i0 + i1;
  25285. index += i1 * width;
  25286. }
  25287. sign = this.decodeSignBit(i, j, index);
  25288. coefficentsSign[index] = sign;
  25289. coefficentsMagnitude[index] = 1;
  25290. this.setNeighborsSignificance(i, j, index);
  25291. processingFlags[index] |= firstMagnitudeBitMask;
  25292. index = index0;
  25293. for (let i2 = i0; i2 <= i; i2++, index += width) {
  25294. bitsDecoded[index]++;
  25295. }
  25296. i1++;
  25297. }
  25298. for (i = i0 + i1; i < iNext; i++, index += width) {
  25299. if (
  25300. coefficentsMagnitude[index] ||
  25301. (processingFlags[index] & processedMask) !== 0
  25302. ) {
  25303. continue;
  25304. }
  25305. const contextLabel = labels[neighborsSignificance[index]];
  25306. const decision = decoder.readBit(contexts, contextLabel);
  25307. if (decision === 1) {
  25308. sign = this.decodeSignBit(i, j, index);
  25309. coefficentsSign[index] = sign;
  25310. coefficentsMagnitude[index] = 1;
  25311. this.setNeighborsSignificance(i, j, index);
  25312. processingFlags[index] |= firstMagnitudeBitMask;
  25313. }
  25314. bitsDecoded[index]++;
  25315. }
  25316. }
  25317. }
  25318. }
  25319. checkSegmentationSymbol() {
  25320. const decoder = this.decoder;
  25321. const contexts = this.contexts;
  25322. const symbol =
  25323. (decoder.readBit(contexts, UNIFORM_CONTEXT) << 3) |
  25324. (decoder.readBit(contexts, UNIFORM_CONTEXT) << 2) |
  25325. (decoder.readBit(contexts, UNIFORM_CONTEXT) << 1) |
  25326. decoder.readBit(contexts, UNIFORM_CONTEXT);
  25327. if (symbol !== 0xa) {
  25328. throw new JpxError("Invalid segmentation symbol");
  25329. }
  25330. }
  25331. }
  25332. return BitModel;
  25333. })();
  25334. class Transform {
  25335. constructor() {
  25336. if (this.constructor === Transform) {
  25337. (0, _util.unreachable)("Cannot initialize Transform.");
  25338. }
  25339. }
  25340. calculate(subbands, u0, v0) {
  25341. let ll = subbands[0];
  25342. for (let i = 1, ii = subbands.length; i < ii; i++) {
  25343. ll = this.iterate(ll, subbands[i], u0, v0);
  25344. }
  25345. return ll;
  25346. }
  25347. extend(buffer, offset, size) {
  25348. let i1 = offset - 1,
  25349. j1 = offset + 1;
  25350. let i2 = offset + size - 2,
  25351. j2 = offset + size;
  25352. buffer[i1--] = buffer[j1++];
  25353. buffer[j2++] = buffer[i2--];
  25354. buffer[i1--] = buffer[j1++];
  25355. buffer[j2++] = buffer[i2--];
  25356. buffer[i1--] = buffer[j1++];
  25357. buffer[j2++] = buffer[i2--];
  25358. buffer[i1] = buffer[j1];
  25359. buffer[j2] = buffer[i2];
  25360. }
  25361. filter(x, offset, length) {
  25362. (0, _util.unreachable)("Abstract method `filter` called");
  25363. }
  25364. iterate(ll, hl_lh_hh, u0, v0) {
  25365. const llWidth = ll.width,
  25366. llHeight = ll.height;
  25367. let llItems = ll.items;
  25368. const width = hl_lh_hh.width;
  25369. const height = hl_lh_hh.height;
  25370. const items = hl_lh_hh.items;
  25371. let i, j, k, l, u, v;
  25372. for (k = 0, i = 0; i < llHeight; i++) {
  25373. l = i * 2 * width;
  25374. for (j = 0; j < llWidth; j++, k++, l += 2) {
  25375. items[l] = llItems[k];
  25376. }
  25377. }
  25378. llItems = ll.items = null;
  25379. const bufferPadding = 4;
  25380. const rowBuffer = new Float32Array(width + 2 * bufferPadding);
  25381. if (width === 1) {
  25382. if ((u0 & 1) !== 0) {
  25383. for (v = 0, k = 0; v < height; v++, k += width) {
  25384. items[k] *= 0.5;
  25385. }
  25386. }
  25387. } else {
  25388. for (v = 0, k = 0; v < height; v++, k += width) {
  25389. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  25390. this.extend(rowBuffer, bufferPadding, width);
  25391. this.filter(rowBuffer, bufferPadding, width);
  25392. items.set(
  25393. rowBuffer.subarray(bufferPadding, bufferPadding + width),
  25394. k
  25395. );
  25396. }
  25397. }
  25398. let numBuffers = 16;
  25399. const colBuffers = [];
  25400. for (i = 0; i < numBuffers; i++) {
  25401. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  25402. }
  25403. let b,
  25404. currentBuffer = 0;
  25405. ll = bufferPadding + height;
  25406. if (height === 1) {
  25407. if ((v0 & 1) !== 0) {
  25408. for (u = 0; u < width; u++) {
  25409. items[u] *= 0.5;
  25410. }
  25411. }
  25412. } else {
  25413. for (u = 0; u < width; u++) {
  25414. if (currentBuffer === 0) {
  25415. numBuffers = Math.min(width - u, numBuffers);
  25416. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  25417. for (b = 0; b < numBuffers; b++) {
  25418. colBuffers[b][l] = items[k + b];
  25419. }
  25420. }
  25421. currentBuffer = numBuffers;
  25422. }
  25423. currentBuffer--;
  25424. const buffer = colBuffers[currentBuffer];
  25425. this.extend(buffer, bufferPadding, height);
  25426. this.filter(buffer, bufferPadding, height);
  25427. if (currentBuffer === 0) {
  25428. k = u - numBuffers + 1;
  25429. for (l = bufferPadding; l < ll; k += width, l++) {
  25430. for (b = 0; b < numBuffers; b++) {
  25431. items[k + b] = colBuffers[b][l];
  25432. }
  25433. }
  25434. }
  25435. }
  25436. }
  25437. return {
  25438. width,
  25439. height,
  25440. items,
  25441. };
  25442. }
  25443. }
  25444. class IrreversibleTransform extends Transform {
  25445. filter(x, offset, length) {
  25446. const len = length >> 1;
  25447. offset |= 0;
  25448. let j, n, current, next;
  25449. const alpha = -1.586134342059924;
  25450. const beta = -0.052980118572961;
  25451. const gamma = 0.882911075530934;
  25452. const delta = 0.443506852043971;
  25453. const K = 1.230174104914001;
  25454. const K_ = 1 / K;
  25455. j = offset - 3;
  25456. for (n = len + 4; n--; j += 2) {
  25457. x[j] *= K_;
  25458. }
  25459. j = offset - 2;
  25460. current = delta * x[j - 1];
  25461. for (n = len + 3; n--; j += 2) {
  25462. next = delta * x[j + 1];
  25463. x[j] = K * x[j] - current - next;
  25464. if (n--) {
  25465. j += 2;
  25466. current = delta * x[j + 1];
  25467. x[j] = K * x[j] - current - next;
  25468. } else {
  25469. break;
  25470. }
  25471. }
  25472. j = offset - 1;
  25473. current = gamma * x[j - 1];
  25474. for (n = len + 2; n--; j += 2) {
  25475. next = gamma * x[j + 1];
  25476. x[j] -= current + next;
  25477. if (n--) {
  25478. j += 2;
  25479. current = gamma * x[j + 1];
  25480. x[j] -= current + next;
  25481. } else {
  25482. break;
  25483. }
  25484. }
  25485. j = offset;
  25486. current = beta * x[j - 1];
  25487. for (n = len + 1; n--; j += 2) {
  25488. next = beta * x[j + 1];
  25489. x[j] -= current + next;
  25490. if (n--) {
  25491. j += 2;
  25492. current = beta * x[j + 1];
  25493. x[j] -= current + next;
  25494. } else {
  25495. break;
  25496. }
  25497. }
  25498. if (len !== 0) {
  25499. j = offset + 1;
  25500. current = alpha * x[j - 1];
  25501. for (n = len; n--; j += 2) {
  25502. next = alpha * x[j + 1];
  25503. x[j] -= current + next;
  25504. if (n--) {
  25505. j += 2;
  25506. current = alpha * x[j + 1];
  25507. x[j] -= current + next;
  25508. } else {
  25509. break;
  25510. }
  25511. }
  25512. }
  25513. }
  25514. }
  25515. class ReversibleTransform extends Transform {
  25516. filter(x, offset, length) {
  25517. const len = length >> 1;
  25518. offset |= 0;
  25519. let j, n;
  25520. for (j = offset, n = len + 1; n--; j += 2) {
  25521. x[j] -= (x[j - 1] + x[j + 1] + 2) >> 2;
  25522. }
  25523. for (j = offset + 1, n = len; n--; j += 2) {
  25524. x[j] += (x[j - 1] + x[j + 1]) >> 1;
  25525. }
  25526. }
  25527. }
  25528. /***/
  25529. },
  25530. /* 31 */
  25531. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25532. Object.defineProperty(exports, "__esModule", {
  25533. value: true,
  25534. });
  25535. exports.LZWStream = void 0;
  25536. var _decode_stream = __w_pdfjs_require__(19);
  25537. class LZWStream extends _decode_stream.DecodeStream {
  25538. constructor(str, maybeLength, earlyChange) {
  25539. super(maybeLength);
  25540. this.str = str;
  25541. this.dict = str.dict;
  25542. this.cachedData = 0;
  25543. this.bitsCached = 0;
  25544. const maxLzwDictionarySize = 4096;
  25545. const lzwState = {
  25546. earlyChange,
  25547. codeLength: 9,
  25548. nextCode: 258,
  25549. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  25550. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  25551. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  25552. currentSequence: new Uint8Array(maxLzwDictionarySize),
  25553. currentSequenceLength: 0,
  25554. };
  25555. for (let i = 0; i < 256; ++i) {
  25556. lzwState.dictionaryValues[i] = i;
  25557. lzwState.dictionaryLengths[i] = 1;
  25558. }
  25559. this.lzwState = lzwState;
  25560. }
  25561. readBits(n) {
  25562. let bitsCached = this.bitsCached;
  25563. let cachedData = this.cachedData;
  25564. while (bitsCached < n) {
  25565. const c = this.str.getByte();
  25566. if (c === -1) {
  25567. this.eof = true;
  25568. return null;
  25569. }
  25570. cachedData = (cachedData << 8) | c;
  25571. bitsCached += 8;
  25572. }
  25573. this.bitsCached = bitsCached -= n;
  25574. this.cachedData = cachedData;
  25575. this.lastCode = null;
  25576. return (cachedData >>> bitsCached) & ((1 << n) - 1);
  25577. }
  25578. readBlock() {
  25579. const blockSize = 512,
  25580. decodedSizeDelta = blockSize;
  25581. let estimatedDecodedSize = blockSize * 2;
  25582. let i, j, q;
  25583. const lzwState = this.lzwState;
  25584. if (!lzwState) {
  25585. return;
  25586. }
  25587. const earlyChange = lzwState.earlyChange;
  25588. let nextCode = lzwState.nextCode;
  25589. const dictionaryValues = lzwState.dictionaryValues;
  25590. const dictionaryLengths = lzwState.dictionaryLengths;
  25591. const dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  25592. let codeLength = lzwState.codeLength;
  25593. let prevCode = lzwState.prevCode;
  25594. const currentSequence = lzwState.currentSequence;
  25595. let currentSequenceLength = lzwState.currentSequenceLength;
  25596. let decodedLength = 0;
  25597. let currentBufferLength = this.bufferLength;
  25598. let buffer = this.ensureBuffer(
  25599. this.bufferLength + estimatedDecodedSize
  25600. );
  25601. for (i = 0; i < blockSize; i++) {
  25602. const code = this.readBits(codeLength);
  25603. const hasPrev = currentSequenceLength > 0;
  25604. if (code < 256) {
  25605. currentSequence[0] = code;
  25606. currentSequenceLength = 1;
  25607. } else if (code >= 258) {
  25608. if (code < nextCode) {
  25609. currentSequenceLength = dictionaryLengths[code];
  25610. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  25611. currentSequence[j] = dictionaryValues[q];
  25612. q = dictionaryPrevCodes[q];
  25613. }
  25614. } else {
  25615. currentSequence[currentSequenceLength++] = currentSequence[0];
  25616. }
  25617. } else if (code === 256) {
  25618. codeLength = 9;
  25619. nextCode = 258;
  25620. currentSequenceLength = 0;
  25621. continue;
  25622. } else {
  25623. this.eof = true;
  25624. delete this.lzwState;
  25625. break;
  25626. }
  25627. if (hasPrev) {
  25628. dictionaryPrevCodes[nextCode] = prevCode;
  25629. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  25630. dictionaryValues[nextCode] = currentSequence[0];
  25631. nextCode++;
  25632. codeLength =
  25633. (nextCode + earlyChange) & (nextCode + earlyChange - 1)
  25634. ? codeLength
  25635. : Math.min(
  25636. Math.log(nextCode + earlyChange) / 0.6931471805599453 +
  25637. 1,
  25638. 12
  25639. ) | 0;
  25640. }
  25641. prevCode = code;
  25642. decodedLength += currentSequenceLength;
  25643. if (estimatedDecodedSize < decodedLength) {
  25644. do {
  25645. estimatedDecodedSize += decodedSizeDelta;
  25646. } while (estimatedDecodedSize < decodedLength);
  25647. buffer = this.ensureBuffer(
  25648. this.bufferLength + estimatedDecodedSize
  25649. );
  25650. }
  25651. for (j = 0; j < currentSequenceLength; j++) {
  25652. buffer[currentBufferLength++] = currentSequence[j];
  25653. }
  25654. }
  25655. lzwState.nextCode = nextCode;
  25656. lzwState.codeLength = codeLength;
  25657. lzwState.prevCode = prevCode;
  25658. lzwState.currentSequenceLength = currentSequenceLength;
  25659. this.bufferLength = currentBufferLength;
  25660. }
  25661. }
  25662. exports.LZWStream = LZWStream;
  25663. /***/
  25664. },
  25665. /* 32 */
  25666. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25667. Object.defineProperty(exports, "__esModule", {
  25668. value: true,
  25669. });
  25670. exports.PredictorStream = void 0;
  25671. var _decode_stream = __w_pdfjs_require__(19);
  25672. var _primitives = __w_pdfjs_require__(5);
  25673. var _util = __w_pdfjs_require__(2);
  25674. class PredictorStream extends _decode_stream.DecodeStream {
  25675. constructor(str, maybeLength, params) {
  25676. super(maybeLength);
  25677. if (!(params instanceof _primitives.Dict)) {
  25678. return str;
  25679. }
  25680. const predictor = (this.predictor = params.get("Predictor") || 1);
  25681. if (predictor <= 1) {
  25682. return str;
  25683. }
  25684. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  25685. throw new _util.FormatError(
  25686. `Unsupported predictor: ${predictor}`
  25687. );
  25688. }
  25689. if (predictor === 2) {
  25690. this.readBlock = this.readBlockTiff;
  25691. } else {
  25692. this.readBlock = this.readBlockPng;
  25693. }
  25694. this.str = str;
  25695. this.dict = str.dict;
  25696. const colors = (this.colors = params.get("Colors") || 1);
  25697. const bits = (this.bits =
  25698. params.get("BPC", "BitsPerComponent") || 8);
  25699. const columns = (this.columns = params.get("Columns") || 1);
  25700. this.pixBytes = (colors * bits + 7) >> 3;
  25701. this.rowBytes = (columns * colors * bits + 7) >> 3;
  25702. return this;
  25703. }
  25704. readBlockTiff() {
  25705. const rowBytes = this.rowBytes;
  25706. const bufferLength = this.bufferLength;
  25707. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  25708. const bits = this.bits;
  25709. const colors = this.colors;
  25710. const rawBytes = this.str.getBytes(rowBytes);
  25711. this.eof = !rawBytes.length;
  25712. if (this.eof) {
  25713. return;
  25714. }
  25715. let inbuf = 0,
  25716. outbuf = 0;
  25717. let inbits = 0,
  25718. outbits = 0;
  25719. let pos = bufferLength;
  25720. let i;
  25721. if (bits === 1 && colors === 1) {
  25722. for (i = 0; i < rowBytes; ++i) {
  25723. let c = rawBytes[i] ^ inbuf;
  25724. c ^= c >> 1;
  25725. c ^= c >> 2;
  25726. c ^= c >> 4;
  25727. inbuf = (c & 1) << 7;
  25728. buffer[pos++] = c;
  25729. }
  25730. } else if (bits === 8) {
  25731. for (i = 0; i < colors; ++i) {
  25732. buffer[pos++] = rawBytes[i];
  25733. }
  25734. for (; i < rowBytes; ++i) {
  25735. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  25736. pos++;
  25737. }
  25738. } else if (bits === 16) {
  25739. const bytesPerPixel = colors * 2;
  25740. for (i = 0; i < bytesPerPixel; ++i) {
  25741. buffer[pos++] = rawBytes[i];
  25742. }
  25743. for (; i < rowBytes; i += 2) {
  25744. const sum =
  25745. ((rawBytes[i] & 0xff) << 8) +
  25746. (rawBytes[i + 1] & 0xff) +
  25747. ((buffer[pos - bytesPerPixel] & 0xff) << 8) +
  25748. (buffer[pos - bytesPerPixel + 1] & 0xff);
  25749. buffer[pos++] = (sum >> 8) & 0xff;
  25750. buffer[pos++] = sum & 0xff;
  25751. }
  25752. } else {
  25753. const compArray = new Uint8Array(colors + 1);
  25754. const bitMask = (1 << bits) - 1;
  25755. let j = 0,
  25756. k = bufferLength;
  25757. const columns = this.columns;
  25758. for (i = 0; i < columns; ++i) {
  25759. for (let kk = 0; kk < colors; ++kk) {
  25760. if (inbits < bits) {
  25761. inbuf = (inbuf << 8) | (rawBytes[j++] & 0xff);
  25762. inbits += 8;
  25763. }
  25764. compArray[kk] =
  25765. (compArray[kk] + (inbuf >> (inbits - bits))) & bitMask;
  25766. inbits -= bits;
  25767. outbuf = (outbuf << bits) | compArray[kk];
  25768. outbits += bits;
  25769. if (outbits >= 8) {
  25770. buffer[k++] = (outbuf >> (outbits - 8)) & 0xff;
  25771. outbits -= 8;
  25772. }
  25773. }
  25774. }
  25775. if (outbits > 0) {
  25776. buffer[k++] =
  25777. (outbuf << (8 - outbits)) +
  25778. (inbuf & ((1 << (8 - outbits)) - 1));
  25779. }
  25780. }
  25781. this.bufferLength += rowBytes;
  25782. }
  25783. readBlockPng() {
  25784. const rowBytes = this.rowBytes;
  25785. const pixBytes = this.pixBytes;
  25786. const predictor = this.str.getByte();
  25787. const rawBytes = this.str.getBytes(rowBytes);
  25788. this.eof = !rawBytes.length;
  25789. if (this.eof) {
  25790. return;
  25791. }
  25792. const bufferLength = this.bufferLength;
  25793. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  25794. let prevRow = buffer.subarray(
  25795. bufferLength - rowBytes,
  25796. bufferLength
  25797. );
  25798. if (prevRow.length === 0) {
  25799. prevRow = new Uint8Array(rowBytes);
  25800. }
  25801. let i,
  25802. j = bufferLength,
  25803. up,
  25804. c;
  25805. switch (predictor) {
  25806. case 0:
  25807. for (i = 0; i < rowBytes; ++i) {
  25808. buffer[j++] = rawBytes[i];
  25809. }
  25810. break;
  25811. case 1:
  25812. for (i = 0; i < pixBytes; ++i) {
  25813. buffer[j++] = rawBytes[i];
  25814. }
  25815. for (; i < rowBytes; ++i) {
  25816. buffer[j] = (buffer[j - pixBytes] + rawBytes[i]) & 0xff;
  25817. j++;
  25818. }
  25819. break;
  25820. case 2:
  25821. for (i = 0; i < rowBytes; ++i) {
  25822. buffer[j++] = (prevRow[i] + rawBytes[i]) & 0xff;
  25823. }
  25824. break;
  25825. case 3:
  25826. for (i = 0; i < pixBytes; ++i) {
  25827. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  25828. }
  25829. for (; i < rowBytes; ++i) {
  25830. buffer[j] =
  25831. (((prevRow[i] + buffer[j - pixBytes]) >> 1) + rawBytes[i]) &
  25832. 0xff;
  25833. j++;
  25834. }
  25835. break;
  25836. case 4:
  25837. for (i = 0; i < pixBytes; ++i) {
  25838. up = prevRow[i];
  25839. c = rawBytes[i];
  25840. buffer[j++] = up + c;
  25841. }
  25842. for (; i < rowBytes; ++i) {
  25843. up = prevRow[i];
  25844. const upLeft = prevRow[i - pixBytes];
  25845. const left = buffer[j - pixBytes];
  25846. const p = left + up - upLeft;
  25847. let pa = p - left;
  25848. if (pa < 0) {
  25849. pa = -pa;
  25850. }
  25851. let pb = p - up;
  25852. if (pb < 0) {
  25853. pb = -pb;
  25854. }
  25855. let pc = p - upLeft;
  25856. if (pc < 0) {
  25857. pc = -pc;
  25858. }
  25859. c = rawBytes[i];
  25860. if (pa <= pb && pa <= pc) {
  25861. buffer[j++] = left + c;
  25862. } else if (pb <= pc) {
  25863. buffer[j++] = up + c;
  25864. } else {
  25865. buffer[j++] = upLeft + c;
  25866. }
  25867. }
  25868. break;
  25869. default:
  25870. throw new _util.FormatError(
  25871. `Unsupported predictor: ${predictor}`
  25872. );
  25873. }
  25874. this.bufferLength += rowBytes;
  25875. }
  25876. }
  25877. exports.PredictorStream = PredictorStream;
  25878. /***/
  25879. },
  25880. /* 33 */
  25881. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25882. Object.defineProperty(exports, "__esModule", {
  25883. value: true,
  25884. });
  25885. exports.RunLengthStream = void 0;
  25886. var _decode_stream = __w_pdfjs_require__(19);
  25887. class RunLengthStream extends _decode_stream.DecodeStream {
  25888. constructor(str, maybeLength) {
  25889. super(maybeLength);
  25890. this.str = str;
  25891. this.dict = str.dict;
  25892. }
  25893. readBlock() {
  25894. const repeatHeader = this.str.getBytes(2);
  25895. if (
  25896. !repeatHeader ||
  25897. repeatHeader.length < 2 ||
  25898. repeatHeader[0] === 128
  25899. ) {
  25900. this.eof = true;
  25901. return;
  25902. }
  25903. let buffer;
  25904. let bufferLength = this.bufferLength;
  25905. let n = repeatHeader[0];
  25906. if (n < 128) {
  25907. buffer = this.ensureBuffer(bufferLength + n + 1);
  25908. buffer[bufferLength++] = repeatHeader[1];
  25909. if (n > 0) {
  25910. const source = this.str.getBytes(n);
  25911. buffer.set(source, bufferLength);
  25912. bufferLength += n;
  25913. }
  25914. } else {
  25915. n = 257 - n;
  25916. const b = repeatHeader[1];
  25917. buffer = this.ensureBuffer(bufferLength + n + 1);
  25918. for (let i = 0; i < n; i++) {
  25919. buffer[bufferLength++] = b;
  25920. }
  25921. }
  25922. this.bufferLength = bufferLength;
  25923. }
  25924. }
  25925. exports.RunLengthStream = RunLengthStream;
  25926. /***/
  25927. },
  25928. /* 34 */
  25929. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25930. Object.defineProperty(exports, "__esModule", {
  25931. value: true,
  25932. });
  25933. exports.Font = exports.ErrorFont = void 0;
  25934. var _util = __w_pdfjs_require__(2);
  25935. var _cff_parser = __w_pdfjs_require__(35);
  25936. var _fonts_utils = __w_pdfjs_require__(38);
  25937. var _unicode = __w_pdfjs_require__(40);
  25938. var _glyphlist = __w_pdfjs_require__(39);
  25939. var _encodings = __w_pdfjs_require__(37);
  25940. var _standard_fonts = __w_pdfjs_require__(41);
  25941. var _to_unicode_map = __w_pdfjs_require__(42);
  25942. var _cff_font = __w_pdfjs_require__(43);
  25943. var _font_renderer = __w_pdfjs_require__(44);
  25944. var _metrics = __w_pdfjs_require__(45);
  25945. var _glyf = __w_pdfjs_require__(46);
  25946. var _cmap = __w_pdfjs_require__(16);
  25947. var _opentype_file_builder = __w_pdfjs_require__(47);
  25948. var _core_utils = __w_pdfjs_require__(6);
  25949. var _stream = __w_pdfjs_require__(10);
  25950. var _type1_font = __w_pdfjs_require__(48);
  25951. const PRIVATE_USE_AREAS = [
  25952. [0xe000, 0xf8ff],
  25953. [0x100000, 0x10fffd],
  25954. ];
  25955. const PDF_GLYPH_SPACE_UNITS = 1000;
  25956. const EXPORT_DATA_PROPERTIES = [
  25957. "ascent",
  25958. "bbox",
  25959. "black",
  25960. "bold",
  25961. "charProcOperatorList",
  25962. "composite",
  25963. "cssFontInfo",
  25964. "data",
  25965. "defaultVMetrics",
  25966. "defaultWidth",
  25967. "descent",
  25968. "fallbackName",
  25969. "fontMatrix",
  25970. "fontType",
  25971. "isType3Font",
  25972. "italic",
  25973. "loadedName",
  25974. "mimetype",
  25975. "missingFile",
  25976. "name",
  25977. "remeasure",
  25978. "subtype",
  25979. "type",
  25980. "vertical",
  25981. ];
  25982. const EXPORT_DATA_EXTRA_PROPERTIES = [
  25983. "cMap",
  25984. "defaultEncoding",
  25985. "differences",
  25986. "isMonospace",
  25987. "isSerifFont",
  25988. "isSymbolicFont",
  25989. "seacMap",
  25990. "toFontChar",
  25991. "toUnicode",
  25992. "vmetrics",
  25993. "widths",
  25994. ];
  25995. function adjustWidths(properties) {
  25996. if (!properties.fontMatrix) {
  25997. return;
  25998. }
  25999. if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
  26000. return;
  26001. }
  26002. const scale = 0.001 / properties.fontMatrix[0];
  26003. const glyphsWidths = properties.widths;
  26004. for (const glyph in glyphsWidths) {
  26005. glyphsWidths[glyph] *= scale;
  26006. }
  26007. properties.defaultWidth *= scale;
  26008. }
  26009. function adjustToUnicode(properties, builtInEncoding) {
  26010. if (properties.isInternalFont) {
  26011. return;
  26012. }
  26013. if (builtInEncoding === properties.defaultEncoding) {
  26014. return;
  26015. }
  26016. if (
  26017. properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap
  26018. ) {
  26019. return;
  26020. }
  26021. const toUnicode = [],
  26022. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  26023. for (const charCode in builtInEncoding) {
  26024. if (properties.hasIncludedToUnicodeMap) {
  26025. if (properties.toUnicode.has(charCode)) {
  26026. continue;
  26027. }
  26028. } else if (properties.hasEncoding) {
  26029. if (
  26030. properties.differences.length === 0 ||
  26031. properties.differences[charCode] !== undefined
  26032. ) {
  26033. continue;
  26034. }
  26035. }
  26036. const glyphName = builtInEncoding[charCode];
  26037. const unicode = (0, _unicode.getUnicodeForGlyph)(
  26038. glyphName,
  26039. glyphsUnicodeMap
  26040. );
  26041. if (unicode !== -1) {
  26042. toUnicode[charCode] = String.fromCharCode(unicode);
  26043. }
  26044. }
  26045. if (toUnicode.length > 0) {
  26046. properties.toUnicode.amend(toUnicode);
  26047. }
  26048. }
  26049. function amendFallbackToUnicode(properties) {
  26050. if (!properties.fallbackToUnicode) {
  26051. return;
  26052. }
  26053. if (
  26054. properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap
  26055. ) {
  26056. return;
  26057. }
  26058. const toUnicode = [];
  26059. for (const charCode in properties.fallbackToUnicode) {
  26060. if (properties.toUnicode.has(charCode)) {
  26061. continue;
  26062. }
  26063. toUnicode[charCode] = properties.fallbackToUnicode[charCode];
  26064. }
  26065. if (toUnicode.length > 0) {
  26066. properties.toUnicode.amend(toUnicode);
  26067. }
  26068. }
  26069. class Glyph {
  26070. constructor(
  26071. originalCharCode,
  26072. fontChar,
  26073. unicode,
  26074. accent,
  26075. width,
  26076. vmetric,
  26077. operatorListId,
  26078. isSpace,
  26079. isInFont
  26080. ) {
  26081. this.originalCharCode = originalCharCode;
  26082. this.fontChar = fontChar;
  26083. this.unicode = unicode;
  26084. this.accent = accent;
  26085. this.width = width;
  26086. this.vmetric = vmetric;
  26087. this.operatorListId = operatorListId;
  26088. this.isSpace = isSpace;
  26089. this.isInFont = isInFont;
  26090. const category = (0, _unicode.getCharUnicodeCategory)(unicode);
  26091. this.isWhitespace = category.isWhitespace;
  26092. this.isZeroWidthDiacritic = category.isZeroWidthDiacritic;
  26093. this.isInvisibleFormatMark = category.isInvisibleFormatMark;
  26094. }
  26095. matchesForCache(
  26096. originalCharCode,
  26097. fontChar,
  26098. unicode,
  26099. accent,
  26100. width,
  26101. vmetric,
  26102. operatorListId,
  26103. isSpace,
  26104. isInFont
  26105. ) {
  26106. return (
  26107. this.originalCharCode === originalCharCode &&
  26108. this.fontChar === fontChar &&
  26109. this.unicode === unicode &&
  26110. this.accent === accent &&
  26111. this.width === width &&
  26112. this.vmetric === vmetric &&
  26113. this.operatorListId === operatorListId &&
  26114. this.isSpace === isSpace &&
  26115. this.isInFont === isInFont
  26116. );
  26117. }
  26118. }
  26119. function int16(b0, b1) {
  26120. return (b0 << 8) + b1;
  26121. }
  26122. function writeSignedInt16(bytes, index, value) {
  26123. bytes[index + 1] = value;
  26124. bytes[index] = value >>> 8;
  26125. }
  26126. function signedInt16(b0, b1) {
  26127. const value = (b0 << 8) + b1;
  26128. return value & (1 << 15) ? value - 0x10000 : value;
  26129. }
  26130. function int32(b0, b1, b2, b3) {
  26131. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  26132. }
  26133. function string16(value) {
  26134. return String.fromCharCode((value >> 8) & 0xff, value & 0xff);
  26135. }
  26136. function safeString16(value) {
  26137. if (value > 0x7fff) {
  26138. value = 0x7fff;
  26139. } else if (value < -0x8000) {
  26140. value = -0x8000;
  26141. }
  26142. return String.fromCharCode((value >> 8) & 0xff, value & 0xff);
  26143. }
  26144. function isTrueTypeFile(file) {
  26145. const header = file.peekBytes(4);
  26146. return (
  26147. (0, _core_utils.readUint32)(header, 0) === 0x00010000 ||
  26148. (0, _util.bytesToString)(header) === "true"
  26149. );
  26150. }
  26151. function isTrueTypeCollectionFile(file) {
  26152. const header = file.peekBytes(4);
  26153. return (0, _util.bytesToString)(header) === "ttcf";
  26154. }
  26155. function isOpenTypeFile(file) {
  26156. const header = file.peekBytes(4);
  26157. return (0, _util.bytesToString)(header) === "OTTO";
  26158. }
  26159. function isType1File(file) {
  26160. const header = file.peekBytes(2);
  26161. if (header[0] === 0x25 && header[1] === 0x21) {
  26162. return true;
  26163. }
  26164. if (header[0] === 0x80 && header[1] === 0x01) {
  26165. return true;
  26166. }
  26167. return false;
  26168. }
  26169. function isCFFFile(file) {
  26170. const header = file.peekBytes(4);
  26171. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  26172. return true;
  26173. }
  26174. return false;
  26175. }
  26176. function getFontFileType(file, { type, subtype, composite }) {
  26177. let fileType, fileSubtype;
  26178. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  26179. if (composite) {
  26180. fileType = "CIDFontType2";
  26181. } else {
  26182. fileType = "TrueType";
  26183. }
  26184. } else if (isOpenTypeFile(file)) {
  26185. if (composite) {
  26186. fileType = "CIDFontType2";
  26187. } else {
  26188. fileType = "OpenType";
  26189. }
  26190. } else if (isType1File(file)) {
  26191. if (composite) {
  26192. fileType = "CIDFontType0";
  26193. } else {
  26194. fileType = type === "MMType1" ? "MMType1" : "Type1";
  26195. }
  26196. } else if (isCFFFile(file)) {
  26197. if (composite) {
  26198. fileType = "CIDFontType0";
  26199. fileSubtype = "CIDFontType0C";
  26200. } else {
  26201. fileType = type === "MMType1" ? "MMType1" : "Type1";
  26202. fileSubtype = "Type1C";
  26203. }
  26204. } else {
  26205. (0, _util.warn)(
  26206. "getFontFileType: Unable to detect correct font file Type/Subtype."
  26207. );
  26208. fileType = type;
  26209. fileSubtype = subtype;
  26210. }
  26211. return [fileType, fileSubtype];
  26212. }
  26213. function applyStandardFontGlyphMap(map, glyphMap) {
  26214. for (const charCode in glyphMap) {
  26215. map[+charCode] = glyphMap[charCode];
  26216. }
  26217. }
  26218. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  26219. const toFontChar = [];
  26220. let unicode;
  26221. for (let i = 0, ii = encoding.length; i < ii; i++) {
  26222. unicode = (0, _unicode.getUnicodeForGlyph)(
  26223. encoding[i],
  26224. glyphsUnicodeMap
  26225. );
  26226. if (unicode !== -1) {
  26227. toFontChar[i] = unicode;
  26228. }
  26229. }
  26230. for (const charCode in differences) {
  26231. unicode = (0, _unicode.getUnicodeForGlyph)(
  26232. differences[charCode],
  26233. glyphsUnicodeMap
  26234. );
  26235. if (unicode !== -1) {
  26236. toFontChar[+charCode] = unicode;
  26237. }
  26238. }
  26239. return toFontChar;
  26240. }
  26241. function convertCidString(charCode, cid, shouldThrow = false) {
  26242. switch (cid.length) {
  26243. case 1:
  26244. return cid.charCodeAt(0);
  26245. case 2:
  26246. return (cid.charCodeAt(0) << 8) | cid.charCodeAt(1);
  26247. }
  26248. const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`;
  26249. if (shouldThrow) {
  26250. throw new _util.FormatError(msg);
  26251. }
  26252. (0, _util.warn)(msg);
  26253. return cid;
  26254. }
  26255. function adjustMapping(
  26256. charCodeToGlyphId,
  26257. hasGlyph,
  26258. newGlyphZeroId,
  26259. toUnicode
  26260. ) {
  26261. const newMap = Object.create(null);
  26262. const toUnicodeExtraMap = new Map();
  26263. const toFontChar = [];
  26264. const usedGlyphIds = new Set();
  26265. let privateUseAreaIndex = 0;
  26266. const privateUseOffetStart =
  26267. PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  26268. let nextAvailableFontCharCode = privateUseOffetStart;
  26269. let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  26270. for (let originalCharCode in charCodeToGlyphId) {
  26271. originalCharCode |= 0;
  26272. let glyphId = charCodeToGlyphId[originalCharCode];
  26273. if (!hasGlyph(glyphId)) {
  26274. continue;
  26275. }
  26276. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  26277. privateUseAreaIndex++;
  26278. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  26279. (0, _util.warn)("Ran out of space in font private use area.");
  26280. break;
  26281. }
  26282. nextAvailableFontCharCode =
  26283. PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  26284. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  26285. }
  26286. const fontCharCode = nextAvailableFontCharCode++;
  26287. if (glyphId === 0) {
  26288. glyphId = newGlyphZeroId;
  26289. }
  26290. let unicode = toUnicode.get(originalCharCode);
  26291. if (typeof unicode === "string") {
  26292. unicode = unicode.codePointAt(0);
  26293. }
  26294. if (
  26295. unicode &&
  26296. unicode < privateUseOffetStart &&
  26297. !usedGlyphIds.has(glyphId)
  26298. ) {
  26299. toUnicodeExtraMap.set(unicode, glyphId);
  26300. usedGlyphIds.add(glyphId);
  26301. }
  26302. newMap[fontCharCode] = glyphId;
  26303. toFontChar[originalCharCode] = fontCharCode;
  26304. }
  26305. return {
  26306. toFontChar,
  26307. charCodeToGlyphId: newMap,
  26308. toUnicodeExtraMap,
  26309. nextAvailableFontCharCode,
  26310. };
  26311. }
  26312. function getRanges(glyphs, toUnicodeExtraMap, numGlyphs) {
  26313. const codes = [];
  26314. for (const charCode in glyphs) {
  26315. if (glyphs[charCode] >= numGlyphs) {
  26316. continue;
  26317. }
  26318. codes.push({
  26319. fontCharCode: charCode | 0,
  26320. glyphId: glyphs[charCode],
  26321. });
  26322. }
  26323. if (toUnicodeExtraMap) {
  26324. for (const [unicode, glyphId] of toUnicodeExtraMap) {
  26325. if (glyphId >= numGlyphs) {
  26326. continue;
  26327. }
  26328. codes.push({
  26329. fontCharCode: unicode,
  26330. glyphId,
  26331. });
  26332. }
  26333. }
  26334. if (codes.length === 0) {
  26335. codes.push({
  26336. fontCharCode: 0,
  26337. glyphId: 0,
  26338. });
  26339. }
  26340. codes.sort(function fontGetRangesSort(a, b) {
  26341. return a.fontCharCode - b.fontCharCode;
  26342. });
  26343. const ranges = [];
  26344. const length = codes.length;
  26345. for (let n = 0; n < length; ) {
  26346. const start = codes[n].fontCharCode;
  26347. const codeIndices = [codes[n].glyphId];
  26348. ++n;
  26349. let end = start;
  26350. while (n < length && end + 1 === codes[n].fontCharCode) {
  26351. codeIndices.push(codes[n].glyphId);
  26352. ++end;
  26353. ++n;
  26354. if (end === 0xffff) {
  26355. break;
  26356. }
  26357. }
  26358. ranges.push([start, end, codeIndices]);
  26359. }
  26360. return ranges;
  26361. }
  26362. function createCmapTable(glyphs, toUnicodeExtraMap, numGlyphs) {
  26363. const ranges = getRanges(glyphs, toUnicodeExtraMap, numGlyphs);
  26364. const numTables = ranges.at(-1)[1] > 0xffff ? 2 : 1;
  26365. let cmap =
  26366. "\x00\x00" +
  26367. string16(numTables) +
  26368. "\x00\x03" +
  26369. "\x00\x01" +
  26370. (0, _util.string32)(4 + numTables * 8);
  26371. let i, ii, j, jj;
  26372. for (i = ranges.length - 1; i >= 0; --i) {
  26373. if (ranges[i][0] <= 0xffff) {
  26374. break;
  26375. }
  26376. }
  26377. const bmpLength = i + 1;
  26378. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  26379. ranges[i][1] = 0xfffe;
  26380. }
  26381. const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  26382. const segCount = bmpLength + trailingRangesCount;
  26383. const searchParams =
  26384. _opentype_file_builder.OpenTypeFileBuilder.getSearchParams(
  26385. segCount,
  26386. 2
  26387. );
  26388. let startCount = "";
  26389. let endCount = "";
  26390. let idDeltas = "";
  26391. let idRangeOffsets = "";
  26392. let glyphsIds = "";
  26393. let bias = 0;
  26394. let range, start, end, codes;
  26395. for (i = 0, ii = bmpLength; i < ii; i++) {
  26396. range = ranges[i];
  26397. start = range[0];
  26398. end = range[1];
  26399. startCount += string16(start);
  26400. endCount += string16(end);
  26401. codes = range[2];
  26402. let contiguous = true;
  26403. for (j = 1, jj = codes.length; j < jj; ++j) {
  26404. if (codes[j] !== codes[j - 1] + 1) {
  26405. contiguous = false;
  26406. break;
  26407. }
  26408. }
  26409. if (!contiguous) {
  26410. const offset = (segCount - i) * 2 + bias * 2;
  26411. bias += end - start + 1;
  26412. idDeltas += string16(0);
  26413. idRangeOffsets += string16(offset);
  26414. for (j = 0, jj = codes.length; j < jj; ++j) {
  26415. glyphsIds += string16(codes[j]);
  26416. }
  26417. } else {
  26418. const startCode = codes[0];
  26419. idDeltas += string16((startCode - start) & 0xffff);
  26420. idRangeOffsets += string16(0);
  26421. }
  26422. }
  26423. if (trailingRangesCount > 0) {
  26424. endCount += "\xFF\xFF";
  26425. startCount += "\xFF\xFF";
  26426. idDeltas += "\x00\x01";
  26427. idRangeOffsets += "\x00\x00";
  26428. }
  26429. const format314 =
  26430. "\x00\x00" +
  26431. string16(2 * segCount) +
  26432. string16(searchParams.range) +
  26433. string16(searchParams.entry) +
  26434. string16(searchParams.rangeShift) +
  26435. endCount +
  26436. "\x00\x00" +
  26437. startCount +
  26438. idDeltas +
  26439. idRangeOffsets +
  26440. glyphsIds;
  26441. let format31012 = "";
  26442. let header31012 = "";
  26443. if (numTables > 1) {
  26444. cmap +=
  26445. "\x00\x03" +
  26446. "\x00\x0A" +
  26447. (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
  26448. format31012 = "";
  26449. for (i = 0, ii = ranges.length; i < ii; i++) {
  26450. range = ranges[i];
  26451. start = range[0];
  26452. codes = range[2];
  26453. let code = codes[0];
  26454. for (j = 1, jj = codes.length; j < jj; ++j) {
  26455. if (codes[j] !== codes[j - 1] + 1) {
  26456. end = range[0] + j - 1;
  26457. format31012 +=
  26458. (0, _util.string32)(start) +
  26459. (0, _util.string32)(end) +
  26460. (0, _util.string32)(code);
  26461. start = end + 1;
  26462. code = codes[j];
  26463. }
  26464. }
  26465. format31012 +=
  26466. (0, _util.string32)(start) +
  26467. (0, _util.string32)(range[1]) +
  26468. (0, _util.string32)(code);
  26469. }
  26470. header31012 =
  26471. "\x00\x0C" +
  26472. "\x00\x00" +
  26473. (0, _util.string32)(format31012.length + 16) +
  26474. "\x00\x00\x00\x00" +
  26475. (0, _util.string32)(format31012.length / 12);
  26476. }
  26477. return (
  26478. cmap +
  26479. "\x00\x04" +
  26480. string16(format314.length + 4) +
  26481. format314 +
  26482. header31012 +
  26483. format31012
  26484. );
  26485. }
  26486. function validateOS2Table(os2, file) {
  26487. file.pos = (file.start || 0) + os2.offset;
  26488. const version = file.getUint16();
  26489. file.skip(60);
  26490. const selection = file.getUint16();
  26491. if (version < 4 && selection & 0x0300) {
  26492. return false;
  26493. }
  26494. const firstChar = file.getUint16();
  26495. const lastChar = file.getUint16();
  26496. if (firstChar > lastChar) {
  26497. return false;
  26498. }
  26499. file.skip(6);
  26500. const usWinAscent = file.getUint16();
  26501. if (usWinAscent === 0) {
  26502. return false;
  26503. }
  26504. os2.data[8] = os2.data[9] = 0;
  26505. return true;
  26506. }
  26507. function createOS2Table(properties, charstrings, override) {
  26508. override = override || {
  26509. unitsPerEm: 0,
  26510. yMax: 0,
  26511. yMin: 0,
  26512. ascent: 0,
  26513. descent: 0,
  26514. };
  26515. let ulUnicodeRange1 = 0;
  26516. let ulUnicodeRange2 = 0;
  26517. let ulUnicodeRange3 = 0;
  26518. let ulUnicodeRange4 = 0;
  26519. let firstCharIndex = null;
  26520. let lastCharIndex = 0;
  26521. if (charstrings) {
  26522. for (let code in charstrings) {
  26523. code |= 0;
  26524. if (firstCharIndex > code || !firstCharIndex) {
  26525. firstCharIndex = code;
  26526. }
  26527. if (lastCharIndex < code) {
  26528. lastCharIndex = code;
  26529. }
  26530. const position = (0, _unicode.getUnicodeRangeFor)(code);
  26531. if (position < 32) {
  26532. ulUnicodeRange1 |= 1 << position;
  26533. } else if (position < 64) {
  26534. ulUnicodeRange2 |= 1 << (position - 32);
  26535. } else if (position < 96) {
  26536. ulUnicodeRange3 |= 1 << (position - 64);
  26537. } else if (position < 123) {
  26538. ulUnicodeRange4 |= 1 << (position - 96);
  26539. } else {
  26540. throw new _util.FormatError(
  26541. "Unicode ranges Bits > 123 are reserved for internal usage"
  26542. );
  26543. }
  26544. }
  26545. if (lastCharIndex > 0xffff) {
  26546. lastCharIndex = 0xffff;
  26547. }
  26548. } else {
  26549. firstCharIndex = 0;
  26550. lastCharIndex = 255;
  26551. }
  26552. const bbox = properties.bbox || [0, 0, 0, 0];
  26553. const unitsPerEm =
  26554. override.unitsPerEm ||
  26555. 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  26556. const scale = properties.ascentScaled
  26557. ? 1.0
  26558. : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  26559. const typoAscent =
  26560. override.ascent ||
  26561. Math.round(scale * (properties.ascent || bbox[3]));
  26562. let typoDescent =
  26563. override.descent ||
  26564. Math.round(scale * (properties.descent || bbox[1]));
  26565. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  26566. typoDescent = -typoDescent;
  26567. }
  26568. const winAscent = override.yMax || typoAscent;
  26569. const winDescent = -override.yMin || -typoDescent;
  26570. return (
  26571. "\x00\x03" +
  26572. "\x02\x24" +
  26573. "\x01\xF4" +
  26574. "\x00\x05" +
  26575. "\x00\x00" +
  26576. "\x02\x8A" +
  26577. "\x02\xBB" +
  26578. "\x00\x00" +
  26579. "\x00\x8C" +
  26580. "\x02\x8A" +
  26581. "\x02\xBB" +
  26582. "\x00\x00" +
  26583. "\x01\xDF" +
  26584. "\x00\x31" +
  26585. "\x01\x02" +
  26586. "\x00\x00" +
  26587. "\x00\x00\x06" +
  26588. String.fromCharCode(properties.fixedPitch ? 0x09 : 0x00) +
  26589. "\x00\x00\x00\x00\x00\x00" +
  26590. (0, _util.string32)(ulUnicodeRange1) +
  26591. (0, _util.string32)(ulUnicodeRange2) +
  26592. (0, _util.string32)(ulUnicodeRange3) +
  26593. (0, _util.string32)(ulUnicodeRange4) +
  26594. "\x2A\x32\x31\x2A" +
  26595. string16(properties.italicAngle ? 1 : 0) +
  26596. string16(firstCharIndex || properties.firstChar) +
  26597. string16(lastCharIndex || properties.lastChar) +
  26598. string16(typoAscent) +
  26599. string16(typoDescent) +
  26600. "\x00\x64" +
  26601. string16(winAscent) +
  26602. string16(winDescent) +
  26603. "\x00\x00\x00\x00" +
  26604. "\x00\x00\x00\x00" +
  26605. string16(properties.xHeight) +
  26606. string16(properties.capHeight) +
  26607. string16(0) +
  26608. string16(firstCharIndex || properties.firstChar) +
  26609. "\x00\x03"
  26610. );
  26611. }
  26612. function createPostTable(properties) {
  26613. const angle = Math.floor(properties.italicAngle * 2 ** 16);
  26614. return (
  26615. "\x00\x03\x00\x00" +
  26616. (0, _util.string32)(angle) +
  26617. "\x00\x00" +
  26618. "\x00\x00" +
  26619. (0, _util.string32)(properties.fixedPitch ? 1 : 0) +
  26620. "\x00\x00\x00\x00" +
  26621. "\x00\x00\x00\x00" +
  26622. "\x00\x00\x00\x00" +
  26623. "\x00\x00\x00\x00"
  26624. );
  26625. }
  26626. function createPostscriptName(name) {
  26627. return name.replace(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63);
  26628. }
  26629. function createNameTable(name, proto) {
  26630. if (!proto) {
  26631. proto = [[], []];
  26632. }
  26633. const strings = [
  26634. proto[0][0] || "Original licence",
  26635. proto[0][1] || name,
  26636. proto[0][2] || "Unknown",
  26637. proto[0][3] || "uniqueID",
  26638. proto[0][4] || name,
  26639. proto[0][5] || "Version 0.11",
  26640. proto[0][6] || createPostscriptName(name),
  26641. proto[0][7] || "Unknown",
  26642. proto[0][8] || "Unknown",
  26643. proto[0][9] || "Unknown",
  26644. ];
  26645. const stringsUnicode = [];
  26646. let i, ii, j, jj, str;
  26647. for (i = 0, ii = strings.length; i < ii; i++) {
  26648. str = proto[1][i] || strings[i];
  26649. const strBufUnicode = [];
  26650. for (j = 0, jj = str.length; j < jj; j++) {
  26651. strBufUnicode.push(string16(str.charCodeAt(j)));
  26652. }
  26653. stringsUnicode.push(strBufUnicode.join(""));
  26654. }
  26655. const names = [strings, stringsUnicode];
  26656. const platforms = ["\x00\x01", "\x00\x03"];
  26657. const encodings = ["\x00\x00", "\x00\x01"];
  26658. const languages = ["\x00\x00", "\x04\x09"];
  26659. const namesRecordCount = strings.length * platforms.length;
  26660. let nameTable =
  26661. "\x00\x00" +
  26662. string16(namesRecordCount) +
  26663. string16(namesRecordCount * 12 + 6);
  26664. let strOffset = 0;
  26665. for (i = 0, ii = platforms.length; i < ii; i++) {
  26666. const strs = names[i];
  26667. for (j = 0, jj = strs.length; j < jj; j++) {
  26668. str = strs[j];
  26669. const nameRecord =
  26670. platforms[i] +
  26671. encodings[i] +
  26672. languages[i] +
  26673. string16(j) +
  26674. string16(str.length) +
  26675. string16(strOffset);
  26676. nameTable += nameRecord;
  26677. strOffset += str.length;
  26678. }
  26679. }
  26680. nameTable += strings.join("") + stringsUnicode.join("");
  26681. return nameTable;
  26682. }
  26683. class Font {
  26684. constructor(name, file, properties) {
  26685. this.name = name;
  26686. this.psName = null;
  26687. this.mimetype = null;
  26688. this.disableFontFace = false;
  26689. this.loadedName = properties.loadedName;
  26690. this.isType3Font = properties.isType3Font;
  26691. this.missingFile = false;
  26692. this.cssFontInfo = properties.cssFontInfo;
  26693. this._charsCache = Object.create(null);
  26694. this._glyphCache = Object.create(null);
  26695. let isSerifFont = !!(
  26696. properties.flags & _fonts_utils.FontFlags.Serif
  26697. );
  26698. if (!isSerifFont && !properties.isSimulatedFlags) {
  26699. const baseName = name.replace(/[,_]/g, "-").split("-")[0],
  26700. serifFonts = (0, _standard_fonts.getSerifFonts)();
  26701. for (const namePart of baseName.split("+")) {
  26702. if (serifFonts[namePart]) {
  26703. isSerifFont = true;
  26704. break;
  26705. }
  26706. }
  26707. }
  26708. this.isSerifFont = isSerifFont;
  26709. this.isSymbolicFont = !!(
  26710. properties.flags & _fonts_utils.FontFlags.Symbolic
  26711. );
  26712. this.isMonospace = !!(
  26713. properties.flags & _fonts_utils.FontFlags.FixedPitch
  26714. );
  26715. let type = properties.type;
  26716. let subtype = properties.subtype;
  26717. this.type = type;
  26718. this.subtype = subtype;
  26719. let fallbackName = "sans-serif";
  26720. if (this.isMonospace) {
  26721. fallbackName = "monospace";
  26722. } else if (this.isSerifFont) {
  26723. fallbackName = "serif";
  26724. }
  26725. this.fallbackName = fallbackName;
  26726. this.differences = properties.differences;
  26727. this.widths = properties.widths;
  26728. this.defaultWidth = properties.defaultWidth;
  26729. this.composite = properties.composite;
  26730. this.cMap = properties.cMap;
  26731. this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
  26732. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  26733. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  26734. this.lineHeight = this.ascent - this.descent;
  26735. this.fontMatrix = properties.fontMatrix;
  26736. this.bbox = properties.bbox;
  26737. this.defaultEncoding = properties.defaultEncoding;
  26738. this.toUnicode = properties.toUnicode;
  26739. this.toFontChar = [];
  26740. if (properties.type === "Type3") {
  26741. for (let charCode = 0; charCode < 256; charCode++) {
  26742. this.toFontChar[charCode] =
  26743. this.differences[charCode] ||
  26744. properties.defaultEncoding[charCode];
  26745. }
  26746. this.fontType = _util.FontType.TYPE3;
  26747. return;
  26748. }
  26749. this.cidEncoding = properties.cidEncoding || "";
  26750. this.vertical = !!properties.vertical;
  26751. if (this.vertical) {
  26752. this.vmetrics = properties.vmetrics;
  26753. this.defaultVMetrics = properties.defaultVMetrics;
  26754. }
  26755. if (!file || file.isEmpty) {
  26756. if (file) {
  26757. (0, _util.warn)(
  26758. 'Font file is empty in "' +
  26759. name +
  26760. '" (' +
  26761. this.loadedName +
  26762. ")"
  26763. );
  26764. }
  26765. this.fallbackToSystemFont(properties);
  26766. return;
  26767. }
  26768. [type, subtype] = getFontFileType(file, properties);
  26769. if (type !== this.type || subtype !== this.subtype) {
  26770. (0, _util.info)(
  26771. "Inconsistent font file Type/SubType, expected: " +
  26772. `${this.type}/${this.subtype} but found: ${type}/${subtype}.`
  26773. );
  26774. }
  26775. let data;
  26776. try {
  26777. switch (type) {
  26778. case "MMType1":
  26779. (0, _util.info)(
  26780. "MMType1 font (" + name + "), falling back to Type1."
  26781. );
  26782. case "Type1":
  26783. case "CIDFontType0":
  26784. this.mimetype = "font/opentype";
  26785. const cff =
  26786. subtype === "Type1C" || subtype === "CIDFontType0C"
  26787. ? new _cff_font.CFFFont(file, properties)
  26788. : new _type1_font.Type1Font(name, file, properties);
  26789. adjustWidths(properties);
  26790. data = this.convert(name, cff, properties);
  26791. break;
  26792. case "OpenType":
  26793. case "TrueType":
  26794. case "CIDFontType2":
  26795. this.mimetype = "font/opentype";
  26796. data = this.checkAndRepair(name, file, properties);
  26797. if (this.isOpenType) {
  26798. adjustWidths(properties);
  26799. type = "OpenType";
  26800. }
  26801. break;
  26802. default:
  26803. throw new _util.FormatError(`Font ${type} is not supported`);
  26804. }
  26805. } catch (e) {
  26806. (0, _util.warn)(e);
  26807. this.fallbackToSystemFont(properties);
  26808. return;
  26809. }
  26810. amendFallbackToUnicode(properties);
  26811. this.data = data;
  26812. this.fontType = (0, _fonts_utils.getFontType)(
  26813. type,
  26814. subtype,
  26815. properties.isStandardFont
  26816. );
  26817. this.fontMatrix = properties.fontMatrix;
  26818. this.widths = properties.widths;
  26819. this.defaultWidth = properties.defaultWidth;
  26820. this.toUnicode = properties.toUnicode;
  26821. this.seacMap = properties.seacMap;
  26822. }
  26823. get renderer() {
  26824. const renderer = _font_renderer.FontRendererFactory.create(
  26825. this,
  26826. _fonts_utils.SEAC_ANALYSIS_ENABLED
  26827. );
  26828. return (0, _util.shadow)(this, "renderer", renderer);
  26829. }
  26830. exportData(extraProperties = false) {
  26831. const exportDataProperties = extraProperties
  26832. ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES]
  26833. : EXPORT_DATA_PROPERTIES;
  26834. const data = Object.create(null);
  26835. let property, value;
  26836. for (property of exportDataProperties) {
  26837. value = this[property];
  26838. if (value !== undefined) {
  26839. data[property] = value;
  26840. }
  26841. }
  26842. return data;
  26843. }
  26844. fallbackToSystemFont(properties) {
  26845. this.missingFile = true;
  26846. const name = this.name;
  26847. const type = this.type;
  26848. const subtype = this.subtype;
  26849. let fontName = (0, _fonts_utils.normalizeFontName)(name);
  26850. const stdFontMap = (0, _standard_fonts.getStdFontMap)(),
  26851. nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
  26852. const isStandardFont = !!stdFontMap[fontName];
  26853. const isMappedToStandardFont = !!(
  26854. nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]
  26855. );
  26856. fontName =
  26857. stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  26858. const fontBasicMetricsMap = (0, _metrics.getFontBasicMetrics)();
  26859. const metrics = fontBasicMetricsMap[fontName];
  26860. if (metrics) {
  26861. if (isNaN(this.ascent)) {
  26862. this.ascent = metrics.ascent / PDF_GLYPH_SPACE_UNITS;
  26863. }
  26864. if (isNaN(this.descent)) {
  26865. this.descent = metrics.descent / PDF_GLYPH_SPACE_UNITS;
  26866. }
  26867. if (isNaN(this.capHeight)) {
  26868. this.capHeight = metrics.capHeight / PDF_GLYPH_SPACE_UNITS;
  26869. }
  26870. }
  26871. this.bold = fontName.search(/bold/gi) !== -1;
  26872. this.italic =
  26873. fontName.search(/oblique/gi) !== -1 ||
  26874. fontName.search(/italic/gi) !== -1;
  26875. this.black = name.search(/Black/g) !== -1;
  26876. const isNarrow = name.search(/Narrow/g) !== -1;
  26877. this.remeasure =
  26878. (!isStandardFont || isNarrow) &&
  26879. Object.keys(this.widths).length > 0;
  26880. if (
  26881. (isStandardFont || isMappedToStandardFont) &&
  26882. type === "CIDFontType2" &&
  26883. this.cidEncoding.startsWith("Identity-")
  26884. ) {
  26885. const cidToGidMap = properties.cidToGidMap;
  26886. const map = [];
  26887. applyStandardFontGlyphMap(
  26888. map,
  26889. (0, _standard_fonts.getGlyphMapForStandardFonts)()
  26890. );
  26891. if (/Arial-?Black/i.test(name)) {
  26892. applyStandardFontGlyphMap(
  26893. map,
  26894. (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)()
  26895. );
  26896. } else if (/Calibri/i.test(name)) {
  26897. applyStandardFontGlyphMap(
  26898. map,
  26899. (0, _standard_fonts.getSupplementalGlyphMapForCalibri)()
  26900. );
  26901. }
  26902. if (cidToGidMap) {
  26903. for (const charCode in map) {
  26904. const cid = map[charCode];
  26905. if (cidToGidMap[cid] !== undefined) {
  26906. map[+charCode] = cidToGidMap[cid];
  26907. }
  26908. }
  26909. if (
  26910. cidToGidMap.length !== this.toUnicode.length &&
  26911. properties.hasIncludedToUnicodeMap &&
  26912. this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap
  26913. ) {
  26914. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  26915. const cid = map[charCode];
  26916. if (cidToGidMap[cid] === undefined) {
  26917. map[+charCode] = unicodeCharCode;
  26918. }
  26919. });
  26920. }
  26921. }
  26922. if (
  26923. !(
  26924. this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap
  26925. )
  26926. ) {
  26927. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  26928. map[+charCode] = unicodeCharCode;
  26929. });
  26930. }
  26931. this.toFontChar = map;
  26932. this.toUnicode = new _to_unicode_map.ToUnicodeMap(map);
  26933. } else if (/Symbol/i.test(fontName)) {
  26934. this.toFontChar = buildToFontChar(
  26935. _encodings.SymbolSetEncoding,
  26936. (0, _glyphlist.getGlyphsUnicode)(),
  26937. this.differences
  26938. );
  26939. } else if (/Dingbats/i.test(fontName)) {
  26940. if (/Wingdings/i.test(name)) {
  26941. (0, _util.warn)(
  26942. "Non-embedded Wingdings font, falling back to ZapfDingbats."
  26943. );
  26944. }
  26945. this.toFontChar = buildToFontChar(
  26946. _encodings.ZapfDingbatsEncoding,
  26947. (0, _glyphlist.getDingbatsGlyphsUnicode)(),
  26948. this.differences
  26949. );
  26950. } else if (isStandardFont) {
  26951. const map = buildToFontChar(
  26952. this.defaultEncoding,
  26953. (0, _glyphlist.getGlyphsUnicode)(),
  26954. this.differences
  26955. );
  26956. if (
  26957. type === "CIDFontType2" &&
  26958. !this.cidEncoding.startsWith("Identity-") &&
  26959. !(
  26960. this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap
  26961. )
  26962. ) {
  26963. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  26964. map[+charCode] = unicodeCharCode;
  26965. });
  26966. }
  26967. this.toFontChar = map;
  26968. } else {
  26969. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  26970. const map = [];
  26971. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  26972. if (!this.composite) {
  26973. const glyphName =
  26974. this.differences[charCode] ||
  26975. this.defaultEncoding[charCode];
  26976. const unicode = (0, _unicode.getUnicodeForGlyph)(
  26977. glyphName,
  26978. glyphsUnicodeMap
  26979. );
  26980. if (unicode !== -1) {
  26981. unicodeCharCode = unicode;
  26982. }
  26983. }
  26984. map[+charCode] = unicodeCharCode;
  26985. });
  26986. if (
  26987. this.composite &&
  26988. this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap
  26989. ) {
  26990. if (/Verdana/i.test(name)) {
  26991. applyStandardFontGlyphMap(
  26992. map,
  26993. (0, _standard_fonts.getGlyphMapForStandardFonts)()
  26994. );
  26995. }
  26996. }
  26997. this.toFontChar = map;
  26998. }
  26999. amendFallbackToUnicode(properties);
  27000. this.loadedName = fontName.split("-")[0];
  27001. this.fontType = (0, _fonts_utils.getFontType)(
  27002. type,
  27003. subtype,
  27004. properties.isStandardFont
  27005. );
  27006. }
  27007. checkAndRepair(name, font, properties) {
  27008. const VALID_TABLES = [
  27009. "OS/2",
  27010. "cmap",
  27011. "head",
  27012. "hhea",
  27013. "hmtx",
  27014. "maxp",
  27015. "name",
  27016. "post",
  27017. "loca",
  27018. "glyf",
  27019. "fpgm",
  27020. "prep",
  27021. "cvt ",
  27022. "CFF ",
  27023. ];
  27024. function readTables(file, numTables) {
  27025. const tables = Object.create(null);
  27026. tables["OS/2"] = null;
  27027. tables.cmap = null;
  27028. tables.head = null;
  27029. tables.hhea = null;
  27030. tables.hmtx = null;
  27031. tables.maxp = null;
  27032. tables.name = null;
  27033. tables.post = null;
  27034. for (let i = 0; i < numTables; i++) {
  27035. const table = readTableEntry(file);
  27036. if (!VALID_TABLES.includes(table.tag)) {
  27037. continue;
  27038. }
  27039. if (table.length === 0) {
  27040. continue;
  27041. }
  27042. tables[table.tag] = table;
  27043. }
  27044. return tables;
  27045. }
  27046. function readTableEntry(file) {
  27047. const tag = file.getString(4);
  27048. const checksum = file.getInt32() >>> 0;
  27049. const offset = file.getInt32() >>> 0;
  27050. const length = file.getInt32() >>> 0;
  27051. const previousPosition = file.pos;
  27052. file.pos = file.start || 0;
  27053. file.skip(offset);
  27054. const data = file.getBytes(length);
  27055. file.pos = previousPosition;
  27056. if (tag === "head") {
  27057. data[8] = data[9] = data[10] = data[11] = 0;
  27058. data[17] |= 0x20;
  27059. }
  27060. return {
  27061. tag,
  27062. checksum,
  27063. length,
  27064. offset,
  27065. data,
  27066. };
  27067. }
  27068. function readOpenTypeHeader(ttf) {
  27069. return {
  27070. version: ttf.getString(4),
  27071. numTables: ttf.getUint16(),
  27072. searchRange: ttf.getUint16(),
  27073. entrySelector: ttf.getUint16(),
  27074. rangeShift: ttf.getUint16(),
  27075. };
  27076. }
  27077. function readTrueTypeCollectionHeader(ttc) {
  27078. const ttcTag = ttc.getString(4);
  27079. (0, _util.assert)(
  27080. ttcTag === "ttcf",
  27081. "Must be a TrueType Collection font."
  27082. );
  27083. const majorVersion = ttc.getUint16();
  27084. const minorVersion = ttc.getUint16();
  27085. const numFonts = ttc.getInt32() >>> 0;
  27086. const offsetTable = [];
  27087. for (let i = 0; i < numFonts; i++) {
  27088. offsetTable.push(ttc.getInt32() >>> 0);
  27089. }
  27090. const header = {
  27091. ttcTag,
  27092. majorVersion,
  27093. minorVersion,
  27094. numFonts,
  27095. offsetTable,
  27096. };
  27097. switch (majorVersion) {
  27098. case 1:
  27099. return header;
  27100. case 2:
  27101. header.dsigTag = ttc.getInt32() >>> 0;
  27102. header.dsigLength = ttc.getInt32() >>> 0;
  27103. header.dsigOffset = ttc.getInt32() >>> 0;
  27104. return header;
  27105. }
  27106. throw new _util.FormatError(
  27107. `Invalid TrueType Collection majorVersion: ${majorVersion}.`
  27108. );
  27109. }
  27110. function readTrueTypeCollectionData(ttc, fontName) {
  27111. const { numFonts, offsetTable } =
  27112. readTrueTypeCollectionHeader(ttc);
  27113. const fontNameParts = fontName.split("+");
  27114. let fallbackData;
  27115. for (let i = 0; i < numFonts; i++) {
  27116. ttc.pos = (ttc.start || 0) + offsetTable[i];
  27117. const potentialHeader = readOpenTypeHeader(ttc);
  27118. const potentialTables = readTables(
  27119. ttc,
  27120. potentialHeader.numTables
  27121. );
  27122. if (!potentialTables.name) {
  27123. throw new _util.FormatError(
  27124. 'TrueType Collection font must contain a "name" table.'
  27125. );
  27126. }
  27127. const nameTable = readNameTable(potentialTables.name);
  27128. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  27129. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  27130. const nameEntry =
  27131. nameTable[j][k] && nameTable[j][k].replace(/\s/g, "");
  27132. if (!nameEntry) {
  27133. continue;
  27134. }
  27135. if (nameEntry === fontName) {
  27136. return {
  27137. header: potentialHeader,
  27138. tables: potentialTables,
  27139. };
  27140. }
  27141. if (fontNameParts.length < 2) {
  27142. continue;
  27143. }
  27144. for (const part of fontNameParts) {
  27145. if (nameEntry === part) {
  27146. fallbackData = {
  27147. name: part,
  27148. header: potentialHeader,
  27149. tables: potentialTables,
  27150. };
  27151. }
  27152. }
  27153. }
  27154. }
  27155. }
  27156. if (fallbackData) {
  27157. (0, _util.warn)(
  27158. `TrueType Collection does not contain "${fontName}" font, ` +
  27159. `falling back to "${fallbackData.name}" font instead.`
  27160. );
  27161. return {
  27162. header: fallbackData.header,
  27163. tables: fallbackData.tables,
  27164. };
  27165. }
  27166. throw new _util.FormatError(
  27167. `TrueType Collection does not contain "${fontName}" font.`
  27168. );
  27169. }
  27170. function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
  27171. if (!cmap) {
  27172. (0, _util.warn)("No cmap table available.");
  27173. return {
  27174. platformId: -1,
  27175. encodingId: -1,
  27176. mappings: [],
  27177. hasShortCmap: false,
  27178. };
  27179. }
  27180. let segment;
  27181. let start = (file.start || 0) + cmap.offset;
  27182. file.pos = start;
  27183. file.skip(2);
  27184. const numTables = file.getUint16();
  27185. let potentialTable;
  27186. let canBreak = false;
  27187. for (let i = 0; i < numTables; i++) {
  27188. const platformId = file.getUint16();
  27189. const encodingId = file.getUint16();
  27190. const offset = file.getInt32() >>> 0;
  27191. let useTable = false;
  27192. if (
  27193. potentialTable &&
  27194. potentialTable.platformId === platformId &&
  27195. potentialTable.encodingId === encodingId
  27196. ) {
  27197. continue;
  27198. }
  27199. if (
  27200. platformId === 0 &&
  27201. (encodingId === 0 || encodingId === 1 || encodingId === 3)
  27202. ) {
  27203. useTable = true;
  27204. } else if (platformId === 1 && encodingId === 0) {
  27205. useTable = true;
  27206. } else if (
  27207. platformId === 3 &&
  27208. encodingId === 1 &&
  27209. (hasEncoding || !potentialTable)
  27210. ) {
  27211. useTable = true;
  27212. if (!isSymbolicFont) {
  27213. canBreak = true;
  27214. }
  27215. } else if (
  27216. isSymbolicFont &&
  27217. platformId === 3 &&
  27218. encodingId === 0
  27219. ) {
  27220. useTable = true;
  27221. let correctlySorted = true;
  27222. if (i < numTables - 1) {
  27223. const nextBytes = file.peekBytes(2),
  27224. nextPlatformId = int16(nextBytes[0], nextBytes[1]);
  27225. if (nextPlatformId < platformId) {
  27226. correctlySorted = false;
  27227. }
  27228. }
  27229. if (correctlySorted) {
  27230. canBreak = true;
  27231. }
  27232. }
  27233. if (useTable) {
  27234. potentialTable = {
  27235. platformId,
  27236. encodingId,
  27237. offset,
  27238. };
  27239. }
  27240. if (canBreak) {
  27241. break;
  27242. }
  27243. }
  27244. if (potentialTable) {
  27245. file.pos = start + potentialTable.offset;
  27246. }
  27247. if (!potentialTable || file.peekByte() === -1) {
  27248. (0, _util.warn)("Could not find a preferred cmap table.");
  27249. return {
  27250. platformId: -1,
  27251. encodingId: -1,
  27252. mappings: [],
  27253. hasShortCmap: false,
  27254. };
  27255. }
  27256. const format = file.getUint16();
  27257. let hasShortCmap = false;
  27258. const mappings = [];
  27259. let j, glyphId;
  27260. if (format === 0) {
  27261. file.skip(2 + 2);
  27262. for (j = 0; j < 256; j++) {
  27263. const index = file.getByte();
  27264. if (!index) {
  27265. continue;
  27266. }
  27267. mappings.push({
  27268. charCode: j,
  27269. glyphId: index,
  27270. });
  27271. }
  27272. hasShortCmap = true;
  27273. } else if (format === 2) {
  27274. file.skip(2 + 2);
  27275. const subHeaderKeys = [];
  27276. let maxSubHeaderKey = 0;
  27277. for (let i = 0; i < 256; i++) {
  27278. const subHeaderKey = file.getUint16() >> 3;
  27279. subHeaderKeys.push(subHeaderKey);
  27280. maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey);
  27281. }
  27282. const subHeaders = [];
  27283. for (let i = 0; i <= maxSubHeaderKey; i++) {
  27284. subHeaders.push({
  27285. firstCode: file.getUint16(),
  27286. entryCount: file.getUint16(),
  27287. idDelta: signedInt16(file.getByte(), file.getByte()),
  27288. idRangePos: file.pos + file.getUint16(),
  27289. });
  27290. }
  27291. for (let i = 0; i < 256; i++) {
  27292. if (subHeaderKeys[i] === 0) {
  27293. file.pos = subHeaders[0].idRangePos + 2 * i;
  27294. glyphId = file.getUint16();
  27295. mappings.push({
  27296. charCode: i,
  27297. glyphId,
  27298. });
  27299. } else {
  27300. const s = subHeaders[subHeaderKeys[i]];
  27301. for (j = 0; j < s.entryCount; j++) {
  27302. const charCode = (i << 8) + j + s.firstCode;
  27303. file.pos = s.idRangePos + 2 * j;
  27304. glyphId = file.getUint16();
  27305. if (glyphId !== 0) {
  27306. glyphId = (glyphId + s.idDelta) % 65536;
  27307. }
  27308. mappings.push({
  27309. charCode,
  27310. glyphId,
  27311. });
  27312. }
  27313. }
  27314. }
  27315. } else if (format === 4) {
  27316. file.skip(2 + 2);
  27317. const segCount = file.getUint16() >> 1;
  27318. file.skip(6);
  27319. const segments = [];
  27320. let segIndex;
  27321. for (segIndex = 0; segIndex < segCount; segIndex++) {
  27322. segments.push({
  27323. end: file.getUint16(),
  27324. });
  27325. }
  27326. file.skip(2);
  27327. for (segIndex = 0; segIndex < segCount; segIndex++) {
  27328. segments[segIndex].start = file.getUint16();
  27329. }
  27330. for (segIndex = 0; segIndex < segCount; segIndex++) {
  27331. segments[segIndex].delta = file.getUint16();
  27332. }
  27333. let offsetsCount = 0,
  27334. offsetIndex;
  27335. for (segIndex = 0; segIndex < segCount; segIndex++) {
  27336. segment = segments[segIndex];
  27337. const rangeOffset = file.getUint16();
  27338. if (!rangeOffset) {
  27339. segment.offsetIndex = -1;
  27340. continue;
  27341. }
  27342. offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  27343. segment.offsetIndex = offsetIndex;
  27344. offsetsCount = Math.max(
  27345. offsetsCount,
  27346. offsetIndex + segment.end - segment.start + 1
  27347. );
  27348. }
  27349. const offsets = [];
  27350. for (j = 0; j < offsetsCount; j++) {
  27351. offsets.push(file.getUint16());
  27352. }
  27353. for (segIndex = 0; segIndex < segCount; segIndex++) {
  27354. segment = segments[segIndex];
  27355. start = segment.start;
  27356. const end = segment.end;
  27357. const delta = segment.delta;
  27358. offsetIndex = segment.offsetIndex;
  27359. for (j = start; j <= end; j++) {
  27360. if (j === 0xffff) {
  27361. continue;
  27362. }
  27363. glyphId =
  27364. offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  27365. glyphId = (glyphId + delta) & 0xffff;
  27366. mappings.push({
  27367. charCode: j,
  27368. glyphId,
  27369. });
  27370. }
  27371. }
  27372. } else if (format === 6) {
  27373. file.skip(2 + 2);
  27374. const firstCode = file.getUint16();
  27375. const entryCount = file.getUint16();
  27376. for (j = 0; j < entryCount; j++) {
  27377. glyphId = file.getUint16();
  27378. const charCode = firstCode + j;
  27379. mappings.push({
  27380. charCode,
  27381. glyphId,
  27382. });
  27383. }
  27384. } else if (format === 12) {
  27385. file.skip(2 + 4 + 4);
  27386. const nGroups = file.getInt32() >>> 0;
  27387. for (j = 0; j < nGroups; j++) {
  27388. const startCharCode = file.getInt32() >>> 0;
  27389. const endCharCode = file.getInt32() >>> 0;
  27390. let glyphCode = file.getInt32() >>> 0;
  27391. for (
  27392. let charCode = startCharCode;
  27393. charCode <= endCharCode;
  27394. charCode++
  27395. ) {
  27396. mappings.push({
  27397. charCode,
  27398. glyphId: glyphCode++,
  27399. });
  27400. }
  27401. }
  27402. } else {
  27403. (0, _util.warn)("cmap table has unsupported format: " + format);
  27404. return {
  27405. platformId: -1,
  27406. encodingId: -1,
  27407. mappings: [],
  27408. hasShortCmap: false,
  27409. };
  27410. }
  27411. mappings.sort(function (a, b) {
  27412. return a.charCode - b.charCode;
  27413. });
  27414. for (let i = 1; i < mappings.length; i++) {
  27415. if (mappings[i - 1].charCode === mappings[i].charCode) {
  27416. mappings.splice(i, 1);
  27417. i--;
  27418. }
  27419. }
  27420. return {
  27421. platformId: potentialTable.platformId,
  27422. encodingId: potentialTable.encodingId,
  27423. mappings,
  27424. hasShortCmap,
  27425. };
  27426. }
  27427. function sanitizeMetrics(
  27428. file,
  27429. header,
  27430. metrics,
  27431. headTable,
  27432. numGlyphs,
  27433. dupFirstEntry
  27434. ) {
  27435. if (!header) {
  27436. if (metrics) {
  27437. metrics.data = null;
  27438. }
  27439. return;
  27440. }
  27441. file.pos = (file.start || 0) + header.offset;
  27442. file.pos += 4;
  27443. file.pos += 2;
  27444. file.pos += 2;
  27445. file.pos += 2;
  27446. file.pos += 2;
  27447. file.pos += 2;
  27448. file.pos += 2;
  27449. file.pos += 2;
  27450. file.pos += 2;
  27451. file.pos += 2;
  27452. const caretOffset = file.getUint16();
  27453. file.pos += 8;
  27454. file.pos += 2;
  27455. let numOfMetrics = file.getUint16();
  27456. if (caretOffset !== 0) {
  27457. const macStyle = int16(headTable.data[44], headTable.data[45]);
  27458. if (!(macStyle & 2)) {
  27459. header.data[22] = 0;
  27460. header.data[23] = 0;
  27461. }
  27462. }
  27463. if (numOfMetrics > numGlyphs) {
  27464. (0, _util.info)(
  27465. `The numOfMetrics (${numOfMetrics}) should not be ` +
  27466. `greater than the numGlyphs (${numGlyphs}).`
  27467. );
  27468. numOfMetrics = numGlyphs;
  27469. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  27470. header.data[35] = numOfMetrics & 0x00ff;
  27471. }
  27472. const numOfSidebearings = numGlyphs - numOfMetrics;
  27473. const numMissing =
  27474. numOfSidebearings - ((metrics.length - numOfMetrics * 4) >> 1);
  27475. if (numMissing > 0) {
  27476. const entries = new Uint8Array(metrics.length + numMissing * 2);
  27477. entries.set(metrics.data);
  27478. if (dupFirstEntry) {
  27479. entries[metrics.length] = metrics.data[2];
  27480. entries[metrics.length + 1] = metrics.data[3];
  27481. }
  27482. metrics.data = entries;
  27483. }
  27484. }
  27485. function sanitizeGlyph(
  27486. source,
  27487. sourceStart,
  27488. sourceEnd,
  27489. dest,
  27490. destStart,
  27491. hintsValid
  27492. ) {
  27493. const glyphProfile = {
  27494. length: 0,
  27495. sizeOfInstructions: 0,
  27496. };
  27497. if (sourceEnd - sourceStart <= 12) {
  27498. return glyphProfile;
  27499. }
  27500. const glyf = source.subarray(sourceStart, sourceEnd);
  27501. let contoursCount = signedInt16(glyf[0], glyf[1]);
  27502. if (contoursCount < 0) {
  27503. contoursCount = -1;
  27504. writeSignedInt16(glyf, 0, contoursCount);
  27505. dest.set(glyf, destStart);
  27506. glyphProfile.length = glyf.length;
  27507. return glyphProfile;
  27508. }
  27509. let i,
  27510. j = 10,
  27511. flagsCount = 0;
  27512. for (i = 0; i < contoursCount; i++) {
  27513. const endPoint = (glyf[j] << 8) | glyf[j + 1];
  27514. flagsCount = endPoint + 1;
  27515. j += 2;
  27516. }
  27517. const instructionsStart = j;
  27518. const instructionsLength = (glyf[j] << 8) | glyf[j + 1];
  27519. glyphProfile.sizeOfInstructions = instructionsLength;
  27520. j += 2 + instructionsLength;
  27521. const instructionsEnd = j;
  27522. let coordinatesLength = 0;
  27523. for (i = 0; i < flagsCount; i++) {
  27524. const flag = glyf[j++];
  27525. if (flag & 0xc0) {
  27526. glyf[j - 1] = flag & 0x3f;
  27527. }
  27528. let xLength = 2;
  27529. if (flag & 2) {
  27530. xLength = 1;
  27531. } else if (flag & 16) {
  27532. xLength = 0;
  27533. }
  27534. let yLength = 2;
  27535. if (flag & 4) {
  27536. yLength = 1;
  27537. } else if (flag & 32) {
  27538. yLength = 0;
  27539. }
  27540. const xyLength = xLength + yLength;
  27541. coordinatesLength += xyLength;
  27542. if (flag & 8) {
  27543. const repeat = glyf[j++];
  27544. i += repeat;
  27545. coordinatesLength += repeat * xyLength;
  27546. }
  27547. }
  27548. if (coordinatesLength === 0) {
  27549. return glyphProfile;
  27550. }
  27551. let glyphDataLength = j + coordinatesLength;
  27552. if (glyphDataLength > glyf.length) {
  27553. return glyphProfile;
  27554. }
  27555. if (!hintsValid && instructionsLength > 0) {
  27556. dest.set(glyf.subarray(0, instructionsStart), destStart);
  27557. dest.set([0, 0], destStart + instructionsStart);
  27558. dest.set(
  27559. glyf.subarray(instructionsEnd, glyphDataLength),
  27560. destStart + instructionsStart + 2
  27561. );
  27562. glyphDataLength -= instructionsLength;
  27563. if (glyf.length - glyphDataLength > 3) {
  27564. glyphDataLength = (glyphDataLength + 3) & ~3;
  27565. }
  27566. glyphProfile.length = glyphDataLength;
  27567. return glyphProfile;
  27568. }
  27569. if (glyf.length - glyphDataLength > 3) {
  27570. glyphDataLength = (glyphDataLength + 3) & ~3;
  27571. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  27572. glyphProfile.length = glyphDataLength;
  27573. return glyphProfile;
  27574. }
  27575. dest.set(glyf, destStart);
  27576. glyphProfile.length = glyf.length;
  27577. return glyphProfile;
  27578. }
  27579. function sanitizeHead(head, numGlyphs, locaLength) {
  27580. const data = head.data;
  27581. const version = int32(data[0], data[1], data[2], data[3]);
  27582. if (version >> 16 !== 1) {
  27583. (0, _util.info)(
  27584. "Attempting to fix invalid version in head table: " + version
  27585. );
  27586. data[0] = 0;
  27587. data[1] = 1;
  27588. data[2] = 0;
  27589. data[3] = 0;
  27590. }
  27591. const indexToLocFormat = int16(data[50], data[51]);
  27592. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  27593. (0, _util.info)(
  27594. "Attempting to fix invalid indexToLocFormat in head table: " +
  27595. indexToLocFormat
  27596. );
  27597. const numGlyphsPlusOne = numGlyphs + 1;
  27598. if (locaLength === numGlyphsPlusOne << 1) {
  27599. data[50] = 0;
  27600. data[51] = 0;
  27601. } else if (locaLength === numGlyphsPlusOne << 2) {
  27602. data[50] = 0;
  27603. data[51] = 1;
  27604. } else {
  27605. throw new _util.FormatError(
  27606. "Could not fix indexToLocFormat: " + indexToLocFormat
  27607. );
  27608. }
  27609. }
  27610. }
  27611. function sanitizeGlyphLocations(
  27612. loca,
  27613. glyf,
  27614. numGlyphs,
  27615. isGlyphLocationsLong,
  27616. hintsValid,
  27617. dupFirstEntry,
  27618. maxSizeOfInstructions
  27619. ) {
  27620. let itemSize, itemDecode, itemEncode;
  27621. if (isGlyphLocationsLong) {
  27622. itemSize = 4;
  27623. itemDecode = function fontItemDecodeLong(data, offset) {
  27624. return (
  27625. (data[offset] << 24) |
  27626. (data[offset + 1] << 16) |
  27627. (data[offset + 2] << 8) |
  27628. data[offset + 3]
  27629. );
  27630. };
  27631. itemEncode = function fontItemEncodeLong(data, offset, value) {
  27632. data[offset] = (value >>> 24) & 0xff;
  27633. data[offset + 1] = (value >> 16) & 0xff;
  27634. data[offset + 2] = (value >> 8) & 0xff;
  27635. data[offset + 3] = value & 0xff;
  27636. };
  27637. } else {
  27638. itemSize = 2;
  27639. itemDecode = function fontItemDecode(data, offset) {
  27640. return (data[offset] << 9) | (data[offset + 1] << 1);
  27641. };
  27642. itemEncode = function fontItemEncode(data, offset, value) {
  27643. data[offset] = (value >> 9) & 0xff;
  27644. data[offset + 1] = (value >> 1) & 0xff;
  27645. };
  27646. }
  27647. const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  27648. const locaDataSize = itemSize * (1 + numGlyphsOut);
  27649. const locaData = new Uint8Array(locaDataSize);
  27650. locaData.set(loca.data.subarray(0, locaDataSize));
  27651. loca.data = locaData;
  27652. const oldGlyfData = glyf.data;
  27653. const oldGlyfDataLength = oldGlyfData.length;
  27654. const newGlyfData = new Uint8Array(oldGlyfDataLength);
  27655. let i, j;
  27656. const locaEntries = [];
  27657. for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
  27658. let offset = itemDecode(locaData, j);
  27659. if (offset > oldGlyfDataLength) {
  27660. offset = oldGlyfDataLength;
  27661. }
  27662. locaEntries.push({
  27663. index: i,
  27664. offset,
  27665. endOffset: 0,
  27666. });
  27667. }
  27668. locaEntries.sort((a, b) => {
  27669. return a.offset - b.offset;
  27670. });
  27671. for (i = 0; i < numGlyphs; i++) {
  27672. locaEntries[i].endOffset = locaEntries[i + 1].offset;
  27673. }
  27674. locaEntries.sort((a, b) => {
  27675. return a.index - b.index;
  27676. });
  27677. for (i = 0; i < numGlyphs; i++) {
  27678. const { offset, endOffset } = locaEntries[i];
  27679. if (offset !== 0 || endOffset !== 0) {
  27680. break;
  27681. }
  27682. const nextOffset = locaEntries[i + 1].offset;
  27683. if (nextOffset === 0) {
  27684. continue;
  27685. }
  27686. locaEntries[i].endOffset = nextOffset;
  27687. break;
  27688. }
  27689. const missingGlyphs = Object.create(null);
  27690. let writeOffset = 0;
  27691. itemEncode(locaData, 0, writeOffset);
  27692. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  27693. const glyphProfile = sanitizeGlyph(
  27694. oldGlyfData,
  27695. locaEntries[i].offset,
  27696. locaEntries[i].endOffset,
  27697. newGlyfData,
  27698. writeOffset,
  27699. hintsValid
  27700. );
  27701. const newLength = glyphProfile.length;
  27702. if (newLength === 0) {
  27703. missingGlyphs[i] = true;
  27704. }
  27705. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  27706. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  27707. }
  27708. writeOffset += newLength;
  27709. itemEncode(locaData, j, writeOffset);
  27710. }
  27711. if (writeOffset === 0) {
  27712. const simpleGlyph = new Uint8Array([
  27713. 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0,
  27714. ]);
  27715. for (
  27716. i = 0, j = itemSize;
  27717. i < numGlyphsOut;
  27718. i++, j += itemSize
  27719. ) {
  27720. itemEncode(locaData, j, simpleGlyph.length);
  27721. }
  27722. glyf.data = simpleGlyph;
  27723. } else if (dupFirstEntry) {
  27724. const firstEntryLength = itemDecode(locaData, itemSize);
  27725. if (newGlyfData.length > firstEntryLength + writeOffset) {
  27726. glyf.data = newGlyfData.subarray(
  27727. 0,
  27728. firstEntryLength + writeOffset
  27729. );
  27730. } else {
  27731. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  27732. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  27733. }
  27734. glyf.data.set(
  27735. newGlyfData.subarray(0, firstEntryLength),
  27736. writeOffset
  27737. );
  27738. itemEncode(
  27739. loca.data,
  27740. locaData.length - itemSize,
  27741. writeOffset + firstEntryLength
  27742. );
  27743. } else {
  27744. glyf.data = newGlyfData.subarray(0, writeOffset);
  27745. }
  27746. return {
  27747. missingGlyphs,
  27748. maxSizeOfInstructions,
  27749. };
  27750. }
  27751. function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
  27752. const start = (font.start || 0) + post.offset;
  27753. font.pos = start;
  27754. const length = post.length,
  27755. end = start + length;
  27756. const version = font.getInt32();
  27757. font.skip(28);
  27758. let glyphNames;
  27759. let valid = true;
  27760. let i;
  27761. switch (version) {
  27762. case 0x00010000:
  27763. glyphNames = _fonts_utils.MacStandardGlyphOrdering;
  27764. break;
  27765. case 0x00020000:
  27766. const numGlyphs = font.getUint16();
  27767. if (numGlyphs !== maxpNumGlyphs) {
  27768. valid = false;
  27769. break;
  27770. }
  27771. const glyphNameIndexes = [];
  27772. for (i = 0; i < numGlyphs; ++i) {
  27773. const index = font.getUint16();
  27774. if (index >= 32768) {
  27775. valid = false;
  27776. break;
  27777. }
  27778. glyphNameIndexes.push(index);
  27779. }
  27780. if (!valid) {
  27781. break;
  27782. }
  27783. const customNames = [],
  27784. strBuf = [];
  27785. while (font.pos < end) {
  27786. const stringLength = font.getByte();
  27787. strBuf.length = stringLength;
  27788. for (i = 0; i < stringLength; ++i) {
  27789. strBuf[i] = String.fromCharCode(font.getByte());
  27790. }
  27791. customNames.push(strBuf.join(""));
  27792. }
  27793. glyphNames = [];
  27794. for (i = 0; i < numGlyphs; ++i) {
  27795. const j = glyphNameIndexes[i];
  27796. if (j < 258) {
  27797. glyphNames.push(_fonts_utils.MacStandardGlyphOrdering[j]);
  27798. continue;
  27799. }
  27800. glyphNames.push(customNames[j - 258]);
  27801. }
  27802. break;
  27803. case 0x00030000:
  27804. break;
  27805. default:
  27806. (0, _util.warn)(
  27807. "Unknown/unsupported post table version " + version
  27808. );
  27809. valid = false;
  27810. if (propertiesObj.defaultEncoding) {
  27811. glyphNames = propertiesObj.defaultEncoding;
  27812. }
  27813. break;
  27814. }
  27815. propertiesObj.glyphNames = glyphNames;
  27816. return valid;
  27817. }
  27818. function readNameTable(nameTable) {
  27819. const start = (font.start || 0) + nameTable.offset;
  27820. font.pos = start;
  27821. const names = [[], []];
  27822. const length = nameTable.length,
  27823. end = start + length;
  27824. const format = font.getUint16();
  27825. const FORMAT_0_HEADER_LENGTH = 6;
  27826. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  27827. return names;
  27828. }
  27829. const numRecords = font.getUint16();
  27830. const stringsStart = font.getUint16();
  27831. const records = [];
  27832. const NAME_RECORD_LENGTH = 12;
  27833. let i, ii;
  27834. for (
  27835. i = 0;
  27836. i < numRecords && font.pos + NAME_RECORD_LENGTH <= end;
  27837. i++
  27838. ) {
  27839. const r = {
  27840. platform: font.getUint16(),
  27841. encoding: font.getUint16(),
  27842. language: font.getUint16(),
  27843. name: font.getUint16(),
  27844. length: font.getUint16(),
  27845. offset: font.getUint16(),
  27846. };
  27847. if (
  27848. (r.platform === 1 && r.encoding === 0 && r.language === 0) ||
  27849. (r.platform === 3 && r.encoding === 1 && r.language === 0x409)
  27850. ) {
  27851. records.push(r);
  27852. }
  27853. }
  27854. for (i = 0, ii = records.length; i < ii; i++) {
  27855. const record = records[i];
  27856. if (record.length <= 0) {
  27857. continue;
  27858. }
  27859. const pos = start + stringsStart + record.offset;
  27860. if (pos + record.length > end) {
  27861. continue;
  27862. }
  27863. font.pos = pos;
  27864. const nameIndex = record.name;
  27865. if (record.encoding) {
  27866. let str = "";
  27867. for (let j = 0, jj = record.length; j < jj; j += 2) {
  27868. str += String.fromCharCode(font.getUint16());
  27869. }
  27870. names[1][nameIndex] = str;
  27871. } else {
  27872. names[0][nameIndex] = font.getString(record.length);
  27873. }
  27874. }
  27875. return names;
  27876. }
  27877. const TTOpsStackDeltas = [
  27878. 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, 0, 0, -2, -5, -1, -1, -1,
  27879. -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -1, -1, 1, -1, -999, 0,
  27880. 1, 0, -1, -2, 0, -1, -2, -1, -1, 0, -1, -1, 0, 0, -999, -999, -1,
  27881. -1, -1, -1, -2, -999, -2, -2, -999, 0, -2, -2, 0, 0, -2, 0, -2, 0,
  27882. 0, 0, -2, -1, -1, 1, 1, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0,
  27883. -1, 0, -1, -1, 0, -999, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0,
  27884. 0, 0, 0, 0, 0, 0, -2, -999, -999, -999, -999, -999, -1, -1, -2,
  27885. -2, 0, 0, 0, 0, -1, -1, -999, -2, -2, 0, 0, -1, -2, -2, 0, 0, 0,
  27886. -1, -1, -1, -2,
  27887. ];
  27888. function sanitizeTTProgram(table, ttContext) {
  27889. let data = table.data;
  27890. let i = 0,
  27891. j,
  27892. n,
  27893. b,
  27894. funcId,
  27895. pc,
  27896. lastEndf = 0,
  27897. lastDeff = 0;
  27898. const stack = [];
  27899. const callstack = [];
  27900. const functionsCalled = [];
  27901. let tooComplexToFollowFunctions =
  27902. ttContext.tooComplexToFollowFunctions;
  27903. let inFDEF = false,
  27904. ifLevel = 0,
  27905. inELSE = 0;
  27906. for (let ii = data.length; i < ii; ) {
  27907. const op = data[i++];
  27908. if (op === 0x40) {
  27909. n = data[i++];
  27910. if (inFDEF || inELSE) {
  27911. i += n;
  27912. } else {
  27913. for (j = 0; j < n; j++) {
  27914. stack.push(data[i++]);
  27915. }
  27916. }
  27917. } else if (op === 0x41) {
  27918. n = data[i++];
  27919. if (inFDEF || inELSE) {
  27920. i += n * 2;
  27921. } else {
  27922. for (j = 0; j < n; j++) {
  27923. b = data[i++];
  27924. stack.push((b << 8) | data[i++]);
  27925. }
  27926. }
  27927. } else if ((op & 0xf8) === 0xb0) {
  27928. n = op - 0xb0 + 1;
  27929. if (inFDEF || inELSE) {
  27930. i += n;
  27931. } else {
  27932. for (j = 0; j < n; j++) {
  27933. stack.push(data[i++]);
  27934. }
  27935. }
  27936. } else if ((op & 0xf8) === 0xb8) {
  27937. n = op - 0xb8 + 1;
  27938. if (inFDEF || inELSE) {
  27939. i += n * 2;
  27940. } else {
  27941. for (j = 0; j < n; j++) {
  27942. b = data[i++];
  27943. stack.push((b << 8) | data[i++]);
  27944. }
  27945. }
  27946. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  27947. if (!inFDEF && !inELSE) {
  27948. funcId = stack.at(-1);
  27949. if (isNaN(funcId)) {
  27950. (0, _util.info)(
  27951. "TT: CALL empty stack (or invalid entry)."
  27952. );
  27953. } else {
  27954. ttContext.functionsUsed[funcId] = true;
  27955. if (funcId in ttContext.functionsStackDeltas) {
  27956. const newStackLength =
  27957. stack.length + ttContext.functionsStackDeltas[funcId];
  27958. if (newStackLength < 0) {
  27959. (0, _util.warn)(
  27960. "TT: CALL invalid functions stack delta."
  27961. );
  27962. ttContext.hintsValid = false;
  27963. return;
  27964. }
  27965. stack.length = newStackLength;
  27966. } else if (
  27967. funcId in ttContext.functionsDefined &&
  27968. !functionsCalled.includes(funcId)
  27969. ) {
  27970. callstack.push({
  27971. data,
  27972. i,
  27973. stackTop: stack.length - 1,
  27974. });
  27975. functionsCalled.push(funcId);
  27976. pc = ttContext.functionsDefined[funcId];
  27977. if (!pc) {
  27978. (0, _util.warn)("TT: CALL non-existent function");
  27979. ttContext.hintsValid = false;
  27980. return;
  27981. }
  27982. data = pc.data;
  27983. i = pc.i;
  27984. }
  27985. }
  27986. }
  27987. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  27988. if (inFDEF || inELSE) {
  27989. (0, _util.warn)("TT: nested FDEFs not allowed");
  27990. tooComplexToFollowFunctions = true;
  27991. }
  27992. inFDEF = true;
  27993. lastDeff = i;
  27994. funcId = stack.pop();
  27995. ttContext.functionsDefined[funcId] = {
  27996. data,
  27997. i,
  27998. };
  27999. } else if (op === 0x2d) {
  28000. if (inFDEF) {
  28001. inFDEF = false;
  28002. lastEndf = i;
  28003. } else {
  28004. pc = callstack.pop();
  28005. if (!pc) {
  28006. (0, _util.warn)("TT: ENDF bad stack");
  28007. ttContext.hintsValid = false;
  28008. return;
  28009. }
  28010. funcId = functionsCalled.pop();
  28011. data = pc.data;
  28012. i = pc.i;
  28013. ttContext.functionsStackDeltas[funcId] =
  28014. stack.length - pc.stackTop;
  28015. }
  28016. } else if (op === 0x89) {
  28017. if (inFDEF || inELSE) {
  28018. (0, _util.warn)("TT: nested IDEFs not allowed");
  28019. tooComplexToFollowFunctions = true;
  28020. }
  28021. inFDEF = true;
  28022. lastDeff = i;
  28023. } else if (op === 0x58) {
  28024. ++ifLevel;
  28025. } else if (op === 0x1b) {
  28026. inELSE = ifLevel;
  28027. } else if (op === 0x59) {
  28028. if (inELSE === ifLevel) {
  28029. inELSE = 0;
  28030. }
  28031. --ifLevel;
  28032. } else if (op === 0x1c) {
  28033. if (!inFDEF && !inELSE) {
  28034. const offset = stack.at(-1);
  28035. if (offset > 0) {
  28036. i += offset - 1;
  28037. }
  28038. }
  28039. }
  28040. if (!inFDEF && !inELSE) {
  28041. let stackDelta = 0;
  28042. if (op <= 0x8e) {
  28043. stackDelta = TTOpsStackDeltas[op];
  28044. } else if (op >= 0xc0 && op <= 0xdf) {
  28045. stackDelta = -1;
  28046. } else if (op >= 0xe0) {
  28047. stackDelta = -2;
  28048. }
  28049. if (op >= 0x71 && op <= 0x75) {
  28050. n = stack.pop();
  28051. if (!isNaN(n)) {
  28052. stackDelta = -n * 2;
  28053. }
  28054. }
  28055. while (stackDelta < 0 && stack.length > 0) {
  28056. stack.pop();
  28057. stackDelta++;
  28058. }
  28059. while (stackDelta > 0) {
  28060. stack.push(NaN);
  28061. stackDelta--;
  28062. }
  28063. }
  28064. }
  28065. ttContext.tooComplexToFollowFunctions =
  28066. tooComplexToFollowFunctions;
  28067. const content = [data];
  28068. if (i > data.length) {
  28069. content.push(new Uint8Array(i - data.length));
  28070. }
  28071. if (lastDeff > lastEndf) {
  28072. (0, _util.warn)("TT: complementing a missing function tail");
  28073. content.push(new Uint8Array([0x22, 0x2d]));
  28074. }
  28075. foldTTTable(table, content);
  28076. }
  28077. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  28078. if (ttContext.tooComplexToFollowFunctions) {
  28079. return;
  28080. }
  28081. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  28082. (0, _util.warn)("TT: more functions defined than expected");
  28083. ttContext.hintsValid = false;
  28084. return;
  28085. }
  28086. for (
  28087. let j = 0, jj = ttContext.functionsUsed.length;
  28088. j < jj;
  28089. j++
  28090. ) {
  28091. if (j > maxFunctionDefs) {
  28092. (0, _util.warn)("TT: invalid function id: " + j);
  28093. ttContext.hintsValid = false;
  28094. return;
  28095. }
  28096. if (
  28097. ttContext.functionsUsed[j] &&
  28098. !ttContext.functionsDefined[j]
  28099. ) {
  28100. (0, _util.warn)("TT: undefined function: " + j);
  28101. ttContext.hintsValid = false;
  28102. return;
  28103. }
  28104. }
  28105. }
  28106. function foldTTTable(table, content) {
  28107. if (content.length > 1) {
  28108. let newLength = 0;
  28109. let j, jj;
  28110. for (j = 0, jj = content.length; j < jj; j++) {
  28111. newLength += content[j].length;
  28112. }
  28113. newLength = (newLength + 3) & ~3;
  28114. const result = new Uint8Array(newLength);
  28115. let pos = 0;
  28116. for (j = 0, jj = content.length; j < jj; j++) {
  28117. result.set(content[j], pos);
  28118. pos += content[j].length;
  28119. }
  28120. table.data = result;
  28121. table.length = newLength;
  28122. }
  28123. }
  28124. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  28125. const ttContext = {
  28126. functionsDefined: [],
  28127. functionsUsed: [],
  28128. functionsStackDeltas: [],
  28129. tooComplexToFollowFunctions: false,
  28130. hintsValid: true,
  28131. };
  28132. if (fpgm) {
  28133. sanitizeTTProgram(fpgm, ttContext);
  28134. }
  28135. if (prep) {
  28136. sanitizeTTProgram(prep, ttContext);
  28137. }
  28138. if (fpgm) {
  28139. checkInvalidFunctions(ttContext, maxFunctionDefs);
  28140. }
  28141. if (cvt && cvt.length & 1) {
  28142. const cvtData = new Uint8Array(cvt.length + 1);
  28143. cvtData.set(cvt.data);
  28144. cvt.data = cvtData;
  28145. }
  28146. return ttContext.hintsValid;
  28147. }
  28148. font = new _stream.Stream(new Uint8Array(font.getBytes()));
  28149. let header, tables;
  28150. if (isTrueTypeCollectionFile(font)) {
  28151. const ttcData = readTrueTypeCollectionData(font, this.name);
  28152. header = ttcData.header;
  28153. tables = ttcData.tables;
  28154. } else {
  28155. header = readOpenTypeHeader(font);
  28156. tables = readTables(font, header.numTables);
  28157. }
  28158. let cff, cffFile;
  28159. const isTrueType = !tables["CFF "];
  28160. if (!isTrueType) {
  28161. const isComposite =
  28162. properties.composite &&
  28163. ((properties.cidToGidMap || []).length > 0 ||
  28164. !(properties.cMap instanceof _cmap.IdentityCMap));
  28165. if (
  28166. (header.version === "OTTO" && !isComposite) ||
  28167. !tables.head ||
  28168. !tables.hhea ||
  28169. !tables.maxp ||
  28170. !tables.post
  28171. ) {
  28172. cffFile = new _stream.Stream(tables["CFF "].data);
  28173. cff = new _cff_font.CFFFont(cffFile, properties);
  28174. adjustWidths(properties);
  28175. return this.convert(name, cff, properties);
  28176. }
  28177. delete tables.glyf;
  28178. delete tables.loca;
  28179. delete tables.fpgm;
  28180. delete tables.prep;
  28181. delete tables["cvt "];
  28182. this.isOpenType = true;
  28183. } else {
  28184. if (!tables.loca) {
  28185. throw new _util.FormatError(
  28186. 'Required "loca" table is not found'
  28187. );
  28188. }
  28189. if (!tables.glyf) {
  28190. (0, _util.warn)(
  28191. 'Required "glyf" table is not found -- trying to recover.'
  28192. );
  28193. tables.glyf = {
  28194. tag: "glyf",
  28195. data: new Uint8Array(0),
  28196. };
  28197. }
  28198. this.isOpenType = false;
  28199. }
  28200. if (!tables.maxp) {
  28201. throw new _util.FormatError('Required "maxp" table is not found');
  28202. }
  28203. font.pos = (font.start || 0) + tables.maxp.offset;
  28204. const version = font.getInt32();
  28205. const numGlyphs = font.getUint16();
  28206. if (
  28207. properties.scaleFactors &&
  28208. properties.scaleFactors.length === numGlyphs &&
  28209. isTrueType
  28210. ) {
  28211. const { scaleFactors } = properties;
  28212. const isGlyphLocationsLong = int16(
  28213. tables.head.data[50],
  28214. tables.head.data[51]
  28215. );
  28216. const glyphs = new _glyf.GlyfTable({
  28217. glyfTable: tables.glyf.data,
  28218. isGlyphLocationsLong,
  28219. locaTable: tables.loca.data,
  28220. numGlyphs,
  28221. });
  28222. glyphs.scale(scaleFactors);
  28223. const { glyf, loca, isLocationLong } = glyphs.write();
  28224. tables.glyf.data = glyf;
  28225. tables.loca.data = loca;
  28226. if (isLocationLong !== !!isGlyphLocationsLong) {
  28227. tables.head.data[50] = 0;
  28228. tables.head.data[51] = isLocationLong ? 1 : 0;
  28229. }
  28230. const metrics = tables.hmtx.data;
  28231. for (let i = 0; i < numGlyphs; i++) {
  28232. const j = 4 * i;
  28233. const advanceWidth = Math.round(
  28234. scaleFactors[i] * int16(metrics[j], metrics[j + 1])
  28235. );
  28236. metrics[j] = (advanceWidth >> 8) & 0xff;
  28237. metrics[j + 1] = advanceWidth & 0xff;
  28238. const lsb = Math.round(
  28239. scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3])
  28240. );
  28241. writeSignedInt16(metrics, j + 2, lsb);
  28242. }
  28243. }
  28244. let numGlyphsOut = numGlyphs + 1;
  28245. let dupFirstEntry = true;
  28246. if (numGlyphsOut > 0xffff) {
  28247. dupFirstEntry = false;
  28248. numGlyphsOut = numGlyphs;
  28249. (0, _util.warn)(
  28250. "Not enough space in glyfs to duplicate first glyph."
  28251. );
  28252. }
  28253. let maxFunctionDefs = 0;
  28254. let maxSizeOfInstructions = 0;
  28255. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  28256. font.pos += 8;
  28257. const maxZones = font.getUint16();
  28258. if (maxZones > 2) {
  28259. tables.maxp.data[14] = 0;
  28260. tables.maxp.data[15] = 2;
  28261. }
  28262. font.pos += 4;
  28263. maxFunctionDefs = font.getUint16();
  28264. font.pos += 4;
  28265. maxSizeOfInstructions = font.getUint16();
  28266. }
  28267. tables.maxp.data[4] = numGlyphsOut >> 8;
  28268. tables.maxp.data[5] = numGlyphsOut & 255;
  28269. const hintsValid = sanitizeTTPrograms(
  28270. tables.fpgm,
  28271. tables.prep,
  28272. tables["cvt "],
  28273. maxFunctionDefs
  28274. );
  28275. if (!hintsValid) {
  28276. delete tables.fpgm;
  28277. delete tables.prep;
  28278. delete tables["cvt "];
  28279. }
  28280. sanitizeMetrics(
  28281. font,
  28282. tables.hhea,
  28283. tables.hmtx,
  28284. tables.head,
  28285. numGlyphsOut,
  28286. dupFirstEntry
  28287. );
  28288. if (!tables.head) {
  28289. throw new _util.FormatError('Required "head" table is not found');
  28290. }
  28291. sanitizeHead(
  28292. tables.head,
  28293. numGlyphs,
  28294. isTrueType ? tables.loca.length : 0
  28295. );
  28296. let missingGlyphs = Object.create(null);
  28297. if (isTrueType) {
  28298. const isGlyphLocationsLong = int16(
  28299. tables.head.data[50],
  28300. tables.head.data[51]
  28301. );
  28302. const glyphsInfo = sanitizeGlyphLocations(
  28303. tables.loca,
  28304. tables.glyf,
  28305. numGlyphs,
  28306. isGlyphLocationsLong,
  28307. hintsValid,
  28308. dupFirstEntry,
  28309. maxSizeOfInstructions
  28310. );
  28311. missingGlyphs = glyphsInfo.missingGlyphs;
  28312. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  28313. tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  28314. tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  28315. }
  28316. }
  28317. if (!tables.hhea) {
  28318. throw new _util.FormatError('Required "hhea" table is not found');
  28319. }
  28320. if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
  28321. tables.hhea.data[10] = 0xff;
  28322. tables.hhea.data[11] = 0xff;
  28323. }
  28324. const metricsOverride = {
  28325. unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
  28326. yMax: int16(tables.head.data[42], tables.head.data[43]),
  28327. yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
  28328. ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]),
  28329. descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]),
  28330. lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9]),
  28331. };
  28332. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  28333. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  28334. this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm;
  28335. if (this.cssFontInfo && this.cssFontInfo.lineHeight) {
  28336. this.lineHeight = this.cssFontInfo.metrics.lineHeight;
  28337. this.lineGap = this.cssFontInfo.metrics.lineGap;
  28338. } else {
  28339. this.lineHeight = this.ascent - this.descent + this.lineGap;
  28340. }
  28341. if (tables.post) {
  28342. readPostScriptTable(tables.post, properties, numGlyphs);
  28343. }
  28344. tables.post = {
  28345. tag: "post",
  28346. data: createPostTable(properties),
  28347. };
  28348. const charCodeToGlyphId = [];
  28349. function hasGlyph(glyphId) {
  28350. return !missingGlyphs[glyphId];
  28351. }
  28352. if (properties.composite) {
  28353. const cidToGidMap = properties.cidToGidMap || [];
  28354. const isCidToGidMapEmpty = cidToGidMap.length === 0;
  28355. properties.cMap.forEach(function (charCode, cid) {
  28356. if (typeof cid === "string") {
  28357. cid = convertCidString(charCode, cid, true);
  28358. }
  28359. if (cid > 0xffff) {
  28360. throw new _util.FormatError("Max size of CID is 65,535");
  28361. }
  28362. let glyphId = -1;
  28363. if (isCidToGidMapEmpty) {
  28364. glyphId = cid;
  28365. } else if (cidToGidMap[cid] !== undefined) {
  28366. glyphId = cidToGidMap[cid];
  28367. }
  28368. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  28369. charCodeToGlyphId[charCode] = glyphId;
  28370. }
  28371. });
  28372. } else {
  28373. const cmapTable = readCmapTable(
  28374. tables.cmap,
  28375. font,
  28376. this.isSymbolicFont,
  28377. properties.hasEncoding
  28378. );
  28379. const cmapPlatformId = cmapTable.platformId;
  28380. const cmapEncodingId = cmapTable.encodingId;
  28381. const cmapMappings = cmapTable.mappings;
  28382. const cmapMappingsLength = cmapMappings.length;
  28383. let baseEncoding = [],
  28384. forcePostTable = false;
  28385. if (
  28386. properties.hasEncoding &&
  28387. (properties.baseEncodingName === "MacRomanEncoding" ||
  28388. properties.baseEncodingName === "WinAnsiEncoding")
  28389. ) {
  28390. baseEncoding = (0, _encodings.getEncoding)(
  28391. properties.baseEncodingName
  28392. );
  28393. }
  28394. if (
  28395. properties.hasEncoding &&
  28396. !this.isSymbolicFont &&
  28397. ((cmapPlatformId === 3 && cmapEncodingId === 1) ||
  28398. (cmapPlatformId === 1 && cmapEncodingId === 0))
  28399. ) {
  28400. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  28401. for (let charCode = 0; charCode < 256; charCode++) {
  28402. let glyphName;
  28403. if (this.differences[charCode] !== undefined) {
  28404. glyphName = this.differences[charCode];
  28405. } else if (
  28406. baseEncoding.length &&
  28407. baseEncoding[charCode] !== ""
  28408. ) {
  28409. glyphName = baseEncoding[charCode];
  28410. } else {
  28411. glyphName = _encodings.StandardEncoding[charCode];
  28412. }
  28413. if (!glyphName) {
  28414. continue;
  28415. }
  28416. const standardGlyphName = (0, _fonts_utils.recoverGlyphName)(
  28417. glyphName,
  28418. glyphsUnicodeMap
  28419. );
  28420. let unicodeOrCharCode;
  28421. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  28422. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  28423. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  28424. unicodeOrCharCode =
  28425. _encodings.MacRomanEncoding.indexOf(standardGlyphName);
  28426. }
  28427. if (unicodeOrCharCode === undefined) {
  28428. if (
  28429. !properties.glyphNames &&
  28430. properties.hasIncludedToUnicodeMap &&
  28431. !(
  28432. this.toUnicode instanceof
  28433. _to_unicode_map.IdentityToUnicodeMap
  28434. )
  28435. ) {
  28436. const unicode = this.toUnicode.get(charCode);
  28437. if (unicode) {
  28438. unicodeOrCharCode = unicode.codePointAt(0);
  28439. }
  28440. }
  28441. if (unicodeOrCharCode === undefined) {
  28442. continue;
  28443. }
  28444. }
  28445. for (let i = 0; i < cmapMappingsLength; ++i) {
  28446. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  28447. continue;
  28448. }
  28449. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  28450. break;
  28451. }
  28452. }
  28453. } else if (cmapPlatformId === 0) {
  28454. for (let i = 0; i < cmapMappingsLength; ++i) {
  28455. charCodeToGlyphId[cmapMappings[i].charCode] =
  28456. cmapMappings[i].glyphId;
  28457. }
  28458. forcePostTable = true;
  28459. } else {
  28460. for (let i = 0; i < cmapMappingsLength; ++i) {
  28461. let charCode = cmapMappings[i].charCode;
  28462. if (
  28463. cmapPlatformId === 3 &&
  28464. charCode >= 0xf000 &&
  28465. charCode <= 0xf0ff
  28466. ) {
  28467. charCode &= 0xff;
  28468. }
  28469. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  28470. }
  28471. }
  28472. if (
  28473. properties.glyphNames &&
  28474. (baseEncoding.length || this.differences.length)
  28475. ) {
  28476. for (let i = 0; i < 256; ++i) {
  28477. if (!forcePostTable && charCodeToGlyphId[i] !== undefined) {
  28478. continue;
  28479. }
  28480. const glyphName = this.differences[i] || baseEncoding[i];
  28481. if (!glyphName) {
  28482. continue;
  28483. }
  28484. const glyphId = properties.glyphNames.indexOf(glyphName);
  28485. if (glyphId > 0 && hasGlyph(glyphId)) {
  28486. charCodeToGlyphId[i] = glyphId;
  28487. }
  28488. }
  28489. }
  28490. }
  28491. if (charCodeToGlyphId.length === 0) {
  28492. charCodeToGlyphId[0] = 0;
  28493. }
  28494. let glyphZeroId = numGlyphsOut - 1;
  28495. if (!dupFirstEntry) {
  28496. glyphZeroId = 0;
  28497. }
  28498. if (!properties.cssFontInfo) {
  28499. const newMapping = adjustMapping(
  28500. charCodeToGlyphId,
  28501. hasGlyph,
  28502. glyphZeroId,
  28503. this.toUnicode
  28504. );
  28505. this.toFontChar = newMapping.toFontChar;
  28506. tables.cmap = {
  28507. tag: "cmap",
  28508. data: createCmapTable(
  28509. newMapping.charCodeToGlyphId,
  28510. newMapping.toUnicodeExtraMap,
  28511. numGlyphsOut
  28512. ),
  28513. };
  28514. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
  28515. tables["OS/2"] = {
  28516. tag: "OS/2",
  28517. data: createOS2Table(
  28518. properties,
  28519. newMapping.charCodeToGlyphId,
  28520. metricsOverride
  28521. ),
  28522. };
  28523. }
  28524. }
  28525. if (!isTrueType) {
  28526. try {
  28527. cffFile = new _stream.Stream(tables["CFF "].data);
  28528. const parser = new _cff_parser.CFFParser(
  28529. cffFile,
  28530. properties,
  28531. _fonts_utils.SEAC_ANALYSIS_ENABLED
  28532. );
  28533. cff = parser.parse();
  28534. cff.duplicateFirstGlyph();
  28535. const compiler = new _cff_parser.CFFCompiler(cff);
  28536. tables["CFF "].data = compiler.compile();
  28537. } catch (e) {
  28538. (0, _util.warn)(
  28539. "Failed to compile font " + properties.loadedName
  28540. );
  28541. }
  28542. }
  28543. if (!tables.name) {
  28544. tables.name = {
  28545. tag: "name",
  28546. data: createNameTable(this.name),
  28547. };
  28548. } else {
  28549. const namePrototype = readNameTable(tables.name);
  28550. tables.name.data = createNameTable(name, namePrototype);
  28551. this.psName = namePrototype[0][6] || null;
  28552. }
  28553. const builder = new _opentype_file_builder.OpenTypeFileBuilder(
  28554. header.version
  28555. );
  28556. for (const tableTag in tables) {
  28557. builder.addTable(tableTag, tables[tableTag].data);
  28558. }
  28559. return builder.toArray();
  28560. }
  28561. convert(fontName, font, properties) {
  28562. properties.fixedPitch = false;
  28563. if (properties.builtInEncoding) {
  28564. adjustToUnicode(properties, properties.builtInEncoding);
  28565. }
  28566. let glyphZeroId = 1;
  28567. if (font instanceof _cff_font.CFFFont) {
  28568. glyphZeroId = font.numGlyphs - 1;
  28569. }
  28570. const mapping = font.getGlyphMapping(properties);
  28571. let newMapping = null;
  28572. let newCharCodeToGlyphId = mapping;
  28573. let toUnicodeExtraMap = null;
  28574. if (!properties.cssFontInfo) {
  28575. newMapping = adjustMapping(
  28576. mapping,
  28577. font.hasGlyphId.bind(font),
  28578. glyphZeroId,
  28579. this.toUnicode
  28580. );
  28581. this.toFontChar = newMapping.toFontChar;
  28582. newCharCodeToGlyphId = newMapping.charCodeToGlyphId;
  28583. toUnicodeExtraMap = newMapping.toUnicodeExtraMap;
  28584. }
  28585. const numGlyphs = font.numGlyphs;
  28586. function getCharCodes(charCodeToGlyphId, glyphId) {
  28587. let charCodes = null;
  28588. for (const charCode in charCodeToGlyphId) {
  28589. if (glyphId === charCodeToGlyphId[charCode]) {
  28590. if (!charCodes) {
  28591. charCodes = [];
  28592. }
  28593. charCodes.push(charCode | 0);
  28594. }
  28595. }
  28596. return charCodes;
  28597. }
  28598. function createCharCode(charCodeToGlyphId, glyphId) {
  28599. for (const charCode in charCodeToGlyphId) {
  28600. if (glyphId === charCodeToGlyphId[charCode]) {
  28601. return charCode | 0;
  28602. }
  28603. }
  28604. newMapping.charCodeToGlyphId[
  28605. newMapping.nextAvailableFontCharCode
  28606. ] = glyphId;
  28607. return newMapping.nextAvailableFontCharCode++;
  28608. }
  28609. const seacs = font.seacs;
  28610. if (
  28611. newMapping &&
  28612. _fonts_utils.SEAC_ANALYSIS_ENABLED &&
  28613. seacs &&
  28614. seacs.length
  28615. ) {
  28616. const matrix =
  28617. properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  28618. const charset = font.getCharset();
  28619. const seacMap = Object.create(null);
  28620. for (let glyphId in seacs) {
  28621. glyphId |= 0;
  28622. const seac = seacs[glyphId];
  28623. const baseGlyphName = _encodings.StandardEncoding[seac[2]];
  28624. const accentGlyphName = _encodings.StandardEncoding[seac[3]];
  28625. const baseGlyphId = charset.indexOf(baseGlyphName);
  28626. const accentGlyphId = charset.indexOf(accentGlyphName);
  28627. if (baseGlyphId < 0 || accentGlyphId < 0) {
  28628. continue;
  28629. }
  28630. const accentOffset = {
  28631. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  28632. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5],
  28633. };
  28634. const charCodes = getCharCodes(mapping, glyphId);
  28635. if (!charCodes) {
  28636. continue;
  28637. }
  28638. for (let i = 0, ii = charCodes.length; i < ii; i++) {
  28639. const charCode = charCodes[i];
  28640. const charCodeToGlyphId = newMapping.charCodeToGlyphId;
  28641. const baseFontCharCode = createCharCode(
  28642. charCodeToGlyphId,
  28643. baseGlyphId
  28644. );
  28645. const accentFontCharCode = createCharCode(
  28646. charCodeToGlyphId,
  28647. accentGlyphId
  28648. );
  28649. seacMap[charCode] = {
  28650. baseFontCharCode,
  28651. accentFontCharCode,
  28652. accentOffset,
  28653. };
  28654. }
  28655. }
  28656. properties.seacMap = seacMap;
  28657. }
  28658. const unitsPerEm =
  28659. 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  28660. const builder = new _opentype_file_builder.OpenTypeFileBuilder(
  28661. "\x4F\x54\x54\x4F"
  28662. );
  28663. builder.addTable("CFF ", font.data);
  28664. builder.addTable(
  28665. "OS/2",
  28666. createOS2Table(properties, newCharCodeToGlyphId)
  28667. );
  28668. builder.addTable(
  28669. "cmap",
  28670. createCmapTable(
  28671. newCharCodeToGlyphId,
  28672. toUnicodeExtraMap,
  28673. numGlyphs
  28674. )
  28675. );
  28676. builder.addTable(
  28677. "head",
  28678. "\x00\x01\x00\x00" +
  28679. "\x00\x00\x10\x00" +
  28680. "\x00\x00\x00\x00" +
  28681. "\x5F\x0F\x3C\xF5" +
  28682. "\x00\x00" +
  28683. safeString16(unitsPerEm) +
  28684. "\x00\x00\x00\x00\x9e\x0b\x7e\x27" +
  28685. "\x00\x00\x00\x00\x9e\x0b\x7e\x27" +
  28686. "\x00\x00" +
  28687. safeString16(properties.descent) +
  28688. "\x0F\xFF" +
  28689. safeString16(properties.ascent) +
  28690. string16(properties.italicAngle ? 2 : 0) +
  28691. "\x00\x11" +
  28692. "\x00\x00" +
  28693. "\x00\x00" +
  28694. "\x00\x00"
  28695. );
  28696. builder.addTable(
  28697. "hhea",
  28698. "\x00\x01\x00\x00" +
  28699. safeString16(properties.ascent) +
  28700. safeString16(properties.descent) +
  28701. "\x00\x00" +
  28702. "\xFF\xFF" +
  28703. "\x00\x00" +
  28704. "\x00\x00" +
  28705. "\x00\x00" +
  28706. safeString16(properties.capHeight) +
  28707. safeString16(
  28708. Math.tan(properties.italicAngle) * properties.xHeight
  28709. ) +
  28710. "\x00\x00" +
  28711. "\x00\x00" +
  28712. "\x00\x00" +
  28713. "\x00\x00" +
  28714. "\x00\x00" +
  28715. "\x00\x00" +
  28716. string16(numGlyphs)
  28717. );
  28718. builder.addTable(
  28719. "hmtx",
  28720. (function fontFieldsHmtx() {
  28721. const charstrings = font.charstrings;
  28722. const cffWidths = font.cff ? font.cff.widths : null;
  28723. let hmtx = "\x00\x00\x00\x00";
  28724. for (let i = 1, ii = numGlyphs; i < ii; i++) {
  28725. let width = 0;
  28726. if (charstrings) {
  28727. const charstring = charstrings[i - 1];
  28728. width = "width" in charstring ? charstring.width : 0;
  28729. } else if (cffWidths) {
  28730. width = Math.ceil(cffWidths[i] || 0);
  28731. }
  28732. hmtx += string16(width) + string16(0);
  28733. }
  28734. return hmtx;
  28735. })()
  28736. );
  28737. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  28738. builder.addTable("name", createNameTable(fontName));
  28739. builder.addTable("post", createPostTable(properties));
  28740. return builder.toArray();
  28741. }
  28742. get spaceWidth() {
  28743. const possibleSpaceReplacements = [
  28744. "space",
  28745. "minus",
  28746. "one",
  28747. "i",
  28748. "I",
  28749. ];
  28750. let width;
  28751. for (
  28752. let i = 0, ii = possibleSpaceReplacements.length;
  28753. i < ii;
  28754. i++
  28755. ) {
  28756. const glyphName = possibleSpaceReplacements[i];
  28757. if (glyphName in this.widths) {
  28758. width = this.widths[glyphName];
  28759. break;
  28760. }
  28761. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  28762. const glyphUnicode = glyphsUnicodeMap[glyphName];
  28763. let charcode = 0;
  28764. if (this.composite && this.cMap.contains(glyphUnicode)) {
  28765. charcode = this.cMap.lookup(glyphUnicode);
  28766. if (typeof charcode === "string") {
  28767. charcode = convertCidString(glyphUnicode, charcode);
  28768. }
  28769. }
  28770. if (!charcode && this.toUnicode) {
  28771. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  28772. }
  28773. if (charcode <= 0) {
  28774. charcode = glyphUnicode;
  28775. }
  28776. width = this.widths[charcode];
  28777. if (width) {
  28778. break;
  28779. }
  28780. }
  28781. width = width || this.defaultWidth;
  28782. return (0, _util.shadow)(this, "spaceWidth", width);
  28783. }
  28784. _charToGlyph(charcode, isSpace = false) {
  28785. let fontCharCode, width, operatorListId;
  28786. let widthCode = charcode;
  28787. if (this.cMap && this.cMap.contains(charcode)) {
  28788. widthCode = this.cMap.lookup(charcode);
  28789. if (typeof widthCode === "string") {
  28790. widthCode = convertCidString(charcode, widthCode);
  28791. }
  28792. }
  28793. width = this.widths[widthCode];
  28794. if (typeof width !== "number") {
  28795. width = this.defaultWidth;
  28796. }
  28797. const vmetric = this.vmetrics && this.vmetrics[widthCode];
  28798. let unicode = this.toUnicode.get(charcode) || charcode;
  28799. if (typeof unicode === "number") {
  28800. unicode = String.fromCharCode(unicode);
  28801. }
  28802. let isInFont = this.toFontChar[charcode] !== undefined;
  28803. fontCharCode = this.toFontChar[charcode] || charcode;
  28804. if (this.missingFile) {
  28805. const glyphName =
  28806. this.differences[charcode] || this.defaultEncoding[charcode];
  28807. if (
  28808. (glyphName === ".notdef" || glyphName === "") &&
  28809. this.type === "Type1"
  28810. ) {
  28811. fontCharCode = 0x20;
  28812. }
  28813. fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(
  28814. fontCharCode
  28815. );
  28816. }
  28817. if (this.isType3Font) {
  28818. operatorListId = fontCharCode;
  28819. }
  28820. let accent = null;
  28821. if (this.seacMap && this.seacMap[charcode]) {
  28822. isInFont = true;
  28823. const seac = this.seacMap[charcode];
  28824. fontCharCode = seac.baseFontCharCode;
  28825. accent = {
  28826. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  28827. offset: seac.accentOffset,
  28828. };
  28829. }
  28830. let fontChar = "";
  28831. if (typeof fontCharCode === "number") {
  28832. if (fontCharCode <= 0x10ffff) {
  28833. fontChar = String.fromCodePoint(fontCharCode);
  28834. } else {
  28835. (0, _util.warn)(
  28836. `charToGlyph - invalid fontCharCode: ${fontCharCode}`
  28837. );
  28838. }
  28839. }
  28840. let glyph = this._glyphCache[charcode];
  28841. if (
  28842. !glyph ||
  28843. !glyph.matchesForCache(
  28844. charcode,
  28845. fontChar,
  28846. unicode,
  28847. accent,
  28848. width,
  28849. vmetric,
  28850. operatorListId,
  28851. isSpace,
  28852. isInFont
  28853. )
  28854. ) {
  28855. glyph = new Glyph(
  28856. charcode,
  28857. fontChar,
  28858. unicode,
  28859. accent,
  28860. width,
  28861. vmetric,
  28862. operatorListId,
  28863. isSpace,
  28864. isInFont
  28865. );
  28866. this._glyphCache[charcode] = glyph;
  28867. }
  28868. return glyph;
  28869. }
  28870. charsToGlyphs(chars) {
  28871. let glyphs = this._charsCache[chars];
  28872. if (glyphs) {
  28873. return glyphs;
  28874. }
  28875. glyphs = [];
  28876. if (this.cMap) {
  28877. const c = Object.create(null),
  28878. ii = chars.length;
  28879. let i = 0;
  28880. while (i < ii) {
  28881. this.cMap.readCharCode(chars, i, c);
  28882. const { charcode, length } = c;
  28883. i += length;
  28884. const glyph = this._charToGlyph(
  28885. charcode,
  28886. length === 1 && chars.charCodeAt(i - 1) === 0x20
  28887. );
  28888. glyphs.push(glyph);
  28889. }
  28890. } else {
  28891. for (let i = 0, ii = chars.length; i < ii; ++i) {
  28892. const charcode = chars.charCodeAt(i);
  28893. const glyph = this._charToGlyph(charcode, charcode === 0x20);
  28894. glyphs.push(glyph);
  28895. }
  28896. }
  28897. return (this._charsCache[chars] = glyphs);
  28898. }
  28899. getCharPositions(chars) {
  28900. const positions = [];
  28901. if (this.cMap) {
  28902. const c = Object.create(null);
  28903. let i = 0;
  28904. while (i < chars.length) {
  28905. this.cMap.readCharCode(chars, i, c);
  28906. const length = c.length;
  28907. positions.push([i, i + length]);
  28908. i += length;
  28909. }
  28910. } else {
  28911. for (let i = 0, ii = chars.length; i < ii; ++i) {
  28912. positions.push([i, i + 1]);
  28913. }
  28914. }
  28915. return positions;
  28916. }
  28917. get glyphCacheValues() {
  28918. return Object.values(this._glyphCache);
  28919. }
  28920. encodeString(str) {
  28921. const buffers = [];
  28922. const currentBuf = [];
  28923. const hasCurrentBufErrors = () => buffers.length % 2 === 1;
  28924. const getCharCode =
  28925. this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap
  28926. ? (unicode) => this.toUnicode.charCodeOf(unicode)
  28927. : (unicode) =>
  28928. this.toUnicode.charCodeOf(String.fromCodePoint(unicode));
  28929. for (let i = 0, ii = str.length; i < ii; i++) {
  28930. const unicode = str.codePointAt(i);
  28931. if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
  28932. i++;
  28933. }
  28934. if (this.toUnicode) {
  28935. const charCode = getCharCode(unicode);
  28936. if (charCode !== -1) {
  28937. if (hasCurrentBufErrors()) {
  28938. buffers.push(currentBuf.join(""));
  28939. currentBuf.length = 0;
  28940. }
  28941. const charCodeLength = this.cMap
  28942. ? this.cMap.getCharCodeLength(charCode)
  28943. : 1;
  28944. for (let j = charCodeLength - 1; j >= 0; j--) {
  28945. currentBuf.push(
  28946. String.fromCharCode((charCode >> (8 * j)) & 0xff)
  28947. );
  28948. }
  28949. continue;
  28950. }
  28951. }
  28952. if (!hasCurrentBufErrors()) {
  28953. buffers.push(currentBuf.join(""));
  28954. currentBuf.length = 0;
  28955. }
  28956. currentBuf.push(String.fromCodePoint(unicode));
  28957. }
  28958. buffers.push(currentBuf.join(""));
  28959. return buffers;
  28960. }
  28961. }
  28962. exports.Font = Font;
  28963. class ErrorFont {
  28964. constructor(error) {
  28965. this.error = error;
  28966. this.loadedName = "g_font_error";
  28967. this.missingFile = true;
  28968. }
  28969. charsToGlyphs() {
  28970. return [];
  28971. }
  28972. encodeString(chars) {
  28973. return [chars];
  28974. }
  28975. exportData(extraProperties = false) {
  28976. return {
  28977. error: this.error,
  28978. };
  28979. }
  28980. }
  28981. exports.ErrorFont = ErrorFont;
  28982. /***/
  28983. },
  28984. /* 35 */
  28985. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  28986. Object.defineProperty(exports, "__esModule", {
  28987. value: true,
  28988. });
  28989. exports.CFFTopDict =
  28990. exports.CFFStrings =
  28991. exports.CFFStandardStrings =
  28992. exports.CFFPrivateDict =
  28993. exports.CFFParser =
  28994. exports.CFFIndex =
  28995. exports.CFFHeader =
  28996. exports.CFFFDSelect =
  28997. exports.CFFCompiler =
  28998. exports.CFFCharset =
  28999. exports.CFF =
  29000. void 0;
  29001. var _util = __w_pdfjs_require__(2);
  29002. var _charsets = __w_pdfjs_require__(36);
  29003. var _encodings = __w_pdfjs_require__(37);
  29004. const MAX_SUBR_NESTING = 10;
  29005. const CFFStandardStrings = [
  29006. ".notdef",
  29007. "space",
  29008. "exclam",
  29009. "quotedbl",
  29010. "numbersign",
  29011. "dollar",
  29012. "percent",
  29013. "ampersand",
  29014. "quoteright",
  29015. "parenleft",
  29016. "parenright",
  29017. "asterisk",
  29018. "plus",
  29019. "comma",
  29020. "hyphen",
  29021. "period",
  29022. "slash",
  29023. "zero",
  29024. "one",
  29025. "two",
  29026. "three",
  29027. "four",
  29028. "five",
  29029. "six",
  29030. "seven",
  29031. "eight",
  29032. "nine",
  29033. "colon",
  29034. "semicolon",
  29035. "less",
  29036. "equal",
  29037. "greater",
  29038. "question",
  29039. "at",
  29040. "A",
  29041. "B",
  29042. "C",
  29043. "D",
  29044. "E",
  29045. "F",
  29046. "G",
  29047. "H",
  29048. "I",
  29049. "J",
  29050. "K",
  29051. "L",
  29052. "M",
  29053. "N",
  29054. "O",
  29055. "P",
  29056. "Q",
  29057. "R",
  29058. "S",
  29059. "T",
  29060. "U",
  29061. "V",
  29062. "W",
  29063. "X",
  29064. "Y",
  29065. "Z",
  29066. "bracketleft",
  29067. "backslash",
  29068. "bracketright",
  29069. "asciicircum",
  29070. "underscore",
  29071. "quoteleft",
  29072. "a",
  29073. "b",
  29074. "c",
  29075. "d",
  29076. "e",
  29077. "f",
  29078. "g",
  29079. "h",
  29080. "i",
  29081. "j",
  29082. "k",
  29083. "l",
  29084. "m",
  29085. "n",
  29086. "o",
  29087. "p",
  29088. "q",
  29089. "r",
  29090. "s",
  29091. "t",
  29092. "u",
  29093. "v",
  29094. "w",
  29095. "x",
  29096. "y",
  29097. "z",
  29098. "braceleft",
  29099. "bar",
  29100. "braceright",
  29101. "asciitilde",
  29102. "exclamdown",
  29103. "cent",
  29104. "sterling",
  29105. "fraction",
  29106. "yen",
  29107. "florin",
  29108. "section",
  29109. "currency",
  29110. "quotesingle",
  29111. "quotedblleft",
  29112. "guillemotleft",
  29113. "guilsinglleft",
  29114. "guilsinglright",
  29115. "fi",
  29116. "fl",
  29117. "endash",
  29118. "dagger",
  29119. "daggerdbl",
  29120. "periodcentered",
  29121. "paragraph",
  29122. "bullet",
  29123. "quotesinglbase",
  29124. "quotedblbase",
  29125. "quotedblright",
  29126. "guillemotright",
  29127. "ellipsis",
  29128. "perthousand",
  29129. "questiondown",
  29130. "grave",
  29131. "acute",
  29132. "circumflex",
  29133. "tilde",
  29134. "macron",
  29135. "breve",
  29136. "dotaccent",
  29137. "dieresis",
  29138. "ring",
  29139. "cedilla",
  29140. "hungarumlaut",
  29141. "ogonek",
  29142. "caron",
  29143. "emdash",
  29144. "AE",
  29145. "ordfeminine",
  29146. "Lslash",
  29147. "Oslash",
  29148. "OE",
  29149. "ordmasculine",
  29150. "ae",
  29151. "dotlessi",
  29152. "lslash",
  29153. "oslash",
  29154. "oe",
  29155. "germandbls",
  29156. "onesuperior",
  29157. "logicalnot",
  29158. "mu",
  29159. "trademark",
  29160. "Eth",
  29161. "onehalf",
  29162. "plusminus",
  29163. "Thorn",
  29164. "onequarter",
  29165. "divide",
  29166. "brokenbar",
  29167. "degree",
  29168. "thorn",
  29169. "threequarters",
  29170. "twosuperior",
  29171. "registered",
  29172. "minus",
  29173. "eth",
  29174. "multiply",
  29175. "threesuperior",
  29176. "copyright",
  29177. "Aacute",
  29178. "Acircumflex",
  29179. "Adieresis",
  29180. "Agrave",
  29181. "Aring",
  29182. "Atilde",
  29183. "Ccedilla",
  29184. "Eacute",
  29185. "Ecircumflex",
  29186. "Edieresis",
  29187. "Egrave",
  29188. "Iacute",
  29189. "Icircumflex",
  29190. "Idieresis",
  29191. "Igrave",
  29192. "Ntilde",
  29193. "Oacute",
  29194. "Ocircumflex",
  29195. "Odieresis",
  29196. "Ograve",
  29197. "Otilde",
  29198. "Scaron",
  29199. "Uacute",
  29200. "Ucircumflex",
  29201. "Udieresis",
  29202. "Ugrave",
  29203. "Yacute",
  29204. "Ydieresis",
  29205. "Zcaron",
  29206. "aacute",
  29207. "acircumflex",
  29208. "adieresis",
  29209. "agrave",
  29210. "aring",
  29211. "atilde",
  29212. "ccedilla",
  29213. "eacute",
  29214. "ecircumflex",
  29215. "edieresis",
  29216. "egrave",
  29217. "iacute",
  29218. "icircumflex",
  29219. "idieresis",
  29220. "igrave",
  29221. "ntilde",
  29222. "oacute",
  29223. "ocircumflex",
  29224. "odieresis",
  29225. "ograve",
  29226. "otilde",
  29227. "scaron",
  29228. "uacute",
  29229. "ucircumflex",
  29230. "udieresis",
  29231. "ugrave",
  29232. "yacute",
  29233. "ydieresis",
  29234. "zcaron",
  29235. "exclamsmall",
  29236. "Hungarumlautsmall",
  29237. "dollaroldstyle",
  29238. "dollarsuperior",
  29239. "ampersandsmall",
  29240. "Acutesmall",
  29241. "parenleftsuperior",
  29242. "parenrightsuperior",
  29243. "twodotenleader",
  29244. "onedotenleader",
  29245. "zerooldstyle",
  29246. "oneoldstyle",
  29247. "twooldstyle",
  29248. "threeoldstyle",
  29249. "fouroldstyle",
  29250. "fiveoldstyle",
  29251. "sixoldstyle",
  29252. "sevenoldstyle",
  29253. "eightoldstyle",
  29254. "nineoldstyle",
  29255. "commasuperior",
  29256. "threequartersemdash",
  29257. "periodsuperior",
  29258. "questionsmall",
  29259. "asuperior",
  29260. "bsuperior",
  29261. "centsuperior",
  29262. "dsuperior",
  29263. "esuperior",
  29264. "isuperior",
  29265. "lsuperior",
  29266. "msuperior",
  29267. "nsuperior",
  29268. "osuperior",
  29269. "rsuperior",
  29270. "ssuperior",
  29271. "tsuperior",
  29272. "ff",
  29273. "ffi",
  29274. "ffl",
  29275. "parenleftinferior",
  29276. "parenrightinferior",
  29277. "Circumflexsmall",
  29278. "hyphensuperior",
  29279. "Gravesmall",
  29280. "Asmall",
  29281. "Bsmall",
  29282. "Csmall",
  29283. "Dsmall",
  29284. "Esmall",
  29285. "Fsmall",
  29286. "Gsmall",
  29287. "Hsmall",
  29288. "Ismall",
  29289. "Jsmall",
  29290. "Ksmall",
  29291. "Lsmall",
  29292. "Msmall",
  29293. "Nsmall",
  29294. "Osmall",
  29295. "Psmall",
  29296. "Qsmall",
  29297. "Rsmall",
  29298. "Ssmall",
  29299. "Tsmall",
  29300. "Usmall",
  29301. "Vsmall",
  29302. "Wsmall",
  29303. "Xsmall",
  29304. "Ysmall",
  29305. "Zsmall",
  29306. "colonmonetary",
  29307. "onefitted",
  29308. "rupiah",
  29309. "Tildesmall",
  29310. "exclamdownsmall",
  29311. "centoldstyle",
  29312. "Lslashsmall",
  29313. "Scaronsmall",
  29314. "Zcaronsmall",
  29315. "Dieresissmall",
  29316. "Brevesmall",
  29317. "Caronsmall",
  29318. "Dotaccentsmall",
  29319. "Macronsmall",
  29320. "figuredash",
  29321. "hypheninferior",
  29322. "Ogoneksmall",
  29323. "Ringsmall",
  29324. "Cedillasmall",
  29325. "questiondownsmall",
  29326. "oneeighth",
  29327. "threeeighths",
  29328. "fiveeighths",
  29329. "seveneighths",
  29330. "onethird",
  29331. "twothirds",
  29332. "zerosuperior",
  29333. "foursuperior",
  29334. "fivesuperior",
  29335. "sixsuperior",
  29336. "sevensuperior",
  29337. "eightsuperior",
  29338. "ninesuperior",
  29339. "zeroinferior",
  29340. "oneinferior",
  29341. "twoinferior",
  29342. "threeinferior",
  29343. "fourinferior",
  29344. "fiveinferior",
  29345. "sixinferior",
  29346. "seveninferior",
  29347. "eightinferior",
  29348. "nineinferior",
  29349. "centinferior",
  29350. "dollarinferior",
  29351. "periodinferior",
  29352. "commainferior",
  29353. "Agravesmall",
  29354. "Aacutesmall",
  29355. "Acircumflexsmall",
  29356. "Atildesmall",
  29357. "Adieresissmall",
  29358. "Aringsmall",
  29359. "AEsmall",
  29360. "Ccedillasmall",
  29361. "Egravesmall",
  29362. "Eacutesmall",
  29363. "Ecircumflexsmall",
  29364. "Edieresissmall",
  29365. "Igravesmall",
  29366. "Iacutesmall",
  29367. "Icircumflexsmall",
  29368. "Idieresissmall",
  29369. "Ethsmall",
  29370. "Ntildesmall",
  29371. "Ogravesmall",
  29372. "Oacutesmall",
  29373. "Ocircumflexsmall",
  29374. "Otildesmall",
  29375. "Odieresissmall",
  29376. "OEsmall",
  29377. "Oslashsmall",
  29378. "Ugravesmall",
  29379. "Uacutesmall",
  29380. "Ucircumflexsmall",
  29381. "Udieresissmall",
  29382. "Yacutesmall",
  29383. "Thornsmall",
  29384. "Ydieresissmall",
  29385. "001.000",
  29386. "001.001",
  29387. "001.002",
  29388. "001.003",
  29389. "Black",
  29390. "Bold",
  29391. "Book",
  29392. "Light",
  29393. "Medium",
  29394. "Regular",
  29395. "Roman",
  29396. "Semibold",
  29397. ];
  29398. exports.CFFStandardStrings = CFFStandardStrings;
  29399. const NUM_STANDARD_CFF_STRINGS = 391;
  29400. const CharstringValidationData = [
  29401. null,
  29402. {
  29403. id: "hstem",
  29404. min: 2,
  29405. stackClearing: true,
  29406. stem: true,
  29407. },
  29408. null,
  29409. {
  29410. id: "vstem",
  29411. min: 2,
  29412. stackClearing: true,
  29413. stem: true,
  29414. },
  29415. {
  29416. id: "vmoveto",
  29417. min: 1,
  29418. stackClearing: true,
  29419. },
  29420. {
  29421. id: "rlineto",
  29422. min: 2,
  29423. resetStack: true,
  29424. },
  29425. {
  29426. id: "hlineto",
  29427. min: 1,
  29428. resetStack: true,
  29429. },
  29430. {
  29431. id: "vlineto",
  29432. min: 1,
  29433. resetStack: true,
  29434. },
  29435. {
  29436. id: "rrcurveto",
  29437. min: 6,
  29438. resetStack: true,
  29439. },
  29440. null,
  29441. {
  29442. id: "callsubr",
  29443. min: 1,
  29444. undefStack: true,
  29445. },
  29446. {
  29447. id: "return",
  29448. min: 0,
  29449. undefStack: true,
  29450. },
  29451. null,
  29452. null,
  29453. {
  29454. id: "endchar",
  29455. min: 0,
  29456. stackClearing: true,
  29457. },
  29458. null,
  29459. null,
  29460. null,
  29461. {
  29462. id: "hstemhm",
  29463. min: 2,
  29464. stackClearing: true,
  29465. stem: true,
  29466. },
  29467. {
  29468. id: "hintmask",
  29469. min: 0,
  29470. stackClearing: true,
  29471. },
  29472. {
  29473. id: "cntrmask",
  29474. min: 0,
  29475. stackClearing: true,
  29476. },
  29477. {
  29478. id: "rmoveto",
  29479. min: 2,
  29480. stackClearing: true,
  29481. },
  29482. {
  29483. id: "hmoveto",
  29484. min: 1,
  29485. stackClearing: true,
  29486. },
  29487. {
  29488. id: "vstemhm",
  29489. min: 2,
  29490. stackClearing: true,
  29491. stem: true,
  29492. },
  29493. {
  29494. id: "rcurveline",
  29495. min: 8,
  29496. resetStack: true,
  29497. },
  29498. {
  29499. id: "rlinecurve",
  29500. min: 8,
  29501. resetStack: true,
  29502. },
  29503. {
  29504. id: "vvcurveto",
  29505. min: 4,
  29506. resetStack: true,
  29507. },
  29508. {
  29509. id: "hhcurveto",
  29510. min: 4,
  29511. resetStack: true,
  29512. },
  29513. null,
  29514. {
  29515. id: "callgsubr",
  29516. min: 1,
  29517. undefStack: true,
  29518. },
  29519. {
  29520. id: "vhcurveto",
  29521. min: 4,
  29522. resetStack: true,
  29523. },
  29524. {
  29525. id: "hvcurveto",
  29526. min: 4,
  29527. resetStack: true,
  29528. },
  29529. ];
  29530. const CharstringValidationData12 = [
  29531. null,
  29532. null,
  29533. null,
  29534. {
  29535. id: "and",
  29536. min: 2,
  29537. stackDelta: -1,
  29538. },
  29539. {
  29540. id: "or",
  29541. min: 2,
  29542. stackDelta: -1,
  29543. },
  29544. {
  29545. id: "not",
  29546. min: 1,
  29547. stackDelta: 0,
  29548. },
  29549. null,
  29550. null,
  29551. null,
  29552. {
  29553. id: "abs",
  29554. min: 1,
  29555. stackDelta: 0,
  29556. },
  29557. {
  29558. id: "add",
  29559. min: 2,
  29560. stackDelta: -1,
  29561. stackFn(stack, index) {
  29562. stack[index - 2] = stack[index - 2] + stack[index - 1];
  29563. },
  29564. },
  29565. {
  29566. id: "sub",
  29567. min: 2,
  29568. stackDelta: -1,
  29569. stackFn(stack, index) {
  29570. stack[index - 2] = stack[index - 2] - stack[index - 1];
  29571. },
  29572. },
  29573. {
  29574. id: "div",
  29575. min: 2,
  29576. stackDelta: -1,
  29577. stackFn(stack, index) {
  29578. stack[index - 2] = stack[index - 2] / stack[index - 1];
  29579. },
  29580. },
  29581. null,
  29582. {
  29583. id: "neg",
  29584. min: 1,
  29585. stackDelta: 0,
  29586. stackFn(stack, index) {
  29587. stack[index - 1] = -stack[index - 1];
  29588. },
  29589. },
  29590. {
  29591. id: "eq",
  29592. min: 2,
  29593. stackDelta: -1,
  29594. },
  29595. null,
  29596. null,
  29597. {
  29598. id: "drop",
  29599. min: 1,
  29600. stackDelta: -1,
  29601. },
  29602. null,
  29603. {
  29604. id: "put",
  29605. min: 2,
  29606. stackDelta: -2,
  29607. },
  29608. {
  29609. id: "get",
  29610. min: 1,
  29611. stackDelta: 0,
  29612. },
  29613. {
  29614. id: "ifelse",
  29615. min: 4,
  29616. stackDelta: -3,
  29617. },
  29618. {
  29619. id: "random",
  29620. min: 0,
  29621. stackDelta: 1,
  29622. },
  29623. {
  29624. id: "mul",
  29625. min: 2,
  29626. stackDelta: -1,
  29627. stackFn(stack, index) {
  29628. stack[index - 2] = stack[index - 2] * stack[index - 1];
  29629. },
  29630. },
  29631. null,
  29632. {
  29633. id: "sqrt",
  29634. min: 1,
  29635. stackDelta: 0,
  29636. },
  29637. {
  29638. id: "dup",
  29639. min: 1,
  29640. stackDelta: 1,
  29641. },
  29642. {
  29643. id: "exch",
  29644. min: 2,
  29645. stackDelta: 0,
  29646. },
  29647. {
  29648. id: "index",
  29649. min: 2,
  29650. stackDelta: 0,
  29651. },
  29652. {
  29653. id: "roll",
  29654. min: 3,
  29655. stackDelta: -2,
  29656. },
  29657. null,
  29658. null,
  29659. null,
  29660. {
  29661. id: "hflex",
  29662. min: 7,
  29663. resetStack: true,
  29664. },
  29665. {
  29666. id: "flex",
  29667. min: 13,
  29668. resetStack: true,
  29669. },
  29670. {
  29671. id: "hflex1",
  29672. min: 9,
  29673. resetStack: true,
  29674. },
  29675. {
  29676. id: "flex1",
  29677. min: 11,
  29678. resetStack: true,
  29679. },
  29680. ];
  29681. class CFFParser {
  29682. constructor(file, properties, seacAnalysisEnabled) {
  29683. this.bytes = file.getBytes();
  29684. this.properties = properties;
  29685. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  29686. }
  29687. parse() {
  29688. const properties = this.properties;
  29689. const cff = new CFF();
  29690. this.cff = cff;
  29691. const header = this.parseHeader();
  29692. const nameIndex = this.parseIndex(header.endPos);
  29693. const topDictIndex = this.parseIndex(nameIndex.endPos);
  29694. const stringIndex = this.parseIndex(topDictIndex.endPos);
  29695. const globalSubrIndex = this.parseIndex(stringIndex.endPos);
  29696. const topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  29697. const topDict = this.createDict(
  29698. CFFTopDict,
  29699. topDictParsed,
  29700. cff.strings
  29701. );
  29702. cff.header = header.obj;
  29703. cff.names = this.parseNameIndex(nameIndex.obj);
  29704. cff.strings = this.parseStringIndex(stringIndex.obj);
  29705. cff.topDict = topDict;
  29706. cff.globalSubrIndex = globalSubrIndex.obj;
  29707. this.parsePrivateDict(cff.topDict);
  29708. cff.isCIDFont = topDict.hasName("ROS");
  29709. const charStringOffset = topDict.getByName("CharStrings");
  29710. const charStringIndex = this.parseIndex(charStringOffset).obj;
  29711. const fontMatrix = topDict.getByName("FontMatrix");
  29712. if (fontMatrix) {
  29713. properties.fontMatrix = fontMatrix;
  29714. }
  29715. const fontBBox = topDict.getByName("FontBBox");
  29716. if (fontBBox) {
  29717. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  29718. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  29719. properties.ascentScaled = true;
  29720. }
  29721. let charset, encoding;
  29722. if (cff.isCIDFont) {
  29723. const fdArrayIndex = this.parseIndex(
  29724. topDict.getByName("FDArray")
  29725. ).obj;
  29726. for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  29727. const dictRaw = fdArrayIndex.get(i);
  29728. const fontDict = this.createDict(
  29729. CFFTopDict,
  29730. this.parseDict(dictRaw),
  29731. cff.strings
  29732. );
  29733. this.parsePrivateDict(fontDict);
  29734. cff.fdArray.push(fontDict);
  29735. }
  29736. encoding = null;
  29737. charset = this.parseCharsets(
  29738. topDict.getByName("charset"),
  29739. charStringIndex.count,
  29740. cff.strings,
  29741. true
  29742. );
  29743. cff.fdSelect = this.parseFDSelect(
  29744. topDict.getByName("FDSelect"),
  29745. charStringIndex.count
  29746. );
  29747. } else {
  29748. charset = this.parseCharsets(
  29749. topDict.getByName("charset"),
  29750. charStringIndex.count,
  29751. cff.strings,
  29752. false
  29753. );
  29754. encoding = this.parseEncoding(
  29755. topDict.getByName("Encoding"),
  29756. properties,
  29757. cff.strings,
  29758. charset.charset
  29759. );
  29760. }
  29761. cff.charset = charset;
  29762. cff.encoding = encoding;
  29763. const charStringsAndSeacs = this.parseCharStrings({
  29764. charStrings: charStringIndex,
  29765. localSubrIndex: topDict.privateDict.subrsIndex,
  29766. globalSubrIndex: globalSubrIndex.obj,
  29767. fdSelect: cff.fdSelect,
  29768. fdArray: cff.fdArray,
  29769. privateDict: topDict.privateDict,
  29770. });
  29771. cff.charStrings = charStringsAndSeacs.charStrings;
  29772. cff.seacs = charStringsAndSeacs.seacs;
  29773. cff.widths = charStringsAndSeacs.widths;
  29774. return cff;
  29775. }
  29776. parseHeader() {
  29777. let bytes = this.bytes;
  29778. const bytesLength = bytes.length;
  29779. let offset = 0;
  29780. while (offset < bytesLength && bytes[offset] !== 1) {
  29781. ++offset;
  29782. }
  29783. if (offset >= bytesLength) {
  29784. throw new _util.FormatError("Invalid CFF header");
  29785. }
  29786. if (offset !== 0) {
  29787. (0, _util.info)("cff data is shifted");
  29788. bytes = bytes.subarray(offset);
  29789. this.bytes = bytes;
  29790. }
  29791. const major = bytes[0];
  29792. const minor = bytes[1];
  29793. const hdrSize = bytes[2];
  29794. const offSize = bytes[3];
  29795. const header = new CFFHeader(major, minor, hdrSize, offSize);
  29796. return {
  29797. obj: header,
  29798. endPos: hdrSize,
  29799. };
  29800. }
  29801. parseDict(dict) {
  29802. let pos = 0;
  29803. function parseOperand() {
  29804. let value = dict[pos++];
  29805. if (value === 30) {
  29806. return parseFloatOperand();
  29807. } else if (value === 28) {
  29808. value = dict[pos++];
  29809. value = ((value << 24) | (dict[pos++] << 16)) >> 16;
  29810. return value;
  29811. } else if (value === 29) {
  29812. value = dict[pos++];
  29813. value = (value << 8) | dict[pos++];
  29814. value = (value << 8) | dict[pos++];
  29815. value = (value << 8) | dict[pos++];
  29816. return value;
  29817. } else if (value >= 32 && value <= 246) {
  29818. return value - 139;
  29819. } else if (value >= 247 && value <= 250) {
  29820. return (value - 247) * 256 + dict[pos++] + 108;
  29821. } else if (value >= 251 && value <= 254) {
  29822. return -((value - 251) * 256) - dict[pos++] - 108;
  29823. }
  29824. (0, _util.warn)(
  29825. 'CFFParser_parseDict: "' + value + '" is a reserved command.'
  29826. );
  29827. return NaN;
  29828. }
  29829. function parseFloatOperand() {
  29830. let str = "";
  29831. const eof = 15;
  29832. const lookup = [
  29833. "0",
  29834. "1",
  29835. "2",
  29836. "3",
  29837. "4",
  29838. "5",
  29839. "6",
  29840. "7",
  29841. "8",
  29842. "9",
  29843. ".",
  29844. "E",
  29845. "E-",
  29846. null,
  29847. "-",
  29848. ];
  29849. const length = dict.length;
  29850. while (pos < length) {
  29851. const b = dict[pos++];
  29852. const b1 = b >> 4;
  29853. const b2 = b & 15;
  29854. if (b1 === eof) {
  29855. break;
  29856. }
  29857. str += lookup[b1];
  29858. if (b2 === eof) {
  29859. break;
  29860. }
  29861. str += lookup[b2];
  29862. }
  29863. return parseFloat(str);
  29864. }
  29865. let operands = [];
  29866. const entries = [];
  29867. pos = 0;
  29868. const end = dict.length;
  29869. while (pos < end) {
  29870. let b = dict[pos];
  29871. if (b <= 21) {
  29872. if (b === 12) {
  29873. b = (b << 8) | dict[++pos];
  29874. }
  29875. entries.push([b, operands]);
  29876. operands = [];
  29877. ++pos;
  29878. } else {
  29879. operands.push(parseOperand());
  29880. }
  29881. }
  29882. return entries;
  29883. }
  29884. parseIndex(pos) {
  29885. const cffIndex = new CFFIndex();
  29886. const bytes = this.bytes;
  29887. const count = (bytes[pos++] << 8) | bytes[pos++];
  29888. const offsets = [];
  29889. let end = pos;
  29890. let i, ii;
  29891. if (count !== 0) {
  29892. const offsetSize = bytes[pos++];
  29893. const startPos = pos + (count + 1) * offsetSize - 1;
  29894. for (i = 0, ii = count + 1; i < ii; ++i) {
  29895. let offset = 0;
  29896. for (let j = 0; j < offsetSize; ++j) {
  29897. offset <<= 8;
  29898. offset += bytes[pos++];
  29899. }
  29900. offsets.push(startPos + offset);
  29901. }
  29902. end = offsets[count];
  29903. }
  29904. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  29905. const offsetStart = offsets[i];
  29906. const offsetEnd = offsets[i + 1];
  29907. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  29908. }
  29909. return {
  29910. obj: cffIndex,
  29911. endPos: end,
  29912. };
  29913. }
  29914. parseNameIndex(index) {
  29915. const names = [];
  29916. for (let i = 0, ii = index.count; i < ii; ++i) {
  29917. const name = index.get(i);
  29918. names.push((0, _util.bytesToString)(name));
  29919. }
  29920. return names;
  29921. }
  29922. parseStringIndex(index) {
  29923. const strings = new CFFStrings();
  29924. for (let i = 0, ii = index.count; i < ii; ++i) {
  29925. const data = index.get(i);
  29926. strings.add((0, _util.bytesToString)(data));
  29927. }
  29928. return strings;
  29929. }
  29930. createDict(Type, dict, strings) {
  29931. const cffDict = new Type(strings);
  29932. for (let i = 0, ii = dict.length; i < ii; ++i) {
  29933. const pair = dict[i];
  29934. const key = pair[0];
  29935. const value = pair[1];
  29936. cffDict.setByKey(key, value);
  29937. }
  29938. return cffDict;
  29939. }
  29940. parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  29941. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  29942. return false;
  29943. }
  29944. let stackSize = state.stackSize;
  29945. const stack = state.stack;
  29946. const length = data.length;
  29947. for (let j = 0; j < length; ) {
  29948. const value = data[j++];
  29949. let validationCommand = null;
  29950. if (value === 12) {
  29951. const q = data[j++];
  29952. if (q === 0) {
  29953. data[j - 2] = 139;
  29954. data[j - 1] = 22;
  29955. stackSize = 0;
  29956. } else {
  29957. validationCommand = CharstringValidationData12[q];
  29958. }
  29959. } else if (value === 28) {
  29960. stack[stackSize] =
  29961. ((data[j] << 24) | (data[j + 1] << 16)) >> 16;
  29962. j += 2;
  29963. stackSize++;
  29964. } else if (value === 14) {
  29965. if (stackSize >= 4) {
  29966. stackSize -= 4;
  29967. if (this.seacAnalysisEnabled) {
  29968. state.seac = stack.slice(stackSize, stackSize + 4);
  29969. return false;
  29970. }
  29971. }
  29972. validationCommand = CharstringValidationData[value];
  29973. } else if (value >= 32 && value <= 246) {
  29974. stack[stackSize] = value - 139;
  29975. stackSize++;
  29976. } else if (value >= 247 && value <= 254) {
  29977. stack[stackSize] =
  29978. value < 251
  29979. ? ((value - 247) << 8) + data[j] + 108
  29980. : -((value - 251) << 8) - data[j] - 108;
  29981. j++;
  29982. stackSize++;
  29983. } else if (value === 255) {
  29984. stack[stackSize] =
  29985. ((data[j] << 24) |
  29986. (data[j + 1] << 16) |
  29987. (data[j + 2] << 8) |
  29988. data[j + 3]) /
  29989. 65536;
  29990. j += 4;
  29991. stackSize++;
  29992. } else if (value === 19 || value === 20) {
  29993. state.hints += stackSize >> 1;
  29994. j += (state.hints + 7) >> 3;
  29995. stackSize %= 2;
  29996. validationCommand = CharstringValidationData[value];
  29997. } else if (value === 10 || value === 29) {
  29998. let subrsIndex;
  29999. if (value === 10) {
  30000. subrsIndex = localSubrIndex;
  30001. } else {
  30002. subrsIndex = globalSubrIndex;
  30003. }
  30004. if (!subrsIndex) {
  30005. validationCommand = CharstringValidationData[value];
  30006. (0, _util.warn)(
  30007. "Missing subrsIndex for " + validationCommand.id
  30008. );
  30009. return false;
  30010. }
  30011. let bias = 32768;
  30012. if (subrsIndex.count < 1240) {
  30013. bias = 107;
  30014. } else if (subrsIndex.count < 33900) {
  30015. bias = 1131;
  30016. }
  30017. const subrNumber = stack[--stackSize] + bias;
  30018. if (
  30019. subrNumber < 0 ||
  30020. subrNumber >= subrsIndex.count ||
  30021. isNaN(subrNumber)
  30022. ) {
  30023. validationCommand = CharstringValidationData[value];
  30024. (0, _util.warn)(
  30025. "Out of bounds subrIndex for " + validationCommand.id
  30026. );
  30027. return false;
  30028. }
  30029. state.stackSize = stackSize;
  30030. state.callDepth++;
  30031. const valid = this.parseCharString(
  30032. state,
  30033. subrsIndex.get(subrNumber),
  30034. localSubrIndex,
  30035. globalSubrIndex
  30036. );
  30037. if (!valid) {
  30038. return false;
  30039. }
  30040. state.callDepth--;
  30041. stackSize = state.stackSize;
  30042. continue;
  30043. } else if (value === 11) {
  30044. state.stackSize = stackSize;
  30045. return true;
  30046. } else if (value === 0 && j === data.length) {
  30047. data[j - 1] = 14;
  30048. validationCommand = CharstringValidationData[14];
  30049. } else {
  30050. validationCommand = CharstringValidationData[value];
  30051. }
  30052. if (validationCommand) {
  30053. if (validationCommand.stem) {
  30054. state.hints += stackSize >> 1;
  30055. if (value === 3 || value === 23) {
  30056. state.hasVStems = true;
  30057. } else if (state.hasVStems && (value === 1 || value === 18)) {
  30058. (0, _util.warn)("CFF stem hints are in wrong order");
  30059. data[j - 1] = value === 1 ? 3 : 23;
  30060. }
  30061. }
  30062. if ("min" in validationCommand) {
  30063. if (!state.undefStack && stackSize < validationCommand.min) {
  30064. (0, _util.warn)(
  30065. "Not enough parameters for " +
  30066. validationCommand.id +
  30067. "; actual: " +
  30068. stackSize +
  30069. ", expected: " +
  30070. validationCommand.min
  30071. );
  30072. if (stackSize === 0) {
  30073. data[j - 1] = 14;
  30074. return true;
  30075. }
  30076. return false;
  30077. }
  30078. }
  30079. if (
  30080. state.firstStackClearing &&
  30081. validationCommand.stackClearing
  30082. ) {
  30083. state.firstStackClearing = false;
  30084. stackSize -= validationCommand.min;
  30085. if (stackSize >= 2 && validationCommand.stem) {
  30086. stackSize %= 2;
  30087. } else if (stackSize > 1) {
  30088. (0, _util.warn)(
  30089. "Found too many parameters for stack-clearing command"
  30090. );
  30091. }
  30092. if (stackSize > 0) {
  30093. state.width = stack[stackSize - 1];
  30094. }
  30095. }
  30096. if ("stackDelta" in validationCommand) {
  30097. if ("stackFn" in validationCommand) {
  30098. validationCommand.stackFn(stack, stackSize);
  30099. }
  30100. stackSize += validationCommand.stackDelta;
  30101. } else if (validationCommand.stackClearing) {
  30102. stackSize = 0;
  30103. } else if (validationCommand.resetStack) {
  30104. stackSize = 0;
  30105. state.undefStack = false;
  30106. } else if (validationCommand.undefStack) {
  30107. stackSize = 0;
  30108. state.undefStack = true;
  30109. state.firstStackClearing = false;
  30110. }
  30111. }
  30112. }
  30113. state.stackSize = stackSize;
  30114. return true;
  30115. }
  30116. parseCharStrings({
  30117. charStrings,
  30118. localSubrIndex,
  30119. globalSubrIndex,
  30120. fdSelect,
  30121. fdArray,
  30122. privateDict,
  30123. }) {
  30124. const seacs = [];
  30125. const widths = [];
  30126. const count = charStrings.count;
  30127. for (let i = 0; i < count; i++) {
  30128. const charstring = charStrings.get(i);
  30129. const state = {
  30130. callDepth: 0,
  30131. stackSize: 0,
  30132. stack: [],
  30133. undefStack: true,
  30134. hints: 0,
  30135. firstStackClearing: true,
  30136. seac: null,
  30137. width: null,
  30138. hasVStems: false,
  30139. };
  30140. let valid = true;
  30141. let localSubrToUse = null;
  30142. let privateDictToUse = privateDict;
  30143. if (fdSelect && fdArray.length) {
  30144. const fdIndex = fdSelect.getFDIndex(i);
  30145. if (fdIndex === -1) {
  30146. (0, _util.warn)("Glyph index is not in fd select.");
  30147. valid = false;
  30148. }
  30149. if (fdIndex >= fdArray.length) {
  30150. (0, _util.warn)("Invalid fd index for glyph index.");
  30151. valid = false;
  30152. }
  30153. if (valid) {
  30154. privateDictToUse = fdArray[fdIndex].privateDict;
  30155. localSubrToUse = privateDictToUse.subrsIndex;
  30156. }
  30157. } else if (localSubrIndex) {
  30158. localSubrToUse = localSubrIndex;
  30159. }
  30160. if (valid) {
  30161. valid = this.parseCharString(
  30162. state,
  30163. charstring,
  30164. localSubrToUse,
  30165. globalSubrIndex
  30166. );
  30167. }
  30168. if (state.width !== null) {
  30169. const nominalWidth =
  30170. privateDictToUse.getByName("nominalWidthX");
  30171. widths[i] = nominalWidth + state.width;
  30172. } else {
  30173. const defaultWidth =
  30174. privateDictToUse.getByName("defaultWidthX");
  30175. widths[i] = defaultWidth;
  30176. }
  30177. if (state.seac !== null) {
  30178. seacs[i] = state.seac;
  30179. }
  30180. if (!valid) {
  30181. charStrings.set(i, new Uint8Array([14]));
  30182. }
  30183. }
  30184. return {
  30185. charStrings,
  30186. seacs,
  30187. widths,
  30188. };
  30189. }
  30190. emptyPrivateDictionary(parentDict) {
  30191. const privateDict = this.createDict(
  30192. CFFPrivateDict,
  30193. [],
  30194. parentDict.strings
  30195. );
  30196. parentDict.setByKey(18, [0, 0]);
  30197. parentDict.privateDict = privateDict;
  30198. }
  30199. parsePrivateDict(parentDict) {
  30200. if (!parentDict.hasName("Private")) {
  30201. this.emptyPrivateDictionary(parentDict);
  30202. return;
  30203. }
  30204. const privateOffset = parentDict.getByName("Private");
  30205. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  30206. parentDict.removeByName("Private");
  30207. return;
  30208. }
  30209. const size = privateOffset[0];
  30210. const offset = privateOffset[1];
  30211. if (size === 0 || offset >= this.bytes.length) {
  30212. this.emptyPrivateDictionary(parentDict);
  30213. return;
  30214. }
  30215. const privateDictEnd = offset + size;
  30216. const dictData = this.bytes.subarray(offset, privateDictEnd);
  30217. const dict = this.parseDict(dictData);
  30218. const privateDict = this.createDict(
  30219. CFFPrivateDict,
  30220. dict,
  30221. parentDict.strings
  30222. );
  30223. parentDict.privateDict = privateDict;
  30224. if (!privateDict.getByName("Subrs")) {
  30225. return;
  30226. }
  30227. const subrsOffset = privateDict.getByName("Subrs");
  30228. const relativeOffset = offset + subrsOffset;
  30229. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  30230. this.emptyPrivateDictionary(parentDict);
  30231. return;
  30232. }
  30233. const subrsIndex = this.parseIndex(relativeOffset);
  30234. privateDict.subrsIndex = subrsIndex.obj;
  30235. }
  30236. parseCharsets(pos, length, strings, cid) {
  30237. if (pos === 0) {
  30238. return new CFFCharset(
  30239. true,
  30240. CFFCharsetPredefinedTypes.ISO_ADOBE,
  30241. _charsets.ISOAdobeCharset
  30242. );
  30243. } else if (pos === 1) {
  30244. return new CFFCharset(
  30245. true,
  30246. CFFCharsetPredefinedTypes.EXPERT,
  30247. _charsets.ExpertCharset
  30248. );
  30249. } else if (pos === 2) {
  30250. return new CFFCharset(
  30251. true,
  30252. CFFCharsetPredefinedTypes.EXPERT_SUBSET,
  30253. _charsets.ExpertSubsetCharset
  30254. );
  30255. }
  30256. const bytes = this.bytes;
  30257. const start = pos;
  30258. const format = bytes[pos++];
  30259. const charset = [cid ? 0 : ".notdef"];
  30260. let id, count, i;
  30261. length -= 1;
  30262. switch (format) {
  30263. case 0:
  30264. for (i = 0; i < length; i++) {
  30265. id = (bytes[pos++] << 8) | bytes[pos++];
  30266. charset.push(cid ? id : strings.get(id));
  30267. }
  30268. break;
  30269. case 1:
  30270. while (charset.length <= length) {
  30271. id = (bytes[pos++] << 8) | bytes[pos++];
  30272. count = bytes[pos++];
  30273. for (i = 0; i <= count; i++) {
  30274. charset.push(cid ? id++ : strings.get(id++));
  30275. }
  30276. }
  30277. break;
  30278. case 2:
  30279. while (charset.length <= length) {
  30280. id = (bytes[pos++] << 8) | bytes[pos++];
  30281. count = (bytes[pos++] << 8) | bytes[pos++];
  30282. for (i = 0; i <= count; i++) {
  30283. charset.push(cid ? id++ : strings.get(id++));
  30284. }
  30285. }
  30286. break;
  30287. default:
  30288. throw new _util.FormatError("Unknown charset format");
  30289. }
  30290. const end = pos;
  30291. const raw = bytes.subarray(start, end);
  30292. return new CFFCharset(false, format, charset, raw);
  30293. }
  30294. parseEncoding(pos, properties, strings, charset) {
  30295. const encoding = Object.create(null);
  30296. const bytes = this.bytes;
  30297. let predefined = false;
  30298. let format, i, ii;
  30299. let raw = null;
  30300. function readSupplement() {
  30301. const supplementsCount = bytes[pos++];
  30302. for (i = 0; i < supplementsCount; i++) {
  30303. const code = bytes[pos++];
  30304. const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  30305. encoding[code] = charset.indexOf(strings.get(sid));
  30306. }
  30307. }
  30308. if (pos === 0 || pos === 1) {
  30309. predefined = true;
  30310. format = pos;
  30311. const baseEncoding = pos
  30312. ? _encodings.ExpertEncoding
  30313. : _encodings.StandardEncoding;
  30314. for (i = 0, ii = charset.length; i < ii; i++) {
  30315. const index = baseEncoding.indexOf(charset[i]);
  30316. if (index !== -1) {
  30317. encoding[index] = i;
  30318. }
  30319. }
  30320. } else {
  30321. const dataStart = pos;
  30322. format = bytes[pos++];
  30323. switch (format & 0x7f) {
  30324. case 0:
  30325. const glyphsCount = bytes[pos++];
  30326. for (i = 1; i <= glyphsCount; i++) {
  30327. encoding[bytes[pos++]] = i;
  30328. }
  30329. break;
  30330. case 1:
  30331. const rangesCount = bytes[pos++];
  30332. let gid = 1;
  30333. for (i = 0; i < rangesCount; i++) {
  30334. const start = bytes[pos++];
  30335. const left = bytes[pos++];
  30336. for (let j = start; j <= start + left; j++) {
  30337. encoding[j] = gid++;
  30338. }
  30339. }
  30340. break;
  30341. default:
  30342. throw new _util.FormatError(
  30343. `Unknown encoding format: ${format} in CFF`
  30344. );
  30345. }
  30346. const dataEnd = pos;
  30347. if (format & 0x80) {
  30348. bytes[dataStart] &= 0x7f;
  30349. readSupplement();
  30350. }
  30351. raw = bytes.subarray(dataStart, dataEnd);
  30352. }
  30353. format &= 0x7f;
  30354. return new CFFEncoding(predefined, format, encoding, raw);
  30355. }
  30356. parseFDSelect(pos, length) {
  30357. const bytes = this.bytes;
  30358. const format = bytes[pos++];
  30359. const fdSelect = [];
  30360. let i;
  30361. switch (format) {
  30362. case 0:
  30363. for (i = 0; i < length; ++i) {
  30364. const id = bytes[pos++];
  30365. fdSelect.push(id);
  30366. }
  30367. break;
  30368. case 3:
  30369. const rangesCount = (bytes[pos++] << 8) | bytes[pos++];
  30370. for (i = 0; i < rangesCount; ++i) {
  30371. let first = (bytes[pos++] << 8) | bytes[pos++];
  30372. if (i === 0 && first !== 0) {
  30373. (0, _util.warn)(
  30374. "parseFDSelect: The first range must have a first GID of 0" +
  30375. " -- trying to recover."
  30376. );
  30377. first = 0;
  30378. }
  30379. const fdIndex = bytes[pos++];
  30380. const next = (bytes[pos] << 8) | bytes[pos + 1];
  30381. for (let j = first; j < next; ++j) {
  30382. fdSelect.push(fdIndex);
  30383. }
  30384. }
  30385. pos += 2;
  30386. break;
  30387. default:
  30388. throw new _util.FormatError(
  30389. `parseFDSelect: Unknown format "${format}".`
  30390. );
  30391. }
  30392. if (fdSelect.length !== length) {
  30393. throw new _util.FormatError("parseFDSelect: Invalid font data.");
  30394. }
  30395. return new CFFFDSelect(format, fdSelect);
  30396. }
  30397. }
  30398. exports.CFFParser = CFFParser;
  30399. class CFF {
  30400. constructor() {
  30401. this.header = null;
  30402. this.names = [];
  30403. this.topDict = null;
  30404. this.strings = new CFFStrings();
  30405. this.globalSubrIndex = null;
  30406. this.encoding = null;
  30407. this.charset = null;
  30408. this.charStrings = null;
  30409. this.fdArray = [];
  30410. this.fdSelect = null;
  30411. this.isCIDFont = false;
  30412. }
  30413. duplicateFirstGlyph() {
  30414. if (this.charStrings.count >= 65535) {
  30415. (0, _util.warn)(
  30416. "Not enough space in charstrings to duplicate first glyph."
  30417. );
  30418. return;
  30419. }
  30420. const glyphZero = this.charStrings.get(0);
  30421. this.charStrings.add(glyphZero);
  30422. if (this.isCIDFont) {
  30423. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  30424. }
  30425. }
  30426. hasGlyphId(id) {
  30427. if (id < 0 || id >= this.charStrings.count) {
  30428. return false;
  30429. }
  30430. const glyph = this.charStrings.get(id);
  30431. return glyph.length > 0;
  30432. }
  30433. }
  30434. exports.CFF = CFF;
  30435. class CFFHeader {
  30436. constructor(major, minor, hdrSize, offSize) {
  30437. this.major = major;
  30438. this.minor = minor;
  30439. this.hdrSize = hdrSize;
  30440. this.offSize = offSize;
  30441. }
  30442. }
  30443. exports.CFFHeader = CFFHeader;
  30444. class CFFStrings {
  30445. constructor() {
  30446. this.strings = [];
  30447. }
  30448. get(index) {
  30449. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  30450. return CFFStandardStrings[index];
  30451. }
  30452. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  30453. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  30454. }
  30455. return CFFStandardStrings[0];
  30456. }
  30457. getSID(str) {
  30458. let index = CFFStandardStrings.indexOf(str);
  30459. if (index !== -1) {
  30460. return index;
  30461. }
  30462. index = this.strings.indexOf(str);
  30463. if (index !== -1) {
  30464. return index + NUM_STANDARD_CFF_STRINGS;
  30465. }
  30466. return -1;
  30467. }
  30468. add(value) {
  30469. this.strings.push(value);
  30470. }
  30471. get count() {
  30472. return this.strings.length;
  30473. }
  30474. }
  30475. exports.CFFStrings = CFFStrings;
  30476. class CFFIndex {
  30477. constructor() {
  30478. this.objects = [];
  30479. this.length = 0;
  30480. }
  30481. add(data) {
  30482. this.length += data.length;
  30483. this.objects.push(data);
  30484. }
  30485. set(index, data) {
  30486. this.length += data.length - this.objects[index].length;
  30487. this.objects[index] = data;
  30488. }
  30489. get(index) {
  30490. return this.objects[index];
  30491. }
  30492. get count() {
  30493. return this.objects.length;
  30494. }
  30495. }
  30496. exports.CFFIndex = CFFIndex;
  30497. class CFFDict {
  30498. constructor(tables, strings) {
  30499. this.keyToNameMap = tables.keyToNameMap;
  30500. this.nameToKeyMap = tables.nameToKeyMap;
  30501. this.defaults = tables.defaults;
  30502. this.types = tables.types;
  30503. this.opcodes = tables.opcodes;
  30504. this.order = tables.order;
  30505. this.strings = strings;
  30506. this.values = Object.create(null);
  30507. }
  30508. setByKey(key, value) {
  30509. if (!(key in this.keyToNameMap)) {
  30510. return false;
  30511. }
  30512. const valueLength = value.length;
  30513. if (valueLength === 0) {
  30514. return true;
  30515. }
  30516. for (let i = 0; i < valueLength; i++) {
  30517. if (isNaN(value[i])) {
  30518. (0, _util.warn)(
  30519. 'Invalid CFFDict value: "' +
  30520. value +
  30521. '" for key "' +
  30522. key +
  30523. '".'
  30524. );
  30525. return true;
  30526. }
  30527. }
  30528. const type = this.types[key];
  30529. if (type === "num" || type === "sid" || type === "offset") {
  30530. value = value[0];
  30531. }
  30532. this.values[key] = value;
  30533. return true;
  30534. }
  30535. setByName(name, value) {
  30536. if (!(name in this.nameToKeyMap)) {
  30537. throw new _util.FormatError(`Invalid dictionary name "${name}"`);
  30538. }
  30539. this.values[this.nameToKeyMap[name]] = value;
  30540. }
  30541. hasName(name) {
  30542. return this.nameToKeyMap[name] in this.values;
  30543. }
  30544. getByName(name) {
  30545. if (!(name in this.nameToKeyMap)) {
  30546. throw new _util.FormatError(`Invalid dictionary name ${name}"`);
  30547. }
  30548. const key = this.nameToKeyMap[name];
  30549. if (!(key in this.values)) {
  30550. return this.defaults[key];
  30551. }
  30552. return this.values[key];
  30553. }
  30554. removeByName(name) {
  30555. delete this.values[this.nameToKeyMap[name]];
  30556. }
  30557. static createTables(layout) {
  30558. const tables = {
  30559. keyToNameMap: {},
  30560. nameToKeyMap: {},
  30561. defaults: {},
  30562. types: {},
  30563. opcodes: {},
  30564. order: [],
  30565. };
  30566. for (let i = 0, ii = layout.length; i < ii; ++i) {
  30567. const entry = layout[i];
  30568. const key = Array.isArray(entry[0])
  30569. ? (entry[0][0] << 8) + entry[0][1]
  30570. : entry[0];
  30571. tables.keyToNameMap[key] = entry[1];
  30572. tables.nameToKeyMap[entry[1]] = key;
  30573. tables.types[key] = entry[2];
  30574. tables.defaults[key] = entry[3];
  30575. tables.opcodes[key] = Array.isArray(entry[0])
  30576. ? entry[0]
  30577. : [entry[0]];
  30578. tables.order.push(key);
  30579. }
  30580. return tables;
  30581. }
  30582. }
  30583. const CFFTopDictLayout = [
  30584. [[12, 30], "ROS", ["sid", "sid", "num"], null],
  30585. [[12, 20], "SyntheticBase", "num", null],
  30586. [0, "version", "sid", null],
  30587. [1, "Notice", "sid", null],
  30588. [[12, 0], "Copyright", "sid", null],
  30589. [2, "FullName", "sid", null],
  30590. [3, "FamilyName", "sid", null],
  30591. [4, "Weight", "sid", null],
  30592. [[12, 1], "isFixedPitch", "num", 0],
  30593. [[12, 2], "ItalicAngle", "num", 0],
  30594. [[12, 3], "UnderlinePosition", "num", -100],
  30595. [[12, 4], "UnderlineThickness", "num", 50],
  30596. [[12, 5], "PaintType", "num", 0],
  30597. [[12, 6], "CharstringType", "num", 2],
  30598. [
  30599. [12, 7],
  30600. "FontMatrix",
  30601. ["num", "num", "num", "num", "num", "num"],
  30602. [0.001, 0, 0, 0.001, 0, 0],
  30603. ],
  30604. [13, "UniqueID", "num", null],
  30605. [5, "FontBBox", ["num", "num", "num", "num"], [0, 0, 0, 0]],
  30606. [[12, 8], "StrokeWidth", "num", 0],
  30607. [14, "XUID", "array", null],
  30608. [15, "charset", "offset", 0],
  30609. [16, "Encoding", "offset", 0],
  30610. [17, "CharStrings", "offset", 0],
  30611. [18, "Private", ["offset", "offset"], null],
  30612. [[12, 21], "PostScript", "sid", null],
  30613. [[12, 22], "BaseFontName", "sid", null],
  30614. [[12, 23], "BaseFontBlend", "delta", null],
  30615. [[12, 31], "CIDFontVersion", "num", 0],
  30616. [[12, 32], "CIDFontRevision", "num", 0],
  30617. [[12, 33], "CIDFontType", "num", 0],
  30618. [[12, 34], "CIDCount", "num", 8720],
  30619. [[12, 35], "UIDBase", "num", null],
  30620. [[12, 37], "FDSelect", "offset", null],
  30621. [[12, 36], "FDArray", "offset", null],
  30622. [[12, 38], "FontName", "sid", null],
  30623. ];
  30624. class CFFTopDict extends CFFDict {
  30625. static get tables() {
  30626. return (0, _util.shadow)(
  30627. this,
  30628. "tables",
  30629. this.createTables(CFFTopDictLayout)
  30630. );
  30631. }
  30632. constructor(strings) {
  30633. super(CFFTopDict.tables, strings);
  30634. this.privateDict = null;
  30635. }
  30636. }
  30637. exports.CFFTopDict = CFFTopDict;
  30638. const CFFPrivateDictLayout = [
  30639. [6, "BlueValues", "delta", null],
  30640. [7, "OtherBlues", "delta", null],
  30641. [8, "FamilyBlues", "delta", null],
  30642. [9, "FamilyOtherBlues", "delta", null],
  30643. [[12, 9], "BlueScale", "num", 0.039625],
  30644. [[12, 10], "BlueShift", "num", 7],
  30645. [[12, 11], "BlueFuzz", "num", 1],
  30646. [10, "StdHW", "num", null],
  30647. [11, "StdVW", "num", null],
  30648. [[12, 12], "StemSnapH", "delta", null],
  30649. [[12, 13], "StemSnapV", "delta", null],
  30650. [[12, 14], "ForceBold", "num", 0],
  30651. [[12, 17], "LanguageGroup", "num", 0],
  30652. [[12, 18], "ExpansionFactor", "num", 0.06],
  30653. [[12, 19], "initialRandomSeed", "num", 0],
  30654. [20, "defaultWidthX", "num", 0],
  30655. [21, "nominalWidthX", "num", 0],
  30656. [19, "Subrs", "offset", null],
  30657. ];
  30658. class CFFPrivateDict extends CFFDict {
  30659. static get tables() {
  30660. return (0, _util.shadow)(
  30661. this,
  30662. "tables",
  30663. this.createTables(CFFPrivateDictLayout)
  30664. );
  30665. }
  30666. constructor(strings) {
  30667. super(CFFPrivateDict.tables, strings);
  30668. this.subrsIndex = null;
  30669. }
  30670. }
  30671. exports.CFFPrivateDict = CFFPrivateDict;
  30672. const CFFCharsetPredefinedTypes = {
  30673. ISO_ADOBE: 0,
  30674. EXPERT: 1,
  30675. EXPERT_SUBSET: 2,
  30676. };
  30677. class CFFCharset {
  30678. constructor(predefined, format, charset, raw) {
  30679. this.predefined = predefined;
  30680. this.format = format;
  30681. this.charset = charset;
  30682. this.raw = raw;
  30683. }
  30684. }
  30685. exports.CFFCharset = CFFCharset;
  30686. class CFFEncoding {
  30687. constructor(predefined, format, encoding, raw) {
  30688. this.predefined = predefined;
  30689. this.format = format;
  30690. this.encoding = encoding;
  30691. this.raw = raw;
  30692. }
  30693. }
  30694. class CFFFDSelect {
  30695. constructor(format, fdSelect) {
  30696. this.format = format;
  30697. this.fdSelect = fdSelect;
  30698. }
  30699. getFDIndex(glyphIndex) {
  30700. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  30701. return -1;
  30702. }
  30703. return this.fdSelect[glyphIndex];
  30704. }
  30705. }
  30706. exports.CFFFDSelect = CFFFDSelect;
  30707. class CFFOffsetTracker {
  30708. constructor() {
  30709. this.offsets = Object.create(null);
  30710. }
  30711. isTracking(key) {
  30712. return key in this.offsets;
  30713. }
  30714. track(key, location) {
  30715. if (key in this.offsets) {
  30716. throw new _util.FormatError(
  30717. `Already tracking location of ${key}`
  30718. );
  30719. }
  30720. this.offsets[key] = location;
  30721. }
  30722. offset(value) {
  30723. for (const key in this.offsets) {
  30724. this.offsets[key] += value;
  30725. }
  30726. }
  30727. setEntryLocation(key, values, output) {
  30728. if (!(key in this.offsets)) {
  30729. throw new _util.FormatError(`Not tracking location of ${key}`);
  30730. }
  30731. const data = output.data;
  30732. const dataOffset = this.offsets[key];
  30733. const size = 5;
  30734. for (let i = 0, ii = values.length; i < ii; ++i) {
  30735. const offset0 = i * size + dataOffset;
  30736. const offset1 = offset0 + 1;
  30737. const offset2 = offset0 + 2;
  30738. const offset3 = offset0 + 3;
  30739. const offset4 = offset0 + 4;
  30740. if (
  30741. data[offset0] !== 0x1d ||
  30742. data[offset1] !== 0 ||
  30743. data[offset2] !== 0 ||
  30744. data[offset3] !== 0 ||
  30745. data[offset4] !== 0
  30746. ) {
  30747. throw new _util.FormatError(
  30748. "writing to an offset that is not empty"
  30749. );
  30750. }
  30751. const value = values[i];
  30752. data[offset0] = 0x1d;
  30753. data[offset1] = (value >> 24) & 0xff;
  30754. data[offset2] = (value >> 16) & 0xff;
  30755. data[offset3] = (value >> 8) & 0xff;
  30756. data[offset4] = value & 0xff;
  30757. }
  30758. }
  30759. }
  30760. class CFFCompiler {
  30761. constructor(cff) {
  30762. this.cff = cff;
  30763. }
  30764. compile() {
  30765. const cff = this.cff;
  30766. const output = {
  30767. data: [],
  30768. length: 0,
  30769. add(data) {
  30770. this.data = this.data.concat(data);
  30771. this.length = this.data.length;
  30772. },
  30773. };
  30774. const header = this.compileHeader(cff.header);
  30775. output.add(header);
  30776. const nameIndex = this.compileNameIndex(cff.names);
  30777. output.add(nameIndex);
  30778. if (cff.isCIDFont) {
  30779. if (cff.topDict.hasName("FontMatrix")) {
  30780. const base = cff.topDict.getByName("FontMatrix");
  30781. cff.topDict.removeByName("FontMatrix");
  30782. for (let i = 0, ii = cff.fdArray.length; i < ii; i++) {
  30783. const subDict = cff.fdArray[i];
  30784. let matrix = base.slice(0);
  30785. if (subDict.hasName("FontMatrix")) {
  30786. matrix = _util.Util.transform(
  30787. matrix,
  30788. subDict.getByName("FontMatrix")
  30789. );
  30790. }
  30791. subDict.setByName("FontMatrix", matrix);
  30792. }
  30793. }
  30794. }
  30795. const xuid = cff.topDict.getByName("XUID");
  30796. if (xuid && xuid.length > 16) {
  30797. cff.topDict.removeByName("XUID");
  30798. }
  30799. cff.topDict.setByName("charset", 0);
  30800. let compiled = this.compileTopDicts(
  30801. [cff.topDict],
  30802. output.length,
  30803. cff.isCIDFont
  30804. );
  30805. output.add(compiled.output);
  30806. const topDictTracker = compiled.trackers[0];
  30807. const stringIndex = this.compileStringIndex(cff.strings.strings);
  30808. output.add(stringIndex);
  30809. const globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  30810. output.add(globalSubrIndex);
  30811. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  30812. if (cff.encoding.predefined) {
  30813. topDictTracker.setEntryLocation(
  30814. "Encoding",
  30815. [cff.encoding.format],
  30816. output
  30817. );
  30818. } else {
  30819. const encoding = this.compileEncoding(cff.encoding);
  30820. topDictTracker.setEntryLocation(
  30821. "Encoding",
  30822. [output.length],
  30823. output
  30824. );
  30825. output.add(encoding);
  30826. }
  30827. }
  30828. const charset = this.compileCharset(
  30829. cff.charset,
  30830. cff.charStrings.count,
  30831. cff.strings,
  30832. cff.isCIDFont
  30833. );
  30834. topDictTracker.setEntryLocation("charset", [output.length], output);
  30835. output.add(charset);
  30836. const charStrings = this.compileCharStrings(cff.charStrings);
  30837. topDictTracker.setEntryLocation(
  30838. "CharStrings",
  30839. [output.length],
  30840. output
  30841. );
  30842. output.add(charStrings);
  30843. if (cff.isCIDFont) {
  30844. topDictTracker.setEntryLocation(
  30845. "FDSelect",
  30846. [output.length],
  30847. output
  30848. );
  30849. const fdSelect = this.compileFDSelect(cff.fdSelect);
  30850. output.add(fdSelect);
  30851. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  30852. topDictTracker.setEntryLocation(
  30853. "FDArray",
  30854. [output.length],
  30855. output
  30856. );
  30857. output.add(compiled.output);
  30858. const fontDictTrackers = compiled.trackers;
  30859. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  30860. }
  30861. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  30862. output.add([0]);
  30863. return output.data;
  30864. }
  30865. encodeNumber(value) {
  30866. if (Number.isInteger(value)) {
  30867. return this.encodeInteger(value);
  30868. }
  30869. return this.encodeFloat(value);
  30870. }
  30871. static get EncodeFloatRegExp() {
  30872. return (0, _util.shadow)(
  30873. this,
  30874. "EncodeFloatRegExp",
  30875. /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/
  30876. );
  30877. }
  30878. encodeFloat(num) {
  30879. let value = num.toString();
  30880. const m = CFFCompiler.EncodeFloatRegExp.exec(value);
  30881. if (m) {
  30882. const epsilon = parseFloat(
  30883. "1e" + ((m[2] ? +m[2] : 0) + m[1].length)
  30884. );
  30885. value = (Math.round(num * epsilon) / epsilon).toString();
  30886. }
  30887. let nibbles = "";
  30888. let i, ii;
  30889. for (i = 0, ii = value.length; i < ii; ++i) {
  30890. const a = value[i];
  30891. if (a === "e") {
  30892. nibbles += value[++i] === "-" ? "c" : "b";
  30893. } else if (a === ".") {
  30894. nibbles += "a";
  30895. } else if (a === "-") {
  30896. nibbles += "e";
  30897. } else {
  30898. nibbles += a;
  30899. }
  30900. }
  30901. nibbles += nibbles.length & 1 ? "f" : "ff";
  30902. const out = [30];
  30903. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  30904. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  30905. }
  30906. return out;
  30907. }
  30908. encodeInteger(value) {
  30909. let code;
  30910. if (value >= -107 && value <= 107) {
  30911. code = [value + 139];
  30912. } else if (value >= 108 && value <= 1131) {
  30913. value -= 108;
  30914. code = [(value >> 8) + 247, value & 0xff];
  30915. } else if (value >= -1131 && value <= -108) {
  30916. value = -value - 108;
  30917. code = [(value >> 8) + 251, value & 0xff];
  30918. } else if (value >= -32768 && value <= 32767) {
  30919. code = [0x1c, (value >> 8) & 0xff, value & 0xff];
  30920. } else {
  30921. code = [
  30922. 0x1d,
  30923. (value >> 24) & 0xff,
  30924. (value >> 16) & 0xff,
  30925. (value >> 8) & 0xff,
  30926. value & 0xff,
  30927. ];
  30928. }
  30929. return code;
  30930. }
  30931. compileHeader(header) {
  30932. return [header.major, header.minor, 4, header.offSize];
  30933. }
  30934. compileNameIndex(names) {
  30935. const nameIndex = new CFFIndex();
  30936. for (let i = 0, ii = names.length; i < ii; ++i) {
  30937. const name = names[i];
  30938. const length = Math.min(name.length, 127);
  30939. let sanitizedName = new Array(length);
  30940. for (let j = 0; j < length; j++) {
  30941. let char = name[j];
  30942. if (
  30943. char < "!" ||
  30944. char > "~" ||
  30945. char === "[" ||
  30946. char === "]" ||
  30947. char === "(" ||
  30948. char === ")" ||
  30949. char === "{" ||
  30950. char === "}" ||
  30951. char === "<" ||
  30952. char === ">" ||
  30953. char === "/" ||
  30954. char === "%"
  30955. ) {
  30956. char = "_";
  30957. }
  30958. sanitizedName[j] = char;
  30959. }
  30960. sanitizedName = sanitizedName.join("");
  30961. if (sanitizedName === "") {
  30962. sanitizedName = "Bad_Font_Name";
  30963. }
  30964. nameIndex.add((0, _util.stringToBytes)(sanitizedName));
  30965. }
  30966. return this.compileIndex(nameIndex);
  30967. }
  30968. compileTopDicts(dicts, length, removeCidKeys) {
  30969. const fontDictTrackers = [];
  30970. let fdArrayIndex = new CFFIndex();
  30971. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  30972. const fontDict = dicts[i];
  30973. if (removeCidKeys) {
  30974. fontDict.removeByName("CIDFontVersion");
  30975. fontDict.removeByName("CIDFontRevision");
  30976. fontDict.removeByName("CIDFontType");
  30977. fontDict.removeByName("CIDCount");
  30978. fontDict.removeByName("UIDBase");
  30979. }
  30980. const fontDictTracker = new CFFOffsetTracker();
  30981. const fontDictData = this.compileDict(fontDict, fontDictTracker);
  30982. fontDictTrackers.push(fontDictTracker);
  30983. fdArrayIndex.add(fontDictData);
  30984. fontDictTracker.offset(length);
  30985. }
  30986. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  30987. return {
  30988. trackers: fontDictTrackers,
  30989. output: fdArrayIndex,
  30990. };
  30991. }
  30992. compilePrivateDicts(dicts, trackers, output) {
  30993. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  30994. const fontDict = dicts[i];
  30995. const privateDict = fontDict.privateDict;
  30996. if (!privateDict || !fontDict.hasName("Private")) {
  30997. throw new _util.FormatError(
  30998. "There must be a private dictionary."
  30999. );
  31000. }
  31001. const privateDictTracker = new CFFOffsetTracker();
  31002. const privateDictData = this.compileDict(
  31003. privateDict,
  31004. privateDictTracker
  31005. );
  31006. let outputLength = output.length;
  31007. privateDictTracker.offset(outputLength);
  31008. if (!privateDictData.length) {
  31009. outputLength = 0;
  31010. }
  31011. trackers[i].setEntryLocation(
  31012. "Private",
  31013. [privateDictData.length, outputLength],
  31014. output
  31015. );
  31016. output.add(privateDictData);
  31017. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  31018. const subrs = this.compileIndex(privateDict.subrsIndex);
  31019. privateDictTracker.setEntryLocation(
  31020. "Subrs",
  31021. [privateDictData.length],
  31022. output
  31023. );
  31024. output.add(subrs);
  31025. }
  31026. }
  31027. }
  31028. compileDict(dict, offsetTracker) {
  31029. const out = [];
  31030. for (const key of dict.order) {
  31031. if (!(key in dict.values)) {
  31032. continue;
  31033. }
  31034. let values = dict.values[key];
  31035. let types = dict.types[key];
  31036. if (!Array.isArray(types)) {
  31037. types = [types];
  31038. }
  31039. if (!Array.isArray(values)) {
  31040. values = [values];
  31041. }
  31042. if (values.length === 0) {
  31043. continue;
  31044. }
  31045. for (let j = 0, jj = types.length; j < jj; ++j) {
  31046. const type = types[j];
  31047. const value = values[j];
  31048. switch (type) {
  31049. case "num":
  31050. case "sid":
  31051. out.push(...this.encodeNumber(value));
  31052. break;
  31053. case "offset":
  31054. const name = dict.keyToNameMap[key];
  31055. if (!offsetTracker.isTracking(name)) {
  31056. offsetTracker.track(name, out.length);
  31057. }
  31058. out.push(0x1d, 0, 0, 0, 0);
  31059. break;
  31060. case "array":
  31061. case "delta":
  31062. out.push(...this.encodeNumber(value));
  31063. for (let k = 1, kk = values.length; k < kk; ++k) {
  31064. out.push(...this.encodeNumber(values[k]));
  31065. }
  31066. break;
  31067. default:
  31068. throw new _util.FormatError(`Unknown data type of ${type}`);
  31069. }
  31070. }
  31071. out.push(...dict.opcodes[key]);
  31072. }
  31073. return out;
  31074. }
  31075. compileStringIndex(strings) {
  31076. const stringIndex = new CFFIndex();
  31077. for (let i = 0, ii = strings.length; i < ii; ++i) {
  31078. stringIndex.add((0, _util.stringToBytes)(strings[i]));
  31079. }
  31080. return this.compileIndex(stringIndex);
  31081. }
  31082. compileGlobalSubrIndex() {
  31083. const globalSubrIndex = this.cff.globalSubrIndex;
  31084. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  31085. }
  31086. compileCharStrings(charStrings) {
  31087. const charStringsIndex = new CFFIndex();
  31088. for (let i = 0; i < charStrings.count; i++) {
  31089. const glyph = charStrings.get(i);
  31090. if (glyph.length === 0) {
  31091. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  31092. continue;
  31093. }
  31094. charStringsIndex.add(glyph);
  31095. }
  31096. return this.compileIndex(charStringsIndex);
  31097. }
  31098. compileCharset(charset, numGlyphs, strings, isCIDFont) {
  31099. let out;
  31100. const numGlyphsLessNotDef = numGlyphs - 1;
  31101. if (isCIDFont) {
  31102. out = new Uint8Array([
  31103. 2,
  31104. 0,
  31105. 0,
  31106. (numGlyphsLessNotDef >> 8) & 0xff,
  31107. numGlyphsLessNotDef & 0xff,
  31108. ]);
  31109. } else {
  31110. const length = 1 + numGlyphsLessNotDef * 2;
  31111. out = new Uint8Array(length);
  31112. out[0] = 0;
  31113. let charsetIndex = 0;
  31114. const numCharsets = charset.charset.length;
  31115. let warned = false;
  31116. for (let i = 1; i < out.length; i += 2) {
  31117. let sid = 0;
  31118. if (charsetIndex < numCharsets) {
  31119. const name = charset.charset[charsetIndex++];
  31120. sid = strings.getSID(name);
  31121. if (sid === -1) {
  31122. sid = 0;
  31123. if (!warned) {
  31124. warned = true;
  31125. (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
  31126. }
  31127. }
  31128. }
  31129. out[i] = (sid >> 8) & 0xff;
  31130. out[i + 1] = sid & 0xff;
  31131. }
  31132. }
  31133. return this.compileTypedArray(out);
  31134. }
  31135. compileEncoding(encoding) {
  31136. return this.compileTypedArray(encoding.raw);
  31137. }
  31138. compileFDSelect(fdSelect) {
  31139. const format = fdSelect.format;
  31140. let out, i;
  31141. switch (format) {
  31142. case 0:
  31143. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  31144. out[0] = format;
  31145. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  31146. out[i + 1] = fdSelect.fdSelect[i];
  31147. }
  31148. break;
  31149. case 3:
  31150. const start = 0;
  31151. let lastFD = fdSelect.fdSelect[0];
  31152. const ranges = [
  31153. format,
  31154. 0,
  31155. 0,
  31156. (start >> 8) & 0xff,
  31157. start & 0xff,
  31158. lastFD,
  31159. ];
  31160. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  31161. const currentFD = fdSelect.fdSelect[i];
  31162. if (currentFD !== lastFD) {
  31163. ranges.push((i >> 8) & 0xff, i & 0xff, currentFD);
  31164. lastFD = currentFD;
  31165. }
  31166. }
  31167. const numRanges = (ranges.length - 3) / 3;
  31168. ranges[1] = (numRanges >> 8) & 0xff;
  31169. ranges[2] = numRanges & 0xff;
  31170. ranges.push((i >> 8) & 0xff, i & 0xff);
  31171. out = new Uint8Array(ranges);
  31172. break;
  31173. }
  31174. return this.compileTypedArray(out);
  31175. }
  31176. compileTypedArray(data) {
  31177. const out = [];
  31178. for (let i = 0, ii = data.length; i < ii; ++i) {
  31179. out[i] = data[i];
  31180. }
  31181. return out;
  31182. }
  31183. compileIndex(index, trackers = []) {
  31184. const objects = index.objects;
  31185. const count = objects.length;
  31186. if (count === 0) {
  31187. return [0, 0];
  31188. }
  31189. const data = [(count >> 8) & 0xff, count & 0xff];
  31190. let lastOffset = 1,
  31191. i;
  31192. for (i = 0; i < count; ++i) {
  31193. lastOffset += objects[i].length;
  31194. }
  31195. let offsetSize;
  31196. if (lastOffset < 0x100) {
  31197. offsetSize = 1;
  31198. } else if (lastOffset < 0x10000) {
  31199. offsetSize = 2;
  31200. } else if (lastOffset < 0x1000000) {
  31201. offsetSize = 3;
  31202. } else {
  31203. offsetSize = 4;
  31204. }
  31205. data.push(offsetSize);
  31206. let relativeOffset = 1;
  31207. for (i = 0; i < count + 1; i++) {
  31208. if (offsetSize === 1) {
  31209. data.push(relativeOffset & 0xff);
  31210. } else if (offsetSize === 2) {
  31211. data.push((relativeOffset >> 8) & 0xff, relativeOffset & 0xff);
  31212. } else if (offsetSize === 3) {
  31213. data.push(
  31214. (relativeOffset >> 16) & 0xff,
  31215. (relativeOffset >> 8) & 0xff,
  31216. relativeOffset & 0xff
  31217. );
  31218. } else {
  31219. data.push(
  31220. (relativeOffset >>> 24) & 0xff,
  31221. (relativeOffset >> 16) & 0xff,
  31222. (relativeOffset >> 8) & 0xff,
  31223. relativeOffset & 0xff
  31224. );
  31225. }
  31226. if (objects[i]) {
  31227. relativeOffset += objects[i].length;
  31228. }
  31229. }
  31230. for (i = 0; i < count; i++) {
  31231. if (trackers[i]) {
  31232. trackers[i].offset(data.length);
  31233. }
  31234. for (let j = 0, jj = objects[i].length; j < jj; j++) {
  31235. data.push(objects[i][j]);
  31236. }
  31237. }
  31238. return data;
  31239. }
  31240. }
  31241. exports.CFFCompiler = CFFCompiler;
  31242. /***/
  31243. },
  31244. /* 36 */
  31245. /***/ (__unused_webpack_module, exports) => {
  31246. Object.defineProperty(exports, "__esModule", {
  31247. value: true,
  31248. });
  31249. exports.ISOAdobeCharset =
  31250. exports.ExpertSubsetCharset =
  31251. exports.ExpertCharset =
  31252. void 0;
  31253. const ISOAdobeCharset = [
  31254. ".notdef",
  31255. "space",
  31256. "exclam",
  31257. "quotedbl",
  31258. "numbersign",
  31259. "dollar",
  31260. "percent",
  31261. "ampersand",
  31262. "quoteright",
  31263. "parenleft",
  31264. "parenright",
  31265. "asterisk",
  31266. "plus",
  31267. "comma",
  31268. "hyphen",
  31269. "period",
  31270. "slash",
  31271. "zero",
  31272. "one",
  31273. "two",
  31274. "three",
  31275. "four",
  31276. "five",
  31277. "six",
  31278. "seven",
  31279. "eight",
  31280. "nine",
  31281. "colon",
  31282. "semicolon",
  31283. "less",
  31284. "equal",
  31285. "greater",
  31286. "question",
  31287. "at",
  31288. "A",
  31289. "B",
  31290. "C",
  31291. "D",
  31292. "E",
  31293. "F",
  31294. "G",
  31295. "H",
  31296. "I",
  31297. "J",
  31298. "K",
  31299. "L",
  31300. "M",
  31301. "N",
  31302. "O",
  31303. "P",
  31304. "Q",
  31305. "R",
  31306. "S",
  31307. "T",
  31308. "U",
  31309. "V",
  31310. "W",
  31311. "X",
  31312. "Y",
  31313. "Z",
  31314. "bracketleft",
  31315. "backslash",
  31316. "bracketright",
  31317. "asciicircum",
  31318. "underscore",
  31319. "quoteleft",
  31320. "a",
  31321. "b",
  31322. "c",
  31323. "d",
  31324. "e",
  31325. "f",
  31326. "g",
  31327. "h",
  31328. "i",
  31329. "j",
  31330. "k",
  31331. "l",
  31332. "m",
  31333. "n",
  31334. "o",
  31335. "p",
  31336. "q",
  31337. "r",
  31338. "s",
  31339. "t",
  31340. "u",
  31341. "v",
  31342. "w",
  31343. "x",
  31344. "y",
  31345. "z",
  31346. "braceleft",
  31347. "bar",
  31348. "braceright",
  31349. "asciitilde",
  31350. "exclamdown",
  31351. "cent",
  31352. "sterling",
  31353. "fraction",
  31354. "yen",
  31355. "florin",
  31356. "section",
  31357. "currency",
  31358. "quotesingle",
  31359. "quotedblleft",
  31360. "guillemotleft",
  31361. "guilsinglleft",
  31362. "guilsinglright",
  31363. "fi",
  31364. "fl",
  31365. "endash",
  31366. "dagger",
  31367. "daggerdbl",
  31368. "periodcentered",
  31369. "paragraph",
  31370. "bullet",
  31371. "quotesinglbase",
  31372. "quotedblbase",
  31373. "quotedblright",
  31374. "guillemotright",
  31375. "ellipsis",
  31376. "perthousand",
  31377. "questiondown",
  31378. "grave",
  31379. "acute",
  31380. "circumflex",
  31381. "tilde",
  31382. "macron",
  31383. "breve",
  31384. "dotaccent",
  31385. "dieresis",
  31386. "ring",
  31387. "cedilla",
  31388. "hungarumlaut",
  31389. "ogonek",
  31390. "caron",
  31391. "emdash",
  31392. "AE",
  31393. "ordfeminine",
  31394. "Lslash",
  31395. "Oslash",
  31396. "OE",
  31397. "ordmasculine",
  31398. "ae",
  31399. "dotlessi",
  31400. "lslash",
  31401. "oslash",
  31402. "oe",
  31403. "germandbls",
  31404. "onesuperior",
  31405. "logicalnot",
  31406. "mu",
  31407. "trademark",
  31408. "Eth",
  31409. "onehalf",
  31410. "plusminus",
  31411. "Thorn",
  31412. "onequarter",
  31413. "divide",
  31414. "brokenbar",
  31415. "degree",
  31416. "thorn",
  31417. "threequarters",
  31418. "twosuperior",
  31419. "registered",
  31420. "minus",
  31421. "eth",
  31422. "multiply",
  31423. "threesuperior",
  31424. "copyright",
  31425. "Aacute",
  31426. "Acircumflex",
  31427. "Adieresis",
  31428. "Agrave",
  31429. "Aring",
  31430. "Atilde",
  31431. "Ccedilla",
  31432. "Eacute",
  31433. "Ecircumflex",
  31434. "Edieresis",
  31435. "Egrave",
  31436. "Iacute",
  31437. "Icircumflex",
  31438. "Idieresis",
  31439. "Igrave",
  31440. "Ntilde",
  31441. "Oacute",
  31442. "Ocircumflex",
  31443. "Odieresis",
  31444. "Ograve",
  31445. "Otilde",
  31446. "Scaron",
  31447. "Uacute",
  31448. "Ucircumflex",
  31449. "Udieresis",
  31450. "Ugrave",
  31451. "Yacute",
  31452. "Ydieresis",
  31453. "Zcaron",
  31454. "aacute",
  31455. "acircumflex",
  31456. "adieresis",
  31457. "agrave",
  31458. "aring",
  31459. "atilde",
  31460. "ccedilla",
  31461. "eacute",
  31462. "ecircumflex",
  31463. "edieresis",
  31464. "egrave",
  31465. "iacute",
  31466. "icircumflex",
  31467. "idieresis",
  31468. "igrave",
  31469. "ntilde",
  31470. "oacute",
  31471. "ocircumflex",
  31472. "odieresis",
  31473. "ograve",
  31474. "otilde",
  31475. "scaron",
  31476. "uacute",
  31477. "ucircumflex",
  31478. "udieresis",
  31479. "ugrave",
  31480. "yacute",
  31481. "ydieresis",
  31482. "zcaron",
  31483. ];
  31484. exports.ISOAdobeCharset = ISOAdobeCharset;
  31485. const ExpertCharset = [
  31486. ".notdef",
  31487. "space",
  31488. "exclamsmall",
  31489. "Hungarumlautsmall",
  31490. "dollaroldstyle",
  31491. "dollarsuperior",
  31492. "ampersandsmall",
  31493. "Acutesmall",
  31494. "parenleftsuperior",
  31495. "parenrightsuperior",
  31496. "twodotenleader",
  31497. "onedotenleader",
  31498. "comma",
  31499. "hyphen",
  31500. "period",
  31501. "fraction",
  31502. "zerooldstyle",
  31503. "oneoldstyle",
  31504. "twooldstyle",
  31505. "threeoldstyle",
  31506. "fouroldstyle",
  31507. "fiveoldstyle",
  31508. "sixoldstyle",
  31509. "sevenoldstyle",
  31510. "eightoldstyle",
  31511. "nineoldstyle",
  31512. "colon",
  31513. "semicolon",
  31514. "commasuperior",
  31515. "threequartersemdash",
  31516. "periodsuperior",
  31517. "questionsmall",
  31518. "asuperior",
  31519. "bsuperior",
  31520. "centsuperior",
  31521. "dsuperior",
  31522. "esuperior",
  31523. "isuperior",
  31524. "lsuperior",
  31525. "msuperior",
  31526. "nsuperior",
  31527. "osuperior",
  31528. "rsuperior",
  31529. "ssuperior",
  31530. "tsuperior",
  31531. "ff",
  31532. "fi",
  31533. "fl",
  31534. "ffi",
  31535. "ffl",
  31536. "parenleftinferior",
  31537. "parenrightinferior",
  31538. "Circumflexsmall",
  31539. "hyphensuperior",
  31540. "Gravesmall",
  31541. "Asmall",
  31542. "Bsmall",
  31543. "Csmall",
  31544. "Dsmall",
  31545. "Esmall",
  31546. "Fsmall",
  31547. "Gsmall",
  31548. "Hsmall",
  31549. "Ismall",
  31550. "Jsmall",
  31551. "Ksmall",
  31552. "Lsmall",
  31553. "Msmall",
  31554. "Nsmall",
  31555. "Osmall",
  31556. "Psmall",
  31557. "Qsmall",
  31558. "Rsmall",
  31559. "Ssmall",
  31560. "Tsmall",
  31561. "Usmall",
  31562. "Vsmall",
  31563. "Wsmall",
  31564. "Xsmall",
  31565. "Ysmall",
  31566. "Zsmall",
  31567. "colonmonetary",
  31568. "onefitted",
  31569. "rupiah",
  31570. "Tildesmall",
  31571. "exclamdownsmall",
  31572. "centoldstyle",
  31573. "Lslashsmall",
  31574. "Scaronsmall",
  31575. "Zcaronsmall",
  31576. "Dieresissmall",
  31577. "Brevesmall",
  31578. "Caronsmall",
  31579. "Dotaccentsmall",
  31580. "Macronsmall",
  31581. "figuredash",
  31582. "hypheninferior",
  31583. "Ogoneksmall",
  31584. "Ringsmall",
  31585. "Cedillasmall",
  31586. "onequarter",
  31587. "onehalf",
  31588. "threequarters",
  31589. "questiondownsmall",
  31590. "oneeighth",
  31591. "threeeighths",
  31592. "fiveeighths",
  31593. "seveneighths",
  31594. "onethird",
  31595. "twothirds",
  31596. "zerosuperior",
  31597. "onesuperior",
  31598. "twosuperior",
  31599. "threesuperior",
  31600. "foursuperior",
  31601. "fivesuperior",
  31602. "sixsuperior",
  31603. "sevensuperior",
  31604. "eightsuperior",
  31605. "ninesuperior",
  31606. "zeroinferior",
  31607. "oneinferior",
  31608. "twoinferior",
  31609. "threeinferior",
  31610. "fourinferior",
  31611. "fiveinferior",
  31612. "sixinferior",
  31613. "seveninferior",
  31614. "eightinferior",
  31615. "nineinferior",
  31616. "centinferior",
  31617. "dollarinferior",
  31618. "periodinferior",
  31619. "commainferior",
  31620. "Agravesmall",
  31621. "Aacutesmall",
  31622. "Acircumflexsmall",
  31623. "Atildesmall",
  31624. "Adieresissmall",
  31625. "Aringsmall",
  31626. "AEsmall",
  31627. "Ccedillasmall",
  31628. "Egravesmall",
  31629. "Eacutesmall",
  31630. "Ecircumflexsmall",
  31631. "Edieresissmall",
  31632. "Igravesmall",
  31633. "Iacutesmall",
  31634. "Icircumflexsmall",
  31635. "Idieresissmall",
  31636. "Ethsmall",
  31637. "Ntildesmall",
  31638. "Ogravesmall",
  31639. "Oacutesmall",
  31640. "Ocircumflexsmall",
  31641. "Otildesmall",
  31642. "Odieresissmall",
  31643. "OEsmall",
  31644. "Oslashsmall",
  31645. "Ugravesmall",
  31646. "Uacutesmall",
  31647. "Ucircumflexsmall",
  31648. "Udieresissmall",
  31649. "Yacutesmall",
  31650. "Thornsmall",
  31651. "Ydieresissmall",
  31652. ];
  31653. exports.ExpertCharset = ExpertCharset;
  31654. const ExpertSubsetCharset = [
  31655. ".notdef",
  31656. "space",
  31657. "dollaroldstyle",
  31658. "dollarsuperior",
  31659. "parenleftsuperior",
  31660. "parenrightsuperior",
  31661. "twodotenleader",
  31662. "onedotenleader",
  31663. "comma",
  31664. "hyphen",
  31665. "period",
  31666. "fraction",
  31667. "zerooldstyle",
  31668. "oneoldstyle",
  31669. "twooldstyle",
  31670. "threeoldstyle",
  31671. "fouroldstyle",
  31672. "fiveoldstyle",
  31673. "sixoldstyle",
  31674. "sevenoldstyle",
  31675. "eightoldstyle",
  31676. "nineoldstyle",
  31677. "colon",
  31678. "semicolon",
  31679. "commasuperior",
  31680. "threequartersemdash",
  31681. "periodsuperior",
  31682. "asuperior",
  31683. "bsuperior",
  31684. "centsuperior",
  31685. "dsuperior",
  31686. "esuperior",
  31687. "isuperior",
  31688. "lsuperior",
  31689. "msuperior",
  31690. "nsuperior",
  31691. "osuperior",
  31692. "rsuperior",
  31693. "ssuperior",
  31694. "tsuperior",
  31695. "ff",
  31696. "fi",
  31697. "fl",
  31698. "ffi",
  31699. "ffl",
  31700. "parenleftinferior",
  31701. "parenrightinferior",
  31702. "hyphensuperior",
  31703. "colonmonetary",
  31704. "onefitted",
  31705. "rupiah",
  31706. "centoldstyle",
  31707. "figuredash",
  31708. "hypheninferior",
  31709. "onequarter",
  31710. "onehalf",
  31711. "threequarters",
  31712. "oneeighth",
  31713. "threeeighths",
  31714. "fiveeighths",
  31715. "seveneighths",
  31716. "onethird",
  31717. "twothirds",
  31718. "zerosuperior",
  31719. "onesuperior",
  31720. "twosuperior",
  31721. "threesuperior",
  31722. "foursuperior",
  31723. "fivesuperior",
  31724. "sixsuperior",
  31725. "sevensuperior",
  31726. "eightsuperior",
  31727. "ninesuperior",
  31728. "zeroinferior",
  31729. "oneinferior",
  31730. "twoinferior",
  31731. "threeinferior",
  31732. "fourinferior",
  31733. "fiveinferior",
  31734. "sixinferior",
  31735. "seveninferior",
  31736. "eightinferior",
  31737. "nineinferior",
  31738. "centinferior",
  31739. "dollarinferior",
  31740. "periodinferior",
  31741. "commainferior",
  31742. ];
  31743. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  31744. /***/
  31745. },
  31746. /* 37 */
  31747. /***/ (__unused_webpack_module, exports) => {
  31748. Object.defineProperty(exports, "__esModule", {
  31749. value: true,
  31750. });
  31751. exports.ZapfDingbatsEncoding =
  31752. exports.WinAnsiEncoding =
  31753. exports.SymbolSetEncoding =
  31754. exports.StandardEncoding =
  31755. exports.MacRomanEncoding =
  31756. exports.ExpertEncoding =
  31757. void 0;
  31758. exports.getEncoding = getEncoding;
  31759. const ExpertEncoding = [
  31760. "",
  31761. "",
  31762. "",
  31763. "",
  31764. "",
  31765. "",
  31766. "",
  31767. "",
  31768. "",
  31769. "",
  31770. "",
  31771. "",
  31772. "",
  31773. "",
  31774. "",
  31775. "",
  31776. "",
  31777. "",
  31778. "",
  31779. "",
  31780. "",
  31781. "",
  31782. "",
  31783. "",
  31784. "",
  31785. "",
  31786. "",
  31787. "",
  31788. "",
  31789. "",
  31790. "",
  31791. "",
  31792. "space",
  31793. "exclamsmall",
  31794. "Hungarumlautsmall",
  31795. "",
  31796. "dollaroldstyle",
  31797. "dollarsuperior",
  31798. "ampersandsmall",
  31799. "Acutesmall",
  31800. "parenleftsuperior",
  31801. "parenrightsuperior",
  31802. "twodotenleader",
  31803. "onedotenleader",
  31804. "comma",
  31805. "hyphen",
  31806. "period",
  31807. "fraction",
  31808. "zerooldstyle",
  31809. "oneoldstyle",
  31810. "twooldstyle",
  31811. "threeoldstyle",
  31812. "fouroldstyle",
  31813. "fiveoldstyle",
  31814. "sixoldstyle",
  31815. "sevenoldstyle",
  31816. "eightoldstyle",
  31817. "nineoldstyle",
  31818. "colon",
  31819. "semicolon",
  31820. "commasuperior",
  31821. "threequartersemdash",
  31822. "periodsuperior",
  31823. "questionsmall",
  31824. "",
  31825. "asuperior",
  31826. "bsuperior",
  31827. "centsuperior",
  31828. "dsuperior",
  31829. "esuperior",
  31830. "",
  31831. "",
  31832. "",
  31833. "isuperior",
  31834. "",
  31835. "",
  31836. "lsuperior",
  31837. "msuperior",
  31838. "nsuperior",
  31839. "osuperior",
  31840. "",
  31841. "",
  31842. "rsuperior",
  31843. "ssuperior",
  31844. "tsuperior",
  31845. "",
  31846. "ff",
  31847. "fi",
  31848. "fl",
  31849. "ffi",
  31850. "ffl",
  31851. "parenleftinferior",
  31852. "",
  31853. "parenrightinferior",
  31854. "Circumflexsmall",
  31855. "hyphensuperior",
  31856. "Gravesmall",
  31857. "Asmall",
  31858. "Bsmall",
  31859. "Csmall",
  31860. "Dsmall",
  31861. "Esmall",
  31862. "Fsmall",
  31863. "Gsmall",
  31864. "Hsmall",
  31865. "Ismall",
  31866. "Jsmall",
  31867. "Ksmall",
  31868. "Lsmall",
  31869. "Msmall",
  31870. "Nsmall",
  31871. "Osmall",
  31872. "Psmall",
  31873. "Qsmall",
  31874. "Rsmall",
  31875. "Ssmall",
  31876. "Tsmall",
  31877. "Usmall",
  31878. "Vsmall",
  31879. "Wsmall",
  31880. "Xsmall",
  31881. "Ysmall",
  31882. "Zsmall",
  31883. "colonmonetary",
  31884. "onefitted",
  31885. "rupiah",
  31886. "Tildesmall",
  31887. "",
  31888. "",
  31889. "",
  31890. "",
  31891. "",
  31892. "",
  31893. "",
  31894. "",
  31895. "",
  31896. "",
  31897. "",
  31898. "",
  31899. "",
  31900. "",
  31901. "",
  31902. "",
  31903. "",
  31904. "",
  31905. "",
  31906. "",
  31907. "",
  31908. "",
  31909. "",
  31910. "",
  31911. "",
  31912. "",
  31913. "",
  31914. "",
  31915. "",
  31916. "",
  31917. "",
  31918. "",
  31919. "",
  31920. "",
  31921. "exclamdownsmall",
  31922. "centoldstyle",
  31923. "Lslashsmall",
  31924. "",
  31925. "",
  31926. "Scaronsmall",
  31927. "Zcaronsmall",
  31928. "Dieresissmall",
  31929. "Brevesmall",
  31930. "Caronsmall",
  31931. "",
  31932. "Dotaccentsmall",
  31933. "",
  31934. "",
  31935. "Macronsmall",
  31936. "",
  31937. "",
  31938. "figuredash",
  31939. "hypheninferior",
  31940. "",
  31941. "",
  31942. "Ogoneksmall",
  31943. "Ringsmall",
  31944. "Cedillasmall",
  31945. "",
  31946. "",
  31947. "",
  31948. "onequarter",
  31949. "onehalf",
  31950. "threequarters",
  31951. "questiondownsmall",
  31952. "oneeighth",
  31953. "threeeighths",
  31954. "fiveeighths",
  31955. "seveneighths",
  31956. "onethird",
  31957. "twothirds",
  31958. "",
  31959. "",
  31960. "zerosuperior",
  31961. "onesuperior",
  31962. "twosuperior",
  31963. "threesuperior",
  31964. "foursuperior",
  31965. "fivesuperior",
  31966. "sixsuperior",
  31967. "sevensuperior",
  31968. "eightsuperior",
  31969. "ninesuperior",
  31970. "zeroinferior",
  31971. "oneinferior",
  31972. "twoinferior",
  31973. "threeinferior",
  31974. "fourinferior",
  31975. "fiveinferior",
  31976. "sixinferior",
  31977. "seveninferior",
  31978. "eightinferior",
  31979. "nineinferior",
  31980. "centinferior",
  31981. "dollarinferior",
  31982. "periodinferior",
  31983. "commainferior",
  31984. "Agravesmall",
  31985. "Aacutesmall",
  31986. "Acircumflexsmall",
  31987. "Atildesmall",
  31988. "Adieresissmall",
  31989. "Aringsmall",
  31990. "AEsmall",
  31991. "Ccedillasmall",
  31992. "Egravesmall",
  31993. "Eacutesmall",
  31994. "Ecircumflexsmall",
  31995. "Edieresissmall",
  31996. "Igravesmall",
  31997. "Iacutesmall",
  31998. "Icircumflexsmall",
  31999. "Idieresissmall",
  32000. "Ethsmall",
  32001. "Ntildesmall",
  32002. "Ogravesmall",
  32003. "Oacutesmall",
  32004. "Ocircumflexsmall",
  32005. "Otildesmall",
  32006. "Odieresissmall",
  32007. "OEsmall",
  32008. "Oslashsmall",
  32009. "Ugravesmall",
  32010. "Uacutesmall",
  32011. "Ucircumflexsmall",
  32012. "Udieresissmall",
  32013. "Yacutesmall",
  32014. "Thornsmall",
  32015. "Ydieresissmall",
  32016. ];
  32017. exports.ExpertEncoding = ExpertEncoding;
  32018. const MacExpertEncoding = [
  32019. "",
  32020. "",
  32021. "",
  32022. "",
  32023. "",
  32024. "",
  32025. "",
  32026. "",
  32027. "",
  32028. "",
  32029. "",
  32030. "",
  32031. "",
  32032. "",
  32033. "",
  32034. "",
  32035. "",
  32036. "",
  32037. "",
  32038. "",
  32039. "",
  32040. "",
  32041. "",
  32042. "",
  32043. "",
  32044. "",
  32045. "",
  32046. "",
  32047. "",
  32048. "",
  32049. "",
  32050. "",
  32051. "space",
  32052. "exclamsmall",
  32053. "Hungarumlautsmall",
  32054. "centoldstyle",
  32055. "dollaroldstyle",
  32056. "dollarsuperior",
  32057. "ampersandsmall",
  32058. "Acutesmall",
  32059. "parenleftsuperior",
  32060. "parenrightsuperior",
  32061. "twodotenleader",
  32062. "onedotenleader",
  32063. "comma",
  32064. "hyphen",
  32065. "period",
  32066. "fraction",
  32067. "zerooldstyle",
  32068. "oneoldstyle",
  32069. "twooldstyle",
  32070. "threeoldstyle",
  32071. "fouroldstyle",
  32072. "fiveoldstyle",
  32073. "sixoldstyle",
  32074. "sevenoldstyle",
  32075. "eightoldstyle",
  32076. "nineoldstyle",
  32077. "colon",
  32078. "semicolon",
  32079. "",
  32080. "threequartersemdash",
  32081. "",
  32082. "questionsmall",
  32083. "",
  32084. "",
  32085. "",
  32086. "",
  32087. "Ethsmall",
  32088. "",
  32089. "",
  32090. "onequarter",
  32091. "onehalf",
  32092. "threequarters",
  32093. "oneeighth",
  32094. "threeeighths",
  32095. "fiveeighths",
  32096. "seveneighths",
  32097. "onethird",
  32098. "twothirds",
  32099. "",
  32100. "",
  32101. "",
  32102. "",
  32103. "",
  32104. "",
  32105. "ff",
  32106. "fi",
  32107. "fl",
  32108. "ffi",
  32109. "ffl",
  32110. "parenleftinferior",
  32111. "",
  32112. "parenrightinferior",
  32113. "Circumflexsmall",
  32114. "hypheninferior",
  32115. "Gravesmall",
  32116. "Asmall",
  32117. "Bsmall",
  32118. "Csmall",
  32119. "Dsmall",
  32120. "Esmall",
  32121. "Fsmall",
  32122. "Gsmall",
  32123. "Hsmall",
  32124. "Ismall",
  32125. "Jsmall",
  32126. "Ksmall",
  32127. "Lsmall",
  32128. "Msmall",
  32129. "Nsmall",
  32130. "Osmall",
  32131. "Psmall",
  32132. "Qsmall",
  32133. "Rsmall",
  32134. "Ssmall",
  32135. "Tsmall",
  32136. "Usmall",
  32137. "Vsmall",
  32138. "Wsmall",
  32139. "Xsmall",
  32140. "Ysmall",
  32141. "Zsmall",
  32142. "colonmonetary",
  32143. "onefitted",
  32144. "rupiah",
  32145. "Tildesmall",
  32146. "",
  32147. "",
  32148. "asuperior",
  32149. "centsuperior",
  32150. "",
  32151. "",
  32152. "",
  32153. "",
  32154. "Aacutesmall",
  32155. "Agravesmall",
  32156. "Acircumflexsmall",
  32157. "Adieresissmall",
  32158. "Atildesmall",
  32159. "Aringsmall",
  32160. "Ccedillasmall",
  32161. "Eacutesmall",
  32162. "Egravesmall",
  32163. "Ecircumflexsmall",
  32164. "Edieresissmall",
  32165. "Iacutesmall",
  32166. "Igravesmall",
  32167. "Icircumflexsmall",
  32168. "Idieresissmall",
  32169. "Ntildesmall",
  32170. "Oacutesmall",
  32171. "Ogravesmall",
  32172. "Ocircumflexsmall",
  32173. "Odieresissmall",
  32174. "Otildesmall",
  32175. "Uacutesmall",
  32176. "Ugravesmall",
  32177. "Ucircumflexsmall",
  32178. "Udieresissmall",
  32179. "",
  32180. "eightsuperior",
  32181. "fourinferior",
  32182. "threeinferior",
  32183. "sixinferior",
  32184. "eightinferior",
  32185. "seveninferior",
  32186. "Scaronsmall",
  32187. "",
  32188. "centinferior",
  32189. "twoinferior",
  32190. "",
  32191. "Dieresissmall",
  32192. "",
  32193. "Caronsmall",
  32194. "osuperior",
  32195. "fiveinferior",
  32196. "",
  32197. "commainferior",
  32198. "periodinferior",
  32199. "Yacutesmall",
  32200. "",
  32201. "dollarinferior",
  32202. "",
  32203. "",
  32204. "Thornsmall",
  32205. "",
  32206. "nineinferior",
  32207. "zeroinferior",
  32208. "Zcaronsmall",
  32209. "AEsmall",
  32210. "Oslashsmall",
  32211. "questiondownsmall",
  32212. "oneinferior",
  32213. "Lslashsmall",
  32214. "",
  32215. "",
  32216. "",
  32217. "",
  32218. "",
  32219. "",
  32220. "Cedillasmall",
  32221. "",
  32222. "",
  32223. "",
  32224. "",
  32225. "",
  32226. "OEsmall",
  32227. "figuredash",
  32228. "hyphensuperior",
  32229. "",
  32230. "",
  32231. "",
  32232. "",
  32233. "exclamdownsmall",
  32234. "",
  32235. "Ydieresissmall",
  32236. "",
  32237. "onesuperior",
  32238. "twosuperior",
  32239. "threesuperior",
  32240. "foursuperior",
  32241. "fivesuperior",
  32242. "sixsuperior",
  32243. "sevensuperior",
  32244. "ninesuperior",
  32245. "zerosuperior",
  32246. "",
  32247. "esuperior",
  32248. "rsuperior",
  32249. "tsuperior",
  32250. "",
  32251. "",
  32252. "isuperior",
  32253. "ssuperior",
  32254. "dsuperior",
  32255. "",
  32256. "",
  32257. "",
  32258. "",
  32259. "",
  32260. "lsuperior",
  32261. "Ogoneksmall",
  32262. "Brevesmall",
  32263. "Macronsmall",
  32264. "bsuperior",
  32265. "nsuperior",
  32266. "msuperior",
  32267. "commasuperior",
  32268. "periodsuperior",
  32269. "Dotaccentsmall",
  32270. "Ringsmall",
  32271. "",
  32272. "",
  32273. "",
  32274. "",
  32275. ];
  32276. const MacRomanEncoding = [
  32277. "",
  32278. "",
  32279. "",
  32280. "",
  32281. "",
  32282. "",
  32283. "",
  32284. "",
  32285. "",
  32286. "",
  32287. "",
  32288. "",
  32289. "",
  32290. "",
  32291. "",
  32292. "",
  32293. "",
  32294. "",
  32295. "",
  32296. "",
  32297. "",
  32298. "",
  32299. "",
  32300. "",
  32301. "",
  32302. "",
  32303. "",
  32304. "",
  32305. "",
  32306. "",
  32307. "",
  32308. "",
  32309. "space",
  32310. "exclam",
  32311. "quotedbl",
  32312. "numbersign",
  32313. "dollar",
  32314. "percent",
  32315. "ampersand",
  32316. "quotesingle",
  32317. "parenleft",
  32318. "parenright",
  32319. "asterisk",
  32320. "plus",
  32321. "comma",
  32322. "hyphen",
  32323. "period",
  32324. "slash",
  32325. "zero",
  32326. "one",
  32327. "two",
  32328. "three",
  32329. "four",
  32330. "five",
  32331. "six",
  32332. "seven",
  32333. "eight",
  32334. "nine",
  32335. "colon",
  32336. "semicolon",
  32337. "less",
  32338. "equal",
  32339. "greater",
  32340. "question",
  32341. "at",
  32342. "A",
  32343. "B",
  32344. "C",
  32345. "D",
  32346. "E",
  32347. "F",
  32348. "G",
  32349. "H",
  32350. "I",
  32351. "J",
  32352. "K",
  32353. "L",
  32354. "M",
  32355. "N",
  32356. "O",
  32357. "P",
  32358. "Q",
  32359. "R",
  32360. "S",
  32361. "T",
  32362. "U",
  32363. "V",
  32364. "W",
  32365. "X",
  32366. "Y",
  32367. "Z",
  32368. "bracketleft",
  32369. "backslash",
  32370. "bracketright",
  32371. "asciicircum",
  32372. "underscore",
  32373. "grave",
  32374. "a",
  32375. "b",
  32376. "c",
  32377. "d",
  32378. "e",
  32379. "f",
  32380. "g",
  32381. "h",
  32382. "i",
  32383. "j",
  32384. "k",
  32385. "l",
  32386. "m",
  32387. "n",
  32388. "o",
  32389. "p",
  32390. "q",
  32391. "r",
  32392. "s",
  32393. "t",
  32394. "u",
  32395. "v",
  32396. "w",
  32397. "x",
  32398. "y",
  32399. "z",
  32400. "braceleft",
  32401. "bar",
  32402. "braceright",
  32403. "asciitilde",
  32404. "",
  32405. "Adieresis",
  32406. "Aring",
  32407. "Ccedilla",
  32408. "Eacute",
  32409. "Ntilde",
  32410. "Odieresis",
  32411. "Udieresis",
  32412. "aacute",
  32413. "agrave",
  32414. "acircumflex",
  32415. "adieresis",
  32416. "atilde",
  32417. "aring",
  32418. "ccedilla",
  32419. "eacute",
  32420. "egrave",
  32421. "ecircumflex",
  32422. "edieresis",
  32423. "iacute",
  32424. "igrave",
  32425. "icircumflex",
  32426. "idieresis",
  32427. "ntilde",
  32428. "oacute",
  32429. "ograve",
  32430. "ocircumflex",
  32431. "odieresis",
  32432. "otilde",
  32433. "uacute",
  32434. "ugrave",
  32435. "ucircumflex",
  32436. "udieresis",
  32437. "dagger",
  32438. "degree",
  32439. "cent",
  32440. "sterling",
  32441. "section",
  32442. "bullet",
  32443. "paragraph",
  32444. "germandbls",
  32445. "registered",
  32446. "copyright",
  32447. "trademark",
  32448. "acute",
  32449. "dieresis",
  32450. "notequal",
  32451. "AE",
  32452. "Oslash",
  32453. "infinity",
  32454. "plusminus",
  32455. "lessequal",
  32456. "greaterequal",
  32457. "yen",
  32458. "mu",
  32459. "partialdiff",
  32460. "summation",
  32461. "product",
  32462. "pi",
  32463. "integral",
  32464. "ordfeminine",
  32465. "ordmasculine",
  32466. "Omega",
  32467. "ae",
  32468. "oslash",
  32469. "questiondown",
  32470. "exclamdown",
  32471. "logicalnot",
  32472. "radical",
  32473. "florin",
  32474. "approxequal",
  32475. "Delta",
  32476. "guillemotleft",
  32477. "guillemotright",
  32478. "ellipsis",
  32479. "space",
  32480. "Agrave",
  32481. "Atilde",
  32482. "Otilde",
  32483. "OE",
  32484. "oe",
  32485. "endash",
  32486. "emdash",
  32487. "quotedblleft",
  32488. "quotedblright",
  32489. "quoteleft",
  32490. "quoteright",
  32491. "divide",
  32492. "lozenge",
  32493. "ydieresis",
  32494. "Ydieresis",
  32495. "fraction",
  32496. "currency",
  32497. "guilsinglleft",
  32498. "guilsinglright",
  32499. "fi",
  32500. "fl",
  32501. "daggerdbl",
  32502. "periodcentered",
  32503. "quotesinglbase",
  32504. "quotedblbase",
  32505. "perthousand",
  32506. "Acircumflex",
  32507. "Ecircumflex",
  32508. "Aacute",
  32509. "Edieresis",
  32510. "Egrave",
  32511. "Iacute",
  32512. "Icircumflex",
  32513. "Idieresis",
  32514. "Igrave",
  32515. "Oacute",
  32516. "Ocircumflex",
  32517. "apple",
  32518. "Ograve",
  32519. "Uacute",
  32520. "Ucircumflex",
  32521. "Ugrave",
  32522. "dotlessi",
  32523. "circumflex",
  32524. "tilde",
  32525. "macron",
  32526. "breve",
  32527. "dotaccent",
  32528. "ring",
  32529. "cedilla",
  32530. "hungarumlaut",
  32531. "ogonek",
  32532. "caron",
  32533. ];
  32534. exports.MacRomanEncoding = MacRomanEncoding;
  32535. const StandardEncoding = [
  32536. "",
  32537. "",
  32538. "",
  32539. "",
  32540. "",
  32541. "",
  32542. "",
  32543. "",
  32544. "",
  32545. "",
  32546. "",
  32547. "",
  32548. "",
  32549. "",
  32550. "",
  32551. "",
  32552. "",
  32553. "",
  32554. "",
  32555. "",
  32556. "",
  32557. "",
  32558. "",
  32559. "",
  32560. "",
  32561. "",
  32562. "",
  32563. "",
  32564. "",
  32565. "",
  32566. "",
  32567. "",
  32568. "space",
  32569. "exclam",
  32570. "quotedbl",
  32571. "numbersign",
  32572. "dollar",
  32573. "percent",
  32574. "ampersand",
  32575. "quoteright",
  32576. "parenleft",
  32577. "parenright",
  32578. "asterisk",
  32579. "plus",
  32580. "comma",
  32581. "hyphen",
  32582. "period",
  32583. "slash",
  32584. "zero",
  32585. "one",
  32586. "two",
  32587. "three",
  32588. "four",
  32589. "five",
  32590. "six",
  32591. "seven",
  32592. "eight",
  32593. "nine",
  32594. "colon",
  32595. "semicolon",
  32596. "less",
  32597. "equal",
  32598. "greater",
  32599. "question",
  32600. "at",
  32601. "A",
  32602. "B",
  32603. "C",
  32604. "D",
  32605. "E",
  32606. "F",
  32607. "G",
  32608. "H",
  32609. "I",
  32610. "J",
  32611. "K",
  32612. "L",
  32613. "M",
  32614. "N",
  32615. "O",
  32616. "P",
  32617. "Q",
  32618. "R",
  32619. "S",
  32620. "T",
  32621. "U",
  32622. "V",
  32623. "W",
  32624. "X",
  32625. "Y",
  32626. "Z",
  32627. "bracketleft",
  32628. "backslash",
  32629. "bracketright",
  32630. "asciicircum",
  32631. "underscore",
  32632. "quoteleft",
  32633. "a",
  32634. "b",
  32635. "c",
  32636. "d",
  32637. "e",
  32638. "f",
  32639. "g",
  32640. "h",
  32641. "i",
  32642. "j",
  32643. "k",
  32644. "l",
  32645. "m",
  32646. "n",
  32647. "o",
  32648. "p",
  32649. "q",
  32650. "r",
  32651. "s",
  32652. "t",
  32653. "u",
  32654. "v",
  32655. "w",
  32656. "x",
  32657. "y",
  32658. "z",
  32659. "braceleft",
  32660. "bar",
  32661. "braceright",
  32662. "asciitilde",
  32663. "",
  32664. "",
  32665. "",
  32666. "",
  32667. "",
  32668. "",
  32669. "",
  32670. "",
  32671. "",
  32672. "",
  32673. "",
  32674. "",
  32675. "",
  32676. "",
  32677. "",
  32678. "",
  32679. "",
  32680. "",
  32681. "",
  32682. "",
  32683. "",
  32684. "",
  32685. "",
  32686. "",
  32687. "",
  32688. "",
  32689. "",
  32690. "",
  32691. "",
  32692. "",
  32693. "",
  32694. "",
  32695. "",
  32696. "",
  32697. "exclamdown",
  32698. "cent",
  32699. "sterling",
  32700. "fraction",
  32701. "yen",
  32702. "florin",
  32703. "section",
  32704. "currency",
  32705. "quotesingle",
  32706. "quotedblleft",
  32707. "guillemotleft",
  32708. "guilsinglleft",
  32709. "guilsinglright",
  32710. "fi",
  32711. "fl",
  32712. "",
  32713. "endash",
  32714. "dagger",
  32715. "daggerdbl",
  32716. "periodcentered",
  32717. "",
  32718. "paragraph",
  32719. "bullet",
  32720. "quotesinglbase",
  32721. "quotedblbase",
  32722. "quotedblright",
  32723. "guillemotright",
  32724. "ellipsis",
  32725. "perthousand",
  32726. "",
  32727. "questiondown",
  32728. "",
  32729. "grave",
  32730. "acute",
  32731. "circumflex",
  32732. "tilde",
  32733. "macron",
  32734. "breve",
  32735. "dotaccent",
  32736. "dieresis",
  32737. "",
  32738. "ring",
  32739. "cedilla",
  32740. "",
  32741. "hungarumlaut",
  32742. "ogonek",
  32743. "caron",
  32744. "emdash",
  32745. "",
  32746. "",
  32747. "",
  32748. "",
  32749. "",
  32750. "",
  32751. "",
  32752. "",
  32753. "",
  32754. "",
  32755. "",
  32756. "",
  32757. "",
  32758. "",
  32759. "",
  32760. "",
  32761. "AE",
  32762. "",
  32763. "ordfeminine",
  32764. "",
  32765. "",
  32766. "",
  32767. "",
  32768. "Lslash",
  32769. "Oslash",
  32770. "OE",
  32771. "ordmasculine",
  32772. "",
  32773. "",
  32774. "",
  32775. "",
  32776. "",
  32777. "ae",
  32778. "",
  32779. "",
  32780. "",
  32781. "dotlessi",
  32782. "",
  32783. "",
  32784. "lslash",
  32785. "oslash",
  32786. "oe",
  32787. "germandbls",
  32788. "",
  32789. "",
  32790. "",
  32791. "",
  32792. ];
  32793. exports.StandardEncoding = StandardEncoding;
  32794. const WinAnsiEncoding = [
  32795. "",
  32796. "",
  32797. "",
  32798. "",
  32799. "",
  32800. "",
  32801. "",
  32802. "",
  32803. "",
  32804. "",
  32805. "",
  32806. "",
  32807. "",
  32808. "",
  32809. "",
  32810. "",
  32811. "",
  32812. "",
  32813. "",
  32814. "",
  32815. "",
  32816. "",
  32817. "",
  32818. "",
  32819. "",
  32820. "",
  32821. "",
  32822. "",
  32823. "",
  32824. "",
  32825. "",
  32826. "",
  32827. "space",
  32828. "exclam",
  32829. "quotedbl",
  32830. "numbersign",
  32831. "dollar",
  32832. "percent",
  32833. "ampersand",
  32834. "quotesingle",
  32835. "parenleft",
  32836. "parenright",
  32837. "asterisk",
  32838. "plus",
  32839. "comma",
  32840. "hyphen",
  32841. "period",
  32842. "slash",
  32843. "zero",
  32844. "one",
  32845. "two",
  32846. "three",
  32847. "four",
  32848. "five",
  32849. "six",
  32850. "seven",
  32851. "eight",
  32852. "nine",
  32853. "colon",
  32854. "semicolon",
  32855. "less",
  32856. "equal",
  32857. "greater",
  32858. "question",
  32859. "at",
  32860. "A",
  32861. "B",
  32862. "C",
  32863. "D",
  32864. "E",
  32865. "F",
  32866. "G",
  32867. "H",
  32868. "I",
  32869. "J",
  32870. "K",
  32871. "L",
  32872. "M",
  32873. "N",
  32874. "O",
  32875. "P",
  32876. "Q",
  32877. "R",
  32878. "S",
  32879. "T",
  32880. "U",
  32881. "V",
  32882. "W",
  32883. "X",
  32884. "Y",
  32885. "Z",
  32886. "bracketleft",
  32887. "backslash",
  32888. "bracketright",
  32889. "asciicircum",
  32890. "underscore",
  32891. "grave",
  32892. "a",
  32893. "b",
  32894. "c",
  32895. "d",
  32896. "e",
  32897. "f",
  32898. "g",
  32899. "h",
  32900. "i",
  32901. "j",
  32902. "k",
  32903. "l",
  32904. "m",
  32905. "n",
  32906. "o",
  32907. "p",
  32908. "q",
  32909. "r",
  32910. "s",
  32911. "t",
  32912. "u",
  32913. "v",
  32914. "w",
  32915. "x",
  32916. "y",
  32917. "z",
  32918. "braceleft",
  32919. "bar",
  32920. "braceright",
  32921. "asciitilde",
  32922. "bullet",
  32923. "Euro",
  32924. "bullet",
  32925. "quotesinglbase",
  32926. "florin",
  32927. "quotedblbase",
  32928. "ellipsis",
  32929. "dagger",
  32930. "daggerdbl",
  32931. "circumflex",
  32932. "perthousand",
  32933. "Scaron",
  32934. "guilsinglleft",
  32935. "OE",
  32936. "bullet",
  32937. "Zcaron",
  32938. "bullet",
  32939. "bullet",
  32940. "quoteleft",
  32941. "quoteright",
  32942. "quotedblleft",
  32943. "quotedblright",
  32944. "bullet",
  32945. "endash",
  32946. "emdash",
  32947. "tilde",
  32948. "trademark",
  32949. "scaron",
  32950. "guilsinglright",
  32951. "oe",
  32952. "bullet",
  32953. "zcaron",
  32954. "Ydieresis",
  32955. "space",
  32956. "exclamdown",
  32957. "cent",
  32958. "sterling",
  32959. "currency",
  32960. "yen",
  32961. "brokenbar",
  32962. "section",
  32963. "dieresis",
  32964. "copyright",
  32965. "ordfeminine",
  32966. "guillemotleft",
  32967. "logicalnot",
  32968. "hyphen",
  32969. "registered",
  32970. "macron",
  32971. "degree",
  32972. "plusminus",
  32973. "twosuperior",
  32974. "threesuperior",
  32975. "acute",
  32976. "mu",
  32977. "paragraph",
  32978. "periodcentered",
  32979. "cedilla",
  32980. "onesuperior",
  32981. "ordmasculine",
  32982. "guillemotright",
  32983. "onequarter",
  32984. "onehalf",
  32985. "threequarters",
  32986. "questiondown",
  32987. "Agrave",
  32988. "Aacute",
  32989. "Acircumflex",
  32990. "Atilde",
  32991. "Adieresis",
  32992. "Aring",
  32993. "AE",
  32994. "Ccedilla",
  32995. "Egrave",
  32996. "Eacute",
  32997. "Ecircumflex",
  32998. "Edieresis",
  32999. "Igrave",
  33000. "Iacute",
  33001. "Icircumflex",
  33002. "Idieresis",
  33003. "Eth",
  33004. "Ntilde",
  33005. "Ograve",
  33006. "Oacute",
  33007. "Ocircumflex",
  33008. "Otilde",
  33009. "Odieresis",
  33010. "multiply",
  33011. "Oslash",
  33012. "Ugrave",
  33013. "Uacute",
  33014. "Ucircumflex",
  33015. "Udieresis",
  33016. "Yacute",
  33017. "Thorn",
  33018. "germandbls",
  33019. "agrave",
  33020. "aacute",
  33021. "acircumflex",
  33022. "atilde",
  33023. "adieresis",
  33024. "aring",
  33025. "ae",
  33026. "ccedilla",
  33027. "egrave",
  33028. "eacute",
  33029. "ecircumflex",
  33030. "edieresis",
  33031. "igrave",
  33032. "iacute",
  33033. "icircumflex",
  33034. "idieresis",
  33035. "eth",
  33036. "ntilde",
  33037. "ograve",
  33038. "oacute",
  33039. "ocircumflex",
  33040. "otilde",
  33041. "odieresis",
  33042. "divide",
  33043. "oslash",
  33044. "ugrave",
  33045. "uacute",
  33046. "ucircumflex",
  33047. "udieresis",
  33048. "yacute",
  33049. "thorn",
  33050. "ydieresis",
  33051. ];
  33052. exports.WinAnsiEncoding = WinAnsiEncoding;
  33053. const SymbolSetEncoding = [
  33054. "",
  33055. "",
  33056. "",
  33057. "",
  33058. "",
  33059. "",
  33060. "",
  33061. "",
  33062. "",
  33063. "",
  33064. "",
  33065. "",
  33066. "",
  33067. "",
  33068. "",
  33069. "",
  33070. "",
  33071. "",
  33072. "",
  33073. "",
  33074. "",
  33075. "",
  33076. "",
  33077. "",
  33078. "",
  33079. "",
  33080. "",
  33081. "",
  33082. "",
  33083. "",
  33084. "",
  33085. "",
  33086. "space",
  33087. "exclam",
  33088. "universal",
  33089. "numbersign",
  33090. "existential",
  33091. "percent",
  33092. "ampersand",
  33093. "suchthat",
  33094. "parenleft",
  33095. "parenright",
  33096. "asteriskmath",
  33097. "plus",
  33098. "comma",
  33099. "minus",
  33100. "period",
  33101. "slash",
  33102. "zero",
  33103. "one",
  33104. "two",
  33105. "three",
  33106. "four",
  33107. "five",
  33108. "six",
  33109. "seven",
  33110. "eight",
  33111. "nine",
  33112. "colon",
  33113. "semicolon",
  33114. "less",
  33115. "equal",
  33116. "greater",
  33117. "question",
  33118. "congruent",
  33119. "Alpha",
  33120. "Beta",
  33121. "Chi",
  33122. "Delta",
  33123. "Epsilon",
  33124. "Phi",
  33125. "Gamma",
  33126. "Eta",
  33127. "Iota",
  33128. "theta1",
  33129. "Kappa",
  33130. "Lambda",
  33131. "Mu",
  33132. "Nu",
  33133. "Omicron",
  33134. "Pi",
  33135. "Theta",
  33136. "Rho",
  33137. "Sigma",
  33138. "Tau",
  33139. "Upsilon",
  33140. "sigma1",
  33141. "Omega",
  33142. "Xi",
  33143. "Psi",
  33144. "Zeta",
  33145. "bracketleft",
  33146. "therefore",
  33147. "bracketright",
  33148. "perpendicular",
  33149. "underscore",
  33150. "radicalex",
  33151. "alpha",
  33152. "beta",
  33153. "chi",
  33154. "delta",
  33155. "epsilon",
  33156. "phi",
  33157. "gamma",
  33158. "eta",
  33159. "iota",
  33160. "phi1",
  33161. "kappa",
  33162. "lambda",
  33163. "mu",
  33164. "nu",
  33165. "omicron",
  33166. "pi",
  33167. "theta",
  33168. "rho",
  33169. "sigma",
  33170. "tau",
  33171. "upsilon",
  33172. "omega1",
  33173. "omega",
  33174. "xi",
  33175. "psi",
  33176. "zeta",
  33177. "braceleft",
  33178. "bar",
  33179. "braceright",
  33180. "similar",
  33181. "",
  33182. "",
  33183. "",
  33184. "",
  33185. "",
  33186. "",
  33187. "",
  33188. "",
  33189. "",
  33190. "",
  33191. "",
  33192. "",
  33193. "",
  33194. "",
  33195. "",
  33196. "",
  33197. "",
  33198. "",
  33199. "",
  33200. "",
  33201. "",
  33202. "",
  33203. "",
  33204. "",
  33205. "",
  33206. "",
  33207. "",
  33208. "",
  33209. "",
  33210. "",
  33211. "",
  33212. "",
  33213. "",
  33214. "Euro",
  33215. "Upsilon1",
  33216. "minute",
  33217. "lessequal",
  33218. "fraction",
  33219. "infinity",
  33220. "florin",
  33221. "club",
  33222. "diamond",
  33223. "heart",
  33224. "spade",
  33225. "arrowboth",
  33226. "arrowleft",
  33227. "arrowup",
  33228. "arrowright",
  33229. "arrowdown",
  33230. "degree",
  33231. "plusminus",
  33232. "second",
  33233. "greaterequal",
  33234. "multiply",
  33235. "proportional",
  33236. "partialdiff",
  33237. "bullet",
  33238. "divide",
  33239. "notequal",
  33240. "equivalence",
  33241. "approxequal",
  33242. "ellipsis",
  33243. "arrowvertex",
  33244. "arrowhorizex",
  33245. "carriagereturn",
  33246. "aleph",
  33247. "Ifraktur",
  33248. "Rfraktur",
  33249. "weierstrass",
  33250. "circlemultiply",
  33251. "circleplus",
  33252. "emptyset",
  33253. "intersection",
  33254. "union",
  33255. "propersuperset",
  33256. "reflexsuperset",
  33257. "notsubset",
  33258. "propersubset",
  33259. "reflexsubset",
  33260. "element",
  33261. "notelement",
  33262. "angle",
  33263. "gradient",
  33264. "registerserif",
  33265. "copyrightserif",
  33266. "trademarkserif",
  33267. "product",
  33268. "radical",
  33269. "dotmath",
  33270. "logicalnot",
  33271. "logicaland",
  33272. "logicalor",
  33273. "arrowdblboth",
  33274. "arrowdblleft",
  33275. "arrowdblup",
  33276. "arrowdblright",
  33277. "arrowdbldown",
  33278. "lozenge",
  33279. "angleleft",
  33280. "registersans",
  33281. "copyrightsans",
  33282. "trademarksans",
  33283. "summation",
  33284. "parenlefttp",
  33285. "parenleftex",
  33286. "parenleftbt",
  33287. "bracketlefttp",
  33288. "bracketleftex",
  33289. "bracketleftbt",
  33290. "bracelefttp",
  33291. "braceleftmid",
  33292. "braceleftbt",
  33293. "braceex",
  33294. "",
  33295. "angleright",
  33296. "integral",
  33297. "integraltp",
  33298. "integralex",
  33299. "integralbt",
  33300. "parenrighttp",
  33301. "parenrightex",
  33302. "parenrightbt",
  33303. "bracketrighttp",
  33304. "bracketrightex",
  33305. "bracketrightbt",
  33306. "bracerighttp",
  33307. "bracerightmid",
  33308. "bracerightbt",
  33309. "",
  33310. ];
  33311. exports.SymbolSetEncoding = SymbolSetEncoding;
  33312. const ZapfDingbatsEncoding = [
  33313. "",
  33314. "",
  33315. "",
  33316. "",
  33317. "",
  33318. "",
  33319. "",
  33320. "",
  33321. "",
  33322. "",
  33323. "",
  33324. "",
  33325. "",
  33326. "",
  33327. "",
  33328. "",
  33329. "",
  33330. "",
  33331. "",
  33332. "",
  33333. "",
  33334. "",
  33335. "",
  33336. "",
  33337. "",
  33338. "",
  33339. "",
  33340. "",
  33341. "",
  33342. "",
  33343. "",
  33344. "",
  33345. "space",
  33346. "a1",
  33347. "a2",
  33348. "a202",
  33349. "a3",
  33350. "a4",
  33351. "a5",
  33352. "a119",
  33353. "a118",
  33354. "a117",
  33355. "a11",
  33356. "a12",
  33357. "a13",
  33358. "a14",
  33359. "a15",
  33360. "a16",
  33361. "a105",
  33362. "a17",
  33363. "a18",
  33364. "a19",
  33365. "a20",
  33366. "a21",
  33367. "a22",
  33368. "a23",
  33369. "a24",
  33370. "a25",
  33371. "a26",
  33372. "a27",
  33373. "a28",
  33374. "a6",
  33375. "a7",
  33376. "a8",
  33377. "a9",
  33378. "a10",
  33379. "a29",
  33380. "a30",
  33381. "a31",
  33382. "a32",
  33383. "a33",
  33384. "a34",
  33385. "a35",
  33386. "a36",
  33387. "a37",
  33388. "a38",
  33389. "a39",
  33390. "a40",
  33391. "a41",
  33392. "a42",
  33393. "a43",
  33394. "a44",
  33395. "a45",
  33396. "a46",
  33397. "a47",
  33398. "a48",
  33399. "a49",
  33400. "a50",
  33401. "a51",
  33402. "a52",
  33403. "a53",
  33404. "a54",
  33405. "a55",
  33406. "a56",
  33407. "a57",
  33408. "a58",
  33409. "a59",
  33410. "a60",
  33411. "a61",
  33412. "a62",
  33413. "a63",
  33414. "a64",
  33415. "a65",
  33416. "a66",
  33417. "a67",
  33418. "a68",
  33419. "a69",
  33420. "a70",
  33421. "a71",
  33422. "a72",
  33423. "a73",
  33424. "a74",
  33425. "a203",
  33426. "a75",
  33427. "a204",
  33428. "a76",
  33429. "a77",
  33430. "a78",
  33431. "a79",
  33432. "a81",
  33433. "a82",
  33434. "a83",
  33435. "a84",
  33436. "a97",
  33437. "a98",
  33438. "a99",
  33439. "a100",
  33440. "",
  33441. "a89",
  33442. "a90",
  33443. "a93",
  33444. "a94",
  33445. "a91",
  33446. "a92",
  33447. "a205",
  33448. "a85",
  33449. "a206",
  33450. "a86",
  33451. "a87",
  33452. "a88",
  33453. "a95",
  33454. "a96",
  33455. "",
  33456. "",
  33457. "",
  33458. "",
  33459. "",
  33460. "",
  33461. "",
  33462. "",
  33463. "",
  33464. "",
  33465. "",
  33466. "",
  33467. "",
  33468. "",
  33469. "",
  33470. "",
  33471. "",
  33472. "",
  33473. "",
  33474. "a101",
  33475. "a102",
  33476. "a103",
  33477. "a104",
  33478. "a106",
  33479. "a107",
  33480. "a108",
  33481. "a112",
  33482. "a111",
  33483. "a110",
  33484. "a109",
  33485. "a120",
  33486. "a121",
  33487. "a122",
  33488. "a123",
  33489. "a124",
  33490. "a125",
  33491. "a126",
  33492. "a127",
  33493. "a128",
  33494. "a129",
  33495. "a130",
  33496. "a131",
  33497. "a132",
  33498. "a133",
  33499. "a134",
  33500. "a135",
  33501. "a136",
  33502. "a137",
  33503. "a138",
  33504. "a139",
  33505. "a140",
  33506. "a141",
  33507. "a142",
  33508. "a143",
  33509. "a144",
  33510. "a145",
  33511. "a146",
  33512. "a147",
  33513. "a148",
  33514. "a149",
  33515. "a150",
  33516. "a151",
  33517. "a152",
  33518. "a153",
  33519. "a154",
  33520. "a155",
  33521. "a156",
  33522. "a157",
  33523. "a158",
  33524. "a159",
  33525. "a160",
  33526. "a161",
  33527. "a163",
  33528. "a164",
  33529. "a196",
  33530. "a165",
  33531. "a192",
  33532. "a166",
  33533. "a167",
  33534. "a168",
  33535. "a169",
  33536. "a170",
  33537. "a171",
  33538. "a172",
  33539. "a173",
  33540. "a162",
  33541. "a174",
  33542. "a175",
  33543. "a176",
  33544. "a177",
  33545. "a178",
  33546. "a179",
  33547. "a193",
  33548. "a180",
  33549. "a199",
  33550. "a181",
  33551. "a200",
  33552. "a182",
  33553. "",
  33554. "a201",
  33555. "a183",
  33556. "a184",
  33557. "a197",
  33558. "a185",
  33559. "a194",
  33560. "a198",
  33561. "a186",
  33562. "a195",
  33563. "a187",
  33564. "a188",
  33565. "a189",
  33566. "a190",
  33567. "a191",
  33568. "",
  33569. ];
  33570. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  33571. function getEncoding(encodingName) {
  33572. switch (encodingName) {
  33573. case "WinAnsiEncoding":
  33574. return WinAnsiEncoding;
  33575. case "StandardEncoding":
  33576. return StandardEncoding;
  33577. case "MacRomanEncoding":
  33578. return MacRomanEncoding;
  33579. case "SymbolSetEncoding":
  33580. return SymbolSetEncoding;
  33581. case "ZapfDingbatsEncoding":
  33582. return ZapfDingbatsEncoding;
  33583. case "ExpertEncoding":
  33584. return ExpertEncoding;
  33585. case "MacExpertEncoding":
  33586. return MacExpertEncoding;
  33587. default:
  33588. return null;
  33589. }
  33590. }
  33591. /***/
  33592. },
  33593. /* 38 */
  33594. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  33595. Object.defineProperty(exports, "__esModule", {
  33596. value: true,
  33597. });
  33598. exports.SEAC_ANALYSIS_ENABLED =
  33599. exports.MacStandardGlyphOrdering =
  33600. exports.FontFlags =
  33601. void 0;
  33602. exports.getFontType = getFontType;
  33603. exports.normalizeFontName = normalizeFontName;
  33604. exports.recoverGlyphName = recoverGlyphName;
  33605. exports.type1FontGlyphMapping = type1FontGlyphMapping;
  33606. var _util = __w_pdfjs_require__(2);
  33607. var _encodings = __w_pdfjs_require__(37);
  33608. var _glyphlist = __w_pdfjs_require__(39);
  33609. var _unicode = __w_pdfjs_require__(40);
  33610. const SEAC_ANALYSIS_ENABLED = true;
  33611. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  33612. const FontFlags = {
  33613. FixedPitch: 1,
  33614. Serif: 2,
  33615. Symbolic: 4,
  33616. Script: 8,
  33617. Nonsymbolic: 32,
  33618. Italic: 64,
  33619. AllCap: 65536,
  33620. SmallCap: 131072,
  33621. ForceBold: 262144,
  33622. };
  33623. exports.FontFlags = FontFlags;
  33624. const MacStandardGlyphOrdering = [
  33625. ".notdef",
  33626. ".null",
  33627. "nonmarkingreturn",
  33628. "space",
  33629. "exclam",
  33630. "quotedbl",
  33631. "numbersign",
  33632. "dollar",
  33633. "percent",
  33634. "ampersand",
  33635. "quotesingle",
  33636. "parenleft",
  33637. "parenright",
  33638. "asterisk",
  33639. "plus",
  33640. "comma",
  33641. "hyphen",
  33642. "period",
  33643. "slash",
  33644. "zero",
  33645. "one",
  33646. "two",
  33647. "three",
  33648. "four",
  33649. "five",
  33650. "six",
  33651. "seven",
  33652. "eight",
  33653. "nine",
  33654. "colon",
  33655. "semicolon",
  33656. "less",
  33657. "equal",
  33658. "greater",
  33659. "question",
  33660. "at",
  33661. "A",
  33662. "B",
  33663. "C",
  33664. "D",
  33665. "E",
  33666. "F",
  33667. "G",
  33668. "H",
  33669. "I",
  33670. "J",
  33671. "K",
  33672. "L",
  33673. "M",
  33674. "N",
  33675. "O",
  33676. "P",
  33677. "Q",
  33678. "R",
  33679. "S",
  33680. "T",
  33681. "U",
  33682. "V",
  33683. "W",
  33684. "X",
  33685. "Y",
  33686. "Z",
  33687. "bracketleft",
  33688. "backslash",
  33689. "bracketright",
  33690. "asciicircum",
  33691. "underscore",
  33692. "grave",
  33693. "a",
  33694. "b",
  33695. "c",
  33696. "d",
  33697. "e",
  33698. "f",
  33699. "g",
  33700. "h",
  33701. "i",
  33702. "j",
  33703. "k",
  33704. "l",
  33705. "m",
  33706. "n",
  33707. "o",
  33708. "p",
  33709. "q",
  33710. "r",
  33711. "s",
  33712. "t",
  33713. "u",
  33714. "v",
  33715. "w",
  33716. "x",
  33717. "y",
  33718. "z",
  33719. "braceleft",
  33720. "bar",
  33721. "braceright",
  33722. "asciitilde",
  33723. "Adieresis",
  33724. "Aring",
  33725. "Ccedilla",
  33726. "Eacute",
  33727. "Ntilde",
  33728. "Odieresis",
  33729. "Udieresis",
  33730. "aacute",
  33731. "agrave",
  33732. "acircumflex",
  33733. "adieresis",
  33734. "atilde",
  33735. "aring",
  33736. "ccedilla",
  33737. "eacute",
  33738. "egrave",
  33739. "ecircumflex",
  33740. "edieresis",
  33741. "iacute",
  33742. "igrave",
  33743. "icircumflex",
  33744. "idieresis",
  33745. "ntilde",
  33746. "oacute",
  33747. "ograve",
  33748. "ocircumflex",
  33749. "odieresis",
  33750. "otilde",
  33751. "uacute",
  33752. "ugrave",
  33753. "ucircumflex",
  33754. "udieresis",
  33755. "dagger",
  33756. "degree",
  33757. "cent",
  33758. "sterling",
  33759. "section",
  33760. "bullet",
  33761. "paragraph",
  33762. "germandbls",
  33763. "registered",
  33764. "copyright",
  33765. "trademark",
  33766. "acute",
  33767. "dieresis",
  33768. "notequal",
  33769. "AE",
  33770. "Oslash",
  33771. "infinity",
  33772. "plusminus",
  33773. "lessequal",
  33774. "greaterequal",
  33775. "yen",
  33776. "mu",
  33777. "partialdiff",
  33778. "summation",
  33779. "product",
  33780. "pi",
  33781. "integral",
  33782. "ordfeminine",
  33783. "ordmasculine",
  33784. "Omega",
  33785. "ae",
  33786. "oslash",
  33787. "questiondown",
  33788. "exclamdown",
  33789. "logicalnot",
  33790. "radical",
  33791. "florin",
  33792. "approxequal",
  33793. "Delta",
  33794. "guillemotleft",
  33795. "guillemotright",
  33796. "ellipsis",
  33797. "nonbreakingspace",
  33798. "Agrave",
  33799. "Atilde",
  33800. "Otilde",
  33801. "OE",
  33802. "oe",
  33803. "endash",
  33804. "emdash",
  33805. "quotedblleft",
  33806. "quotedblright",
  33807. "quoteleft",
  33808. "quoteright",
  33809. "divide",
  33810. "lozenge",
  33811. "ydieresis",
  33812. "Ydieresis",
  33813. "fraction",
  33814. "currency",
  33815. "guilsinglleft",
  33816. "guilsinglright",
  33817. "fi",
  33818. "fl",
  33819. "daggerdbl",
  33820. "periodcentered",
  33821. "quotesinglbase",
  33822. "quotedblbase",
  33823. "perthousand",
  33824. "Acircumflex",
  33825. "Ecircumflex",
  33826. "Aacute",
  33827. "Edieresis",
  33828. "Egrave",
  33829. "Iacute",
  33830. "Icircumflex",
  33831. "Idieresis",
  33832. "Igrave",
  33833. "Oacute",
  33834. "Ocircumflex",
  33835. "apple",
  33836. "Ograve",
  33837. "Uacute",
  33838. "Ucircumflex",
  33839. "Ugrave",
  33840. "dotlessi",
  33841. "circumflex",
  33842. "tilde",
  33843. "macron",
  33844. "breve",
  33845. "dotaccent",
  33846. "ring",
  33847. "cedilla",
  33848. "hungarumlaut",
  33849. "ogonek",
  33850. "caron",
  33851. "Lslash",
  33852. "lslash",
  33853. "Scaron",
  33854. "scaron",
  33855. "Zcaron",
  33856. "zcaron",
  33857. "brokenbar",
  33858. "Eth",
  33859. "eth",
  33860. "Yacute",
  33861. "yacute",
  33862. "Thorn",
  33863. "thorn",
  33864. "minus",
  33865. "multiply",
  33866. "onesuperior",
  33867. "twosuperior",
  33868. "threesuperior",
  33869. "onehalf",
  33870. "onequarter",
  33871. "threequarters",
  33872. "franc",
  33873. "Gbreve",
  33874. "gbreve",
  33875. "Idotaccent",
  33876. "Scedilla",
  33877. "scedilla",
  33878. "Cacute",
  33879. "cacute",
  33880. "Ccaron",
  33881. "ccaron",
  33882. "dcroat",
  33883. ];
  33884. exports.MacStandardGlyphOrdering = MacStandardGlyphOrdering;
  33885. function getFontType(type, subtype, isStandardFont = false) {
  33886. switch (type) {
  33887. case "Type1":
  33888. if (isStandardFont) {
  33889. return _util.FontType.TYPE1STANDARD;
  33890. }
  33891. return subtype === "Type1C"
  33892. ? _util.FontType.TYPE1C
  33893. : _util.FontType.TYPE1;
  33894. case "CIDFontType0":
  33895. return subtype === "CIDFontType0C"
  33896. ? _util.FontType.CIDFONTTYPE0C
  33897. : _util.FontType.CIDFONTTYPE0;
  33898. case "OpenType":
  33899. return _util.FontType.OPENTYPE;
  33900. case "TrueType":
  33901. return _util.FontType.TRUETYPE;
  33902. case "CIDFontType2":
  33903. return _util.FontType.CIDFONTTYPE2;
  33904. case "MMType1":
  33905. return _util.FontType.MMTYPE1;
  33906. case "Type0":
  33907. return _util.FontType.TYPE0;
  33908. default:
  33909. return _util.FontType.UNKNOWN;
  33910. }
  33911. }
  33912. function recoverGlyphName(name, glyphsUnicodeMap) {
  33913. if (glyphsUnicodeMap[name] !== undefined) {
  33914. return name;
  33915. }
  33916. const unicode = (0, _unicode.getUnicodeForGlyph)(
  33917. name,
  33918. glyphsUnicodeMap
  33919. );
  33920. if (unicode !== -1) {
  33921. for (const key in glyphsUnicodeMap) {
  33922. if (glyphsUnicodeMap[key] === unicode) {
  33923. return key;
  33924. }
  33925. }
  33926. }
  33927. (0, _util.info)(
  33928. "Unable to recover a standard glyph name for: " + name
  33929. );
  33930. return name;
  33931. }
  33932. function type1FontGlyphMapping(
  33933. properties,
  33934. builtInEncoding,
  33935. glyphNames
  33936. ) {
  33937. const charCodeToGlyphId = Object.create(null);
  33938. let glyphId, charCode, baseEncoding;
  33939. const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  33940. if (properties.isInternalFont) {
  33941. baseEncoding = builtInEncoding;
  33942. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  33943. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  33944. if (glyphId >= 0) {
  33945. charCodeToGlyphId[charCode] = glyphId;
  33946. } else {
  33947. charCodeToGlyphId[charCode] = 0;
  33948. }
  33949. }
  33950. } else if (properties.baseEncodingName) {
  33951. baseEncoding = (0, _encodings.getEncoding)(
  33952. properties.baseEncodingName
  33953. );
  33954. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  33955. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  33956. if (glyphId >= 0) {
  33957. charCodeToGlyphId[charCode] = glyphId;
  33958. } else {
  33959. charCodeToGlyphId[charCode] = 0;
  33960. }
  33961. }
  33962. } else if (isSymbolicFont) {
  33963. for (charCode in builtInEncoding) {
  33964. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  33965. }
  33966. } else {
  33967. baseEncoding = _encodings.StandardEncoding;
  33968. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  33969. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  33970. if (glyphId >= 0) {
  33971. charCodeToGlyphId[charCode] = glyphId;
  33972. } else {
  33973. charCodeToGlyphId[charCode] = 0;
  33974. }
  33975. }
  33976. }
  33977. const differences = properties.differences;
  33978. let glyphsUnicodeMap;
  33979. if (differences) {
  33980. for (charCode in differences) {
  33981. const glyphName = differences[charCode];
  33982. glyphId = glyphNames.indexOf(glyphName);
  33983. if (glyphId === -1) {
  33984. if (!glyphsUnicodeMap) {
  33985. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  33986. }
  33987. const standardGlyphName = recoverGlyphName(
  33988. glyphName,
  33989. glyphsUnicodeMap
  33990. );
  33991. if (standardGlyphName !== glyphName) {
  33992. glyphId = glyphNames.indexOf(standardGlyphName);
  33993. }
  33994. }
  33995. if (glyphId >= 0) {
  33996. charCodeToGlyphId[charCode] = glyphId;
  33997. } else {
  33998. charCodeToGlyphId[charCode] = 0;
  33999. }
  34000. }
  34001. }
  34002. return charCodeToGlyphId;
  34003. }
  34004. function normalizeFontName(name) {
  34005. return name.replace(/[,_]/g, "-").replace(/\s/g, "");
  34006. }
  34007. /***/
  34008. },
  34009. /* 39 */
  34010. /***/ (
  34011. __unused_webpack_module,
  34012. __webpack_exports__,
  34013. __w_pdfjs_require__
  34014. ) => {
  34015. __w_pdfjs_require__.r(__webpack_exports__);
  34016. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  34017. /* harmony export */ getDingbatsGlyphsUnicode: () =>
  34018. /* binding */ getDingbatsGlyphsUnicode,
  34019. /* harmony export */ getGlyphsUnicode: () =>
  34020. /* binding */ getGlyphsUnicode,
  34021. /* harmony export */
  34022. });
  34023. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ =
  34024. __w_pdfjs_require__(6);
  34025. const getGlyphsUnicode = (0,
  34026. _core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(
  34027. function () {
  34028. return [
  34029. "A",
  34030. 0x0041,
  34031. "AE",
  34032. 0x00c6,
  34033. "AEacute",
  34034. 0x01fc,
  34035. "AEmacron",
  34036. 0x01e2,
  34037. "AEsmall",
  34038. 0xf7e6,
  34039. "Aacute",
  34040. 0x00c1,
  34041. "Aacutesmall",
  34042. 0xf7e1,
  34043. "Abreve",
  34044. 0x0102,
  34045. "Abreveacute",
  34046. 0x1eae,
  34047. "Abrevecyrillic",
  34048. 0x04d0,
  34049. "Abrevedotbelow",
  34050. 0x1eb6,
  34051. "Abrevegrave",
  34052. 0x1eb0,
  34053. "Abrevehookabove",
  34054. 0x1eb2,
  34055. "Abrevetilde",
  34056. 0x1eb4,
  34057. "Acaron",
  34058. 0x01cd,
  34059. "Acircle",
  34060. 0x24b6,
  34061. "Acircumflex",
  34062. 0x00c2,
  34063. "Acircumflexacute",
  34064. 0x1ea4,
  34065. "Acircumflexdotbelow",
  34066. 0x1eac,
  34067. "Acircumflexgrave",
  34068. 0x1ea6,
  34069. "Acircumflexhookabove",
  34070. 0x1ea8,
  34071. "Acircumflexsmall",
  34072. 0xf7e2,
  34073. "Acircumflextilde",
  34074. 0x1eaa,
  34075. "Acute",
  34076. 0xf6c9,
  34077. "Acutesmall",
  34078. 0xf7b4,
  34079. "Acyrillic",
  34080. 0x0410,
  34081. "Adblgrave",
  34082. 0x0200,
  34083. "Adieresis",
  34084. 0x00c4,
  34085. "Adieresiscyrillic",
  34086. 0x04d2,
  34087. "Adieresismacron",
  34088. 0x01de,
  34089. "Adieresissmall",
  34090. 0xf7e4,
  34091. "Adotbelow",
  34092. 0x1ea0,
  34093. "Adotmacron",
  34094. 0x01e0,
  34095. "Agrave",
  34096. 0x00c0,
  34097. "Agravesmall",
  34098. 0xf7e0,
  34099. "Ahookabove",
  34100. 0x1ea2,
  34101. "Aiecyrillic",
  34102. 0x04d4,
  34103. "Ainvertedbreve",
  34104. 0x0202,
  34105. "Alpha",
  34106. 0x0391,
  34107. "Alphatonos",
  34108. 0x0386,
  34109. "Amacron",
  34110. 0x0100,
  34111. "Amonospace",
  34112. 0xff21,
  34113. "Aogonek",
  34114. 0x0104,
  34115. "Aring",
  34116. 0x00c5,
  34117. "Aringacute",
  34118. 0x01fa,
  34119. "Aringbelow",
  34120. 0x1e00,
  34121. "Aringsmall",
  34122. 0xf7e5,
  34123. "Asmall",
  34124. 0xf761,
  34125. "Atilde",
  34126. 0x00c3,
  34127. "Atildesmall",
  34128. 0xf7e3,
  34129. "Aybarmenian",
  34130. 0x0531,
  34131. "B",
  34132. 0x0042,
  34133. "Bcircle",
  34134. 0x24b7,
  34135. "Bdotaccent",
  34136. 0x1e02,
  34137. "Bdotbelow",
  34138. 0x1e04,
  34139. "Becyrillic",
  34140. 0x0411,
  34141. "Benarmenian",
  34142. 0x0532,
  34143. "Beta",
  34144. 0x0392,
  34145. "Bhook",
  34146. 0x0181,
  34147. "Blinebelow",
  34148. 0x1e06,
  34149. "Bmonospace",
  34150. 0xff22,
  34151. "Brevesmall",
  34152. 0xf6f4,
  34153. "Bsmall",
  34154. 0xf762,
  34155. "Btopbar",
  34156. 0x0182,
  34157. "C",
  34158. 0x0043,
  34159. "Caarmenian",
  34160. 0x053e,
  34161. "Cacute",
  34162. 0x0106,
  34163. "Caron",
  34164. 0xf6ca,
  34165. "Caronsmall",
  34166. 0xf6f5,
  34167. "Ccaron",
  34168. 0x010c,
  34169. "Ccedilla",
  34170. 0x00c7,
  34171. "Ccedillaacute",
  34172. 0x1e08,
  34173. "Ccedillasmall",
  34174. 0xf7e7,
  34175. "Ccircle",
  34176. 0x24b8,
  34177. "Ccircumflex",
  34178. 0x0108,
  34179. "Cdot",
  34180. 0x010a,
  34181. "Cdotaccent",
  34182. 0x010a,
  34183. "Cedillasmall",
  34184. 0xf7b8,
  34185. "Chaarmenian",
  34186. 0x0549,
  34187. "Cheabkhasiancyrillic",
  34188. 0x04bc,
  34189. "Checyrillic",
  34190. 0x0427,
  34191. "Chedescenderabkhasiancyrillic",
  34192. 0x04be,
  34193. "Chedescendercyrillic",
  34194. 0x04b6,
  34195. "Chedieresiscyrillic",
  34196. 0x04f4,
  34197. "Cheharmenian",
  34198. 0x0543,
  34199. "Chekhakassiancyrillic",
  34200. 0x04cb,
  34201. "Cheverticalstrokecyrillic",
  34202. 0x04b8,
  34203. "Chi",
  34204. 0x03a7,
  34205. "Chook",
  34206. 0x0187,
  34207. "Circumflexsmall",
  34208. 0xf6f6,
  34209. "Cmonospace",
  34210. 0xff23,
  34211. "Coarmenian",
  34212. 0x0551,
  34213. "Csmall",
  34214. 0xf763,
  34215. "D",
  34216. 0x0044,
  34217. "DZ",
  34218. 0x01f1,
  34219. "DZcaron",
  34220. 0x01c4,
  34221. "Daarmenian",
  34222. 0x0534,
  34223. "Dafrican",
  34224. 0x0189,
  34225. "Dcaron",
  34226. 0x010e,
  34227. "Dcedilla",
  34228. 0x1e10,
  34229. "Dcircle",
  34230. 0x24b9,
  34231. "Dcircumflexbelow",
  34232. 0x1e12,
  34233. "Dcroat",
  34234. 0x0110,
  34235. "Ddotaccent",
  34236. 0x1e0a,
  34237. "Ddotbelow",
  34238. 0x1e0c,
  34239. "Decyrillic",
  34240. 0x0414,
  34241. "Deicoptic",
  34242. 0x03ee,
  34243. "Delta",
  34244. 0x2206,
  34245. "Deltagreek",
  34246. 0x0394,
  34247. "Dhook",
  34248. 0x018a,
  34249. "Dieresis",
  34250. 0xf6cb,
  34251. "DieresisAcute",
  34252. 0xf6cc,
  34253. "DieresisGrave",
  34254. 0xf6cd,
  34255. "Dieresissmall",
  34256. 0xf7a8,
  34257. "Digammagreek",
  34258. 0x03dc,
  34259. "Djecyrillic",
  34260. 0x0402,
  34261. "Dlinebelow",
  34262. 0x1e0e,
  34263. "Dmonospace",
  34264. 0xff24,
  34265. "Dotaccentsmall",
  34266. 0xf6f7,
  34267. "Dslash",
  34268. 0x0110,
  34269. "Dsmall",
  34270. 0xf764,
  34271. "Dtopbar",
  34272. 0x018b,
  34273. "Dz",
  34274. 0x01f2,
  34275. "Dzcaron",
  34276. 0x01c5,
  34277. "Dzeabkhasiancyrillic",
  34278. 0x04e0,
  34279. "Dzecyrillic",
  34280. 0x0405,
  34281. "Dzhecyrillic",
  34282. 0x040f,
  34283. "E",
  34284. 0x0045,
  34285. "Eacute",
  34286. 0x00c9,
  34287. "Eacutesmall",
  34288. 0xf7e9,
  34289. "Ebreve",
  34290. 0x0114,
  34291. "Ecaron",
  34292. 0x011a,
  34293. "Ecedillabreve",
  34294. 0x1e1c,
  34295. "Echarmenian",
  34296. 0x0535,
  34297. "Ecircle",
  34298. 0x24ba,
  34299. "Ecircumflex",
  34300. 0x00ca,
  34301. "Ecircumflexacute",
  34302. 0x1ebe,
  34303. "Ecircumflexbelow",
  34304. 0x1e18,
  34305. "Ecircumflexdotbelow",
  34306. 0x1ec6,
  34307. "Ecircumflexgrave",
  34308. 0x1ec0,
  34309. "Ecircumflexhookabove",
  34310. 0x1ec2,
  34311. "Ecircumflexsmall",
  34312. 0xf7ea,
  34313. "Ecircumflextilde",
  34314. 0x1ec4,
  34315. "Ecyrillic",
  34316. 0x0404,
  34317. "Edblgrave",
  34318. 0x0204,
  34319. "Edieresis",
  34320. 0x00cb,
  34321. "Edieresissmall",
  34322. 0xf7eb,
  34323. "Edot",
  34324. 0x0116,
  34325. "Edotaccent",
  34326. 0x0116,
  34327. "Edotbelow",
  34328. 0x1eb8,
  34329. "Efcyrillic",
  34330. 0x0424,
  34331. "Egrave",
  34332. 0x00c8,
  34333. "Egravesmall",
  34334. 0xf7e8,
  34335. "Eharmenian",
  34336. 0x0537,
  34337. "Ehookabove",
  34338. 0x1eba,
  34339. "Eightroman",
  34340. 0x2167,
  34341. "Einvertedbreve",
  34342. 0x0206,
  34343. "Eiotifiedcyrillic",
  34344. 0x0464,
  34345. "Elcyrillic",
  34346. 0x041b,
  34347. "Elevenroman",
  34348. 0x216a,
  34349. "Emacron",
  34350. 0x0112,
  34351. "Emacronacute",
  34352. 0x1e16,
  34353. "Emacrongrave",
  34354. 0x1e14,
  34355. "Emcyrillic",
  34356. 0x041c,
  34357. "Emonospace",
  34358. 0xff25,
  34359. "Encyrillic",
  34360. 0x041d,
  34361. "Endescendercyrillic",
  34362. 0x04a2,
  34363. "Eng",
  34364. 0x014a,
  34365. "Enghecyrillic",
  34366. 0x04a4,
  34367. "Enhookcyrillic",
  34368. 0x04c7,
  34369. "Eogonek",
  34370. 0x0118,
  34371. "Eopen",
  34372. 0x0190,
  34373. "Epsilon",
  34374. 0x0395,
  34375. "Epsilontonos",
  34376. 0x0388,
  34377. "Ercyrillic",
  34378. 0x0420,
  34379. "Ereversed",
  34380. 0x018e,
  34381. "Ereversedcyrillic",
  34382. 0x042d,
  34383. "Escyrillic",
  34384. 0x0421,
  34385. "Esdescendercyrillic",
  34386. 0x04aa,
  34387. "Esh",
  34388. 0x01a9,
  34389. "Esmall",
  34390. 0xf765,
  34391. "Eta",
  34392. 0x0397,
  34393. "Etarmenian",
  34394. 0x0538,
  34395. "Etatonos",
  34396. 0x0389,
  34397. "Eth",
  34398. 0x00d0,
  34399. "Ethsmall",
  34400. 0xf7f0,
  34401. "Etilde",
  34402. 0x1ebc,
  34403. "Etildebelow",
  34404. 0x1e1a,
  34405. "Euro",
  34406. 0x20ac,
  34407. "Ezh",
  34408. 0x01b7,
  34409. "Ezhcaron",
  34410. 0x01ee,
  34411. "Ezhreversed",
  34412. 0x01b8,
  34413. "F",
  34414. 0x0046,
  34415. "Fcircle",
  34416. 0x24bb,
  34417. "Fdotaccent",
  34418. 0x1e1e,
  34419. "Feharmenian",
  34420. 0x0556,
  34421. "Feicoptic",
  34422. 0x03e4,
  34423. "Fhook",
  34424. 0x0191,
  34425. "Fitacyrillic",
  34426. 0x0472,
  34427. "Fiveroman",
  34428. 0x2164,
  34429. "Fmonospace",
  34430. 0xff26,
  34431. "Fourroman",
  34432. 0x2163,
  34433. "Fsmall",
  34434. 0xf766,
  34435. "G",
  34436. 0x0047,
  34437. "GBsquare",
  34438. 0x3387,
  34439. "Gacute",
  34440. 0x01f4,
  34441. "Gamma",
  34442. 0x0393,
  34443. "Gammaafrican",
  34444. 0x0194,
  34445. "Gangiacoptic",
  34446. 0x03ea,
  34447. "Gbreve",
  34448. 0x011e,
  34449. "Gcaron",
  34450. 0x01e6,
  34451. "Gcedilla",
  34452. 0x0122,
  34453. "Gcircle",
  34454. 0x24bc,
  34455. "Gcircumflex",
  34456. 0x011c,
  34457. "Gcommaaccent",
  34458. 0x0122,
  34459. "Gdot",
  34460. 0x0120,
  34461. "Gdotaccent",
  34462. 0x0120,
  34463. "Gecyrillic",
  34464. 0x0413,
  34465. "Ghadarmenian",
  34466. 0x0542,
  34467. "Ghemiddlehookcyrillic",
  34468. 0x0494,
  34469. "Ghestrokecyrillic",
  34470. 0x0492,
  34471. "Gheupturncyrillic",
  34472. 0x0490,
  34473. "Ghook",
  34474. 0x0193,
  34475. "Gimarmenian",
  34476. 0x0533,
  34477. "Gjecyrillic",
  34478. 0x0403,
  34479. "Gmacron",
  34480. 0x1e20,
  34481. "Gmonospace",
  34482. 0xff27,
  34483. "Grave",
  34484. 0xf6ce,
  34485. "Gravesmall",
  34486. 0xf760,
  34487. "Gsmall",
  34488. 0xf767,
  34489. "Gsmallhook",
  34490. 0x029b,
  34491. "Gstroke",
  34492. 0x01e4,
  34493. "H",
  34494. 0x0048,
  34495. "H18533",
  34496. 0x25cf,
  34497. "H18543",
  34498. 0x25aa,
  34499. "H18551",
  34500. 0x25ab,
  34501. "H22073",
  34502. 0x25a1,
  34503. "HPsquare",
  34504. 0x33cb,
  34505. "Haabkhasiancyrillic",
  34506. 0x04a8,
  34507. "Hadescendercyrillic",
  34508. 0x04b2,
  34509. "Hardsigncyrillic",
  34510. 0x042a,
  34511. "Hbar",
  34512. 0x0126,
  34513. "Hbrevebelow",
  34514. 0x1e2a,
  34515. "Hcedilla",
  34516. 0x1e28,
  34517. "Hcircle",
  34518. 0x24bd,
  34519. "Hcircumflex",
  34520. 0x0124,
  34521. "Hdieresis",
  34522. 0x1e26,
  34523. "Hdotaccent",
  34524. 0x1e22,
  34525. "Hdotbelow",
  34526. 0x1e24,
  34527. "Hmonospace",
  34528. 0xff28,
  34529. "Hoarmenian",
  34530. 0x0540,
  34531. "Horicoptic",
  34532. 0x03e8,
  34533. "Hsmall",
  34534. 0xf768,
  34535. "Hungarumlaut",
  34536. 0xf6cf,
  34537. "Hungarumlautsmall",
  34538. 0xf6f8,
  34539. "Hzsquare",
  34540. 0x3390,
  34541. "I",
  34542. 0x0049,
  34543. "IAcyrillic",
  34544. 0x042f,
  34545. "IJ",
  34546. 0x0132,
  34547. "IUcyrillic",
  34548. 0x042e,
  34549. "Iacute",
  34550. 0x00cd,
  34551. "Iacutesmall",
  34552. 0xf7ed,
  34553. "Ibreve",
  34554. 0x012c,
  34555. "Icaron",
  34556. 0x01cf,
  34557. "Icircle",
  34558. 0x24be,
  34559. "Icircumflex",
  34560. 0x00ce,
  34561. "Icircumflexsmall",
  34562. 0xf7ee,
  34563. "Icyrillic",
  34564. 0x0406,
  34565. "Idblgrave",
  34566. 0x0208,
  34567. "Idieresis",
  34568. 0x00cf,
  34569. "Idieresisacute",
  34570. 0x1e2e,
  34571. "Idieresiscyrillic",
  34572. 0x04e4,
  34573. "Idieresissmall",
  34574. 0xf7ef,
  34575. "Idot",
  34576. 0x0130,
  34577. "Idotaccent",
  34578. 0x0130,
  34579. "Idotbelow",
  34580. 0x1eca,
  34581. "Iebrevecyrillic",
  34582. 0x04d6,
  34583. "Iecyrillic",
  34584. 0x0415,
  34585. "Ifraktur",
  34586. 0x2111,
  34587. "Igrave",
  34588. 0x00cc,
  34589. "Igravesmall",
  34590. 0xf7ec,
  34591. "Ihookabove",
  34592. 0x1ec8,
  34593. "Iicyrillic",
  34594. 0x0418,
  34595. "Iinvertedbreve",
  34596. 0x020a,
  34597. "Iishortcyrillic",
  34598. 0x0419,
  34599. "Imacron",
  34600. 0x012a,
  34601. "Imacroncyrillic",
  34602. 0x04e2,
  34603. "Imonospace",
  34604. 0xff29,
  34605. "Iniarmenian",
  34606. 0x053b,
  34607. "Iocyrillic",
  34608. 0x0401,
  34609. "Iogonek",
  34610. 0x012e,
  34611. "Iota",
  34612. 0x0399,
  34613. "Iotaafrican",
  34614. 0x0196,
  34615. "Iotadieresis",
  34616. 0x03aa,
  34617. "Iotatonos",
  34618. 0x038a,
  34619. "Ismall",
  34620. 0xf769,
  34621. "Istroke",
  34622. 0x0197,
  34623. "Itilde",
  34624. 0x0128,
  34625. "Itildebelow",
  34626. 0x1e2c,
  34627. "Izhitsacyrillic",
  34628. 0x0474,
  34629. "Izhitsadblgravecyrillic",
  34630. 0x0476,
  34631. "J",
  34632. 0x004a,
  34633. "Jaarmenian",
  34634. 0x0541,
  34635. "Jcircle",
  34636. 0x24bf,
  34637. "Jcircumflex",
  34638. 0x0134,
  34639. "Jecyrillic",
  34640. 0x0408,
  34641. "Jheharmenian",
  34642. 0x054b,
  34643. "Jmonospace",
  34644. 0xff2a,
  34645. "Jsmall",
  34646. 0xf76a,
  34647. "K",
  34648. 0x004b,
  34649. "KBsquare",
  34650. 0x3385,
  34651. "KKsquare",
  34652. 0x33cd,
  34653. "Kabashkircyrillic",
  34654. 0x04a0,
  34655. "Kacute",
  34656. 0x1e30,
  34657. "Kacyrillic",
  34658. 0x041a,
  34659. "Kadescendercyrillic",
  34660. 0x049a,
  34661. "Kahookcyrillic",
  34662. 0x04c3,
  34663. "Kappa",
  34664. 0x039a,
  34665. "Kastrokecyrillic",
  34666. 0x049e,
  34667. "Kaverticalstrokecyrillic",
  34668. 0x049c,
  34669. "Kcaron",
  34670. 0x01e8,
  34671. "Kcedilla",
  34672. 0x0136,
  34673. "Kcircle",
  34674. 0x24c0,
  34675. "Kcommaaccent",
  34676. 0x0136,
  34677. "Kdotbelow",
  34678. 0x1e32,
  34679. "Keharmenian",
  34680. 0x0554,
  34681. "Kenarmenian",
  34682. 0x053f,
  34683. "Khacyrillic",
  34684. 0x0425,
  34685. "Kheicoptic",
  34686. 0x03e6,
  34687. "Khook",
  34688. 0x0198,
  34689. "Kjecyrillic",
  34690. 0x040c,
  34691. "Klinebelow",
  34692. 0x1e34,
  34693. "Kmonospace",
  34694. 0xff2b,
  34695. "Koppacyrillic",
  34696. 0x0480,
  34697. "Koppagreek",
  34698. 0x03de,
  34699. "Ksicyrillic",
  34700. 0x046e,
  34701. "Ksmall",
  34702. 0xf76b,
  34703. "L",
  34704. 0x004c,
  34705. "LJ",
  34706. 0x01c7,
  34707. "LL",
  34708. 0xf6bf,
  34709. "Lacute",
  34710. 0x0139,
  34711. "Lambda",
  34712. 0x039b,
  34713. "Lcaron",
  34714. 0x013d,
  34715. "Lcedilla",
  34716. 0x013b,
  34717. "Lcircle",
  34718. 0x24c1,
  34719. "Lcircumflexbelow",
  34720. 0x1e3c,
  34721. "Lcommaaccent",
  34722. 0x013b,
  34723. "Ldot",
  34724. 0x013f,
  34725. "Ldotaccent",
  34726. 0x013f,
  34727. "Ldotbelow",
  34728. 0x1e36,
  34729. "Ldotbelowmacron",
  34730. 0x1e38,
  34731. "Liwnarmenian",
  34732. 0x053c,
  34733. "Lj",
  34734. 0x01c8,
  34735. "Ljecyrillic",
  34736. 0x0409,
  34737. "Llinebelow",
  34738. 0x1e3a,
  34739. "Lmonospace",
  34740. 0xff2c,
  34741. "Lslash",
  34742. 0x0141,
  34743. "Lslashsmall",
  34744. 0xf6f9,
  34745. "Lsmall",
  34746. 0xf76c,
  34747. "M",
  34748. 0x004d,
  34749. "MBsquare",
  34750. 0x3386,
  34751. "Macron",
  34752. 0xf6d0,
  34753. "Macronsmall",
  34754. 0xf7af,
  34755. "Macute",
  34756. 0x1e3e,
  34757. "Mcircle",
  34758. 0x24c2,
  34759. "Mdotaccent",
  34760. 0x1e40,
  34761. "Mdotbelow",
  34762. 0x1e42,
  34763. "Menarmenian",
  34764. 0x0544,
  34765. "Mmonospace",
  34766. 0xff2d,
  34767. "Msmall",
  34768. 0xf76d,
  34769. "Mturned",
  34770. 0x019c,
  34771. "Mu",
  34772. 0x039c,
  34773. "N",
  34774. 0x004e,
  34775. "NJ",
  34776. 0x01ca,
  34777. "Nacute",
  34778. 0x0143,
  34779. "Ncaron",
  34780. 0x0147,
  34781. "Ncedilla",
  34782. 0x0145,
  34783. "Ncircle",
  34784. 0x24c3,
  34785. "Ncircumflexbelow",
  34786. 0x1e4a,
  34787. "Ncommaaccent",
  34788. 0x0145,
  34789. "Ndotaccent",
  34790. 0x1e44,
  34791. "Ndotbelow",
  34792. 0x1e46,
  34793. "Nhookleft",
  34794. 0x019d,
  34795. "Nineroman",
  34796. 0x2168,
  34797. "Nj",
  34798. 0x01cb,
  34799. "Njecyrillic",
  34800. 0x040a,
  34801. "Nlinebelow",
  34802. 0x1e48,
  34803. "Nmonospace",
  34804. 0xff2e,
  34805. "Nowarmenian",
  34806. 0x0546,
  34807. "Nsmall",
  34808. 0xf76e,
  34809. "Ntilde",
  34810. 0x00d1,
  34811. "Ntildesmall",
  34812. 0xf7f1,
  34813. "Nu",
  34814. 0x039d,
  34815. "O",
  34816. 0x004f,
  34817. "OE",
  34818. 0x0152,
  34819. "OEsmall",
  34820. 0xf6fa,
  34821. "Oacute",
  34822. 0x00d3,
  34823. "Oacutesmall",
  34824. 0xf7f3,
  34825. "Obarredcyrillic",
  34826. 0x04e8,
  34827. "Obarreddieresiscyrillic",
  34828. 0x04ea,
  34829. "Obreve",
  34830. 0x014e,
  34831. "Ocaron",
  34832. 0x01d1,
  34833. "Ocenteredtilde",
  34834. 0x019f,
  34835. "Ocircle",
  34836. 0x24c4,
  34837. "Ocircumflex",
  34838. 0x00d4,
  34839. "Ocircumflexacute",
  34840. 0x1ed0,
  34841. "Ocircumflexdotbelow",
  34842. 0x1ed8,
  34843. "Ocircumflexgrave",
  34844. 0x1ed2,
  34845. "Ocircumflexhookabove",
  34846. 0x1ed4,
  34847. "Ocircumflexsmall",
  34848. 0xf7f4,
  34849. "Ocircumflextilde",
  34850. 0x1ed6,
  34851. "Ocyrillic",
  34852. 0x041e,
  34853. "Odblacute",
  34854. 0x0150,
  34855. "Odblgrave",
  34856. 0x020c,
  34857. "Odieresis",
  34858. 0x00d6,
  34859. "Odieresiscyrillic",
  34860. 0x04e6,
  34861. "Odieresissmall",
  34862. 0xf7f6,
  34863. "Odotbelow",
  34864. 0x1ecc,
  34865. "Ogoneksmall",
  34866. 0xf6fb,
  34867. "Ograve",
  34868. 0x00d2,
  34869. "Ogravesmall",
  34870. 0xf7f2,
  34871. "Oharmenian",
  34872. 0x0555,
  34873. "Ohm",
  34874. 0x2126,
  34875. "Ohookabove",
  34876. 0x1ece,
  34877. "Ohorn",
  34878. 0x01a0,
  34879. "Ohornacute",
  34880. 0x1eda,
  34881. "Ohorndotbelow",
  34882. 0x1ee2,
  34883. "Ohorngrave",
  34884. 0x1edc,
  34885. "Ohornhookabove",
  34886. 0x1ede,
  34887. "Ohorntilde",
  34888. 0x1ee0,
  34889. "Ohungarumlaut",
  34890. 0x0150,
  34891. "Oi",
  34892. 0x01a2,
  34893. "Oinvertedbreve",
  34894. 0x020e,
  34895. "Omacron",
  34896. 0x014c,
  34897. "Omacronacute",
  34898. 0x1e52,
  34899. "Omacrongrave",
  34900. 0x1e50,
  34901. "Omega",
  34902. 0x2126,
  34903. "Omegacyrillic",
  34904. 0x0460,
  34905. "Omegagreek",
  34906. 0x03a9,
  34907. "Omegaroundcyrillic",
  34908. 0x047a,
  34909. "Omegatitlocyrillic",
  34910. 0x047c,
  34911. "Omegatonos",
  34912. 0x038f,
  34913. "Omicron",
  34914. 0x039f,
  34915. "Omicrontonos",
  34916. 0x038c,
  34917. "Omonospace",
  34918. 0xff2f,
  34919. "Oneroman",
  34920. 0x2160,
  34921. "Oogonek",
  34922. 0x01ea,
  34923. "Oogonekmacron",
  34924. 0x01ec,
  34925. "Oopen",
  34926. 0x0186,
  34927. "Oslash",
  34928. 0x00d8,
  34929. "Oslashacute",
  34930. 0x01fe,
  34931. "Oslashsmall",
  34932. 0xf7f8,
  34933. "Osmall",
  34934. 0xf76f,
  34935. "Ostrokeacute",
  34936. 0x01fe,
  34937. "Otcyrillic",
  34938. 0x047e,
  34939. "Otilde",
  34940. 0x00d5,
  34941. "Otildeacute",
  34942. 0x1e4c,
  34943. "Otildedieresis",
  34944. 0x1e4e,
  34945. "Otildesmall",
  34946. 0xf7f5,
  34947. "P",
  34948. 0x0050,
  34949. "Pacute",
  34950. 0x1e54,
  34951. "Pcircle",
  34952. 0x24c5,
  34953. "Pdotaccent",
  34954. 0x1e56,
  34955. "Pecyrillic",
  34956. 0x041f,
  34957. "Peharmenian",
  34958. 0x054a,
  34959. "Pemiddlehookcyrillic",
  34960. 0x04a6,
  34961. "Phi",
  34962. 0x03a6,
  34963. "Phook",
  34964. 0x01a4,
  34965. "Pi",
  34966. 0x03a0,
  34967. "Piwrarmenian",
  34968. 0x0553,
  34969. "Pmonospace",
  34970. 0xff30,
  34971. "Psi",
  34972. 0x03a8,
  34973. "Psicyrillic",
  34974. 0x0470,
  34975. "Psmall",
  34976. 0xf770,
  34977. "Q",
  34978. 0x0051,
  34979. "Qcircle",
  34980. 0x24c6,
  34981. "Qmonospace",
  34982. 0xff31,
  34983. "Qsmall",
  34984. 0xf771,
  34985. "R",
  34986. 0x0052,
  34987. "Raarmenian",
  34988. 0x054c,
  34989. "Racute",
  34990. 0x0154,
  34991. "Rcaron",
  34992. 0x0158,
  34993. "Rcedilla",
  34994. 0x0156,
  34995. "Rcircle",
  34996. 0x24c7,
  34997. "Rcommaaccent",
  34998. 0x0156,
  34999. "Rdblgrave",
  35000. 0x0210,
  35001. "Rdotaccent",
  35002. 0x1e58,
  35003. "Rdotbelow",
  35004. 0x1e5a,
  35005. "Rdotbelowmacron",
  35006. 0x1e5c,
  35007. "Reharmenian",
  35008. 0x0550,
  35009. "Rfraktur",
  35010. 0x211c,
  35011. "Rho",
  35012. 0x03a1,
  35013. "Ringsmall",
  35014. 0xf6fc,
  35015. "Rinvertedbreve",
  35016. 0x0212,
  35017. "Rlinebelow",
  35018. 0x1e5e,
  35019. "Rmonospace",
  35020. 0xff32,
  35021. "Rsmall",
  35022. 0xf772,
  35023. "Rsmallinverted",
  35024. 0x0281,
  35025. "Rsmallinvertedsuperior",
  35026. 0x02b6,
  35027. "S",
  35028. 0x0053,
  35029. "SF010000",
  35030. 0x250c,
  35031. "SF020000",
  35032. 0x2514,
  35033. "SF030000",
  35034. 0x2510,
  35035. "SF040000",
  35036. 0x2518,
  35037. "SF050000",
  35038. 0x253c,
  35039. "SF060000",
  35040. 0x252c,
  35041. "SF070000",
  35042. 0x2534,
  35043. "SF080000",
  35044. 0x251c,
  35045. "SF090000",
  35046. 0x2524,
  35047. "SF100000",
  35048. 0x2500,
  35049. "SF110000",
  35050. 0x2502,
  35051. "SF190000",
  35052. 0x2561,
  35053. "SF200000",
  35054. 0x2562,
  35055. "SF210000",
  35056. 0x2556,
  35057. "SF220000",
  35058. 0x2555,
  35059. "SF230000",
  35060. 0x2563,
  35061. "SF240000",
  35062. 0x2551,
  35063. "SF250000",
  35064. 0x2557,
  35065. "SF260000",
  35066. 0x255d,
  35067. "SF270000",
  35068. 0x255c,
  35069. "SF280000",
  35070. 0x255b,
  35071. "SF360000",
  35072. 0x255e,
  35073. "SF370000",
  35074. 0x255f,
  35075. "SF380000",
  35076. 0x255a,
  35077. "SF390000",
  35078. 0x2554,
  35079. "SF400000",
  35080. 0x2569,
  35081. "SF410000",
  35082. 0x2566,
  35083. "SF420000",
  35084. 0x2560,
  35085. "SF430000",
  35086. 0x2550,
  35087. "SF440000",
  35088. 0x256c,
  35089. "SF450000",
  35090. 0x2567,
  35091. "SF460000",
  35092. 0x2568,
  35093. "SF470000",
  35094. 0x2564,
  35095. "SF480000",
  35096. 0x2565,
  35097. "SF490000",
  35098. 0x2559,
  35099. "SF500000",
  35100. 0x2558,
  35101. "SF510000",
  35102. 0x2552,
  35103. "SF520000",
  35104. 0x2553,
  35105. "SF530000",
  35106. 0x256b,
  35107. "SF540000",
  35108. 0x256a,
  35109. "Sacute",
  35110. 0x015a,
  35111. "Sacutedotaccent",
  35112. 0x1e64,
  35113. "Sampigreek",
  35114. 0x03e0,
  35115. "Scaron",
  35116. 0x0160,
  35117. "Scarondotaccent",
  35118. 0x1e66,
  35119. "Scaronsmall",
  35120. 0xf6fd,
  35121. "Scedilla",
  35122. 0x015e,
  35123. "Schwa",
  35124. 0x018f,
  35125. "Schwacyrillic",
  35126. 0x04d8,
  35127. "Schwadieresiscyrillic",
  35128. 0x04da,
  35129. "Scircle",
  35130. 0x24c8,
  35131. "Scircumflex",
  35132. 0x015c,
  35133. "Scommaaccent",
  35134. 0x0218,
  35135. "Sdotaccent",
  35136. 0x1e60,
  35137. "Sdotbelow",
  35138. 0x1e62,
  35139. "Sdotbelowdotaccent",
  35140. 0x1e68,
  35141. "Seharmenian",
  35142. 0x054d,
  35143. "Sevenroman",
  35144. 0x2166,
  35145. "Shaarmenian",
  35146. 0x0547,
  35147. "Shacyrillic",
  35148. 0x0428,
  35149. "Shchacyrillic",
  35150. 0x0429,
  35151. "Sheicoptic",
  35152. 0x03e2,
  35153. "Shhacyrillic",
  35154. 0x04ba,
  35155. "Shimacoptic",
  35156. 0x03ec,
  35157. "Sigma",
  35158. 0x03a3,
  35159. "Sixroman",
  35160. 0x2165,
  35161. "Smonospace",
  35162. 0xff33,
  35163. "Softsigncyrillic",
  35164. 0x042c,
  35165. "Ssmall",
  35166. 0xf773,
  35167. "Stigmagreek",
  35168. 0x03da,
  35169. "T",
  35170. 0x0054,
  35171. "Tau",
  35172. 0x03a4,
  35173. "Tbar",
  35174. 0x0166,
  35175. "Tcaron",
  35176. 0x0164,
  35177. "Tcedilla",
  35178. 0x0162,
  35179. "Tcircle",
  35180. 0x24c9,
  35181. "Tcircumflexbelow",
  35182. 0x1e70,
  35183. "Tcommaaccent",
  35184. 0x0162,
  35185. "Tdotaccent",
  35186. 0x1e6a,
  35187. "Tdotbelow",
  35188. 0x1e6c,
  35189. "Tecyrillic",
  35190. 0x0422,
  35191. "Tedescendercyrillic",
  35192. 0x04ac,
  35193. "Tenroman",
  35194. 0x2169,
  35195. "Tetsecyrillic",
  35196. 0x04b4,
  35197. "Theta",
  35198. 0x0398,
  35199. "Thook",
  35200. 0x01ac,
  35201. "Thorn",
  35202. 0x00de,
  35203. "Thornsmall",
  35204. 0xf7fe,
  35205. "Threeroman",
  35206. 0x2162,
  35207. "Tildesmall",
  35208. 0xf6fe,
  35209. "Tiwnarmenian",
  35210. 0x054f,
  35211. "Tlinebelow",
  35212. 0x1e6e,
  35213. "Tmonospace",
  35214. 0xff34,
  35215. "Toarmenian",
  35216. 0x0539,
  35217. "Tonefive",
  35218. 0x01bc,
  35219. "Tonesix",
  35220. 0x0184,
  35221. "Tonetwo",
  35222. 0x01a7,
  35223. "Tretroflexhook",
  35224. 0x01ae,
  35225. "Tsecyrillic",
  35226. 0x0426,
  35227. "Tshecyrillic",
  35228. 0x040b,
  35229. "Tsmall",
  35230. 0xf774,
  35231. "Twelveroman",
  35232. 0x216b,
  35233. "Tworoman",
  35234. 0x2161,
  35235. "U",
  35236. 0x0055,
  35237. "Uacute",
  35238. 0x00da,
  35239. "Uacutesmall",
  35240. 0xf7fa,
  35241. "Ubreve",
  35242. 0x016c,
  35243. "Ucaron",
  35244. 0x01d3,
  35245. "Ucircle",
  35246. 0x24ca,
  35247. "Ucircumflex",
  35248. 0x00db,
  35249. "Ucircumflexbelow",
  35250. 0x1e76,
  35251. "Ucircumflexsmall",
  35252. 0xf7fb,
  35253. "Ucyrillic",
  35254. 0x0423,
  35255. "Udblacute",
  35256. 0x0170,
  35257. "Udblgrave",
  35258. 0x0214,
  35259. "Udieresis",
  35260. 0x00dc,
  35261. "Udieresisacute",
  35262. 0x01d7,
  35263. "Udieresisbelow",
  35264. 0x1e72,
  35265. "Udieresiscaron",
  35266. 0x01d9,
  35267. "Udieresiscyrillic",
  35268. 0x04f0,
  35269. "Udieresisgrave",
  35270. 0x01db,
  35271. "Udieresismacron",
  35272. 0x01d5,
  35273. "Udieresissmall",
  35274. 0xf7fc,
  35275. "Udotbelow",
  35276. 0x1ee4,
  35277. "Ugrave",
  35278. 0x00d9,
  35279. "Ugravesmall",
  35280. 0xf7f9,
  35281. "Uhookabove",
  35282. 0x1ee6,
  35283. "Uhorn",
  35284. 0x01af,
  35285. "Uhornacute",
  35286. 0x1ee8,
  35287. "Uhorndotbelow",
  35288. 0x1ef0,
  35289. "Uhorngrave",
  35290. 0x1eea,
  35291. "Uhornhookabove",
  35292. 0x1eec,
  35293. "Uhorntilde",
  35294. 0x1eee,
  35295. "Uhungarumlaut",
  35296. 0x0170,
  35297. "Uhungarumlautcyrillic",
  35298. 0x04f2,
  35299. "Uinvertedbreve",
  35300. 0x0216,
  35301. "Ukcyrillic",
  35302. 0x0478,
  35303. "Umacron",
  35304. 0x016a,
  35305. "Umacroncyrillic",
  35306. 0x04ee,
  35307. "Umacrondieresis",
  35308. 0x1e7a,
  35309. "Umonospace",
  35310. 0xff35,
  35311. "Uogonek",
  35312. 0x0172,
  35313. "Upsilon",
  35314. 0x03a5,
  35315. "Upsilon1",
  35316. 0x03d2,
  35317. "Upsilonacutehooksymbolgreek",
  35318. 0x03d3,
  35319. "Upsilonafrican",
  35320. 0x01b1,
  35321. "Upsilondieresis",
  35322. 0x03ab,
  35323. "Upsilondieresishooksymbolgreek",
  35324. 0x03d4,
  35325. "Upsilonhooksymbol",
  35326. 0x03d2,
  35327. "Upsilontonos",
  35328. 0x038e,
  35329. "Uring",
  35330. 0x016e,
  35331. "Ushortcyrillic",
  35332. 0x040e,
  35333. "Usmall",
  35334. 0xf775,
  35335. "Ustraightcyrillic",
  35336. 0x04ae,
  35337. "Ustraightstrokecyrillic",
  35338. 0x04b0,
  35339. "Utilde",
  35340. 0x0168,
  35341. "Utildeacute",
  35342. 0x1e78,
  35343. "Utildebelow",
  35344. 0x1e74,
  35345. "V",
  35346. 0x0056,
  35347. "Vcircle",
  35348. 0x24cb,
  35349. "Vdotbelow",
  35350. 0x1e7e,
  35351. "Vecyrillic",
  35352. 0x0412,
  35353. "Vewarmenian",
  35354. 0x054e,
  35355. "Vhook",
  35356. 0x01b2,
  35357. "Vmonospace",
  35358. 0xff36,
  35359. "Voarmenian",
  35360. 0x0548,
  35361. "Vsmall",
  35362. 0xf776,
  35363. "Vtilde",
  35364. 0x1e7c,
  35365. "W",
  35366. 0x0057,
  35367. "Wacute",
  35368. 0x1e82,
  35369. "Wcircle",
  35370. 0x24cc,
  35371. "Wcircumflex",
  35372. 0x0174,
  35373. "Wdieresis",
  35374. 0x1e84,
  35375. "Wdotaccent",
  35376. 0x1e86,
  35377. "Wdotbelow",
  35378. 0x1e88,
  35379. "Wgrave",
  35380. 0x1e80,
  35381. "Wmonospace",
  35382. 0xff37,
  35383. "Wsmall",
  35384. 0xf777,
  35385. "X",
  35386. 0x0058,
  35387. "Xcircle",
  35388. 0x24cd,
  35389. "Xdieresis",
  35390. 0x1e8c,
  35391. "Xdotaccent",
  35392. 0x1e8a,
  35393. "Xeharmenian",
  35394. 0x053d,
  35395. "Xi",
  35396. 0x039e,
  35397. "Xmonospace",
  35398. 0xff38,
  35399. "Xsmall",
  35400. 0xf778,
  35401. "Y",
  35402. 0x0059,
  35403. "Yacute",
  35404. 0x00dd,
  35405. "Yacutesmall",
  35406. 0xf7fd,
  35407. "Yatcyrillic",
  35408. 0x0462,
  35409. "Ycircle",
  35410. 0x24ce,
  35411. "Ycircumflex",
  35412. 0x0176,
  35413. "Ydieresis",
  35414. 0x0178,
  35415. "Ydieresissmall",
  35416. 0xf7ff,
  35417. "Ydotaccent",
  35418. 0x1e8e,
  35419. "Ydotbelow",
  35420. 0x1ef4,
  35421. "Yericyrillic",
  35422. 0x042b,
  35423. "Yerudieresiscyrillic",
  35424. 0x04f8,
  35425. "Ygrave",
  35426. 0x1ef2,
  35427. "Yhook",
  35428. 0x01b3,
  35429. "Yhookabove",
  35430. 0x1ef6,
  35431. "Yiarmenian",
  35432. 0x0545,
  35433. "Yicyrillic",
  35434. 0x0407,
  35435. "Yiwnarmenian",
  35436. 0x0552,
  35437. "Ymonospace",
  35438. 0xff39,
  35439. "Ysmall",
  35440. 0xf779,
  35441. "Ytilde",
  35442. 0x1ef8,
  35443. "Yusbigcyrillic",
  35444. 0x046a,
  35445. "Yusbigiotifiedcyrillic",
  35446. 0x046c,
  35447. "Yuslittlecyrillic",
  35448. 0x0466,
  35449. "Yuslittleiotifiedcyrillic",
  35450. 0x0468,
  35451. "Z",
  35452. 0x005a,
  35453. "Zaarmenian",
  35454. 0x0536,
  35455. "Zacute",
  35456. 0x0179,
  35457. "Zcaron",
  35458. 0x017d,
  35459. "Zcaronsmall",
  35460. 0xf6ff,
  35461. "Zcircle",
  35462. 0x24cf,
  35463. "Zcircumflex",
  35464. 0x1e90,
  35465. "Zdot",
  35466. 0x017b,
  35467. "Zdotaccent",
  35468. 0x017b,
  35469. "Zdotbelow",
  35470. 0x1e92,
  35471. "Zecyrillic",
  35472. 0x0417,
  35473. "Zedescendercyrillic",
  35474. 0x0498,
  35475. "Zedieresiscyrillic",
  35476. 0x04de,
  35477. "Zeta",
  35478. 0x0396,
  35479. "Zhearmenian",
  35480. 0x053a,
  35481. "Zhebrevecyrillic",
  35482. 0x04c1,
  35483. "Zhecyrillic",
  35484. 0x0416,
  35485. "Zhedescendercyrillic",
  35486. 0x0496,
  35487. "Zhedieresiscyrillic",
  35488. 0x04dc,
  35489. "Zlinebelow",
  35490. 0x1e94,
  35491. "Zmonospace",
  35492. 0xff3a,
  35493. "Zsmall",
  35494. 0xf77a,
  35495. "Zstroke",
  35496. 0x01b5,
  35497. "a",
  35498. 0x0061,
  35499. "aabengali",
  35500. 0x0986,
  35501. "aacute",
  35502. 0x00e1,
  35503. "aadeva",
  35504. 0x0906,
  35505. "aagujarati",
  35506. 0x0a86,
  35507. "aagurmukhi",
  35508. 0x0a06,
  35509. "aamatragurmukhi",
  35510. 0x0a3e,
  35511. "aarusquare",
  35512. 0x3303,
  35513. "aavowelsignbengali",
  35514. 0x09be,
  35515. "aavowelsigndeva",
  35516. 0x093e,
  35517. "aavowelsigngujarati",
  35518. 0x0abe,
  35519. "abbreviationmarkarmenian",
  35520. 0x055f,
  35521. "abbreviationsigndeva",
  35522. 0x0970,
  35523. "abengali",
  35524. 0x0985,
  35525. "abopomofo",
  35526. 0x311a,
  35527. "abreve",
  35528. 0x0103,
  35529. "abreveacute",
  35530. 0x1eaf,
  35531. "abrevecyrillic",
  35532. 0x04d1,
  35533. "abrevedotbelow",
  35534. 0x1eb7,
  35535. "abrevegrave",
  35536. 0x1eb1,
  35537. "abrevehookabove",
  35538. 0x1eb3,
  35539. "abrevetilde",
  35540. 0x1eb5,
  35541. "acaron",
  35542. 0x01ce,
  35543. "acircle",
  35544. 0x24d0,
  35545. "acircumflex",
  35546. 0x00e2,
  35547. "acircumflexacute",
  35548. 0x1ea5,
  35549. "acircumflexdotbelow",
  35550. 0x1ead,
  35551. "acircumflexgrave",
  35552. 0x1ea7,
  35553. "acircumflexhookabove",
  35554. 0x1ea9,
  35555. "acircumflextilde",
  35556. 0x1eab,
  35557. "acute",
  35558. 0x00b4,
  35559. "acutebelowcmb",
  35560. 0x0317,
  35561. "acutecmb",
  35562. 0x0301,
  35563. "acutecomb",
  35564. 0x0301,
  35565. "acutedeva",
  35566. 0x0954,
  35567. "acutelowmod",
  35568. 0x02cf,
  35569. "acutetonecmb",
  35570. 0x0341,
  35571. "acyrillic",
  35572. 0x0430,
  35573. "adblgrave",
  35574. 0x0201,
  35575. "addakgurmukhi",
  35576. 0x0a71,
  35577. "adeva",
  35578. 0x0905,
  35579. "adieresis",
  35580. 0x00e4,
  35581. "adieresiscyrillic",
  35582. 0x04d3,
  35583. "adieresismacron",
  35584. 0x01df,
  35585. "adotbelow",
  35586. 0x1ea1,
  35587. "adotmacron",
  35588. 0x01e1,
  35589. "ae",
  35590. 0x00e6,
  35591. "aeacute",
  35592. 0x01fd,
  35593. "aekorean",
  35594. 0x3150,
  35595. "aemacron",
  35596. 0x01e3,
  35597. "afii00208",
  35598. 0x2015,
  35599. "afii08941",
  35600. 0x20a4,
  35601. "afii10017",
  35602. 0x0410,
  35603. "afii10018",
  35604. 0x0411,
  35605. "afii10019",
  35606. 0x0412,
  35607. "afii10020",
  35608. 0x0413,
  35609. "afii10021",
  35610. 0x0414,
  35611. "afii10022",
  35612. 0x0415,
  35613. "afii10023",
  35614. 0x0401,
  35615. "afii10024",
  35616. 0x0416,
  35617. "afii10025",
  35618. 0x0417,
  35619. "afii10026",
  35620. 0x0418,
  35621. "afii10027",
  35622. 0x0419,
  35623. "afii10028",
  35624. 0x041a,
  35625. "afii10029",
  35626. 0x041b,
  35627. "afii10030",
  35628. 0x041c,
  35629. "afii10031",
  35630. 0x041d,
  35631. "afii10032",
  35632. 0x041e,
  35633. "afii10033",
  35634. 0x041f,
  35635. "afii10034",
  35636. 0x0420,
  35637. "afii10035",
  35638. 0x0421,
  35639. "afii10036",
  35640. 0x0422,
  35641. "afii10037",
  35642. 0x0423,
  35643. "afii10038",
  35644. 0x0424,
  35645. "afii10039",
  35646. 0x0425,
  35647. "afii10040",
  35648. 0x0426,
  35649. "afii10041",
  35650. 0x0427,
  35651. "afii10042",
  35652. 0x0428,
  35653. "afii10043",
  35654. 0x0429,
  35655. "afii10044",
  35656. 0x042a,
  35657. "afii10045",
  35658. 0x042b,
  35659. "afii10046",
  35660. 0x042c,
  35661. "afii10047",
  35662. 0x042d,
  35663. "afii10048",
  35664. 0x042e,
  35665. "afii10049",
  35666. 0x042f,
  35667. "afii10050",
  35668. 0x0490,
  35669. "afii10051",
  35670. 0x0402,
  35671. "afii10052",
  35672. 0x0403,
  35673. "afii10053",
  35674. 0x0404,
  35675. "afii10054",
  35676. 0x0405,
  35677. "afii10055",
  35678. 0x0406,
  35679. "afii10056",
  35680. 0x0407,
  35681. "afii10057",
  35682. 0x0408,
  35683. "afii10058",
  35684. 0x0409,
  35685. "afii10059",
  35686. 0x040a,
  35687. "afii10060",
  35688. 0x040b,
  35689. "afii10061",
  35690. 0x040c,
  35691. "afii10062",
  35692. 0x040e,
  35693. "afii10063",
  35694. 0xf6c4,
  35695. "afii10064",
  35696. 0xf6c5,
  35697. "afii10065",
  35698. 0x0430,
  35699. "afii10066",
  35700. 0x0431,
  35701. "afii10067",
  35702. 0x0432,
  35703. "afii10068",
  35704. 0x0433,
  35705. "afii10069",
  35706. 0x0434,
  35707. "afii10070",
  35708. 0x0435,
  35709. "afii10071",
  35710. 0x0451,
  35711. "afii10072",
  35712. 0x0436,
  35713. "afii10073",
  35714. 0x0437,
  35715. "afii10074",
  35716. 0x0438,
  35717. "afii10075",
  35718. 0x0439,
  35719. "afii10076",
  35720. 0x043a,
  35721. "afii10077",
  35722. 0x043b,
  35723. "afii10078",
  35724. 0x043c,
  35725. "afii10079",
  35726. 0x043d,
  35727. "afii10080",
  35728. 0x043e,
  35729. "afii10081",
  35730. 0x043f,
  35731. "afii10082",
  35732. 0x0440,
  35733. "afii10083",
  35734. 0x0441,
  35735. "afii10084",
  35736. 0x0442,
  35737. "afii10085",
  35738. 0x0443,
  35739. "afii10086",
  35740. 0x0444,
  35741. "afii10087",
  35742. 0x0445,
  35743. "afii10088",
  35744. 0x0446,
  35745. "afii10089",
  35746. 0x0447,
  35747. "afii10090",
  35748. 0x0448,
  35749. "afii10091",
  35750. 0x0449,
  35751. "afii10092",
  35752. 0x044a,
  35753. "afii10093",
  35754. 0x044b,
  35755. "afii10094",
  35756. 0x044c,
  35757. "afii10095",
  35758. 0x044d,
  35759. "afii10096",
  35760. 0x044e,
  35761. "afii10097",
  35762. 0x044f,
  35763. "afii10098",
  35764. 0x0491,
  35765. "afii10099",
  35766. 0x0452,
  35767. "afii10100",
  35768. 0x0453,
  35769. "afii10101",
  35770. 0x0454,
  35771. "afii10102",
  35772. 0x0455,
  35773. "afii10103",
  35774. 0x0456,
  35775. "afii10104",
  35776. 0x0457,
  35777. "afii10105",
  35778. 0x0458,
  35779. "afii10106",
  35780. 0x0459,
  35781. "afii10107",
  35782. 0x045a,
  35783. "afii10108",
  35784. 0x045b,
  35785. "afii10109",
  35786. 0x045c,
  35787. "afii10110",
  35788. 0x045e,
  35789. "afii10145",
  35790. 0x040f,
  35791. "afii10146",
  35792. 0x0462,
  35793. "afii10147",
  35794. 0x0472,
  35795. "afii10148",
  35796. 0x0474,
  35797. "afii10192",
  35798. 0xf6c6,
  35799. "afii10193",
  35800. 0x045f,
  35801. "afii10194",
  35802. 0x0463,
  35803. "afii10195",
  35804. 0x0473,
  35805. "afii10196",
  35806. 0x0475,
  35807. "afii10831",
  35808. 0xf6c7,
  35809. "afii10832",
  35810. 0xf6c8,
  35811. "afii10846",
  35812. 0x04d9,
  35813. "afii299",
  35814. 0x200e,
  35815. "afii300",
  35816. 0x200f,
  35817. "afii301",
  35818. 0x200d,
  35819. "afii57381",
  35820. 0x066a,
  35821. "afii57388",
  35822. 0x060c,
  35823. "afii57392",
  35824. 0x0660,
  35825. "afii57393",
  35826. 0x0661,
  35827. "afii57394",
  35828. 0x0662,
  35829. "afii57395",
  35830. 0x0663,
  35831. "afii57396",
  35832. 0x0664,
  35833. "afii57397",
  35834. 0x0665,
  35835. "afii57398",
  35836. 0x0666,
  35837. "afii57399",
  35838. 0x0667,
  35839. "afii57400",
  35840. 0x0668,
  35841. "afii57401",
  35842. 0x0669,
  35843. "afii57403",
  35844. 0x061b,
  35845. "afii57407",
  35846. 0x061f,
  35847. "afii57409",
  35848. 0x0621,
  35849. "afii57410",
  35850. 0x0622,
  35851. "afii57411",
  35852. 0x0623,
  35853. "afii57412",
  35854. 0x0624,
  35855. "afii57413",
  35856. 0x0625,
  35857. "afii57414",
  35858. 0x0626,
  35859. "afii57415",
  35860. 0x0627,
  35861. "afii57416",
  35862. 0x0628,
  35863. "afii57417",
  35864. 0x0629,
  35865. "afii57418",
  35866. 0x062a,
  35867. "afii57419",
  35868. 0x062b,
  35869. "afii57420",
  35870. 0x062c,
  35871. "afii57421",
  35872. 0x062d,
  35873. "afii57422",
  35874. 0x062e,
  35875. "afii57423",
  35876. 0x062f,
  35877. "afii57424",
  35878. 0x0630,
  35879. "afii57425",
  35880. 0x0631,
  35881. "afii57426",
  35882. 0x0632,
  35883. "afii57427",
  35884. 0x0633,
  35885. "afii57428",
  35886. 0x0634,
  35887. "afii57429",
  35888. 0x0635,
  35889. "afii57430",
  35890. 0x0636,
  35891. "afii57431",
  35892. 0x0637,
  35893. "afii57432",
  35894. 0x0638,
  35895. "afii57433",
  35896. 0x0639,
  35897. "afii57434",
  35898. 0x063a,
  35899. "afii57440",
  35900. 0x0640,
  35901. "afii57441",
  35902. 0x0641,
  35903. "afii57442",
  35904. 0x0642,
  35905. "afii57443",
  35906. 0x0643,
  35907. "afii57444",
  35908. 0x0644,
  35909. "afii57445",
  35910. 0x0645,
  35911. "afii57446",
  35912. 0x0646,
  35913. "afii57448",
  35914. 0x0648,
  35915. "afii57449",
  35916. 0x0649,
  35917. "afii57450",
  35918. 0x064a,
  35919. "afii57451",
  35920. 0x064b,
  35921. "afii57452",
  35922. 0x064c,
  35923. "afii57453",
  35924. 0x064d,
  35925. "afii57454",
  35926. 0x064e,
  35927. "afii57455",
  35928. 0x064f,
  35929. "afii57456",
  35930. 0x0650,
  35931. "afii57457",
  35932. 0x0651,
  35933. "afii57458",
  35934. 0x0652,
  35935. "afii57470",
  35936. 0x0647,
  35937. "afii57505",
  35938. 0x06a4,
  35939. "afii57506",
  35940. 0x067e,
  35941. "afii57507",
  35942. 0x0686,
  35943. "afii57508",
  35944. 0x0698,
  35945. "afii57509",
  35946. 0x06af,
  35947. "afii57511",
  35948. 0x0679,
  35949. "afii57512",
  35950. 0x0688,
  35951. "afii57513",
  35952. 0x0691,
  35953. "afii57514",
  35954. 0x06ba,
  35955. "afii57519",
  35956. 0x06d2,
  35957. "afii57534",
  35958. 0x06d5,
  35959. "afii57636",
  35960. 0x20aa,
  35961. "afii57645",
  35962. 0x05be,
  35963. "afii57658",
  35964. 0x05c3,
  35965. "afii57664",
  35966. 0x05d0,
  35967. "afii57665",
  35968. 0x05d1,
  35969. "afii57666",
  35970. 0x05d2,
  35971. "afii57667",
  35972. 0x05d3,
  35973. "afii57668",
  35974. 0x05d4,
  35975. "afii57669",
  35976. 0x05d5,
  35977. "afii57670",
  35978. 0x05d6,
  35979. "afii57671",
  35980. 0x05d7,
  35981. "afii57672",
  35982. 0x05d8,
  35983. "afii57673",
  35984. 0x05d9,
  35985. "afii57674",
  35986. 0x05da,
  35987. "afii57675",
  35988. 0x05db,
  35989. "afii57676",
  35990. 0x05dc,
  35991. "afii57677",
  35992. 0x05dd,
  35993. "afii57678",
  35994. 0x05de,
  35995. "afii57679",
  35996. 0x05df,
  35997. "afii57680",
  35998. 0x05e0,
  35999. "afii57681",
  36000. 0x05e1,
  36001. "afii57682",
  36002. 0x05e2,
  36003. "afii57683",
  36004. 0x05e3,
  36005. "afii57684",
  36006. 0x05e4,
  36007. "afii57685",
  36008. 0x05e5,
  36009. "afii57686",
  36010. 0x05e6,
  36011. "afii57687",
  36012. 0x05e7,
  36013. "afii57688",
  36014. 0x05e8,
  36015. "afii57689",
  36016. 0x05e9,
  36017. "afii57690",
  36018. 0x05ea,
  36019. "afii57694",
  36020. 0xfb2a,
  36021. "afii57695",
  36022. 0xfb2b,
  36023. "afii57700",
  36024. 0xfb4b,
  36025. "afii57705",
  36026. 0xfb1f,
  36027. "afii57716",
  36028. 0x05f0,
  36029. "afii57717",
  36030. 0x05f1,
  36031. "afii57718",
  36032. 0x05f2,
  36033. "afii57723",
  36034. 0xfb35,
  36035. "afii57793",
  36036. 0x05b4,
  36037. "afii57794",
  36038. 0x05b5,
  36039. "afii57795",
  36040. 0x05b6,
  36041. "afii57796",
  36042. 0x05bb,
  36043. "afii57797",
  36044. 0x05b8,
  36045. "afii57798",
  36046. 0x05b7,
  36047. "afii57799",
  36048. 0x05b0,
  36049. "afii57800",
  36050. 0x05b2,
  36051. "afii57801",
  36052. 0x05b1,
  36053. "afii57802",
  36054. 0x05b3,
  36055. "afii57803",
  36056. 0x05c2,
  36057. "afii57804",
  36058. 0x05c1,
  36059. "afii57806",
  36060. 0x05b9,
  36061. "afii57807",
  36062. 0x05bc,
  36063. "afii57839",
  36064. 0x05bd,
  36065. "afii57841",
  36066. 0x05bf,
  36067. "afii57842",
  36068. 0x05c0,
  36069. "afii57929",
  36070. 0x02bc,
  36071. "afii61248",
  36072. 0x2105,
  36073. "afii61289",
  36074. 0x2113,
  36075. "afii61352",
  36076. 0x2116,
  36077. "afii61573",
  36078. 0x202c,
  36079. "afii61574",
  36080. 0x202d,
  36081. "afii61575",
  36082. 0x202e,
  36083. "afii61664",
  36084. 0x200c,
  36085. "afii63167",
  36086. 0x066d,
  36087. "afii64937",
  36088. 0x02bd,
  36089. "agrave",
  36090. 0x00e0,
  36091. "agujarati",
  36092. 0x0a85,
  36093. "agurmukhi",
  36094. 0x0a05,
  36095. "ahiragana",
  36096. 0x3042,
  36097. "ahookabove",
  36098. 0x1ea3,
  36099. "aibengali",
  36100. 0x0990,
  36101. "aibopomofo",
  36102. 0x311e,
  36103. "aideva",
  36104. 0x0910,
  36105. "aiecyrillic",
  36106. 0x04d5,
  36107. "aigujarati",
  36108. 0x0a90,
  36109. "aigurmukhi",
  36110. 0x0a10,
  36111. "aimatragurmukhi",
  36112. 0x0a48,
  36113. "ainarabic",
  36114. 0x0639,
  36115. "ainfinalarabic",
  36116. 0xfeca,
  36117. "aininitialarabic",
  36118. 0xfecb,
  36119. "ainmedialarabic",
  36120. 0xfecc,
  36121. "ainvertedbreve",
  36122. 0x0203,
  36123. "aivowelsignbengali",
  36124. 0x09c8,
  36125. "aivowelsigndeva",
  36126. 0x0948,
  36127. "aivowelsigngujarati",
  36128. 0x0ac8,
  36129. "akatakana",
  36130. 0x30a2,
  36131. "akatakanahalfwidth",
  36132. 0xff71,
  36133. "akorean",
  36134. 0x314f,
  36135. "alef",
  36136. 0x05d0,
  36137. "alefarabic",
  36138. 0x0627,
  36139. "alefdageshhebrew",
  36140. 0xfb30,
  36141. "aleffinalarabic",
  36142. 0xfe8e,
  36143. "alefhamzaabovearabic",
  36144. 0x0623,
  36145. "alefhamzaabovefinalarabic",
  36146. 0xfe84,
  36147. "alefhamzabelowarabic",
  36148. 0x0625,
  36149. "alefhamzabelowfinalarabic",
  36150. 0xfe88,
  36151. "alefhebrew",
  36152. 0x05d0,
  36153. "aleflamedhebrew",
  36154. 0xfb4f,
  36155. "alefmaddaabovearabic",
  36156. 0x0622,
  36157. "alefmaddaabovefinalarabic",
  36158. 0xfe82,
  36159. "alefmaksuraarabic",
  36160. 0x0649,
  36161. "alefmaksurafinalarabic",
  36162. 0xfef0,
  36163. "alefmaksurainitialarabic",
  36164. 0xfef3,
  36165. "alefmaksuramedialarabic",
  36166. 0xfef4,
  36167. "alefpatahhebrew",
  36168. 0xfb2e,
  36169. "alefqamatshebrew",
  36170. 0xfb2f,
  36171. "aleph",
  36172. 0x2135,
  36173. "allequal",
  36174. 0x224c,
  36175. "alpha",
  36176. 0x03b1,
  36177. "alphatonos",
  36178. 0x03ac,
  36179. "amacron",
  36180. 0x0101,
  36181. "amonospace",
  36182. 0xff41,
  36183. "ampersand",
  36184. 0x0026,
  36185. "ampersandmonospace",
  36186. 0xff06,
  36187. "ampersandsmall",
  36188. 0xf726,
  36189. "amsquare",
  36190. 0x33c2,
  36191. "anbopomofo",
  36192. 0x3122,
  36193. "angbopomofo",
  36194. 0x3124,
  36195. "angbracketleft",
  36196. 0x3008,
  36197. "angbracketright",
  36198. 0x3009,
  36199. "angkhankhuthai",
  36200. 0x0e5a,
  36201. "angle",
  36202. 0x2220,
  36203. "anglebracketleft",
  36204. 0x3008,
  36205. "anglebracketleftvertical",
  36206. 0xfe3f,
  36207. "anglebracketright",
  36208. 0x3009,
  36209. "anglebracketrightvertical",
  36210. 0xfe40,
  36211. "angleleft",
  36212. 0x2329,
  36213. "angleright",
  36214. 0x232a,
  36215. "angstrom",
  36216. 0x212b,
  36217. "anoteleia",
  36218. 0x0387,
  36219. "anudattadeva",
  36220. 0x0952,
  36221. "anusvarabengali",
  36222. 0x0982,
  36223. "anusvaradeva",
  36224. 0x0902,
  36225. "anusvaragujarati",
  36226. 0x0a82,
  36227. "aogonek",
  36228. 0x0105,
  36229. "apaatosquare",
  36230. 0x3300,
  36231. "aparen",
  36232. 0x249c,
  36233. "apostrophearmenian",
  36234. 0x055a,
  36235. "apostrophemod",
  36236. 0x02bc,
  36237. "apple",
  36238. 0xf8ff,
  36239. "approaches",
  36240. 0x2250,
  36241. "approxequal",
  36242. 0x2248,
  36243. "approxequalorimage",
  36244. 0x2252,
  36245. "approximatelyequal",
  36246. 0x2245,
  36247. "araeaekorean",
  36248. 0x318e,
  36249. "araeakorean",
  36250. 0x318d,
  36251. "arc",
  36252. 0x2312,
  36253. "arighthalfring",
  36254. 0x1e9a,
  36255. "aring",
  36256. 0x00e5,
  36257. "aringacute",
  36258. 0x01fb,
  36259. "aringbelow",
  36260. 0x1e01,
  36261. "arrowboth",
  36262. 0x2194,
  36263. "arrowdashdown",
  36264. 0x21e3,
  36265. "arrowdashleft",
  36266. 0x21e0,
  36267. "arrowdashright",
  36268. 0x21e2,
  36269. "arrowdashup",
  36270. 0x21e1,
  36271. "arrowdblboth",
  36272. 0x21d4,
  36273. "arrowdbldown",
  36274. 0x21d3,
  36275. "arrowdblleft",
  36276. 0x21d0,
  36277. "arrowdblright",
  36278. 0x21d2,
  36279. "arrowdblup",
  36280. 0x21d1,
  36281. "arrowdown",
  36282. 0x2193,
  36283. "arrowdownleft",
  36284. 0x2199,
  36285. "arrowdownright",
  36286. 0x2198,
  36287. "arrowdownwhite",
  36288. 0x21e9,
  36289. "arrowheaddownmod",
  36290. 0x02c5,
  36291. "arrowheadleftmod",
  36292. 0x02c2,
  36293. "arrowheadrightmod",
  36294. 0x02c3,
  36295. "arrowheadupmod",
  36296. 0x02c4,
  36297. "arrowhorizex",
  36298. 0xf8e7,
  36299. "arrowleft",
  36300. 0x2190,
  36301. "arrowleftdbl",
  36302. 0x21d0,
  36303. "arrowleftdblstroke",
  36304. 0x21cd,
  36305. "arrowleftoverright",
  36306. 0x21c6,
  36307. "arrowleftwhite",
  36308. 0x21e6,
  36309. "arrowright",
  36310. 0x2192,
  36311. "arrowrightdblstroke",
  36312. 0x21cf,
  36313. "arrowrightheavy",
  36314. 0x279e,
  36315. "arrowrightoverleft",
  36316. 0x21c4,
  36317. "arrowrightwhite",
  36318. 0x21e8,
  36319. "arrowtableft",
  36320. 0x21e4,
  36321. "arrowtabright",
  36322. 0x21e5,
  36323. "arrowup",
  36324. 0x2191,
  36325. "arrowupdn",
  36326. 0x2195,
  36327. "arrowupdnbse",
  36328. 0x21a8,
  36329. "arrowupdownbase",
  36330. 0x21a8,
  36331. "arrowupleft",
  36332. 0x2196,
  36333. "arrowupleftofdown",
  36334. 0x21c5,
  36335. "arrowupright",
  36336. 0x2197,
  36337. "arrowupwhite",
  36338. 0x21e7,
  36339. "arrowvertex",
  36340. 0xf8e6,
  36341. "asciicircum",
  36342. 0x005e,
  36343. "asciicircummonospace",
  36344. 0xff3e,
  36345. "asciitilde",
  36346. 0x007e,
  36347. "asciitildemonospace",
  36348. 0xff5e,
  36349. "ascript",
  36350. 0x0251,
  36351. "ascriptturned",
  36352. 0x0252,
  36353. "asmallhiragana",
  36354. 0x3041,
  36355. "asmallkatakana",
  36356. 0x30a1,
  36357. "asmallkatakanahalfwidth",
  36358. 0xff67,
  36359. "asterisk",
  36360. 0x002a,
  36361. "asteriskaltonearabic",
  36362. 0x066d,
  36363. "asteriskarabic",
  36364. 0x066d,
  36365. "asteriskmath",
  36366. 0x2217,
  36367. "asteriskmonospace",
  36368. 0xff0a,
  36369. "asterisksmall",
  36370. 0xfe61,
  36371. "asterism",
  36372. 0x2042,
  36373. "asuperior",
  36374. 0xf6e9,
  36375. "asymptoticallyequal",
  36376. 0x2243,
  36377. "at",
  36378. 0x0040,
  36379. "atilde",
  36380. 0x00e3,
  36381. "atmonospace",
  36382. 0xff20,
  36383. "atsmall",
  36384. 0xfe6b,
  36385. "aturned",
  36386. 0x0250,
  36387. "aubengali",
  36388. 0x0994,
  36389. "aubopomofo",
  36390. 0x3120,
  36391. "audeva",
  36392. 0x0914,
  36393. "augujarati",
  36394. 0x0a94,
  36395. "augurmukhi",
  36396. 0x0a14,
  36397. "aulengthmarkbengali",
  36398. 0x09d7,
  36399. "aumatragurmukhi",
  36400. 0x0a4c,
  36401. "auvowelsignbengali",
  36402. 0x09cc,
  36403. "auvowelsigndeva",
  36404. 0x094c,
  36405. "auvowelsigngujarati",
  36406. 0x0acc,
  36407. "avagrahadeva",
  36408. 0x093d,
  36409. "aybarmenian",
  36410. 0x0561,
  36411. "ayin",
  36412. 0x05e2,
  36413. "ayinaltonehebrew",
  36414. 0xfb20,
  36415. "ayinhebrew",
  36416. 0x05e2,
  36417. "b",
  36418. 0x0062,
  36419. "babengali",
  36420. 0x09ac,
  36421. "backslash",
  36422. 0x005c,
  36423. "backslashmonospace",
  36424. 0xff3c,
  36425. "badeva",
  36426. 0x092c,
  36427. "bagujarati",
  36428. 0x0aac,
  36429. "bagurmukhi",
  36430. 0x0a2c,
  36431. "bahiragana",
  36432. 0x3070,
  36433. "bahtthai",
  36434. 0x0e3f,
  36435. "bakatakana",
  36436. 0x30d0,
  36437. "bar",
  36438. 0x007c,
  36439. "barmonospace",
  36440. 0xff5c,
  36441. "bbopomofo",
  36442. 0x3105,
  36443. "bcircle",
  36444. 0x24d1,
  36445. "bdotaccent",
  36446. 0x1e03,
  36447. "bdotbelow",
  36448. 0x1e05,
  36449. "beamedsixteenthnotes",
  36450. 0x266c,
  36451. "because",
  36452. 0x2235,
  36453. "becyrillic",
  36454. 0x0431,
  36455. "beharabic",
  36456. 0x0628,
  36457. "behfinalarabic",
  36458. 0xfe90,
  36459. "behinitialarabic",
  36460. 0xfe91,
  36461. "behiragana",
  36462. 0x3079,
  36463. "behmedialarabic",
  36464. 0xfe92,
  36465. "behmeeminitialarabic",
  36466. 0xfc9f,
  36467. "behmeemisolatedarabic",
  36468. 0xfc08,
  36469. "behnoonfinalarabic",
  36470. 0xfc6d,
  36471. "bekatakana",
  36472. 0x30d9,
  36473. "benarmenian",
  36474. 0x0562,
  36475. "bet",
  36476. 0x05d1,
  36477. "beta",
  36478. 0x03b2,
  36479. "betasymbolgreek",
  36480. 0x03d0,
  36481. "betdagesh",
  36482. 0xfb31,
  36483. "betdageshhebrew",
  36484. 0xfb31,
  36485. "bethebrew",
  36486. 0x05d1,
  36487. "betrafehebrew",
  36488. 0xfb4c,
  36489. "bhabengali",
  36490. 0x09ad,
  36491. "bhadeva",
  36492. 0x092d,
  36493. "bhagujarati",
  36494. 0x0aad,
  36495. "bhagurmukhi",
  36496. 0x0a2d,
  36497. "bhook",
  36498. 0x0253,
  36499. "bihiragana",
  36500. 0x3073,
  36501. "bikatakana",
  36502. 0x30d3,
  36503. "bilabialclick",
  36504. 0x0298,
  36505. "bindigurmukhi",
  36506. 0x0a02,
  36507. "birusquare",
  36508. 0x3331,
  36509. "blackcircle",
  36510. 0x25cf,
  36511. "blackdiamond",
  36512. 0x25c6,
  36513. "blackdownpointingtriangle",
  36514. 0x25bc,
  36515. "blackleftpointingpointer",
  36516. 0x25c4,
  36517. "blackleftpointingtriangle",
  36518. 0x25c0,
  36519. "blacklenticularbracketleft",
  36520. 0x3010,
  36521. "blacklenticularbracketleftvertical",
  36522. 0xfe3b,
  36523. "blacklenticularbracketright",
  36524. 0x3011,
  36525. "blacklenticularbracketrightvertical",
  36526. 0xfe3c,
  36527. "blacklowerlefttriangle",
  36528. 0x25e3,
  36529. "blacklowerrighttriangle",
  36530. 0x25e2,
  36531. "blackrectangle",
  36532. 0x25ac,
  36533. "blackrightpointingpointer",
  36534. 0x25ba,
  36535. "blackrightpointingtriangle",
  36536. 0x25b6,
  36537. "blacksmallsquare",
  36538. 0x25aa,
  36539. "blacksmilingface",
  36540. 0x263b,
  36541. "blacksquare",
  36542. 0x25a0,
  36543. "blackstar",
  36544. 0x2605,
  36545. "blackupperlefttriangle",
  36546. 0x25e4,
  36547. "blackupperrighttriangle",
  36548. 0x25e5,
  36549. "blackuppointingsmalltriangle",
  36550. 0x25b4,
  36551. "blackuppointingtriangle",
  36552. 0x25b2,
  36553. "blank",
  36554. 0x2423,
  36555. "blinebelow",
  36556. 0x1e07,
  36557. "block",
  36558. 0x2588,
  36559. "bmonospace",
  36560. 0xff42,
  36561. "bobaimaithai",
  36562. 0x0e1a,
  36563. "bohiragana",
  36564. 0x307c,
  36565. "bokatakana",
  36566. 0x30dc,
  36567. "bparen",
  36568. 0x249d,
  36569. "bqsquare",
  36570. 0x33c3,
  36571. "braceex",
  36572. 0xf8f4,
  36573. "braceleft",
  36574. 0x007b,
  36575. "braceleftbt",
  36576. 0xf8f3,
  36577. "braceleftmid",
  36578. 0xf8f2,
  36579. "braceleftmonospace",
  36580. 0xff5b,
  36581. "braceleftsmall",
  36582. 0xfe5b,
  36583. "bracelefttp",
  36584. 0xf8f1,
  36585. "braceleftvertical",
  36586. 0xfe37,
  36587. "braceright",
  36588. 0x007d,
  36589. "bracerightbt",
  36590. 0xf8fe,
  36591. "bracerightmid",
  36592. 0xf8fd,
  36593. "bracerightmonospace",
  36594. 0xff5d,
  36595. "bracerightsmall",
  36596. 0xfe5c,
  36597. "bracerighttp",
  36598. 0xf8fc,
  36599. "bracerightvertical",
  36600. 0xfe38,
  36601. "bracketleft",
  36602. 0x005b,
  36603. "bracketleftbt",
  36604. 0xf8f0,
  36605. "bracketleftex",
  36606. 0xf8ef,
  36607. "bracketleftmonospace",
  36608. 0xff3b,
  36609. "bracketlefttp",
  36610. 0xf8ee,
  36611. "bracketright",
  36612. 0x005d,
  36613. "bracketrightbt",
  36614. 0xf8fb,
  36615. "bracketrightex",
  36616. 0xf8fa,
  36617. "bracketrightmonospace",
  36618. 0xff3d,
  36619. "bracketrighttp",
  36620. 0xf8f9,
  36621. "breve",
  36622. 0x02d8,
  36623. "brevebelowcmb",
  36624. 0x032e,
  36625. "brevecmb",
  36626. 0x0306,
  36627. "breveinvertedbelowcmb",
  36628. 0x032f,
  36629. "breveinvertedcmb",
  36630. 0x0311,
  36631. "breveinverteddoublecmb",
  36632. 0x0361,
  36633. "bridgebelowcmb",
  36634. 0x032a,
  36635. "bridgeinvertedbelowcmb",
  36636. 0x033a,
  36637. "brokenbar",
  36638. 0x00a6,
  36639. "bstroke",
  36640. 0x0180,
  36641. "bsuperior",
  36642. 0xf6ea,
  36643. "btopbar",
  36644. 0x0183,
  36645. "buhiragana",
  36646. 0x3076,
  36647. "bukatakana",
  36648. 0x30d6,
  36649. "bullet",
  36650. 0x2022,
  36651. "bulletinverse",
  36652. 0x25d8,
  36653. "bulletoperator",
  36654. 0x2219,
  36655. "bullseye",
  36656. 0x25ce,
  36657. "c",
  36658. 0x0063,
  36659. "caarmenian",
  36660. 0x056e,
  36661. "cabengali",
  36662. 0x099a,
  36663. "cacute",
  36664. 0x0107,
  36665. "cadeva",
  36666. 0x091a,
  36667. "cagujarati",
  36668. 0x0a9a,
  36669. "cagurmukhi",
  36670. 0x0a1a,
  36671. "calsquare",
  36672. 0x3388,
  36673. "candrabindubengali",
  36674. 0x0981,
  36675. "candrabinducmb",
  36676. 0x0310,
  36677. "candrabindudeva",
  36678. 0x0901,
  36679. "candrabindugujarati",
  36680. 0x0a81,
  36681. "capslock",
  36682. 0x21ea,
  36683. "careof",
  36684. 0x2105,
  36685. "caron",
  36686. 0x02c7,
  36687. "caronbelowcmb",
  36688. 0x032c,
  36689. "caroncmb",
  36690. 0x030c,
  36691. "carriagereturn",
  36692. 0x21b5,
  36693. "cbopomofo",
  36694. 0x3118,
  36695. "ccaron",
  36696. 0x010d,
  36697. "ccedilla",
  36698. 0x00e7,
  36699. "ccedillaacute",
  36700. 0x1e09,
  36701. "ccircle",
  36702. 0x24d2,
  36703. "ccircumflex",
  36704. 0x0109,
  36705. "ccurl",
  36706. 0x0255,
  36707. "cdot",
  36708. 0x010b,
  36709. "cdotaccent",
  36710. 0x010b,
  36711. "cdsquare",
  36712. 0x33c5,
  36713. "cedilla",
  36714. 0x00b8,
  36715. "cedillacmb",
  36716. 0x0327,
  36717. "cent",
  36718. 0x00a2,
  36719. "centigrade",
  36720. 0x2103,
  36721. "centinferior",
  36722. 0xf6df,
  36723. "centmonospace",
  36724. 0xffe0,
  36725. "centoldstyle",
  36726. 0xf7a2,
  36727. "centsuperior",
  36728. 0xf6e0,
  36729. "chaarmenian",
  36730. 0x0579,
  36731. "chabengali",
  36732. 0x099b,
  36733. "chadeva",
  36734. 0x091b,
  36735. "chagujarati",
  36736. 0x0a9b,
  36737. "chagurmukhi",
  36738. 0x0a1b,
  36739. "chbopomofo",
  36740. 0x3114,
  36741. "cheabkhasiancyrillic",
  36742. 0x04bd,
  36743. "checkmark",
  36744. 0x2713,
  36745. "checyrillic",
  36746. 0x0447,
  36747. "chedescenderabkhasiancyrillic",
  36748. 0x04bf,
  36749. "chedescendercyrillic",
  36750. 0x04b7,
  36751. "chedieresiscyrillic",
  36752. 0x04f5,
  36753. "cheharmenian",
  36754. 0x0573,
  36755. "chekhakassiancyrillic",
  36756. 0x04cc,
  36757. "cheverticalstrokecyrillic",
  36758. 0x04b9,
  36759. "chi",
  36760. 0x03c7,
  36761. "chieuchacirclekorean",
  36762. 0x3277,
  36763. "chieuchaparenkorean",
  36764. 0x3217,
  36765. "chieuchcirclekorean",
  36766. 0x3269,
  36767. "chieuchkorean",
  36768. 0x314a,
  36769. "chieuchparenkorean",
  36770. 0x3209,
  36771. "chochangthai",
  36772. 0x0e0a,
  36773. "chochanthai",
  36774. 0x0e08,
  36775. "chochingthai",
  36776. 0x0e09,
  36777. "chochoethai",
  36778. 0x0e0c,
  36779. "chook",
  36780. 0x0188,
  36781. "cieucacirclekorean",
  36782. 0x3276,
  36783. "cieucaparenkorean",
  36784. 0x3216,
  36785. "cieuccirclekorean",
  36786. 0x3268,
  36787. "cieuckorean",
  36788. 0x3148,
  36789. "cieucparenkorean",
  36790. 0x3208,
  36791. "cieucuparenkorean",
  36792. 0x321c,
  36793. "circle",
  36794. 0x25cb,
  36795. "circlecopyrt",
  36796. 0x00a9,
  36797. "circlemultiply",
  36798. 0x2297,
  36799. "circleot",
  36800. 0x2299,
  36801. "circleplus",
  36802. 0x2295,
  36803. "circlepostalmark",
  36804. 0x3036,
  36805. "circlewithlefthalfblack",
  36806. 0x25d0,
  36807. "circlewithrighthalfblack",
  36808. 0x25d1,
  36809. "circumflex",
  36810. 0x02c6,
  36811. "circumflexbelowcmb",
  36812. 0x032d,
  36813. "circumflexcmb",
  36814. 0x0302,
  36815. "clear",
  36816. 0x2327,
  36817. "clickalveolar",
  36818. 0x01c2,
  36819. "clickdental",
  36820. 0x01c0,
  36821. "clicklateral",
  36822. 0x01c1,
  36823. "clickretroflex",
  36824. 0x01c3,
  36825. "club",
  36826. 0x2663,
  36827. "clubsuitblack",
  36828. 0x2663,
  36829. "clubsuitwhite",
  36830. 0x2667,
  36831. "cmcubedsquare",
  36832. 0x33a4,
  36833. "cmonospace",
  36834. 0xff43,
  36835. "cmsquaredsquare",
  36836. 0x33a0,
  36837. "coarmenian",
  36838. 0x0581,
  36839. "colon",
  36840. 0x003a,
  36841. "colonmonetary",
  36842. 0x20a1,
  36843. "colonmonospace",
  36844. 0xff1a,
  36845. "colonsign",
  36846. 0x20a1,
  36847. "colonsmall",
  36848. 0xfe55,
  36849. "colontriangularhalfmod",
  36850. 0x02d1,
  36851. "colontriangularmod",
  36852. 0x02d0,
  36853. "comma",
  36854. 0x002c,
  36855. "commaabovecmb",
  36856. 0x0313,
  36857. "commaaboverightcmb",
  36858. 0x0315,
  36859. "commaaccent",
  36860. 0xf6c3,
  36861. "commaarabic",
  36862. 0x060c,
  36863. "commaarmenian",
  36864. 0x055d,
  36865. "commainferior",
  36866. 0xf6e1,
  36867. "commamonospace",
  36868. 0xff0c,
  36869. "commareversedabovecmb",
  36870. 0x0314,
  36871. "commareversedmod",
  36872. 0x02bd,
  36873. "commasmall",
  36874. 0xfe50,
  36875. "commasuperior",
  36876. 0xf6e2,
  36877. "commaturnedabovecmb",
  36878. 0x0312,
  36879. "commaturnedmod",
  36880. 0x02bb,
  36881. "compass",
  36882. 0x263c,
  36883. "congruent",
  36884. 0x2245,
  36885. "contourintegral",
  36886. 0x222e,
  36887. "control",
  36888. 0x2303,
  36889. "controlACK",
  36890. 0x0006,
  36891. "controlBEL",
  36892. 0x0007,
  36893. "controlBS",
  36894. 0x0008,
  36895. "controlCAN",
  36896. 0x0018,
  36897. "controlCR",
  36898. 0x000d,
  36899. "controlDC1",
  36900. 0x0011,
  36901. "controlDC2",
  36902. 0x0012,
  36903. "controlDC3",
  36904. 0x0013,
  36905. "controlDC4",
  36906. 0x0014,
  36907. "controlDEL",
  36908. 0x007f,
  36909. "controlDLE",
  36910. 0x0010,
  36911. "controlEM",
  36912. 0x0019,
  36913. "controlENQ",
  36914. 0x0005,
  36915. "controlEOT",
  36916. 0x0004,
  36917. "controlESC",
  36918. 0x001b,
  36919. "controlETB",
  36920. 0x0017,
  36921. "controlETX",
  36922. 0x0003,
  36923. "controlFF",
  36924. 0x000c,
  36925. "controlFS",
  36926. 0x001c,
  36927. "controlGS",
  36928. 0x001d,
  36929. "controlHT",
  36930. 0x0009,
  36931. "controlLF",
  36932. 0x000a,
  36933. "controlNAK",
  36934. 0x0015,
  36935. "controlNULL",
  36936. 0x0000,
  36937. "controlRS",
  36938. 0x001e,
  36939. "controlSI",
  36940. 0x000f,
  36941. "controlSO",
  36942. 0x000e,
  36943. "controlSOT",
  36944. 0x0002,
  36945. "controlSTX",
  36946. 0x0001,
  36947. "controlSUB",
  36948. 0x001a,
  36949. "controlSYN",
  36950. 0x0016,
  36951. "controlUS",
  36952. 0x001f,
  36953. "controlVT",
  36954. 0x000b,
  36955. "copyright",
  36956. 0x00a9,
  36957. "copyrightsans",
  36958. 0xf8e9,
  36959. "copyrightserif",
  36960. 0xf6d9,
  36961. "cornerbracketleft",
  36962. 0x300c,
  36963. "cornerbracketlefthalfwidth",
  36964. 0xff62,
  36965. "cornerbracketleftvertical",
  36966. 0xfe41,
  36967. "cornerbracketright",
  36968. 0x300d,
  36969. "cornerbracketrighthalfwidth",
  36970. 0xff63,
  36971. "cornerbracketrightvertical",
  36972. 0xfe42,
  36973. "corporationsquare",
  36974. 0x337f,
  36975. "cosquare",
  36976. 0x33c7,
  36977. "coverkgsquare",
  36978. 0x33c6,
  36979. "cparen",
  36980. 0x249e,
  36981. "cruzeiro",
  36982. 0x20a2,
  36983. "cstretched",
  36984. 0x0297,
  36985. "curlyand",
  36986. 0x22cf,
  36987. "curlyor",
  36988. 0x22ce,
  36989. "currency",
  36990. 0x00a4,
  36991. "cyrBreve",
  36992. 0xf6d1,
  36993. "cyrFlex",
  36994. 0xf6d2,
  36995. "cyrbreve",
  36996. 0xf6d4,
  36997. "cyrflex",
  36998. 0xf6d5,
  36999. "d",
  37000. 0x0064,
  37001. "daarmenian",
  37002. 0x0564,
  37003. "dabengali",
  37004. 0x09a6,
  37005. "dadarabic",
  37006. 0x0636,
  37007. "dadeva",
  37008. 0x0926,
  37009. "dadfinalarabic",
  37010. 0xfebe,
  37011. "dadinitialarabic",
  37012. 0xfebf,
  37013. "dadmedialarabic",
  37014. 0xfec0,
  37015. "dagesh",
  37016. 0x05bc,
  37017. "dageshhebrew",
  37018. 0x05bc,
  37019. "dagger",
  37020. 0x2020,
  37021. "daggerdbl",
  37022. 0x2021,
  37023. "dagujarati",
  37024. 0x0aa6,
  37025. "dagurmukhi",
  37026. 0x0a26,
  37027. "dahiragana",
  37028. 0x3060,
  37029. "dakatakana",
  37030. 0x30c0,
  37031. "dalarabic",
  37032. 0x062f,
  37033. "dalet",
  37034. 0x05d3,
  37035. "daletdagesh",
  37036. 0xfb33,
  37037. "daletdageshhebrew",
  37038. 0xfb33,
  37039. "dalethebrew",
  37040. 0x05d3,
  37041. "dalfinalarabic",
  37042. 0xfeaa,
  37043. "dammaarabic",
  37044. 0x064f,
  37045. "dammalowarabic",
  37046. 0x064f,
  37047. "dammatanaltonearabic",
  37048. 0x064c,
  37049. "dammatanarabic",
  37050. 0x064c,
  37051. "danda",
  37052. 0x0964,
  37053. "dargahebrew",
  37054. 0x05a7,
  37055. "dargalefthebrew",
  37056. 0x05a7,
  37057. "dasiapneumatacyrilliccmb",
  37058. 0x0485,
  37059. "dblGrave",
  37060. 0xf6d3,
  37061. "dblanglebracketleft",
  37062. 0x300a,
  37063. "dblanglebracketleftvertical",
  37064. 0xfe3d,
  37065. "dblanglebracketright",
  37066. 0x300b,
  37067. "dblanglebracketrightvertical",
  37068. 0xfe3e,
  37069. "dblarchinvertedbelowcmb",
  37070. 0x032b,
  37071. "dblarrowleft",
  37072. 0x21d4,
  37073. "dblarrowright",
  37074. 0x21d2,
  37075. "dbldanda",
  37076. 0x0965,
  37077. "dblgrave",
  37078. 0xf6d6,
  37079. "dblgravecmb",
  37080. 0x030f,
  37081. "dblintegral",
  37082. 0x222c,
  37083. "dbllowline",
  37084. 0x2017,
  37085. "dbllowlinecmb",
  37086. 0x0333,
  37087. "dbloverlinecmb",
  37088. 0x033f,
  37089. "dblprimemod",
  37090. 0x02ba,
  37091. "dblverticalbar",
  37092. 0x2016,
  37093. "dblverticallineabovecmb",
  37094. 0x030e,
  37095. "dbopomofo",
  37096. 0x3109,
  37097. "dbsquare",
  37098. 0x33c8,
  37099. "dcaron",
  37100. 0x010f,
  37101. "dcedilla",
  37102. 0x1e11,
  37103. "dcircle",
  37104. 0x24d3,
  37105. "dcircumflexbelow",
  37106. 0x1e13,
  37107. "dcroat",
  37108. 0x0111,
  37109. "ddabengali",
  37110. 0x09a1,
  37111. "ddadeva",
  37112. 0x0921,
  37113. "ddagujarati",
  37114. 0x0aa1,
  37115. "ddagurmukhi",
  37116. 0x0a21,
  37117. "ddalarabic",
  37118. 0x0688,
  37119. "ddalfinalarabic",
  37120. 0xfb89,
  37121. "dddhadeva",
  37122. 0x095c,
  37123. "ddhabengali",
  37124. 0x09a2,
  37125. "ddhadeva",
  37126. 0x0922,
  37127. "ddhagujarati",
  37128. 0x0aa2,
  37129. "ddhagurmukhi",
  37130. 0x0a22,
  37131. "ddotaccent",
  37132. 0x1e0b,
  37133. "ddotbelow",
  37134. 0x1e0d,
  37135. "decimalseparatorarabic",
  37136. 0x066b,
  37137. "decimalseparatorpersian",
  37138. 0x066b,
  37139. "decyrillic",
  37140. 0x0434,
  37141. "degree",
  37142. 0x00b0,
  37143. "dehihebrew",
  37144. 0x05ad,
  37145. "dehiragana",
  37146. 0x3067,
  37147. "deicoptic",
  37148. 0x03ef,
  37149. "dekatakana",
  37150. 0x30c7,
  37151. "deleteleft",
  37152. 0x232b,
  37153. "deleteright",
  37154. 0x2326,
  37155. "delta",
  37156. 0x03b4,
  37157. "deltaturned",
  37158. 0x018d,
  37159. "denominatorminusonenumeratorbengali",
  37160. 0x09f8,
  37161. "dezh",
  37162. 0x02a4,
  37163. "dhabengali",
  37164. 0x09a7,
  37165. "dhadeva",
  37166. 0x0927,
  37167. "dhagujarati",
  37168. 0x0aa7,
  37169. "dhagurmukhi",
  37170. 0x0a27,
  37171. "dhook",
  37172. 0x0257,
  37173. "dialytikatonos",
  37174. 0x0385,
  37175. "dialytikatonoscmb",
  37176. 0x0344,
  37177. "diamond",
  37178. 0x2666,
  37179. "diamondsuitwhite",
  37180. 0x2662,
  37181. "dieresis",
  37182. 0x00a8,
  37183. "dieresisacute",
  37184. 0xf6d7,
  37185. "dieresisbelowcmb",
  37186. 0x0324,
  37187. "dieresiscmb",
  37188. 0x0308,
  37189. "dieresisgrave",
  37190. 0xf6d8,
  37191. "dieresistonos",
  37192. 0x0385,
  37193. "dihiragana",
  37194. 0x3062,
  37195. "dikatakana",
  37196. 0x30c2,
  37197. "dittomark",
  37198. 0x3003,
  37199. "divide",
  37200. 0x00f7,
  37201. "divides",
  37202. 0x2223,
  37203. "divisionslash",
  37204. 0x2215,
  37205. "djecyrillic",
  37206. 0x0452,
  37207. "dkshade",
  37208. 0x2593,
  37209. "dlinebelow",
  37210. 0x1e0f,
  37211. "dlsquare",
  37212. 0x3397,
  37213. "dmacron",
  37214. 0x0111,
  37215. "dmonospace",
  37216. 0xff44,
  37217. "dnblock",
  37218. 0x2584,
  37219. "dochadathai",
  37220. 0x0e0e,
  37221. "dodekthai",
  37222. 0x0e14,
  37223. "dohiragana",
  37224. 0x3069,
  37225. "dokatakana",
  37226. 0x30c9,
  37227. "dollar",
  37228. 0x0024,
  37229. "dollarinferior",
  37230. 0xf6e3,
  37231. "dollarmonospace",
  37232. 0xff04,
  37233. "dollaroldstyle",
  37234. 0xf724,
  37235. "dollarsmall",
  37236. 0xfe69,
  37237. "dollarsuperior",
  37238. 0xf6e4,
  37239. "dong",
  37240. 0x20ab,
  37241. "dorusquare",
  37242. 0x3326,
  37243. "dotaccent",
  37244. 0x02d9,
  37245. "dotaccentcmb",
  37246. 0x0307,
  37247. "dotbelowcmb",
  37248. 0x0323,
  37249. "dotbelowcomb",
  37250. 0x0323,
  37251. "dotkatakana",
  37252. 0x30fb,
  37253. "dotlessi",
  37254. 0x0131,
  37255. "dotlessj",
  37256. 0xf6be,
  37257. "dotlessjstrokehook",
  37258. 0x0284,
  37259. "dotmath",
  37260. 0x22c5,
  37261. "dottedcircle",
  37262. 0x25cc,
  37263. "doubleyodpatah",
  37264. 0xfb1f,
  37265. "doubleyodpatahhebrew",
  37266. 0xfb1f,
  37267. "downtackbelowcmb",
  37268. 0x031e,
  37269. "downtackmod",
  37270. 0x02d5,
  37271. "dparen",
  37272. 0x249f,
  37273. "dsuperior",
  37274. 0xf6eb,
  37275. "dtail",
  37276. 0x0256,
  37277. "dtopbar",
  37278. 0x018c,
  37279. "duhiragana",
  37280. 0x3065,
  37281. "dukatakana",
  37282. 0x30c5,
  37283. "dz",
  37284. 0x01f3,
  37285. "dzaltone",
  37286. 0x02a3,
  37287. "dzcaron",
  37288. 0x01c6,
  37289. "dzcurl",
  37290. 0x02a5,
  37291. "dzeabkhasiancyrillic",
  37292. 0x04e1,
  37293. "dzecyrillic",
  37294. 0x0455,
  37295. "dzhecyrillic",
  37296. 0x045f,
  37297. "e",
  37298. 0x0065,
  37299. "eacute",
  37300. 0x00e9,
  37301. "earth",
  37302. 0x2641,
  37303. "ebengali",
  37304. 0x098f,
  37305. "ebopomofo",
  37306. 0x311c,
  37307. "ebreve",
  37308. 0x0115,
  37309. "ecandradeva",
  37310. 0x090d,
  37311. "ecandragujarati",
  37312. 0x0a8d,
  37313. "ecandravowelsigndeva",
  37314. 0x0945,
  37315. "ecandravowelsigngujarati",
  37316. 0x0ac5,
  37317. "ecaron",
  37318. 0x011b,
  37319. "ecedillabreve",
  37320. 0x1e1d,
  37321. "echarmenian",
  37322. 0x0565,
  37323. "echyiwnarmenian",
  37324. 0x0587,
  37325. "ecircle",
  37326. 0x24d4,
  37327. "ecircumflex",
  37328. 0x00ea,
  37329. "ecircumflexacute",
  37330. 0x1ebf,
  37331. "ecircumflexbelow",
  37332. 0x1e19,
  37333. "ecircumflexdotbelow",
  37334. 0x1ec7,
  37335. "ecircumflexgrave",
  37336. 0x1ec1,
  37337. "ecircumflexhookabove",
  37338. 0x1ec3,
  37339. "ecircumflextilde",
  37340. 0x1ec5,
  37341. "ecyrillic",
  37342. 0x0454,
  37343. "edblgrave",
  37344. 0x0205,
  37345. "edeva",
  37346. 0x090f,
  37347. "edieresis",
  37348. 0x00eb,
  37349. "edot",
  37350. 0x0117,
  37351. "edotaccent",
  37352. 0x0117,
  37353. "edotbelow",
  37354. 0x1eb9,
  37355. "eegurmukhi",
  37356. 0x0a0f,
  37357. "eematragurmukhi",
  37358. 0x0a47,
  37359. "efcyrillic",
  37360. 0x0444,
  37361. "egrave",
  37362. 0x00e8,
  37363. "egujarati",
  37364. 0x0a8f,
  37365. "eharmenian",
  37366. 0x0567,
  37367. "ehbopomofo",
  37368. 0x311d,
  37369. "ehiragana",
  37370. 0x3048,
  37371. "ehookabove",
  37372. 0x1ebb,
  37373. "eibopomofo",
  37374. 0x311f,
  37375. "eight",
  37376. 0x0038,
  37377. "eightarabic",
  37378. 0x0668,
  37379. "eightbengali",
  37380. 0x09ee,
  37381. "eightcircle",
  37382. 0x2467,
  37383. "eightcircleinversesansserif",
  37384. 0x2791,
  37385. "eightdeva",
  37386. 0x096e,
  37387. "eighteencircle",
  37388. 0x2471,
  37389. "eighteenparen",
  37390. 0x2485,
  37391. "eighteenperiod",
  37392. 0x2499,
  37393. "eightgujarati",
  37394. 0x0aee,
  37395. "eightgurmukhi",
  37396. 0x0a6e,
  37397. "eighthackarabic",
  37398. 0x0668,
  37399. "eighthangzhou",
  37400. 0x3028,
  37401. "eighthnotebeamed",
  37402. 0x266b,
  37403. "eightideographicparen",
  37404. 0x3227,
  37405. "eightinferior",
  37406. 0x2088,
  37407. "eightmonospace",
  37408. 0xff18,
  37409. "eightoldstyle",
  37410. 0xf738,
  37411. "eightparen",
  37412. 0x247b,
  37413. "eightperiod",
  37414. 0x248f,
  37415. "eightpersian",
  37416. 0x06f8,
  37417. "eightroman",
  37418. 0x2177,
  37419. "eightsuperior",
  37420. 0x2078,
  37421. "eightthai",
  37422. 0x0e58,
  37423. "einvertedbreve",
  37424. 0x0207,
  37425. "eiotifiedcyrillic",
  37426. 0x0465,
  37427. "ekatakana",
  37428. 0x30a8,
  37429. "ekatakanahalfwidth",
  37430. 0xff74,
  37431. "ekonkargurmukhi",
  37432. 0x0a74,
  37433. "ekorean",
  37434. 0x3154,
  37435. "elcyrillic",
  37436. 0x043b,
  37437. "element",
  37438. 0x2208,
  37439. "elevencircle",
  37440. 0x246a,
  37441. "elevenparen",
  37442. 0x247e,
  37443. "elevenperiod",
  37444. 0x2492,
  37445. "elevenroman",
  37446. 0x217a,
  37447. "ellipsis",
  37448. 0x2026,
  37449. "ellipsisvertical",
  37450. 0x22ee,
  37451. "emacron",
  37452. 0x0113,
  37453. "emacronacute",
  37454. 0x1e17,
  37455. "emacrongrave",
  37456. 0x1e15,
  37457. "emcyrillic",
  37458. 0x043c,
  37459. "emdash",
  37460. 0x2014,
  37461. "emdashvertical",
  37462. 0xfe31,
  37463. "emonospace",
  37464. 0xff45,
  37465. "emphasismarkarmenian",
  37466. 0x055b,
  37467. "emptyset",
  37468. 0x2205,
  37469. "enbopomofo",
  37470. 0x3123,
  37471. "encyrillic",
  37472. 0x043d,
  37473. "endash",
  37474. 0x2013,
  37475. "endashvertical",
  37476. 0xfe32,
  37477. "endescendercyrillic",
  37478. 0x04a3,
  37479. "eng",
  37480. 0x014b,
  37481. "engbopomofo",
  37482. 0x3125,
  37483. "enghecyrillic",
  37484. 0x04a5,
  37485. "enhookcyrillic",
  37486. 0x04c8,
  37487. "enspace",
  37488. 0x2002,
  37489. "eogonek",
  37490. 0x0119,
  37491. "eokorean",
  37492. 0x3153,
  37493. "eopen",
  37494. 0x025b,
  37495. "eopenclosed",
  37496. 0x029a,
  37497. "eopenreversed",
  37498. 0x025c,
  37499. "eopenreversedclosed",
  37500. 0x025e,
  37501. "eopenreversedhook",
  37502. 0x025d,
  37503. "eparen",
  37504. 0x24a0,
  37505. "epsilon",
  37506. 0x03b5,
  37507. "epsilontonos",
  37508. 0x03ad,
  37509. "equal",
  37510. 0x003d,
  37511. "equalmonospace",
  37512. 0xff1d,
  37513. "equalsmall",
  37514. 0xfe66,
  37515. "equalsuperior",
  37516. 0x207c,
  37517. "equivalence",
  37518. 0x2261,
  37519. "erbopomofo",
  37520. 0x3126,
  37521. "ercyrillic",
  37522. 0x0440,
  37523. "ereversed",
  37524. 0x0258,
  37525. "ereversedcyrillic",
  37526. 0x044d,
  37527. "escyrillic",
  37528. 0x0441,
  37529. "esdescendercyrillic",
  37530. 0x04ab,
  37531. "esh",
  37532. 0x0283,
  37533. "eshcurl",
  37534. 0x0286,
  37535. "eshortdeva",
  37536. 0x090e,
  37537. "eshortvowelsigndeva",
  37538. 0x0946,
  37539. "eshreversedloop",
  37540. 0x01aa,
  37541. "eshsquatreversed",
  37542. 0x0285,
  37543. "esmallhiragana",
  37544. 0x3047,
  37545. "esmallkatakana",
  37546. 0x30a7,
  37547. "esmallkatakanahalfwidth",
  37548. 0xff6a,
  37549. "estimated",
  37550. 0x212e,
  37551. "esuperior",
  37552. 0xf6ec,
  37553. "eta",
  37554. 0x03b7,
  37555. "etarmenian",
  37556. 0x0568,
  37557. "etatonos",
  37558. 0x03ae,
  37559. "eth",
  37560. 0x00f0,
  37561. "etilde",
  37562. 0x1ebd,
  37563. "etildebelow",
  37564. 0x1e1b,
  37565. "etnahtafoukhhebrew",
  37566. 0x0591,
  37567. "etnahtafoukhlefthebrew",
  37568. 0x0591,
  37569. "etnahtahebrew",
  37570. 0x0591,
  37571. "etnahtalefthebrew",
  37572. 0x0591,
  37573. "eturned",
  37574. 0x01dd,
  37575. "eukorean",
  37576. 0x3161,
  37577. "euro",
  37578. 0x20ac,
  37579. "evowelsignbengali",
  37580. 0x09c7,
  37581. "evowelsigndeva",
  37582. 0x0947,
  37583. "evowelsigngujarati",
  37584. 0x0ac7,
  37585. "exclam",
  37586. 0x0021,
  37587. "exclamarmenian",
  37588. 0x055c,
  37589. "exclamdbl",
  37590. 0x203c,
  37591. "exclamdown",
  37592. 0x00a1,
  37593. "exclamdownsmall",
  37594. 0xf7a1,
  37595. "exclammonospace",
  37596. 0xff01,
  37597. "exclamsmall",
  37598. 0xf721,
  37599. "existential",
  37600. 0x2203,
  37601. "ezh",
  37602. 0x0292,
  37603. "ezhcaron",
  37604. 0x01ef,
  37605. "ezhcurl",
  37606. 0x0293,
  37607. "ezhreversed",
  37608. 0x01b9,
  37609. "ezhtail",
  37610. 0x01ba,
  37611. "f",
  37612. 0x0066,
  37613. "fadeva",
  37614. 0x095e,
  37615. "fagurmukhi",
  37616. 0x0a5e,
  37617. "fahrenheit",
  37618. 0x2109,
  37619. "fathaarabic",
  37620. 0x064e,
  37621. "fathalowarabic",
  37622. 0x064e,
  37623. "fathatanarabic",
  37624. 0x064b,
  37625. "fbopomofo",
  37626. 0x3108,
  37627. "fcircle",
  37628. 0x24d5,
  37629. "fdotaccent",
  37630. 0x1e1f,
  37631. "feharabic",
  37632. 0x0641,
  37633. "feharmenian",
  37634. 0x0586,
  37635. "fehfinalarabic",
  37636. 0xfed2,
  37637. "fehinitialarabic",
  37638. 0xfed3,
  37639. "fehmedialarabic",
  37640. 0xfed4,
  37641. "feicoptic",
  37642. 0x03e5,
  37643. "female",
  37644. 0x2640,
  37645. "ff",
  37646. 0xfb00,
  37647. "f_f",
  37648. 0xfb00,
  37649. "ffi",
  37650. 0xfb03,
  37651. "ffl",
  37652. 0xfb04,
  37653. "fi",
  37654. 0xfb01,
  37655. "fifteencircle",
  37656. 0x246e,
  37657. "fifteenparen",
  37658. 0x2482,
  37659. "fifteenperiod",
  37660. 0x2496,
  37661. "figuredash",
  37662. 0x2012,
  37663. "filledbox",
  37664. 0x25a0,
  37665. "filledrect",
  37666. 0x25ac,
  37667. "finalkaf",
  37668. 0x05da,
  37669. "finalkafdagesh",
  37670. 0xfb3a,
  37671. "finalkafdageshhebrew",
  37672. 0xfb3a,
  37673. "finalkafhebrew",
  37674. 0x05da,
  37675. "finalmem",
  37676. 0x05dd,
  37677. "finalmemhebrew",
  37678. 0x05dd,
  37679. "finalnun",
  37680. 0x05df,
  37681. "finalnunhebrew",
  37682. 0x05df,
  37683. "finalpe",
  37684. 0x05e3,
  37685. "finalpehebrew",
  37686. 0x05e3,
  37687. "finaltsadi",
  37688. 0x05e5,
  37689. "finaltsadihebrew",
  37690. 0x05e5,
  37691. "firsttonechinese",
  37692. 0x02c9,
  37693. "fisheye",
  37694. 0x25c9,
  37695. "fitacyrillic",
  37696. 0x0473,
  37697. "five",
  37698. 0x0035,
  37699. "fivearabic",
  37700. 0x0665,
  37701. "fivebengali",
  37702. 0x09eb,
  37703. "fivecircle",
  37704. 0x2464,
  37705. "fivecircleinversesansserif",
  37706. 0x278e,
  37707. "fivedeva",
  37708. 0x096b,
  37709. "fiveeighths",
  37710. 0x215d,
  37711. "fivegujarati",
  37712. 0x0aeb,
  37713. "fivegurmukhi",
  37714. 0x0a6b,
  37715. "fivehackarabic",
  37716. 0x0665,
  37717. "fivehangzhou",
  37718. 0x3025,
  37719. "fiveideographicparen",
  37720. 0x3224,
  37721. "fiveinferior",
  37722. 0x2085,
  37723. "fivemonospace",
  37724. 0xff15,
  37725. "fiveoldstyle",
  37726. 0xf735,
  37727. "fiveparen",
  37728. 0x2478,
  37729. "fiveperiod",
  37730. 0x248c,
  37731. "fivepersian",
  37732. 0x06f5,
  37733. "fiveroman",
  37734. 0x2174,
  37735. "fivesuperior",
  37736. 0x2075,
  37737. "fivethai",
  37738. 0x0e55,
  37739. "fl",
  37740. 0xfb02,
  37741. "florin",
  37742. 0x0192,
  37743. "fmonospace",
  37744. 0xff46,
  37745. "fmsquare",
  37746. 0x3399,
  37747. "fofanthai",
  37748. 0x0e1f,
  37749. "fofathai",
  37750. 0x0e1d,
  37751. "fongmanthai",
  37752. 0x0e4f,
  37753. "forall",
  37754. 0x2200,
  37755. "four",
  37756. 0x0034,
  37757. "fourarabic",
  37758. 0x0664,
  37759. "fourbengali",
  37760. 0x09ea,
  37761. "fourcircle",
  37762. 0x2463,
  37763. "fourcircleinversesansserif",
  37764. 0x278d,
  37765. "fourdeva",
  37766. 0x096a,
  37767. "fourgujarati",
  37768. 0x0aea,
  37769. "fourgurmukhi",
  37770. 0x0a6a,
  37771. "fourhackarabic",
  37772. 0x0664,
  37773. "fourhangzhou",
  37774. 0x3024,
  37775. "fourideographicparen",
  37776. 0x3223,
  37777. "fourinferior",
  37778. 0x2084,
  37779. "fourmonospace",
  37780. 0xff14,
  37781. "fournumeratorbengali",
  37782. 0x09f7,
  37783. "fouroldstyle",
  37784. 0xf734,
  37785. "fourparen",
  37786. 0x2477,
  37787. "fourperiod",
  37788. 0x248b,
  37789. "fourpersian",
  37790. 0x06f4,
  37791. "fourroman",
  37792. 0x2173,
  37793. "foursuperior",
  37794. 0x2074,
  37795. "fourteencircle",
  37796. 0x246d,
  37797. "fourteenparen",
  37798. 0x2481,
  37799. "fourteenperiod",
  37800. 0x2495,
  37801. "fourthai",
  37802. 0x0e54,
  37803. "fourthtonechinese",
  37804. 0x02cb,
  37805. "fparen",
  37806. 0x24a1,
  37807. "fraction",
  37808. 0x2044,
  37809. "franc",
  37810. 0x20a3,
  37811. "g",
  37812. 0x0067,
  37813. "gabengali",
  37814. 0x0997,
  37815. "gacute",
  37816. 0x01f5,
  37817. "gadeva",
  37818. 0x0917,
  37819. "gafarabic",
  37820. 0x06af,
  37821. "gaffinalarabic",
  37822. 0xfb93,
  37823. "gafinitialarabic",
  37824. 0xfb94,
  37825. "gafmedialarabic",
  37826. 0xfb95,
  37827. "gagujarati",
  37828. 0x0a97,
  37829. "gagurmukhi",
  37830. 0x0a17,
  37831. "gahiragana",
  37832. 0x304c,
  37833. "gakatakana",
  37834. 0x30ac,
  37835. "gamma",
  37836. 0x03b3,
  37837. "gammalatinsmall",
  37838. 0x0263,
  37839. "gammasuperior",
  37840. 0x02e0,
  37841. "gangiacoptic",
  37842. 0x03eb,
  37843. "gbopomofo",
  37844. 0x310d,
  37845. "gbreve",
  37846. 0x011f,
  37847. "gcaron",
  37848. 0x01e7,
  37849. "gcedilla",
  37850. 0x0123,
  37851. "gcircle",
  37852. 0x24d6,
  37853. "gcircumflex",
  37854. 0x011d,
  37855. "gcommaaccent",
  37856. 0x0123,
  37857. "gdot",
  37858. 0x0121,
  37859. "gdotaccent",
  37860. 0x0121,
  37861. "gecyrillic",
  37862. 0x0433,
  37863. "gehiragana",
  37864. 0x3052,
  37865. "gekatakana",
  37866. 0x30b2,
  37867. "geometricallyequal",
  37868. 0x2251,
  37869. "gereshaccenthebrew",
  37870. 0x059c,
  37871. "gereshhebrew",
  37872. 0x05f3,
  37873. "gereshmuqdamhebrew",
  37874. 0x059d,
  37875. "germandbls",
  37876. 0x00df,
  37877. "gershayimaccenthebrew",
  37878. 0x059e,
  37879. "gershayimhebrew",
  37880. 0x05f4,
  37881. "getamark",
  37882. 0x3013,
  37883. "ghabengali",
  37884. 0x0998,
  37885. "ghadarmenian",
  37886. 0x0572,
  37887. "ghadeva",
  37888. 0x0918,
  37889. "ghagujarati",
  37890. 0x0a98,
  37891. "ghagurmukhi",
  37892. 0x0a18,
  37893. "ghainarabic",
  37894. 0x063a,
  37895. "ghainfinalarabic",
  37896. 0xfece,
  37897. "ghaininitialarabic",
  37898. 0xfecf,
  37899. "ghainmedialarabic",
  37900. 0xfed0,
  37901. "ghemiddlehookcyrillic",
  37902. 0x0495,
  37903. "ghestrokecyrillic",
  37904. 0x0493,
  37905. "gheupturncyrillic",
  37906. 0x0491,
  37907. "ghhadeva",
  37908. 0x095a,
  37909. "ghhagurmukhi",
  37910. 0x0a5a,
  37911. "ghook",
  37912. 0x0260,
  37913. "ghzsquare",
  37914. 0x3393,
  37915. "gihiragana",
  37916. 0x304e,
  37917. "gikatakana",
  37918. 0x30ae,
  37919. "gimarmenian",
  37920. 0x0563,
  37921. "gimel",
  37922. 0x05d2,
  37923. "gimeldagesh",
  37924. 0xfb32,
  37925. "gimeldageshhebrew",
  37926. 0xfb32,
  37927. "gimelhebrew",
  37928. 0x05d2,
  37929. "gjecyrillic",
  37930. 0x0453,
  37931. "glottalinvertedstroke",
  37932. 0x01be,
  37933. "glottalstop",
  37934. 0x0294,
  37935. "glottalstopinverted",
  37936. 0x0296,
  37937. "glottalstopmod",
  37938. 0x02c0,
  37939. "glottalstopreversed",
  37940. 0x0295,
  37941. "glottalstopreversedmod",
  37942. 0x02c1,
  37943. "glottalstopreversedsuperior",
  37944. 0x02e4,
  37945. "glottalstopstroke",
  37946. 0x02a1,
  37947. "glottalstopstrokereversed",
  37948. 0x02a2,
  37949. "gmacron",
  37950. 0x1e21,
  37951. "gmonospace",
  37952. 0xff47,
  37953. "gohiragana",
  37954. 0x3054,
  37955. "gokatakana",
  37956. 0x30b4,
  37957. "gparen",
  37958. 0x24a2,
  37959. "gpasquare",
  37960. 0x33ac,
  37961. "gradient",
  37962. 0x2207,
  37963. "grave",
  37964. 0x0060,
  37965. "gravebelowcmb",
  37966. 0x0316,
  37967. "gravecmb",
  37968. 0x0300,
  37969. "gravecomb",
  37970. 0x0300,
  37971. "gravedeva",
  37972. 0x0953,
  37973. "gravelowmod",
  37974. 0x02ce,
  37975. "gravemonospace",
  37976. 0xff40,
  37977. "gravetonecmb",
  37978. 0x0340,
  37979. "greater",
  37980. 0x003e,
  37981. "greaterequal",
  37982. 0x2265,
  37983. "greaterequalorless",
  37984. 0x22db,
  37985. "greatermonospace",
  37986. 0xff1e,
  37987. "greaterorequivalent",
  37988. 0x2273,
  37989. "greaterorless",
  37990. 0x2277,
  37991. "greateroverequal",
  37992. 0x2267,
  37993. "greatersmall",
  37994. 0xfe65,
  37995. "gscript",
  37996. 0x0261,
  37997. "gstroke",
  37998. 0x01e5,
  37999. "guhiragana",
  38000. 0x3050,
  38001. "guillemotleft",
  38002. 0x00ab,
  38003. "guillemotright",
  38004. 0x00bb,
  38005. "guilsinglleft",
  38006. 0x2039,
  38007. "guilsinglright",
  38008. 0x203a,
  38009. "gukatakana",
  38010. 0x30b0,
  38011. "guramusquare",
  38012. 0x3318,
  38013. "gysquare",
  38014. 0x33c9,
  38015. "h",
  38016. 0x0068,
  38017. "haabkhasiancyrillic",
  38018. 0x04a9,
  38019. "haaltonearabic",
  38020. 0x06c1,
  38021. "habengali",
  38022. 0x09b9,
  38023. "hadescendercyrillic",
  38024. 0x04b3,
  38025. "hadeva",
  38026. 0x0939,
  38027. "hagujarati",
  38028. 0x0ab9,
  38029. "hagurmukhi",
  38030. 0x0a39,
  38031. "haharabic",
  38032. 0x062d,
  38033. "hahfinalarabic",
  38034. 0xfea2,
  38035. "hahinitialarabic",
  38036. 0xfea3,
  38037. "hahiragana",
  38038. 0x306f,
  38039. "hahmedialarabic",
  38040. 0xfea4,
  38041. "haitusquare",
  38042. 0x332a,
  38043. "hakatakana",
  38044. 0x30cf,
  38045. "hakatakanahalfwidth",
  38046. 0xff8a,
  38047. "halantgurmukhi",
  38048. 0x0a4d,
  38049. "hamzaarabic",
  38050. 0x0621,
  38051. "hamzalowarabic",
  38052. 0x0621,
  38053. "hangulfiller",
  38054. 0x3164,
  38055. "hardsigncyrillic",
  38056. 0x044a,
  38057. "harpoonleftbarbup",
  38058. 0x21bc,
  38059. "harpoonrightbarbup",
  38060. 0x21c0,
  38061. "hasquare",
  38062. 0x33ca,
  38063. "hatafpatah",
  38064. 0x05b2,
  38065. "hatafpatah16",
  38066. 0x05b2,
  38067. "hatafpatah23",
  38068. 0x05b2,
  38069. "hatafpatah2f",
  38070. 0x05b2,
  38071. "hatafpatahhebrew",
  38072. 0x05b2,
  38073. "hatafpatahnarrowhebrew",
  38074. 0x05b2,
  38075. "hatafpatahquarterhebrew",
  38076. 0x05b2,
  38077. "hatafpatahwidehebrew",
  38078. 0x05b2,
  38079. "hatafqamats",
  38080. 0x05b3,
  38081. "hatafqamats1b",
  38082. 0x05b3,
  38083. "hatafqamats28",
  38084. 0x05b3,
  38085. "hatafqamats34",
  38086. 0x05b3,
  38087. "hatafqamatshebrew",
  38088. 0x05b3,
  38089. "hatafqamatsnarrowhebrew",
  38090. 0x05b3,
  38091. "hatafqamatsquarterhebrew",
  38092. 0x05b3,
  38093. "hatafqamatswidehebrew",
  38094. 0x05b3,
  38095. "hatafsegol",
  38096. 0x05b1,
  38097. "hatafsegol17",
  38098. 0x05b1,
  38099. "hatafsegol24",
  38100. 0x05b1,
  38101. "hatafsegol30",
  38102. 0x05b1,
  38103. "hatafsegolhebrew",
  38104. 0x05b1,
  38105. "hatafsegolnarrowhebrew",
  38106. 0x05b1,
  38107. "hatafsegolquarterhebrew",
  38108. 0x05b1,
  38109. "hatafsegolwidehebrew",
  38110. 0x05b1,
  38111. "hbar",
  38112. 0x0127,
  38113. "hbopomofo",
  38114. 0x310f,
  38115. "hbrevebelow",
  38116. 0x1e2b,
  38117. "hcedilla",
  38118. 0x1e29,
  38119. "hcircle",
  38120. 0x24d7,
  38121. "hcircumflex",
  38122. 0x0125,
  38123. "hdieresis",
  38124. 0x1e27,
  38125. "hdotaccent",
  38126. 0x1e23,
  38127. "hdotbelow",
  38128. 0x1e25,
  38129. "he",
  38130. 0x05d4,
  38131. "heart",
  38132. 0x2665,
  38133. "heartsuitblack",
  38134. 0x2665,
  38135. "heartsuitwhite",
  38136. 0x2661,
  38137. "hedagesh",
  38138. 0xfb34,
  38139. "hedageshhebrew",
  38140. 0xfb34,
  38141. "hehaltonearabic",
  38142. 0x06c1,
  38143. "heharabic",
  38144. 0x0647,
  38145. "hehebrew",
  38146. 0x05d4,
  38147. "hehfinalaltonearabic",
  38148. 0xfba7,
  38149. "hehfinalalttwoarabic",
  38150. 0xfeea,
  38151. "hehfinalarabic",
  38152. 0xfeea,
  38153. "hehhamzaabovefinalarabic",
  38154. 0xfba5,
  38155. "hehhamzaaboveisolatedarabic",
  38156. 0xfba4,
  38157. "hehinitialaltonearabic",
  38158. 0xfba8,
  38159. "hehinitialarabic",
  38160. 0xfeeb,
  38161. "hehiragana",
  38162. 0x3078,
  38163. "hehmedialaltonearabic",
  38164. 0xfba9,
  38165. "hehmedialarabic",
  38166. 0xfeec,
  38167. "heiseierasquare",
  38168. 0x337b,
  38169. "hekatakana",
  38170. 0x30d8,
  38171. "hekatakanahalfwidth",
  38172. 0xff8d,
  38173. "hekutaarusquare",
  38174. 0x3336,
  38175. "henghook",
  38176. 0x0267,
  38177. "herutusquare",
  38178. 0x3339,
  38179. "het",
  38180. 0x05d7,
  38181. "hethebrew",
  38182. 0x05d7,
  38183. "hhook",
  38184. 0x0266,
  38185. "hhooksuperior",
  38186. 0x02b1,
  38187. "hieuhacirclekorean",
  38188. 0x327b,
  38189. "hieuhaparenkorean",
  38190. 0x321b,
  38191. "hieuhcirclekorean",
  38192. 0x326d,
  38193. "hieuhkorean",
  38194. 0x314e,
  38195. "hieuhparenkorean",
  38196. 0x320d,
  38197. "hihiragana",
  38198. 0x3072,
  38199. "hikatakana",
  38200. 0x30d2,
  38201. "hikatakanahalfwidth",
  38202. 0xff8b,
  38203. "hiriq",
  38204. 0x05b4,
  38205. "hiriq14",
  38206. 0x05b4,
  38207. "hiriq21",
  38208. 0x05b4,
  38209. "hiriq2d",
  38210. 0x05b4,
  38211. "hiriqhebrew",
  38212. 0x05b4,
  38213. "hiriqnarrowhebrew",
  38214. 0x05b4,
  38215. "hiriqquarterhebrew",
  38216. 0x05b4,
  38217. "hiriqwidehebrew",
  38218. 0x05b4,
  38219. "hlinebelow",
  38220. 0x1e96,
  38221. "hmonospace",
  38222. 0xff48,
  38223. "hoarmenian",
  38224. 0x0570,
  38225. "hohipthai",
  38226. 0x0e2b,
  38227. "hohiragana",
  38228. 0x307b,
  38229. "hokatakana",
  38230. 0x30db,
  38231. "hokatakanahalfwidth",
  38232. 0xff8e,
  38233. "holam",
  38234. 0x05b9,
  38235. "holam19",
  38236. 0x05b9,
  38237. "holam26",
  38238. 0x05b9,
  38239. "holam32",
  38240. 0x05b9,
  38241. "holamhebrew",
  38242. 0x05b9,
  38243. "holamnarrowhebrew",
  38244. 0x05b9,
  38245. "holamquarterhebrew",
  38246. 0x05b9,
  38247. "holamwidehebrew",
  38248. 0x05b9,
  38249. "honokhukthai",
  38250. 0x0e2e,
  38251. "hookabovecomb",
  38252. 0x0309,
  38253. "hookcmb",
  38254. 0x0309,
  38255. "hookpalatalizedbelowcmb",
  38256. 0x0321,
  38257. "hookretroflexbelowcmb",
  38258. 0x0322,
  38259. "hoonsquare",
  38260. 0x3342,
  38261. "horicoptic",
  38262. 0x03e9,
  38263. "horizontalbar",
  38264. 0x2015,
  38265. "horncmb",
  38266. 0x031b,
  38267. "hotsprings",
  38268. 0x2668,
  38269. "house",
  38270. 0x2302,
  38271. "hparen",
  38272. 0x24a3,
  38273. "hsuperior",
  38274. 0x02b0,
  38275. "hturned",
  38276. 0x0265,
  38277. "huhiragana",
  38278. 0x3075,
  38279. "huiitosquare",
  38280. 0x3333,
  38281. "hukatakana",
  38282. 0x30d5,
  38283. "hukatakanahalfwidth",
  38284. 0xff8c,
  38285. "hungarumlaut",
  38286. 0x02dd,
  38287. "hungarumlautcmb",
  38288. 0x030b,
  38289. "hv",
  38290. 0x0195,
  38291. "hyphen",
  38292. 0x002d,
  38293. "hypheninferior",
  38294. 0xf6e5,
  38295. "hyphenmonospace",
  38296. 0xff0d,
  38297. "hyphensmall",
  38298. 0xfe63,
  38299. "hyphensuperior",
  38300. 0xf6e6,
  38301. "hyphentwo",
  38302. 0x2010,
  38303. "i",
  38304. 0x0069,
  38305. "iacute",
  38306. 0x00ed,
  38307. "iacyrillic",
  38308. 0x044f,
  38309. "ibengali",
  38310. 0x0987,
  38311. "ibopomofo",
  38312. 0x3127,
  38313. "ibreve",
  38314. 0x012d,
  38315. "icaron",
  38316. 0x01d0,
  38317. "icircle",
  38318. 0x24d8,
  38319. "icircumflex",
  38320. 0x00ee,
  38321. "icyrillic",
  38322. 0x0456,
  38323. "idblgrave",
  38324. 0x0209,
  38325. "ideographearthcircle",
  38326. 0x328f,
  38327. "ideographfirecircle",
  38328. 0x328b,
  38329. "ideographicallianceparen",
  38330. 0x323f,
  38331. "ideographiccallparen",
  38332. 0x323a,
  38333. "ideographiccentrecircle",
  38334. 0x32a5,
  38335. "ideographicclose",
  38336. 0x3006,
  38337. "ideographiccomma",
  38338. 0x3001,
  38339. "ideographiccommaleft",
  38340. 0xff64,
  38341. "ideographiccongratulationparen",
  38342. 0x3237,
  38343. "ideographiccorrectcircle",
  38344. 0x32a3,
  38345. "ideographicearthparen",
  38346. 0x322f,
  38347. "ideographicenterpriseparen",
  38348. 0x323d,
  38349. "ideographicexcellentcircle",
  38350. 0x329d,
  38351. "ideographicfestivalparen",
  38352. 0x3240,
  38353. "ideographicfinancialcircle",
  38354. 0x3296,
  38355. "ideographicfinancialparen",
  38356. 0x3236,
  38357. "ideographicfireparen",
  38358. 0x322b,
  38359. "ideographichaveparen",
  38360. 0x3232,
  38361. "ideographichighcircle",
  38362. 0x32a4,
  38363. "ideographiciterationmark",
  38364. 0x3005,
  38365. "ideographiclaborcircle",
  38366. 0x3298,
  38367. "ideographiclaborparen",
  38368. 0x3238,
  38369. "ideographicleftcircle",
  38370. 0x32a7,
  38371. "ideographiclowcircle",
  38372. 0x32a6,
  38373. "ideographicmedicinecircle",
  38374. 0x32a9,
  38375. "ideographicmetalparen",
  38376. 0x322e,
  38377. "ideographicmoonparen",
  38378. 0x322a,
  38379. "ideographicnameparen",
  38380. 0x3234,
  38381. "ideographicperiod",
  38382. 0x3002,
  38383. "ideographicprintcircle",
  38384. 0x329e,
  38385. "ideographicreachparen",
  38386. 0x3243,
  38387. "ideographicrepresentparen",
  38388. 0x3239,
  38389. "ideographicresourceparen",
  38390. 0x323e,
  38391. "ideographicrightcircle",
  38392. 0x32a8,
  38393. "ideographicsecretcircle",
  38394. 0x3299,
  38395. "ideographicselfparen",
  38396. 0x3242,
  38397. "ideographicsocietyparen",
  38398. 0x3233,
  38399. "ideographicspace",
  38400. 0x3000,
  38401. "ideographicspecialparen",
  38402. 0x3235,
  38403. "ideographicstockparen",
  38404. 0x3231,
  38405. "ideographicstudyparen",
  38406. 0x323b,
  38407. "ideographicsunparen",
  38408. 0x3230,
  38409. "ideographicsuperviseparen",
  38410. 0x323c,
  38411. "ideographicwaterparen",
  38412. 0x322c,
  38413. "ideographicwoodparen",
  38414. 0x322d,
  38415. "ideographiczero",
  38416. 0x3007,
  38417. "ideographmetalcircle",
  38418. 0x328e,
  38419. "ideographmooncircle",
  38420. 0x328a,
  38421. "ideographnamecircle",
  38422. 0x3294,
  38423. "ideographsuncircle",
  38424. 0x3290,
  38425. "ideographwatercircle",
  38426. 0x328c,
  38427. "ideographwoodcircle",
  38428. 0x328d,
  38429. "ideva",
  38430. 0x0907,
  38431. "idieresis",
  38432. 0x00ef,
  38433. "idieresisacute",
  38434. 0x1e2f,
  38435. "idieresiscyrillic",
  38436. 0x04e5,
  38437. "idotbelow",
  38438. 0x1ecb,
  38439. "iebrevecyrillic",
  38440. 0x04d7,
  38441. "iecyrillic",
  38442. 0x0435,
  38443. "ieungacirclekorean",
  38444. 0x3275,
  38445. "ieungaparenkorean",
  38446. 0x3215,
  38447. "ieungcirclekorean",
  38448. 0x3267,
  38449. "ieungkorean",
  38450. 0x3147,
  38451. "ieungparenkorean",
  38452. 0x3207,
  38453. "igrave",
  38454. 0x00ec,
  38455. "igujarati",
  38456. 0x0a87,
  38457. "igurmukhi",
  38458. 0x0a07,
  38459. "ihiragana",
  38460. 0x3044,
  38461. "ihookabove",
  38462. 0x1ec9,
  38463. "iibengali",
  38464. 0x0988,
  38465. "iicyrillic",
  38466. 0x0438,
  38467. "iideva",
  38468. 0x0908,
  38469. "iigujarati",
  38470. 0x0a88,
  38471. "iigurmukhi",
  38472. 0x0a08,
  38473. "iimatragurmukhi",
  38474. 0x0a40,
  38475. "iinvertedbreve",
  38476. 0x020b,
  38477. "iishortcyrillic",
  38478. 0x0439,
  38479. "iivowelsignbengali",
  38480. 0x09c0,
  38481. "iivowelsigndeva",
  38482. 0x0940,
  38483. "iivowelsigngujarati",
  38484. 0x0ac0,
  38485. "ij",
  38486. 0x0133,
  38487. "ikatakana",
  38488. 0x30a4,
  38489. "ikatakanahalfwidth",
  38490. 0xff72,
  38491. "ikorean",
  38492. 0x3163,
  38493. "ilde",
  38494. 0x02dc,
  38495. "iluyhebrew",
  38496. 0x05ac,
  38497. "imacron",
  38498. 0x012b,
  38499. "imacroncyrillic",
  38500. 0x04e3,
  38501. "imageorapproximatelyequal",
  38502. 0x2253,
  38503. "imatragurmukhi",
  38504. 0x0a3f,
  38505. "imonospace",
  38506. 0xff49,
  38507. "increment",
  38508. 0x2206,
  38509. "infinity",
  38510. 0x221e,
  38511. "iniarmenian",
  38512. 0x056b,
  38513. "integral",
  38514. 0x222b,
  38515. "integralbottom",
  38516. 0x2321,
  38517. "integralbt",
  38518. 0x2321,
  38519. "integralex",
  38520. 0xf8f5,
  38521. "integraltop",
  38522. 0x2320,
  38523. "integraltp",
  38524. 0x2320,
  38525. "intersection",
  38526. 0x2229,
  38527. "intisquare",
  38528. 0x3305,
  38529. "invbullet",
  38530. 0x25d8,
  38531. "invcircle",
  38532. 0x25d9,
  38533. "invsmileface",
  38534. 0x263b,
  38535. "iocyrillic",
  38536. 0x0451,
  38537. "iogonek",
  38538. 0x012f,
  38539. "iota",
  38540. 0x03b9,
  38541. "iotadieresis",
  38542. 0x03ca,
  38543. "iotadieresistonos",
  38544. 0x0390,
  38545. "iotalatin",
  38546. 0x0269,
  38547. "iotatonos",
  38548. 0x03af,
  38549. "iparen",
  38550. 0x24a4,
  38551. "irigurmukhi",
  38552. 0x0a72,
  38553. "ismallhiragana",
  38554. 0x3043,
  38555. "ismallkatakana",
  38556. 0x30a3,
  38557. "ismallkatakanahalfwidth",
  38558. 0xff68,
  38559. "issharbengali",
  38560. 0x09fa,
  38561. "istroke",
  38562. 0x0268,
  38563. "isuperior",
  38564. 0xf6ed,
  38565. "iterationhiragana",
  38566. 0x309d,
  38567. "iterationkatakana",
  38568. 0x30fd,
  38569. "itilde",
  38570. 0x0129,
  38571. "itildebelow",
  38572. 0x1e2d,
  38573. "iubopomofo",
  38574. 0x3129,
  38575. "iucyrillic",
  38576. 0x044e,
  38577. "ivowelsignbengali",
  38578. 0x09bf,
  38579. "ivowelsigndeva",
  38580. 0x093f,
  38581. "ivowelsigngujarati",
  38582. 0x0abf,
  38583. "izhitsacyrillic",
  38584. 0x0475,
  38585. "izhitsadblgravecyrillic",
  38586. 0x0477,
  38587. "j",
  38588. 0x006a,
  38589. "jaarmenian",
  38590. 0x0571,
  38591. "jabengali",
  38592. 0x099c,
  38593. "jadeva",
  38594. 0x091c,
  38595. "jagujarati",
  38596. 0x0a9c,
  38597. "jagurmukhi",
  38598. 0x0a1c,
  38599. "jbopomofo",
  38600. 0x3110,
  38601. "jcaron",
  38602. 0x01f0,
  38603. "jcircle",
  38604. 0x24d9,
  38605. "jcircumflex",
  38606. 0x0135,
  38607. "jcrossedtail",
  38608. 0x029d,
  38609. "jdotlessstroke",
  38610. 0x025f,
  38611. "jecyrillic",
  38612. 0x0458,
  38613. "jeemarabic",
  38614. 0x062c,
  38615. "jeemfinalarabic",
  38616. 0xfe9e,
  38617. "jeeminitialarabic",
  38618. 0xfe9f,
  38619. "jeemmedialarabic",
  38620. 0xfea0,
  38621. "jeharabic",
  38622. 0x0698,
  38623. "jehfinalarabic",
  38624. 0xfb8b,
  38625. "jhabengali",
  38626. 0x099d,
  38627. "jhadeva",
  38628. 0x091d,
  38629. "jhagujarati",
  38630. 0x0a9d,
  38631. "jhagurmukhi",
  38632. 0x0a1d,
  38633. "jheharmenian",
  38634. 0x057b,
  38635. "jis",
  38636. 0x3004,
  38637. "jmonospace",
  38638. 0xff4a,
  38639. "jparen",
  38640. 0x24a5,
  38641. "jsuperior",
  38642. 0x02b2,
  38643. "k",
  38644. 0x006b,
  38645. "kabashkircyrillic",
  38646. 0x04a1,
  38647. "kabengali",
  38648. 0x0995,
  38649. "kacute",
  38650. 0x1e31,
  38651. "kacyrillic",
  38652. 0x043a,
  38653. "kadescendercyrillic",
  38654. 0x049b,
  38655. "kadeva",
  38656. 0x0915,
  38657. "kaf",
  38658. 0x05db,
  38659. "kafarabic",
  38660. 0x0643,
  38661. "kafdagesh",
  38662. 0xfb3b,
  38663. "kafdageshhebrew",
  38664. 0xfb3b,
  38665. "kaffinalarabic",
  38666. 0xfeda,
  38667. "kafhebrew",
  38668. 0x05db,
  38669. "kafinitialarabic",
  38670. 0xfedb,
  38671. "kafmedialarabic",
  38672. 0xfedc,
  38673. "kafrafehebrew",
  38674. 0xfb4d,
  38675. "kagujarati",
  38676. 0x0a95,
  38677. "kagurmukhi",
  38678. 0x0a15,
  38679. "kahiragana",
  38680. 0x304b,
  38681. "kahookcyrillic",
  38682. 0x04c4,
  38683. "kakatakana",
  38684. 0x30ab,
  38685. "kakatakanahalfwidth",
  38686. 0xff76,
  38687. "kappa",
  38688. 0x03ba,
  38689. "kappasymbolgreek",
  38690. 0x03f0,
  38691. "kapyeounmieumkorean",
  38692. 0x3171,
  38693. "kapyeounphieuphkorean",
  38694. 0x3184,
  38695. "kapyeounpieupkorean",
  38696. 0x3178,
  38697. "kapyeounssangpieupkorean",
  38698. 0x3179,
  38699. "karoriisquare",
  38700. 0x330d,
  38701. "kashidaautoarabic",
  38702. 0x0640,
  38703. "kashidaautonosidebearingarabic",
  38704. 0x0640,
  38705. "kasmallkatakana",
  38706. 0x30f5,
  38707. "kasquare",
  38708. 0x3384,
  38709. "kasraarabic",
  38710. 0x0650,
  38711. "kasratanarabic",
  38712. 0x064d,
  38713. "kastrokecyrillic",
  38714. 0x049f,
  38715. "katahiraprolongmarkhalfwidth",
  38716. 0xff70,
  38717. "kaverticalstrokecyrillic",
  38718. 0x049d,
  38719. "kbopomofo",
  38720. 0x310e,
  38721. "kcalsquare",
  38722. 0x3389,
  38723. "kcaron",
  38724. 0x01e9,
  38725. "kcedilla",
  38726. 0x0137,
  38727. "kcircle",
  38728. 0x24da,
  38729. "kcommaaccent",
  38730. 0x0137,
  38731. "kdotbelow",
  38732. 0x1e33,
  38733. "keharmenian",
  38734. 0x0584,
  38735. "kehiragana",
  38736. 0x3051,
  38737. "kekatakana",
  38738. 0x30b1,
  38739. "kekatakanahalfwidth",
  38740. 0xff79,
  38741. "kenarmenian",
  38742. 0x056f,
  38743. "kesmallkatakana",
  38744. 0x30f6,
  38745. "kgreenlandic",
  38746. 0x0138,
  38747. "khabengali",
  38748. 0x0996,
  38749. "khacyrillic",
  38750. 0x0445,
  38751. "khadeva",
  38752. 0x0916,
  38753. "khagujarati",
  38754. 0x0a96,
  38755. "khagurmukhi",
  38756. 0x0a16,
  38757. "khaharabic",
  38758. 0x062e,
  38759. "khahfinalarabic",
  38760. 0xfea6,
  38761. "khahinitialarabic",
  38762. 0xfea7,
  38763. "khahmedialarabic",
  38764. 0xfea8,
  38765. "kheicoptic",
  38766. 0x03e7,
  38767. "khhadeva",
  38768. 0x0959,
  38769. "khhagurmukhi",
  38770. 0x0a59,
  38771. "khieukhacirclekorean",
  38772. 0x3278,
  38773. "khieukhaparenkorean",
  38774. 0x3218,
  38775. "khieukhcirclekorean",
  38776. 0x326a,
  38777. "khieukhkorean",
  38778. 0x314b,
  38779. "khieukhparenkorean",
  38780. 0x320a,
  38781. "khokhaithai",
  38782. 0x0e02,
  38783. "khokhonthai",
  38784. 0x0e05,
  38785. "khokhuatthai",
  38786. 0x0e03,
  38787. "khokhwaithai",
  38788. 0x0e04,
  38789. "khomutthai",
  38790. 0x0e5b,
  38791. "khook",
  38792. 0x0199,
  38793. "khorakhangthai",
  38794. 0x0e06,
  38795. "khzsquare",
  38796. 0x3391,
  38797. "kihiragana",
  38798. 0x304d,
  38799. "kikatakana",
  38800. 0x30ad,
  38801. "kikatakanahalfwidth",
  38802. 0xff77,
  38803. "kiroguramusquare",
  38804. 0x3315,
  38805. "kiromeetorusquare",
  38806. 0x3316,
  38807. "kirosquare",
  38808. 0x3314,
  38809. "kiyeokacirclekorean",
  38810. 0x326e,
  38811. "kiyeokaparenkorean",
  38812. 0x320e,
  38813. "kiyeokcirclekorean",
  38814. 0x3260,
  38815. "kiyeokkorean",
  38816. 0x3131,
  38817. "kiyeokparenkorean",
  38818. 0x3200,
  38819. "kiyeoksioskorean",
  38820. 0x3133,
  38821. "kjecyrillic",
  38822. 0x045c,
  38823. "klinebelow",
  38824. 0x1e35,
  38825. "klsquare",
  38826. 0x3398,
  38827. "kmcubedsquare",
  38828. 0x33a6,
  38829. "kmonospace",
  38830. 0xff4b,
  38831. "kmsquaredsquare",
  38832. 0x33a2,
  38833. "kohiragana",
  38834. 0x3053,
  38835. "kohmsquare",
  38836. 0x33c0,
  38837. "kokaithai",
  38838. 0x0e01,
  38839. "kokatakana",
  38840. 0x30b3,
  38841. "kokatakanahalfwidth",
  38842. 0xff7a,
  38843. "kooposquare",
  38844. 0x331e,
  38845. "koppacyrillic",
  38846. 0x0481,
  38847. "koreanstandardsymbol",
  38848. 0x327f,
  38849. "koroniscmb",
  38850. 0x0343,
  38851. "kparen",
  38852. 0x24a6,
  38853. "kpasquare",
  38854. 0x33aa,
  38855. "ksicyrillic",
  38856. 0x046f,
  38857. "ktsquare",
  38858. 0x33cf,
  38859. "kturned",
  38860. 0x029e,
  38861. "kuhiragana",
  38862. 0x304f,
  38863. "kukatakana",
  38864. 0x30af,
  38865. "kukatakanahalfwidth",
  38866. 0xff78,
  38867. "kvsquare",
  38868. 0x33b8,
  38869. "kwsquare",
  38870. 0x33be,
  38871. "l",
  38872. 0x006c,
  38873. "labengali",
  38874. 0x09b2,
  38875. "lacute",
  38876. 0x013a,
  38877. "ladeva",
  38878. 0x0932,
  38879. "lagujarati",
  38880. 0x0ab2,
  38881. "lagurmukhi",
  38882. 0x0a32,
  38883. "lakkhangyaothai",
  38884. 0x0e45,
  38885. "lamaleffinalarabic",
  38886. 0xfefc,
  38887. "lamalefhamzaabovefinalarabic",
  38888. 0xfef8,
  38889. "lamalefhamzaaboveisolatedarabic",
  38890. 0xfef7,
  38891. "lamalefhamzabelowfinalarabic",
  38892. 0xfefa,
  38893. "lamalefhamzabelowisolatedarabic",
  38894. 0xfef9,
  38895. "lamalefisolatedarabic",
  38896. 0xfefb,
  38897. "lamalefmaddaabovefinalarabic",
  38898. 0xfef6,
  38899. "lamalefmaddaaboveisolatedarabic",
  38900. 0xfef5,
  38901. "lamarabic",
  38902. 0x0644,
  38903. "lambda",
  38904. 0x03bb,
  38905. "lambdastroke",
  38906. 0x019b,
  38907. "lamed",
  38908. 0x05dc,
  38909. "lameddagesh",
  38910. 0xfb3c,
  38911. "lameddageshhebrew",
  38912. 0xfb3c,
  38913. "lamedhebrew",
  38914. 0x05dc,
  38915. "lamfinalarabic",
  38916. 0xfede,
  38917. "lamhahinitialarabic",
  38918. 0xfcca,
  38919. "laminitialarabic",
  38920. 0xfedf,
  38921. "lamjeeminitialarabic",
  38922. 0xfcc9,
  38923. "lamkhahinitialarabic",
  38924. 0xfccb,
  38925. "lamlamhehisolatedarabic",
  38926. 0xfdf2,
  38927. "lammedialarabic",
  38928. 0xfee0,
  38929. "lammeemhahinitialarabic",
  38930. 0xfd88,
  38931. "lammeeminitialarabic",
  38932. 0xfccc,
  38933. "largecircle",
  38934. 0x25ef,
  38935. "lbar",
  38936. 0x019a,
  38937. "lbelt",
  38938. 0x026c,
  38939. "lbopomofo",
  38940. 0x310c,
  38941. "lcaron",
  38942. 0x013e,
  38943. "lcedilla",
  38944. 0x013c,
  38945. "lcircle",
  38946. 0x24db,
  38947. "lcircumflexbelow",
  38948. 0x1e3d,
  38949. "lcommaaccent",
  38950. 0x013c,
  38951. "ldot",
  38952. 0x0140,
  38953. "ldotaccent",
  38954. 0x0140,
  38955. "ldotbelow",
  38956. 0x1e37,
  38957. "ldotbelowmacron",
  38958. 0x1e39,
  38959. "leftangleabovecmb",
  38960. 0x031a,
  38961. "lefttackbelowcmb",
  38962. 0x0318,
  38963. "less",
  38964. 0x003c,
  38965. "lessequal",
  38966. 0x2264,
  38967. "lessequalorgreater",
  38968. 0x22da,
  38969. "lessmonospace",
  38970. 0xff1c,
  38971. "lessorequivalent",
  38972. 0x2272,
  38973. "lessorgreater",
  38974. 0x2276,
  38975. "lessoverequal",
  38976. 0x2266,
  38977. "lesssmall",
  38978. 0xfe64,
  38979. "lezh",
  38980. 0x026e,
  38981. "lfblock",
  38982. 0x258c,
  38983. "lhookretroflex",
  38984. 0x026d,
  38985. "lira",
  38986. 0x20a4,
  38987. "liwnarmenian",
  38988. 0x056c,
  38989. "lj",
  38990. 0x01c9,
  38991. "ljecyrillic",
  38992. 0x0459,
  38993. "ll",
  38994. 0xf6c0,
  38995. "lladeva",
  38996. 0x0933,
  38997. "llagujarati",
  38998. 0x0ab3,
  38999. "llinebelow",
  39000. 0x1e3b,
  39001. "llladeva",
  39002. 0x0934,
  39003. "llvocalicbengali",
  39004. 0x09e1,
  39005. "llvocalicdeva",
  39006. 0x0961,
  39007. "llvocalicvowelsignbengali",
  39008. 0x09e3,
  39009. "llvocalicvowelsigndeva",
  39010. 0x0963,
  39011. "lmiddletilde",
  39012. 0x026b,
  39013. "lmonospace",
  39014. 0xff4c,
  39015. "lmsquare",
  39016. 0x33d0,
  39017. "lochulathai",
  39018. 0x0e2c,
  39019. "logicaland",
  39020. 0x2227,
  39021. "logicalnot",
  39022. 0x00ac,
  39023. "logicalnotreversed",
  39024. 0x2310,
  39025. "logicalor",
  39026. 0x2228,
  39027. "lolingthai",
  39028. 0x0e25,
  39029. "longs",
  39030. 0x017f,
  39031. "lowlinecenterline",
  39032. 0xfe4e,
  39033. "lowlinecmb",
  39034. 0x0332,
  39035. "lowlinedashed",
  39036. 0xfe4d,
  39037. "lozenge",
  39038. 0x25ca,
  39039. "lparen",
  39040. 0x24a7,
  39041. "lslash",
  39042. 0x0142,
  39043. "lsquare",
  39044. 0x2113,
  39045. "lsuperior",
  39046. 0xf6ee,
  39047. "ltshade",
  39048. 0x2591,
  39049. "luthai",
  39050. 0x0e26,
  39051. "lvocalicbengali",
  39052. 0x098c,
  39053. "lvocalicdeva",
  39054. 0x090c,
  39055. "lvocalicvowelsignbengali",
  39056. 0x09e2,
  39057. "lvocalicvowelsigndeva",
  39058. 0x0962,
  39059. "lxsquare",
  39060. 0x33d3,
  39061. "m",
  39062. 0x006d,
  39063. "mabengali",
  39064. 0x09ae,
  39065. "macron",
  39066. 0x00af,
  39067. "macronbelowcmb",
  39068. 0x0331,
  39069. "macroncmb",
  39070. 0x0304,
  39071. "macronlowmod",
  39072. 0x02cd,
  39073. "macronmonospace",
  39074. 0xffe3,
  39075. "macute",
  39076. 0x1e3f,
  39077. "madeva",
  39078. 0x092e,
  39079. "magujarati",
  39080. 0x0aae,
  39081. "magurmukhi",
  39082. 0x0a2e,
  39083. "mahapakhhebrew",
  39084. 0x05a4,
  39085. "mahapakhlefthebrew",
  39086. 0x05a4,
  39087. "mahiragana",
  39088. 0x307e,
  39089. "maichattawalowleftthai",
  39090. 0xf895,
  39091. "maichattawalowrightthai",
  39092. 0xf894,
  39093. "maichattawathai",
  39094. 0x0e4b,
  39095. "maichattawaupperleftthai",
  39096. 0xf893,
  39097. "maieklowleftthai",
  39098. 0xf88c,
  39099. "maieklowrightthai",
  39100. 0xf88b,
  39101. "maiekthai",
  39102. 0x0e48,
  39103. "maiekupperleftthai",
  39104. 0xf88a,
  39105. "maihanakatleftthai",
  39106. 0xf884,
  39107. "maihanakatthai",
  39108. 0x0e31,
  39109. "maitaikhuleftthai",
  39110. 0xf889,
  39111. "maitaikhuthai",
  39112. 0x0e47,
  39113. "maitholowleftthai",
  39114. 0xf88f,
  39115. "maitholowrightthai",
  39116. 0xf88e,
  39117. "maithothai",
  39118. 0x0e49,
  39119. "maithoupperleftthai",
  39120. 0xf88d,
  39121. "maitrilowleftthai",
  39122. 0xf892,
  39123. "maitrilowrightthai",
  39124. 0xf891,
  39125. "maitrithai",
  39126. 0x0e4a,
  39127. "maitriupperleftthai",
  39128. 0xf890,
  39129. "maiyamokthai",
  39130. 0x0e46,
  39131. "makatakana",
  39132. 0x30de,
  39133. "makatakanahalfwidth",
  39134. 0xff8f,
  39135. "male",
  39136. 0x2642,
  39137. "mansyonsquare",
  39138. 0x3347,
  39139. "maqafhebrew",
  39140. 0x05be,
  39141. "mars",
  39142. 0x2642,
  39143. "masoracirclehebrew",
  39144. 0x05af,
  39145. "masquare",
  39146. 0x3383,
  39147. "mbopomofo",
  39148. 0x3107,
  39149. "mbsquare",
  39150. 0x33d4,
  39151. "mcircle",
  39152. 0x24dc,
  39153. "mcubedsquare",
  39154. 0x33a5,
  39155. "mdotaccent",
  39156. 0x1e41,
  39157. "mdotbelow",
  39158. 0x1e43,
  39159. "meemarabic",
  39160. 0x0645,
  39161. "meemfinalarabic",
  39162. 0xfee2,
  39163. "meeminitialarabic",
  39164. 0xfee3,
  39165. "meemmedialarabic",
  39166. 0xfee4,
  39167. "meemmeeminitialarabic",
  39168. 0xfcd1,
  39169. "meemmeemisolatedarabic",
  39170. 0xfc48,
  39171. "meetorusquare",
  39172. 0x334d,
  39173. "mehiragana",
  39174. 0x3081,
  39175. "meizierasquare",
  39176. 0x337e,
  39177. "mekatakana",
  39178. 0x30e1,
  39179. "mekatakanahalfwidth",
  39180. 0xff92,
  39181. "mem",
  39182. 0x05de,
  39183. "memdagesh",
  39184. 0xfb3e,
  39185. "memdageshhebrew",
  39186. 0xfb3e,
  39187. "memhebrew",
  39188. 0x05de,
  39189. "menarmenian",
  39190. 0x0574,
  39191. "merkhahebrew",
  39192. 0x05a5,
  39193. "merkhakefulahebrew",
  39194. 0x05a6,
  39195. "merkhakefulalefthebrew",
  39196. 0x05a6,
  39197. "merkhalefthebrew",
  39198. 0x05a5,
  39199. "mhook",
  39200. 0x0271,
  39201. "mhzsquare",
  39202. 0x3392,
  39203. "middledotkatakanahalfwidth",
  39204. 0xff65,
  39205. "middot",
  39206. 0x00b7,
  39207. "mieumacirclekorean",
  39208. 0x3272,
  39209. "mieumaparenkorean",
  39210. 0x3212,
  39211. "mieumcirclekorean",
  39212. 0x3264,
  39213. "mieumkorean",
  39214. 0x3141,
  39215. "mieumpansioskorean",
  39216. 0x3170,
  39217. "mieumparenkorean",
  39218. 0x3204,
  39219. "mieumpieupkorean",
  39220. 0x316e,
  39221. "mieumsioskorean",
  39222. 0x316f,
  39223. "mihiragana",
  39224. 0x307f,
  39225. "mikatakana",
  39226. 0x30df,
  39227. "mikatakanahalfwidth",
  39228. 0xff90,
  39229. "minus",
  39230. 0x2212,
  39231. "minusbelowcmb",
  39232. 0x0320,
  39233. "minuscircle",
  39234. 0x2296,
  39235. "minusmod",
  39236. 0x02d7,
  39237. "minusplus",
  39238. 0x2213,
  39239. "minute",
  39240. 0x2032,
  39241. "miribaarusquare",
  39242. 0x334a,
  39243. "mirisquare",
  39244. 0x3349,
  39245. "mlonglegturned",
  39246. 0x0270,
  39247. "mlsquare",
  39248. 0x3396,
  39249. "mmcubedsquare",
  39250. 0x33a3,
  39251. "mmonospace",
  39252. 0xff4d,
  39253. "mmsquaredsquare",
  39254. 0x339f,
  39255. "mohiragana",
  39256. 0x3082,
  39257. "mohmsquare",
  39258. 0x33c1,
  39259. "mokatakana",
  39260. 0x30e2,
  39261. "mokatakanahalfwidth",
  39262. 0xff93,
  39263. "molsquare",
  39264. 0x33d6,
  39265. "momathai",
  39266. 0x0e21,
  39267. "moverssquare",
  39268. 0x33a7,
  39269. "moverssquaredsquare",
  39270. 0x33a8,
  39271. "mparen",
  39272. 0x24a8,
  39273. "mpasquare",
  39274. 0x33ab,
  39275. "mssquare",
  39276. 0x33b3,
  39277. "msuperior",
  39278. 0xf6ef,
  39279. "mturned",
  39280. 0x026f,
  39281. "mu",
  39282. 0x00b5,
  39283. "mu1",
  39284. 0x00b5,
  39285. "muasquare",
  39286. 0x3382,
  39287. "muchgreater",
  39288. 0x226b,
  39289. "muchless",
  39290. 0x226a,
  39291. "mufsquare",
  39292. 0x338c,
  39293. "mugreek",
  39294. 0x03bc,
  39295. "mugsquare",
  39296. 0x338d,
  39297. "muhiragana",
  39298. 0x3080,
  39299. "mukatakana",
  39300. 0x30e0,
  39301. "mukatakanahalfwidth",
  39302. 0xff91,
  39303. "mulsquare",
  39304. 0x3395,
  39305. "multiply",
  39306. 0x00d7,
  39307. "mumsquare",
  39308. 0x339b,
  39309. "munahhebrew",
  39310. 0x05a3,
  39311. "munahlefthebrew",
  39312. 0x05a3,
  39313. "musicalnote",
  39314. 0x266a,
  39315. "musicalnotedbl",
  39316. 0x266b,
  39317. "musicflatsign",
  39318. 0x266d,
  39319. "musicsharpsign",
  39320. 0x266f,
  39321. "mussquare",
  39322. 0x33b2,
  39323. "muvsquare",
  39324. 0x33b6,
  39325. "muwsquare",
  39326. 0x33bc,
  39327. "mvmegasquare",
  39328. 0x33b9,
  39329. "mvsquare",
  39330. 0x33b7,
  39331. "mwmegasquare",
  39332. 0x33bf,
  39333. "mwsquare",
  39334. 0x33bd,
  39335. "n",
  39336. 0x006e,
  39337. "nabengali",
  39338. 0x09a8,
  39339. "nabla",
  39340. 0x2207,
  39341. "nacute",
  39342. 0x0144,
  39343. "nadeva",
  39344. 0x0928,
  39345. "nagujarati",
  39346. 0x0aa8,
  39347. "nagurmukhi",
  39348. 0x0a28,
  39349. "nahiragana",
  39350. 0x306a,
  39351. "nakatakana",
  39352. 0x30ca,
  39353. "nakatakanahalfwidth",
  39354. 0xff85,
  39355. "napostrophe",
  39356. 0x0149,
  39357. "nasquare",
  39358. 0x3381,
  39359. "nbopomofo",
  39360. 0x310b,
  39361. "nbspace",
  39362. 0x00a0,
  39363. "ncaron",
  39364. 0x0148,
  39365. "ncedilla",
  39366. 0x0146,
  39367. "ncircle",
  39368. 0x24dd,
  39369. "ncircumflexbelow",
  39370. 0x1e4b,
  39371. "ncommaaccent",
  39372. 0x0146,
  39373. "ndotaccent",
  39374. 0x1e45,
  39375. "ndotbelow",
  39376. 0x1e47,
  39377. "nehiragana",
  39378. 0x306d,
  39379. "nekatakana",
  39380. 0x30cd,
  39381. "nekatakanahalfwidth",
  39382. 0xff88,
  39383. "newsheqelsign",
  39384. 0x20aa,
  39385. "nfsquare",
  39386. 0x338b,
  39387. "ngabengali",
  39388. 0x0999,
  39389. "ngadeva",
  39390. 0x0919,
  39391. "ngagujarati",
  39392. 0x0a99,
  39393. "ngagurmukhi",
  39394. 0x0a19,
  39395. "ngonguthai",
  39396. 0x0e07,
  39397. "nhiragana",
  39398. 0x3093,
  39399. "nhookleft",
  39400. 0x0272,
  39401. "nhookretroflex",
  39402. 0x0273,
  39403. "nieunacirclekorean",
  39404. 0x326f,
  39405. "nieunaparenkorean",
  39406. 0x320f,
  39407. "nieuncieuckorean",
  39408. 0x3135,
  39409. "nieuncirclekorean",
  39410. 0x3261,
  39411. "nieunhieuhkorean",
  39412. 0x3136,
  39413. "nieunkorean",
  39414. 0x3134,
  39415. "nieunpansioskorean",
  39416. 0x3168,
  39417. "nieunparenkorean",
  39418. 0x3201,
  39419. "nieunsioskorean",
  39420. 0x3167,
  39421. "nieuntikeutkorean",
  39422. 0x3166,
  39423. "nihiragana",
  39424. 0x306b,
  39425. "nikatakana",
  39426. 0x30cb,
  39427. "nikatakanahalfwidth",
  39428. 0xff86,
  39429. "nikhahitleftthai",
  39430. 0xf899,
  39431. "nikhahitthai",
  39432. 0x0e4d,
  39433. "nine",
  39434. 0x0039,
  39435. "ninearabic",
  39436. 0x0669,
  39437. "ninebengali",
  39438. 0x09ef,
  39439. "ninecircle",
  39440. 0x2468,
  39441. "ninecircleinversesansserif",
  39442. 0x2792,
  39443. "ninedeva",
  39444. 0x096f,
  39445. "ninegujarati",
  39446. 0x0aef,
  39447. "ninegurmukhi",
  39448. 0x0a6f,
  39449. "ninehackarabic",
  39450. 0x0669,
  39451. "ninehangzhou",
  39452. 0x3029,
  39453. "nineideographicparen",
  39454. 0x3228,
  39455. "nineinferior",
  39456. 0x2089,
  39457. "ninemonospace",
  39458. 0xff19,
  39459. "nineoldstyle",
  39460. 0xf739,
  39461. "nineparen",
  39462. 0x247c,
  39463. "nineperiod",
  39464. 0x2490,
  39465. "ninepersian",
  39466. 0x06f9,
  39467. "nineroman",
  39468. 0x2178,
  39469. "ninesuperior",
  39470. 0x2079,
  39471. "nineteencircle",
  39472. 0x2472,
  39473. "nineteenparen",
  39474. 0x2486,
  39475. "nineteenperiod",
  39476. 0x249a,
  39477. "ninethai",
  39478. 0x0e59,
  39479. "nj",
  39480. 0x01cc,
  39481. "njecyrillic",
  39482. 0x045a,
  39483. "nkatakana",
  39484. 0x30f3,
  39485. "nkatakanahalfwidth",
  39486. 0xff9d,
  39487. "nlegrightlong",
  39488. 0x019e,
  39489. "nlinebelow",
  39490. 0x1e49,
  39491. "nmonospace",
  39492. 0xff4e,
  39493. "nmsquare",
  39494. 0x339a,
  39495. "nnabengali",
  39496. 0x09a3,
  39497. "nnadeva",
  39498. 0x0923,
  39499. "nnagujarati",
  39500. 0x0aa3,
  39501. "nnagurmukhi",
  39502. 0x0a23,
  39503. "nnnadeva",
  39504. 0x0929,
  39505. "nohiragana",
  39506. 0x306e,
  39507. "nokatakana",
  39508. 0x30ce,
  39509. "nokatakanahalfwidth",
  39510. 0xff89,
  39511. "nonbreakingspace",
  39512. 0x00a0,
  39513. "nonenthai",
  39514. 0x0e13,
  39515. "nonuthai",
  39516. 0x0e19,
  39517. "noonarabic",
  39518. 0x0646,
  39519. "noonfinalarabic",
  39520. 0xfee6,
  39521. "noonghunnaarabic",
  39522. 0x06ba,
  39523. "noonghunnafinalarabic",
  39524. 0xfb9f,
  39525. "nooninitialarabic",
  39526. 0xfee7,
  39527. "noonjeeminitialarabic",
  39528. 0xfcd2,
  39529. "noonjeemisolatedarabic",
  39530. 0xfc4b,
  39531. "noonmedialarabic",
  39532. 0xfee8,
  39533. "noonmeeminitialarabic",
  39534. 0xfcd5,
  39535. "noonmeemisolatedarabic",
  39536. 0xfc4e,
  39537. "noonnoonfinalarabic",
  39538. 0xfc8d,
  39539. "notcontains",
  39540. 0x220c,
  39541. "notelement",
  39542. 0x2209,
  39543. "notelementof",
  39544. 0x2209,
  39545. "notequal",
  39546. 0x2260,
  39547. "notgreater",
  39548. 0x226f,
  39549. "notgreaternorequal",
  39550. 0x2271,
  39551. "notgreaternorless",
  39552. 0x2279,
  39553. "notidentical",
  39554. 0x2262,
  39555. "notless",
  39556. 0x226e,
  39557. "notlessnorequal",
  39558. 0x2270,
  39559. "notparallel",
  39560. 0x2226,
  39561. "notprecedes",
  39562. 0x2280,
  39563. "notsubset",
  39564. 0x2284,
  39565. "notsucceeds",
  39566. 0x2281,
  39567. "notsuperset",
  39568. 0x2285,
  39569. "nowarmenian",
  39570. 0x0576,
  39571. "nparen",
  39572. 0x24a9,
  39573. "nssquare",
  39574. 0x33b1,
  39575. "nsuperior",
  39576. 0x207f,
  39577. "ntilde",
  39578. 0x00f1,
  39579. "nu",
  39580. 0x03bd,
  39581. "nuhiragana",
  39582. 0x306c,
  39583. "nukatakana",
  39584. 0x30cc,
  39585. "nukatakanahalfwidth",
  39586. 0xff87,
  39587. "nuktabengali",
  39588. 0x09bc,
  39589. "nuktadeva",
  39590. 0x093c,
  39591. "nuktagujarati",
  39592. 0x0abc,
  39593. "nuktagurmukhi",
  39594. 0x0a3c,
  39595. "numbersign",
  39596. 0x0023,
  39597. "numbersignmonospace",
  39598. 0xff03,
  39599. "numbersignsmall",
  39600. 0xfe5f,
  39601. "numeralsigngreek",
  39602. 0x0374,
  39603. "numeralsignlowergreek",
  39604. 0x0375,
  39605. "numero",
  39606. 0x2116,
  39607. "nun",
  39608. 0x05e0,
  39609. "nundagesh",
  39610. 0xfb40,
  39611. "nundageshhebrew",
  39612. 0xfb40,
  39613. "nunhebrew",
  39614. 0x05e0,
  39615. "nvsquare",
  39616. 0x33b5,
  39617. "nwsquare",
  39618. 0x33bb,
  39619. "nyabengali",
  39620. 0x099e,
  39621. "nyadeva",
  39622. 0x091e,
  39623. "nyagujarati",
  39624. 0x0a9e,
  39625. "nyagurmukhi",
  39626. 0x0a1e,
  39627. "o",
  39628. 0x006f,
  39629. "oacute",
  39630. 0x00f3,
  39631. "oangthai",
  39632. 0x0e2d,
  39633. "obarred",
  39634. 0x0275,
  39635. "obarredcyrillic",
  39636. 0x04e9,
  39637. "obarreddieresiscyrillic",
  39638. 0x04eb,
  39639. "obengali",
  39640. 0x0993,
  39641. "obopomofo",
  39642. 0x311b,
  39643. "obreve",
  39644. 0x014f,
  39645. "ocandradeva",
  39646. 0x0911,
  39647. "ocandragujarati",
  39648. 0x0a91,
  39649. "ocandravowelsigndeva",
  39650. 0x0949,
  39651. "ocandravowelsigngujarati",
  39652. 0x0ac9,
  39653. "ocaron",
  39654. 0x01d2,
  39655. "ocircle",
  39656. 0x24de,
  39657. "ocircumflex",
  39658. 0x00f4,
  39659. "ocircumflexacute",
  39660. 0x1ed1,
  39661. "ocircumflexdotbelow",
  39662. 0x1ed9,
  39663. "ocircumflexgrave",
  39664. 0x1ed3,
  39665. "ocircumflexhookabove",
  39666. 0x1ed5,
  39667. "ocircumflextilde",
  39668. 0x1ed7,
  39669. "ocyrillic",
  39670. 0x043e,
  39671. "odblacute",
  39672. 0x0151,
  39673. "odblgrave",
  39674. 0x020d,
  39675. "odeva",
  39676. 0x0913,
  39677. "odieresis",
  39678. 0x00f6,
  39679. "odieresiscyrillic",
  39680. 0x04e7,
  39681. "odotbelow",
  39682. 0x1ecd,
  39683. "oe",
  39684. 0x0153,
  39685. "oekorean",
  39686. 0x315a,
  39687. "ogonek",
  39688. 0x02db,
  39689. "ogonekcmb",
  39690. 0x0328,
  39691. "ograve",
  39692. 0x00f2,
  39693. "ogujarati",
  39694. 0x0a93,
  39695. "oharmenian",
  39696. 0x0585,
  39697. "ohiragana",
  39698. 0x304a,
  39699. "ohookabove",
  39700. 0x1ecf,
  39701. "ohorn",
  39702. 0x01a1,
  39703. "ohornacute",
  39704. 0x1edb,
  39705. "ohorndotbelow",
  39706. 0x1ee3,
  39707. "ohorngrave",
  39708. 0x1edd,
  39709. "ohornhookabove",
  39710. 0x1edf,
  39711. "ohorntilde",
  39712. 0x1ee1,
  39713. "ohungarumlaut",
  39714. 0x0151,
  39715. "oi",
  39716. 0x01a3,
  39717. "oinvertedbreve",
  39718. 0x020f,
  39719. "okatakana",
  39720. 0x30aa,
  39721. "okatakanahalfwidth",
  39722. 0xff75,
  39723. "okorean",
  39724. 0x3157,
  39725. "olehebrew",
  39726. 0x05ab,
  39727. "omacron",
  39728. 0x014d,
  39729. "omacronacute",
  39730. 0x1e53,
  39731. "omacrongrave",
  39732. 0x1e51,
  39733. "omdeva",
  39734. 0x0950,
  39735. "omega",
  39736. 0x03c9,
  39737. "omega1",
  39738. 0x03d6,
  39739. "omegacyrillic",
  39740. 0x0461,
  39741. "omegalatinclosed",
  39742. 0x0277,
  39743. "omegaroundcyrillic",
  39744. 0x047b,
  39745. "omegatitlocyrillic",
  39746. 0x047d,
  39747. "omegatonos",
  39748. 0x03ce,
  39749. "omgujarati",
  39750. 0x0ad0,
  39751. "omicron",
  39752. 0x03bf,
  39753. "omicrontonos",
  39754. 0x03cc,
  39755. "omonospace",
  39756. 0xff4f,
  39757. "one",
  39758. 0x0031,
  39759. "onearabic",
  39760. 0x0661,
  39761. "onebengali",
  39762. 0x09e7,
  39763. "onecircle",
  39764. 0x2460,
  39765. "onecircleinversesansserif",
  39766. 0x278a,
  39767. "onedeva",
  39768. 0x0967,
  39769. "onedotenleader",
  39770. 0x2024,
  39771. "oneeighth",
  39772. 0x215b,
  39773. "onefitted",
  39774. 0xf6dc,
  39775. "onegujarati",
  39776. 0x0ae7,
  39777. "onegurmukhi",
  39778. 0x0a67,
  39779. "onehackarabic",
  39780. 0x0661,
  39781. "onehalf",
  39782. 0x00bd,
  39783. "onehangzhou",
  39784. 0x3021,
  39785. "oneideographicparen",
  39786. 0x3220,
  39787. "oneinferior",
  39788. 0x2081,
  39789. "onemonospace",
  39790. 0xff11,
  39791. "onenumeratorbengali",
  39792. 0x09f4,
  39793. "oneoldstyle",
  39794. 0xf731,
  39795. "oneparen",
  39796. 0x2474,
  39797. "oneperiod",
  39798. 0x2488,
  39799. "onepersian",
  39800. 0x06f1,
  39801. "onequarter",
  39802. 0x00bc,
  39803. "oneroman",
  39804. 0x2170,
  39805. "onesuperior",
  39806. 0x00b9,
  39807. "onethai",
  39808. 0x0e51,
  39809. "onethird",
  39810. 0x2153,
  39811. "oogonek",
  39812. 0x01eb,
  39813. "oogonekmacron",
  39814. 0x01ed,
  39815. "oogurmukhi",
  39816. 0x0a13,
  39817. "oomatragurmukhi",
  39818. 0x0a4b,
  39819. "oopen",
  39820. 0x0254,
  39821. "oparen",
  39822. 0x24aa,
  39823. "openbullet",
  39824. 0x25e6,
  39825. "option",
  39826. 0x2325,
  39827. "ordfeminine",
  39828. 0x00aa,
  39829. "ordmasculine",
  39830. 0x00ba,
  39831. "orthogonal",
  39832. 0x221f,
  39833. "oshortdeva",
  39834. 0x0912,
  39835. "oshortvowelsigndeva",
  39836. 0x094a,
  39837. "oslash",
  39838. 0x00f8,
  39839. "oslashacute",
  39840. 0x01ff,
  39841. "osmallhiragana",
  39842. 0x3049,
  39843. "osmallkatakana",
  39844. 0x30a9,
  39845. "osmallkatakanahalfwidth",
  39846. 0xff6b,
  39847. "ostrokeacute",
  39848. 0x01ff,
  39849. "osuperior",
  39850. 0xf6f0,
  39851. "otcyrillic",
  39852. 0x047f,
  39853. "otilde",
  39854. 0x00f5,
  39855. "otildeacute",
  39856. 0x1e4d,
  39857. "otildedieresis",
  39858. 0x1e4f,
  39859. "oubopomofo",
  39860. 0x3121,
  39861. "overline",
  39862. 0x203e,
  39863. "overlinecenterline",
  39864. 0xfe4a,
  39865. "overlinecmb",
  39866. 0x0305,
  39867. "overlinedashed",
  39868. 0xfe49,
  39869. "overlinedblwavy",
  39870. 0xfe4c,
  39871. "overlinewavy",
  39872. 0xfe4b,
  39873. "overscore",
  39874. 0x00af,
  39875. "ovowelsignbengali",
  39876. 0x09cb,
  39877. "ovowelsigndeva",
  39878. 0x094b,
  39879. "ovowelsigngujarati",
  39880. 0x0acb,
  39881. "p",
  39882. 0x0070,
  39883. "paampssquare",
  39884. 0x3380,
  39885. "paasentosquare",
  39886. 0x332b,
  39887. "pabengali",
  39888. 0x09aa,
  39889. "pacute",
  39890. 0x1e55,
  39891. "padeva",
  39892. 0x092a,
  39893. "pagedown",
  39894. 0x21df,
  39895. "pageup",
  39896. 0x21de,
  39897. "pagujarati",
  39898. 0x0aaa,
  39899. "pagurmukhi",
  39900. 0x0a2a,
  39901. "pahiragana",
  39902. 0x3071,
  39903. "paiyannoithai",
  39904. 0x0e2f,
  39905. "pakatakana",
  39906. 0x30d1,
  39907. "palatalizationcyrilliccmb",
  39908. 0x0484,
  39909. "palochkacyrillic",
  39910. 0x04c0,
  39911. "pansioskorean",
  39912. 0x317f,
  39913. "paragraph",
  39914. 0x00b6,
  39915. "parallel",
  39916. 0x2225,
  39917. "parenleft",
  39918. 0x0028,
  39919. "parenleftaltonearabic",
  39920. 0xfd3e,
  39921. "parenleftbt",
  39922. 0xf8ed,
  39923. "parenleftex",
  39924. 0xf8ec,
  39925. "parenleftinferior",
  39926. 0x208d,
  39927. "parenleftmonospace",
  39928. 0xff08,
  39929. "parenleftsmall",
  39930. 0xfe59,
  39931. "parenleftsuperior",
  39932. 0x207d,
  39933. "parenlefttp",
  39934. 0xf8eb,
  39935. "parenleftvertical",
  39936. 0xfe35,
  39937. "parenright",
  39938. 0x0029,
  39939. "parenrightaltonearabic",
  39940. 0xfd3f,
  39941. "parenrightbt",
  39942. 0xf8f8,
  39943. "parenrightex",
  39944. 0xf8f7,
  39945. "parenrightinferior",
  39946. 0x208e,
  39947. "parenrightmonospace",
  39948. 0xff09,
  39949. "parenrightsmall",
  39950. 0xfe5a,
  39951. "parenrightsuperior",
  39952. 0x207e,
  39953. "parenrighttp",
  39954. 0xf8f6,
  39955. "parenrightvertical",
  39956. 0xfe36,
  39957. "partialdiff",
  39958. 0x2202,
  39959. "paseqhebrew",
  39960. 0x05c0,
  39961. "pashtahebrew",
  39962. 0x0599,
  39963. "pasquare",
  39964. 0x33a9,
  39965. "patah",
  39966. 0x05b7,
  39967. "patah11",
  39968. 0x05b7,
  39969. "patah1d",
  39970. 0x05b7,
  39971. "patah2a",
  39972. 0x05b7,
  39973. "patahhebrew",
  39974. 0x05b7,
  39975. "patahnarrowhebrew",
  39976. 0x05b7,
  39977. "patahquarterhebrew",
  39978. 0x05b7,
  39979. "patahwidehebrew",
  39980. 0x05b7,
  39981. "pazerhebrew",
  39982. 0x05a1,
  39983. "pbopomofo",
  39984. 0x3106,
  39985. "pcircle",
  39986. 0x24df,
  39987. "pdotaccent",
  39988. 0x1e57,
  39989. "pe",
  39990. 0x05e4,
  39991. "pecyrillic",
  39992. 0x043f,
  39993. "pedagesh",
  39994. 0xfb44,
  39995. "pedageshhebrew",
  39996. 0xfb44,
  39997. "peezisquare",
  39998. 0x333b,
  39999. "pefinaldageshhebrew",
  40000. 0xfb43,
  40001. "peharabic",
  40002. 0x067e,
  40003. "peharmenian",
  40004. 0x057a,
  40005. "pehebrew",
  40006. 0x05e4,
  40007. "pehfinalarabic",
  40008. 0xfb57,
  40009. "pehinitialarabic",
  40010. 0xfb58,
  40011. "pehiragana",
  40012. 0x307a,
  40013. "pehmedialarabic",
  40014. 0xfb59,
  40015. "pekatakana",
  40016. 0x30da,
  40017. "pemiddlehookcyrillic",
  40018. 0x04a7,
  40019. "perafehebrew",
  40020. 0xfb4e,
  40021. "percent",
  40022. 0x0025,
  40023. "percentarabic",
  40024. 0x066a,
  40025. "percentmonospace",
  40026. 0xff05,
  40027. "percentsmall",
  40028. 0xfe6a,
  40029. "period",
  40030. 0x002e,
  40031. "periodarmenian",
  40032. 0x0589,
  40033. "periodcentered",
  40034. 0x00b7,
  40035. "periodhalfwidth",
  40036. 0xff61,
  40037. "periodinferior",
  40038. 0xf6e7,
  40039. "periodmonospace",
  40040. 0xff0e,
  40041. "periodsmall",
  40042. 0xfe52,
  40043. "periodsuperior",
  40044. 0xf6e8,
  40045. "perispomenigreekcmb",
  40046. 0x0342,
  40047. "perpendicular",
  40048. 0x22a5,
  40049. "perthousand",
  40050. 0x2030,
  40051. "peseta",
  40052. 0x20a7,
  40053. "pfsquare",
  40054. 0x338a,
  40055. "phabengali",
  40056. 0x09ab,
  40057. "phadeva",
  40058. 0x092b,
  40059. "phagujarati",
  40060. 0x0aab,
  40061. "phagurmukhi",
  40062. 0x0a2b,
  40063. "phi",
  40064. 0x03c6,
  40065. "phi1",
  40066. 0x03d5,
  40067. "phieuphacirclekorean",
  40068. 0x327a,
  40069. "phieuphaparenkorean",
  40070. 0x321a,
  40071. "phieuphcirclekorean",
  40072. 0x326c,
  40073. "phieuphkorean",
  40074. 0x314d,
  40075. "phieuphparenkorean",
  40076. 0x320c,
  40077. "philatin",
  40078. 0x0278,
  40079. "phinthuthai",
  40080. 0x0e3a,
  40081. "phisymbolgreek",
  40082. 0x03d5,
  40083. "phook",
  40084. 0x01a5,
  40085. "phophanthai",
  40086. 0x0e1e,
  40087. "phophungthai",
  40088. 0x0e1c,
  40089. "phosamphaothai",
  40090. 0x0e20,
  40091. "pi",
  40092. 0x03c0,
  40093. "pieupacirclekorean",
  40094. 0x3273,
  40095. "pieupaparenkorean",
  40096. 0x3213,
  40097. "pieupcieuckorean",
  40098. 0x3176,
  40099. "pieupcirclekorean",
  40100. 0x3265,
  40101. "pieupkiyeokkorean",
  40102. 0x3172,
  40103. "pieupkorean",
  40104. 0x3142,
  40105. "pieupparenkorean",
  40106. 0x3205,
  40107. "pieupsioskiyeokkorean",
  40108. 0x3174,
  40109. "pieupsioskorean",
  40110. 0x3144,
  40111. "pieupsiostikeutkorean",
  40112. 0x3175,
  40113. "pieupthieuthkorean",
  40114. 0x3177,
  40115. "pieuptikeutkorean",
  40116. 0x3173,
  40117. "pihiragana",
  40118. 0x3074,
  40119. "pikatakana",
  40120. 0x30d4,
  40121. "pisymbolgreek",
  40122. 0x03d6,
  40123. "piwrarmenian",
  40124. 0x0583,
  40125. "plus",
  40126. 0x002b,
  40127. "plusbelowcmb",
  40128. 0x031f,
  40129. "pluscircle",
  40130. 0x2295,
  40131. "plusminus",
  40132. 0x00b1,
  40133. "plusmod",
  40134. 0x02d6,
  40135. "plusmonospace",
  40136. 0xff0b,
  40137. "plussmall",
  40138. 0xfe62,
  40139. "plussuperior",
  40140. 0x207a,
  40141. "pmonospace",
  40142. 0xff50,
  40143. "pmsquare",
  40144. 0x33d8,
  40145. "pohiragana",
  40146. 0x307d,
  40147. "pointingindexdownwhite",
  40148. 0x261f,
  40149. "pointingindexleftwhite",
  40150. 0x261c,
  40151. "pointingindexrightwhite",
  40152. 0x261e,
  40153. "pointingindexupwhite",
  40154. 0x261d,
  40155. "pokatakana",
  40156. 0x30dd,
  40157. "poplathai",
  40158. 0x0e1b,
  40159. "postalmark",
  40160. 0x3012,
  40161. "postalmarkface",
  40162. 0x3020,
  40163. "pparen",
  40164. 0x24ab,
  40165. "precedes",
  40166. 0x227a,
  40167. "prescription",
  40168. 0x211e,
  40169. "primemod",
  40170. 0x02b9,
  40171. "primereversed",
  40172. 0x2035,
  40173. "product",
  40174. 0x220f,
  40175. "projective",
  40176. 0x2305,
  40177. "prolongedkana",
  40178. 0x30fc,
  40179. "propellor",
  40180. 0x2318,
  40181. "propersubset",
  40182. 0x2282,
  40183. "propersuperset",
  40184. 0x2283,
  40185. "proportion",
  40186. 0x2237,
  40187. "proportional",
  40188. 0x221d,
  40189. "psi",
  40190. 0x03c8,
  40191. "psicyrillic",
  40192. 0x0471,
  40193. "psilipneumatacyrilliccmb",
  40194. 0x0486,
  40195. "pssquare",
  40196. 0x33b0,
  40197. "puhiragana",
  40198. 0x3077,
  40199. "pukatakana",
  40200. 0x30d7,
  40201. "pvsquare",
  40202. 0x33b4,
  40203. "pwsquare",
  40204. 0x33ba,
  40205. "q",
  40206. 0x0071,
  40207. "qadeva",
  40208. 0x0958,
  40209. "qadmahebrew",
  40210. 0x05a8,
  40211. "qafarabic",
  40212. 0x0642,
  40213. "qaffinalarabic",
  40214. 0xfed6,
  40215. "qafinitialarabic",
  40216. 0xfed7,
  40217. "qafmedialarabic",
  40218. 0xfed8,
  40219. "qamats",
  40220. 0x05b8,
  40221. "qamats10",
  40222. 0x05b8,
  40223. "qamats1a",
  40224. 0x05b8,
  40225. "qamats1c",
  40226. 0x05b8,
  40227. "qamats27",
  40228. 0x05b8,
  40229. "qamats29",
  40230. 0x05b8,
  40231. "qamats33",
  40232. 0x05b8,
  40233. "qamatsde",
  40234. 0x05b8,
  40235. "qamatshebrew",
  40236. 0x05b8,
  40237. "qamatsnarrowhebrew",
  40238. 0x05b8,
  40239. "qamatsqatanhebrew",
  40240. 0x05b8,
  40241. "qamatsqatannarrowhebrew",
  40242. 0x05b8,
  40243. "qamatsqatanquarterhebrew",
  40244. 0x05b8,
  40245. "qamatsqatanwidehebrew",
  40246. 0x05b8,
  40247. "qamatsquarterhebrew",
  40248. 0x05b8,
  40249. "qamatswidehebrew",
  40250. 0x05b8,
  40251. "qarneyparahebrew",
  40252. 0x059f,
  40253. "qbopomofo",
  40254. 0x3111,
  40255. "qcircle",
  40256. 0x24e0,
  40257. "qhook",
  40258. 0x02a0,
  40259. "qmonospace",
  40260. 0xff51,
  40261. "qof",
  40262. 0x05e7,
  40263. "qofdagesh",
  40264. 0xfb47,
  40265. "qofdageshhebrew",
  40266. 0xfb47,
  40267. "qofhebrew",
  40268. 0x05e7,
  40269. "qparen",
  40270. 0x24ac,
  40271. "quarternote",
  40272. 0x2669,
  40273. "qubuts",
  40274. 0x05bb,
  40275. "qubuts18",
  40276. 0x05bb,
  40277. "qubuts25",
  40278. 0x05bb,
  40279. "qubuts31",
  40280. 0x05bb,
  40281. "qubutshebrew",
  40282. 0x05bb,
  40283. "qubutsnarrowhebrew",
  40284. 0x05bb,
  40285. "qubutsquarterhebrew",
  40286. 0x05bb,
  40287. "qubutswidehebrew",
  40288. 0x05bb,
  40289. "question",
  40290. 0x003f,
  40291. "questionarabic",
  40292. 0x061f,
  40293. "questionarmenian",
  40294. 0x055e,
  40295. "questiondown",
  40296. 0x00bf,
  40297. "questiondownsmall",
  40298. 0xf7bf,
  40299. "questiongreek",
  40300. 0x037e,
  40301. "questionmonospace",
  40302. 0xff1f,
  40303. "questionsmall",
  40304. 0xf73f,
  40305. "quotedbl",
  40306. 0x0022,
  40307. "quotedblbase",
  40308. 0x201e,
  40309. "quotedblleft",
  40310. 0x201c,
  40311. "quotedblmonospace",
  40312. 0xff02,
  40313. "quotedblprime",
  40314. 0x301e,
  40315. "quotedblprimereversed",
  40316. 0x301d,
  40317. "quotedblright",
  40318. 0x201d,
  40319. "quoteleft",
  40320. 0x2018,
  40321. "quoteleftreversed",
  40322. 0x201b,
  40323. "quotereversed",
  40324. 0x201b,
  40325. "quoteright",
  40326. 0x2019,
  40327. "quoterightn",
  40328. 0x0149,
  40329. "quotesinglbase",
  40330. 0x201a,
  40331. "quotesingle",
  40332. 0x0027,
  40333. "quotesinglemonospace",
  40334. 0xff07,
  40335. "r",
  40336. 0x0072,
  40337. "raarmenian",
  40338. 0x057c,
  40339. "rabengali",
  40340. 0x09b0,
  40341. "racute",
  40342. 0x0155,
  40343. "radeva",
  40344. 0x0930,
  40345. "radical",
  40346. 0x221a,
  40347. "radicalex",
  40348. 0xf8e5,
  40349. "radoverssquare",
  40350. 0x33ae,
  40351. "radoverssquaredsquare",
  40352. 0x33af,
  40353. "radsquare",
  40354. 0x33ad,
  40355. "rafe",
  40356. 0x05bf,
  40357. "rafehebrew",
  40358. 0x05bf,
  40359. "ragujarati",
  40360. 0x0ab0,
  40361. "ragurmukhi",
  40362. 0x0a30,
  40363. "rahiragana",
  40364. 0x3089,
  40365. "rakatakana",
  40366. 0x30e9,
  40367. "rakatakanahalfwidth",
  40368. 0xff97,
  40369. "ralowerdiagonalbengali",
  40370. 0x09f1,
  40371. "ramiddlediagonalbengali",
  40372. 0x09f0,
  40373. "ramshorn",
  40374. 0x0264,
  40375. "ratio",
  40376. 0x2236,
  40377. "rbopomofo",
  40378. 0x3116,
  40379. "rcaron",
  40380. 0x0159,
  40381. "rcedilla",
  40382. 0x0157,
  40383. "rcircle",
  40384. 0x24e1,
  40385. "rcommaaccent",
  40386. 0x0157,
  40387. "rdblgrave",
  40388. 0x0211,
  40389. "rdotaccent",
  40390. 0x1e59,
  40391. "rdotbelow",
  40392. 0x1e5b,
  40393. "rdotbelowmacron",
  40394. 0x1e5d,
  40395. "referencemark",
  40396. 0x203b,
  40397. "reflexsubset",
  40398. 0x2286,
  40399. "reflexsuperset",
  40400. 0x2287,
  40401. "registered",
  40402. 0x00ae,
  40403. "registersans",
  40404. 0xf8e8,
  40405. "registerserif",
  40406. 0xf6da,
  40407. "reharabic",
  40408. 0x0631,
  40409. "reharmenian",
  40410. 0x0580,
  40411. "rehfinalarabic",
  40412. 0xfeae,
  40413. "rehiragana",
  40414. 0x308c,
  40415. "rekatakana",
  40416. 0x30ec,
  40417. "rekatakanahalfwidth",
  40418. 0xff9a,
  40419. "resh",
  40420. 0x05e8,
  40421. "reshdageshhebrew",
  40422. 0xfb48,
  40423. "reshhebrew",
  40424. 0x05e8,
  40425. "reversedtilde",
  40426. 0x223d,
  40427. "reviahebrew",
  40428. 0x0597,
  40429. "reviamugrashhebrew",
  40430. 0x0597,
  40431. "revlogicalnot",
  40432. 0x2310,
  40433. "rfishhook",
  40434. 0x027e,
  40435. "rfishhookreversed",
  40436. 0x027f,
  40437. "rhabengali",
  40438. 0x09dd,
  40439. "rhadeva",
  40440. 0x095d,
  40441. "rho",
  40442. 0x03c1,
  40443. "rhook",
  40444. 0x027d,
  40445. "rhookturned",
  40446. 0x027b,
  40447. "rhookturnedsuperior",
  40448. 0x02b5,
  40449. "rhosymbolgreek",
  40450. 0x03f1,
  40451. "rhotichookmod",
  40452. 0x02de,
  40453. "rieulacirclekorean",
  40454. 0x3271,
  40455. "rieulaparenkorean",
  40456. 0x3211,
  40457. "rieulcirclekorean",
  40458. 0x3263,
  40459. "rieulhieuhkorean",
  40460. 0x3140,
  40461. "rieulkiyeokkorean",
  40462. 0x313a,
  40463. "rieulkiyeoksioskorean",
  40464. 0x3169,
  40465. "rieulkorean",
  40466. 0x3139,
  40467. "rieulmieumkorean",
  40468. 0x313b,
  40469. "rieulpansioskorean",
  40470. 0x316c,
  40471. "rieulparenkorean",
  40472. 0x3203,
  40473. "rieulphieuphkorean",
  40474. 0x313f,
  40475. "rieulpieupkorean",
  40476. 0x313c,
  40477. "rieulpieupsioskorean",
  40478. 0x316b,
  40479. "rieulsioskorean",
  40480. 0x313d,
  40481. "rieulthieuthkorean",
  40482. 0x313e,
  40483. "rieultikeutkorean",
  40484. 0x316a,
  40485. "rieulyeorinhieuhkorean",
  40486. 0x316d,
  40487. "rightangle",
  40488. 0x221f,
  40489. "righttackbelowcmb",
  40490. 0x0319,
  40491. "righttriangle",
  40492. 0x22bf,
  40493. "rihiragana",
  40494. 0x308a,
  40495. "rikatakana",
  40496. 0x30ea,
  40497. "rikatakanahalfwidth",
  40498. 0xff98,
  40499. "ring",
  40500. 0x02da,
  40501. "ringbelowcmb",
  40502. 0x0325,
  40503. "ringcmb",
  40504. 0x030a,
  40505. "ringhalfleft",
  40506. 0x02bf,
  40507. "ringhalfleftarmenian",
  40508. 0x0559,
  40509. "ringhalfleftbelowcmb",
  40510. 0x031c,
  40511. "ringhalfleftcentered",
  40512. 0x02d3,
  40513. "ringhalfright",
  40514. 0x02be,
  40515. "ringhalfrightbelowcmb",
  40516. 0x0339,
  40517. "ringhalfrightcentered",
  40518. 0x02d2,
  40519. "rinvertedbreve",
  40520. 0x0213,
  40521. "rittorusquare",
  40522. 0x3351,
  40523. "rlinebelow",
  40524. 0x1e5f,
  40525. "rlongleg",
  40526. 0x027c,
  40527. "rlonglegturned",
  40528. 0x027a,
  40529. "rmonospace",
  40530. 0xff52,
  40531. "rohiragana",
  40532. 0x308d,
  40533. "rokatakana",
  40534. 0x30ed,
  40535. "rokatakanahalfwidth",
  40536. 0xff9b,
  40537. "roruathai",
  40538. 0x0e23,
  40539. "rparen",
  40540. 0x24ad,
  40541. "rrabengali",
  40542. 0x09dc,
  40543. "rradeva",
  40544. 0x0931,
  40545. "rragurmukhi",
  40546. 0x0a5c,
  40547. "rreharabic",
  40548. 0x0691,
  40549. "rrehfinalarabic",
  40550. 0xfb8d,
  40551. "rrvocalicbengali",
  40552. 0x09e0,
  40553. "rrvocalicdeva",
  40554. 0x0960,
  40555. "rrvocalicgujarati",
  40556. 0x0ae0,
  40557. "rrvocalicvowelsignbengali",
  40558. 0x09c4,
  40559. "rrvocalicvowelsigndeva",
  40560. 0x0944,
  40561. "rrvocalicvowelsigngujarati",
  40562. 0x0ac4,
  40563. "rsuperior",
  40564. 0xf6f1,
  40565. "rtblock",
  40566. 0x2590,
  40567. "rturned",
  40568. 0x0279,
  40569. "rturnedsuperior",
  40570. 0x02b4,
  40571. "ruhiragana",
  40572. 0x308b,
  40573. "rukatakana",
  40574. 0x30eb,
  40575. "rukatakanahalfwidth",
  40576. 0xff99,
  40577. "rupeemarkbengali",
  40578. 0x09f2,
  40579. "rupeesignbengali",
  40580. 0x09f3,
  40581. "rupiah",
  40582. 0xf6dd,
  40583. "ruthai",
  40584. 0x0e24,
  40585. "rvocalicbengali",
  40586. 0x098b,
  40587. "rvocalicdeva",
  40588. 0x090b,
  40589. "rvocalicgujarati",
  40590. 0x0a8b,
  40591. "rvocalicvowelsignbengali",
  40592. 0x09c3,
  40593. "rvocalicvowelsigndeva",
  40594. 0x0943,
  40595. "rvocalicvowelsigngujarati",
  40596. 0x0ac3,
  40597. "s",
  40598. 0x0073,
  40599. "sabengali",
  40600. 0x09b8,
  40601. "sacute",
  40602. 0x015b,
  40603. "sacutedotaccent",
  40604. 0x1e65,
  40605. "sadarabic",
  40606. 0x0635,
  40607. "sadeva",
  40608. 0x0938,
  40609. "sadfinalarabic",
  40610. 0xfeba,
  40611. "sadinitialarabic",
  40612. 0xfebb,
  40613. "sadmedialarabic",
  40614. 0xfebc,
  40615. "sagujarati",
  40616. 0x0ab8,
  40617. "sagurmukhi",
  40618. 0x0a38,
  40619. "sahiragana",
  40620. 0x3055,
  40621. "sakatakana",
  40622. 0x30b5,
  40623. "sakatakanahalfwidth",
  40624. 0xff7b,
  40625. "sallallahoualayhewasallamarabic",
  40626. 0xfdfa,
  40627. "samekh",
  40628. 0x05e1,
  40629. "samekhdagesh",
  40630. 0xfb41,
  40631. "samekhdageshhebrew",
  40632. 0xfb41,
  40633. "samekhhebrew",
  40634. 0x05e1,
  40635. "saraaathai",
  40636. 0x0e32,
  40637. "saraaethai",
  40638. 0x0e41,
  40639. "saraaimaimalaithai",
  40640. 0x0e44,
  40641. "saraaimaimuanthai",
  40642. 0x0e43,
  40643. "saraamthai",
  40644. 0x0e33,
  40645. "saraathai",
  40646. 0x0e30,
  40647. "saraethai",
  40648. 0x0e40,
  40649. "saraiileftthai",
  40650. 0xf886,
  40651. "saraiithai",
  40652. 0x0e35,
  40653. "saraileftthai",
  40654. 0xf885,
  40655. "saraithai",
  40656. 0x0e34,
  40657. "saraothai",
  40658. 0x0e42,
  40659. "saraueeleftthai",
  40660. 0xf888,
  40661. "saraueethai",
  40662. 0x0e37,
  40663. "saraueleftthai",
  40664. 0xf887,
  40665. "sarauethai",
  40666. 0x0e36,
  40667. "sarauthai",
  40668. 0x0e38,
  40669. "sarauuthai",
  40670. 0x0e39,
  40671. "sbopomofo",
  40672. 0x3119,
  40673. "scaron",
  40674. 0x0161,
  40675. "scarondotaccent",
  40676. 0x1e67,
  40677. "scedilla",
  40678. 0x015f,
  40679. "schwa",
  40680. 0x0259,
  40681. "schwacyrillic",
  40682. 0x04d9,
  40683. "schwadieresiscyrillic",
  40684. 0x04db,
  40685. "schwahook",
  40686. 0x025a,
  40687. "scircle",
  40688. 0x24e2,
  40689. "scircumflex",
  40690. 0x015d,
  40691. "scommaaccent",
  40692. 0x0219,
  40693. "sdotaccent",
  40694. 0x1e61,
  40695. "sdotbelow",
  40696. 0x1e63,
  40697. "sdotbelowdotaccent",
  40698. 0x1e69,
  40699. "seagullbelowcmb",
  40700. 0x033c,
  40701. "second",
  40702. 0x2033,
  40703. "secondtonechinese",
  40704. 0x02ca,
  40705. "section",
  40706. 0x00a7,
  40707. "seenarabic",
  40708. 0x0633,
  40709. "seenfinalarabic",
  40710. 0xfeb2,
  40711. "seeninitialarabic",
  40712. 0xfeb3,
  40713. "seenmedialarabic",
  40714. 0xfeb4,
  40715. "segol",
  40716. 0x05b6,
  40717. "segol13",
  40718. 0x05b6,
  40719. "segol1f",
  40720. 0x05b6,
  40721. "segol2c",
  40722. 0x05b6,
  40723. "segolhebrew",
  40724. 0x05b6,
  40725. "segolnarrowhebrew",
  40726. 0x05b6,
  40727. "segolquarterhebrew",
  40728. 0x05b6,
  40729. "segoltahebrew",
  40730. 0x0592,
  40731. "segolwidehebrew",
  40732. 0x05b6,
  40733. "seharmenian",
  40734. 0x057d,
  40735. "sehiragana",
  40736. 0x305b,
  40737. "sekatakana",
  40738. 0x30bb,
  40739. "sekatakanahalfwidth",
  40740. 0xff7e,
  40741. "semicolon",
  40742. 0x003b,
  40743. "semicolonarabic",
  40744. 0x061b,
  40745. "semicolonmonospace",
  40746. 0xff1b,
  40747. "semicolonsmall",
  40748. 0xfe54,
  40749. "semivoicedmarkkana",
  40750. 0x309c,
  40751. "semivoicedmarkkanahalfwidth",
  40752. 0xff9f,
  40753. "sentisquare",
  40754. 0x3322,
  40755. "sentosquare",
  40756. 0x3323,
  40757. "seven",
  40758. 0x0037,
  40759. "sevenarabic",
  40760. 0x0667,
  40761. "sevenbengali",
  40762. 0x09ed,
  40763. "sevencircle",
  40764. 0x2466,
  40765. "sevencircleinversesansserif",
  40766. 0x2790,
  40767. "sevendeva",
  40768. 0x096d,
  40769. "seveneighths",
  40770. 0x215e,
  40771. "sevengujarati",
  40772. 0x0aed,
  40773. "sevengurmukhi",
  40774. 0x0a6d,
  40775. "sevenhackarabic",
  40776. 0x0667,
  40777. "sevenhangzhou",
  40778. 0x3027,
  40779. "sevenideographicparen",
  40780. 0x3226,
  40781. "seveninferior",
  40782. 0x2087,
  40783. "sevenmonospace",
  40784. 0xff17,
  40785. "sevenoldstyle",
  40786. 0xf737,
  40787. "sevenparen",
  40788. 0x247a,
  40789. "sevenperiod",
  40790. 0x248e,
  40791. "sevenpersian",
  40792. 0x06f7,
  40793. "sevenroman",
  40794. 0x2176,
  40795. "sevensuperior",
  40796. 0x2077,
  40797. "seventeencircle",
  40798. 0x2470,
  40799. "seventeenparen",
  40800. 0x2484,
  40801. "seventeenperiod",
  40802. 0x2498,
  40803. "seventhai",
  40804. 0x0e57,
  40805. "sfthyphen",
  40806. 0x00ad,
  40807. "shaarmenian",
  40808. 0x0577,
  40809. "shabengali",
  40810. 0x09b6,
  40811. "shacyrillic",
  40812. 0x0448,
  40813. "shaddaarabic",
  40814. 0x0651,
  40815. "shaddadammaarabic",
  40816. 0xfc61,
  40817. "shaddadammatanarabic",
  40818. 0xfc5e,
  40819. "shaddafathaarabic",
  40820. 0xfc60,
  40821. "shaddakasraarabic",
  40822. 0xfc62,
  40823. "shaddakasratanarabic",
  40824. 0xfc5f,
  40825. "shade",
  40826. 0x2592,
  40827. "shadedark",
  40828. 0x2593,
  40829. "shadelight",
  40830. 0x2591,
  40831. "shademedium",
  40832. 0x2592,
  40833. "shadeva",
  40834. 0x0936,
  40835. "shagujarati",
  40836. 0x0ab6,
  40837. "shagurmukhi",
  40838. 0x0a36,
  40839. "shalshelethebrew",
  40840. 0x0593,
  40841. "shbopomofo",
  40842. 0x3115,
  40843. "shchacyrillic",
  40844. 0x0449,
  40845. "sheenarabic",
  40846. 0x0634,
  40847. "sheenfinalarabic",
  40848. 0xfeb6,
  40849. "sheeninitialarabic",
  40850. 0xfeb7,
  40851. "sheenmedialarabic",
  40852. 0xfeb8,
  40853. "sheicoptic",
  40854. 0x03e3,
  40855. "sheqel",
  40856. 0x20aa,
  40857. "sheqelhebrew",
  40858. 0x20aa,
  40859. "sheva",
  40860. 0x05b0,
  40861. "sheva115",
  40862. 0x05b0,
  40863. "sheva15",
  40864. 0x05b0,
  40865. "sheva22",
  40866. 0x05b0,
  40867. "sheva2e",
  40868. 0x05b0,
  40869. "shevahebrew",
  40870. 0x05b0,
  40871. "shevanarrowhebrew",
  40872. 0x05b0,
  40873. "shevaquarterhebrew",
  40874. 0x05b0,
  40875. "shevawidehebrew",
  40876. 0x05b0,
  40877. "shhacyrillic",
  40878. 0x04bb,
  40879. "shimacoptic",
  40880. 0x03ed,
  40881. "shin",
  40882. 0x05e9,
  40883. "shindagesh",
  40884. 0xfb49,
  40885. "shindageshhebrew",
  40886. 0xfb49,
  40887. "shindageshshindot",
  40888. 0xfb2c,
  40889. "shindageshshindothebrew",
  40890. 0xfb2c,
  40891. "shindageshsindot",
  40892. 0xfb2d,
  40893. "shindageshsindothebrew",
  40894. 0xfb2d,
  40895. "shindothebrew",
  40896. 0x05c1,
  40897. "shinhebrew",
  40898. 0x05e9,
  40899. "shinshindot",
  40900. 0xfb2a,
  40901. "shinshindothebrew",
  40902. 0xfb2a,
  40903. "shinsindot",
  40904. 0xfb2b,
  40905. "shinsindothebrew",
  40906. 0xfb2b,
  40907. "shook",
  40908. 0x0282,
  40909. "sigma",
  40910. 0x03c3,
  40911. "sigma1",
  40912. 0x03c2,
  40913. "sigmafinal",
  40914. 0x03c2,
  40915. "sigmalunatesymbolgreek",
  40916. 0x03f2,
  40917. "sihiragana",
  40918. 0x3057,
  40919. "sikatakana",
  40920. 0x30b7,
  40921. "sikatakanahalfwidth",
  40922. 0xff7c,
  40923. "siluqhebrew",
  40924. 0x05bd,
  40925. "siluqlefthebrew",
  40926. 0x05bd,
  40927. "similar",
  40928. 0x223c,
  40929. "sindothebrew",
  40930. 0x05c2,
  40931. "siosacirclekorean",
  40932. 0x3274,
  40933. "siosaparenkorean",
  40934. 0x3214,
  40935. "sioscieuckorean",
  40936. 0x317e,
  40937. "sioscirclekorean",
  40938. 0x3266,
  40939. "sioskiyeokkorean",
  40940. 0x317a,
  40941. "sioskorean",
  40942. 0x3145,
  40943. "siosnieunkorean",
  40944. 0x317b,
  40945. "siosparenkorean",
  40946. 0x3206,
  40947. "siospieupkorean",
  40948. 0x317d,
  40949. "siostikeutkorean",
  40950. 0x317c,
  40951. "six",
  40952. 0x0036,
  40953. "sixarabic",
  40954. 0x0666,
  40955. "sixbengali",
  40956. 0x09ec,
  40957. "sixcircle",
  40958. 0x2465,
  40959. "sixcircleinversesansserif",
  40960. 0x278f,
  40961. "sixdeva",
  40962. 0x096c,
  40963. "sixgujarati",
  40964. 0x0aec,
  40965. "sixgurmukhi",
  40966. 0x0a6c,
  40967. "sixhackarabic",
  40968. 0x0666,
  40969. "sixhangzhou",
  40970. 0x3026,
  40971. "sixideographicparen",
  40972. 0x3225,
  40973. "sixinferior",
  40974. 0x2086,
  40975. "sixmonospace",
  40976. 0xff16,
  40977. "sixoldstyle",
  40978. 0xf736,
  40979. "sixparen",
  40980. 0x2479,
  40981. "sixperiod",
  40982. 0x248d,
  40983. "sixpersian",
  40984. 0x06f6,
  40985. "sixroman",
  40986. 0x2175,
  40987. "sixsuperior",
  40988. 0x2076,
  40989. "sixteencircle",
  40990. 0x246f,
  40991. "sixteencurrencydenominatorbengali",
  40992. 0x09f9,
  40993. "sixteenparen",
  40994. 0x2483,
  40995. "sixteenperiod",
  40996. 0x2497,
  40997. "sixthai",
  40998. 0x0e56,
  40999. "slash",
  41000. 0x002f,
  41001. "slashmonospace",
  41002. 0xff0f,
  41003. "slong",
  41004. 0x017f,
  41005. "slongdotaccent",
  41006. 0x1e9b,
  41007. "smileface",
  41008. 0x263a,
  41009. "smonospace",
  41010. 0xff53,
  41011. "sofpasuqhebrew",
  41012. 0x05c3,
  41013. "softhyphen",
  41014. 0x00ad,
  41015. "softsigncyrillic",
  41016. 0x044c,
  41017. "sohiragana",
  41018. 0x305d,
  41019. "sokatakana",
  41020. 0x30bd,
  41021. "sokatakanahalfwidth",
  41022. 0xff7f,
  41023. "soliduslongoverlaycmb",
  41024. 0x0338,
  41025. "solidusshortoverlaycmb",
  41026. 0x0337,
  41027. "sorusithai",
  41028. 0x0e29,
  41029. "sosalathai",
  41030. 0x0e28,
  41031. "sosothai",
  41032. 0x0e0b,
  41033. "sosuathai",
  41034. 0x0e2a,
  41035. "space",
  41036. 0x0020,
  41037. "spacehackarabic",
  41038. 0x0020,
  41039. "spade",
  41040. 0x2660,
  41041. "spadesuitblack",
  41042. 0x2660,
  41043. "spadesuitwhite",
  41044. 0x2664,
  41045. "sparen",
  41046. 0x24ae,
  41047. "squarebelowcmb",
  41048. 0x033b,
  41049. "squarecc",
  41050. 0x33c4,
  41051. "squarecm",
  41052. 0x339d,
  41053. "squarediagonalcrosshatchfill",
  41054. 0x25a9,
  41055. "squarehorizontalfill",
  41056. 0x25a4,
  41057. "squarekg",
  41058. 0x338f,
  41059. "squarekm",
  41060. 0x339e,
  41061. "squarekmcapital",
  41062. 0x33ce,
  41063. "squareln",
  41064. 0x33d1,
  41065. "squarelog",
  41066. 0x33d2,
  41067. "squaremg",
  41068. 0x338e,
  41069. "squaremil",
  41070. 0x33d5,
  41071. "squaremm",
  41072. 0x339c,
  41073. "squaremsquared",
  41074. 0x33a1,
  41075. "squareorthogonalcrosshatchfill",
  41076. 0x25a6,
  41077. "squareupperlefttolowerrightfill",
  41078. 0x25a7,
  41079. "squareupperrighttolowerleftfill",
  41080. 0x25a8,
  41081. "squareverticalfill",
  41082. 0x25a5,
  41083. "squarewhitewithsmallblack",
  41084. 0x25a3,
  41085. "srsquare",
  41086. 0x33db,
  41087. "ssabengali",
  41088. 0x09b7,
  41089. "ssadeva",
  41090. 0x0937,
  41091. "ssagujarati",
  41092. 0x0ab7,
  41093. "ssangcieuckorean",
  41094. 0x3149,
  41095. "ssanghieuhkorean",
  41096. 0x3185,
  41097. "ssangieungkorean",
  41098. 0x3180,
  41099. "ssangkiyeokkorean",
  41100. 0x3132,
  41101. "ssangnieunkorean",
  41102. 0x3165,
  41103. "ssangpieupkorean",
  41104. 0x3143,
  41105. "ssangsioskorean",
  41106. 0x3146,
  41107. "ssangtikeutkorean",
  41108. 0x3138,
  41109. "ssuperior",
  41110. 0xf6f2,
  41111. "sterling",
  41112. 0x00a3,
  41113. "sterlingmonospace",
  41114. 0xffe1,
  41115. "strokelongoverlaycmb",
  41116. 0x0336,
  41117. "strokeshortoverlaycmb",
  41118. 0x0335,
  41119. "subset",
  41120. 0x2282,
  41121. "subsetnotequal",
  41122. 0x228a,
  41123. "subsetorequal",
  41124. 0x2286,
  41125. "succeeds",
  41126. 0x227b,
  41127. "suchthat",
  41128. 0x220b,
  41129. "suhiragana",
  41130. 0x3059,
  41131. "sukatakana",
  41132. 0x30b9,
  41133. "sukatakanahalfwidth",
  41134. 0xff7d,
  41135. "sukunarabic",
  41136. 0x0652,
  41137. "summation",
  41138. 0x2211,
  41139. "sun",
  41140. 0x263c,
  41141. "superset",
  41142. 0x2283,
  41143. "supersetnotequal",
  41144. 0x228b,
  41145. "supersetorequal",
  41146. 0x2287,
  41147. "svsquare",
  41148. 0x33dc,
  41149. "syouwaerasquare",
  41150. 0x337c,
  41151. "t",
  41152. 0x0074,
  41153. "tabengali",
  41154. 0x09a4,
  41155. "tackdown",
  41156. 0x22a4,
  41157. "tackleft",
  41158. 0x22a3,
  41159. "tadeva",
  41160. 0x0924,
  41161. "tagujarati",
  41162. 0x0aa4,
  41163. "tagurmukhi",
  41164. 0x0a24,
  41165. "taharabic",
  41166. 0x0637,
  41167. "tahfinalarabic",
  41168. 0xfec2,
  41169. "tahinitialarabic",
  41170. 0xfec3,
  41171. "tahiragana",
  41172. 0x305f,
  41173. "tahmedialarabic",
  41174. 0xfec4,
  41175. "taisyouerasquare",
  41176. 0x337d,
  41177. "takatakana",
  41178. 0x30bf,
  41179. "takatakanahalfwidth",
  41180. 0xff80,
  41181. "tatweelarabic",
  41182. 0x0640,
  41183. "tau",
  41184. 0x03c4,
  41185. "tav",
  41186. 0x05ea,
  41187. "tavdages",
  41188. 0xfb4a,
  41189. "tavdagesh",
  41190. 0xfb4a,
  41191. "tavdageshhebrew",
  41192. 0xfb4a,
  41193. "tavhebrew",
  41194. 0x05ea,
  41195. "tbar",
  41196. 0x0167,
  41197. "tbopomofo",
  41198. 0x310a,
  41199. "tcaron",
  41200. 0x0165,
  41201. "tccurl",
  41202. 0x02a8,
  41203. "tcedilla",
  41204. 0x0163,
  41205. "tcheharabic",
  41206. 0x0686,
  41207. "tchehfinalarabic",
  41208. 0xfb7b,
  41209. "tchehinitialarabic",
  41210. 0xfb7c,
  41211. "tchehmedialarabic",
  41212. 0xfb7d,
  41213. "tcircle",
  41214. 0x24e3,
  41215. "tcircumflexbelow",
  41216. 0x1e71,
  41217. "tcommaaccent",
  41218. 0x0163,
  41219. "tdieresis",
  41220. 0x1e97,
  41221. "tdotaccent",
  41222. 0x1e6b,
  41223. "tdotbelow",
  41224. 0x1e6d,
  41225. "tecyrillic",
  41226. 0x0442,
  41227. "tedescendercyrillic",
  41228. 0x04ad,
  41229. "teharabic",
  41230. 0x062a,
  41231. "tehfinalarabic",
  41232. 0xfe96,
  41233. "tehhahinitialarabic",
  41234. 0xfca2,
  41235. "tehhahisolatedarabic",
  41236. 0xfc0c,
  41237. "tehinitialarabic",
  41238. 0xfe97,
  41239. "tehiragana",
  41240. 0x3066,
  41241. "tehjeeminitialarabic",
  41242. 0xfca1,
  41243. "tehjeemisolatedarabic",
  41244. 0xfc0b,
  41245. "tehmarbutaarabic",
  41246. 0x0629,
  41247. "tehmarbutafinalarabic",
  41248. 0xfe94,
  41249. "tehmedialarabic",
  41250. 0xfe98,
  41251. "tehmeeminitialarabic",
  41252. 0xfca4,
  41253. "tehmeemisolatedarabic",
  41254. 0xfc0e,
  41255. "tehnoonfinalarabic",
  41256. 0xfc73,
  41257. "tekatakana",
  41258. 0x30c6,
  41259. "tekatakanahalfwidth",
  41260. 0xff83,
  41261. "telephone",
  41262. 0x2121,
  41263. "telephoneblack",
  41264. 0x260e,
  41265. "telishagedolahebrew",
  41266. 0x05a0,
  41267. "telishaqetanahebrew",
  41268. 0x05a9,
  41269. "tencircle",
  41270. 0x2469,
  41271. "tenideographicparen",
  41272. 0x3229,
  41273. "tenparen",
  41274. 0x247d,
  41275. "tenperiod",
  41276. 0x2491,
  41277. "tenroman",
  41278. 0x2179,
  41279. "tesh",
  41280. 0x02a7,
  41281. "tet",
  41282. 0x05d8,
  41283. "tetdagesh",
  41284. 0xfb38,
  41285. "tetdageshhebrew",
  41286. 0xfb38,
  41287. "tethebrew",
  41288. 0x05d8,
  41289. "tetsecyrillic",
  41290. 0x04b5,
  41291. "tevirhebrew",
  41292. 0x059b,
  41293. "tevirlefthebrew",
  41294. 0x059b,
  41295. "thabengali",
  41296. 0x09a5,
  41297. "thadeva",
  41298. 0x0925,
  41299. "thagujarati",
  41300. 0x0aa5,
  41301. "thagurmukhi",
  41302. 0x0a25,
  41303. "thalarabic",
  41304. 0x0630,
  41305. "thalfinalarabic",
  41306. 0xfeac,
  41307. "thanthakhatlowleftthai",
  41308. 0xf898,
  41309. "thanthakhatlowrightthai",
  41310. 0xf897,
  41311. "thanthakhatthai",
  41312. 0x0e4c,
  41313. "thanthakhatupperleftthai",
  41314. 0xf896,
  41315. "theharabic",
  41316. 0x062b,
  41317. "thehfinalarabic",
  41318. 0xfe9a,
  41319. "thehinitialarabic",
  41320. 0xfe9b,
  41321. "thehmedialarabic",
  41322. 0xfe9c,
  41323. "thereexists",
  41324. 0x2203,
  41325. "therefore",
  41326. 0x2234,
  41327. "theta",
  41328. 0x03b8,
  41329. "theta1",
  41330. 0x03d1,
  41331. "thetasymbolgreek",
  41332. 0x03d1,
  41333. "thieuthacirclekorean",
  41334. 0x3279,
  41335. "thieuthaparenkorean",
  41336. 0x3219,
  41337. "thieuthcirclekorean",
  41338. 0x326b,
  41339. "thieuthkorean",
  41340. 0x314c,
  41341. "thieuthparenkorean",
  41342. 0x320b,
  41343. "thirteencircle",
  41344. 0x246c,
  41345. "thirteenparen",
  41346. 0x2480,
  41347. "thirteenperiod",
  41348. 0x2494,
  41349. "thonangmonthothai",
  41350. 0x0e11,
  41351. "thook",
  41352. 0x01ad,
  41353. "thophuthaothai",
  41354. 0x0e12,
  41355. "thorn",
  41356. 0x00fe,
  41357. "thothahanthai",
  41358. 0x0e17,
  41359. "thothanthai",
  41360. 0x0e10,
  41361. "thothongthai",
  41362. 0x0e18,
  41363. "thothungthai",
  41364. 0x0e16,
  41365. "thousandcyrillic",
  41366. 0x0482,
  41367. "thousandsseparatorarabic",
  41368. 0x066c,
  41369. "thousandsseparatorpersian",
  41370. 0x066c,
  41371. "three",
  41372. 0x0033,
  41373. "threearabic",
  41374. 0x0663,
  41375. "threebengali",
  41376. 0x09e9,
  41377. "threecircle",
  41378. 0x2462,
  41379. "threecircleinversesansserif",
  41380. 0x278c,
  41381. "threedeva",
  41382. 0x0969,
  41383. "threeeighths",
  41384. 0x215c,
  41385. "threegujarati",
  41386. 0x0ae9,
  41387. "threegurmukhi",
  41388. 0x0a69,
  41389. "threehackarabic",
  41390. 0x0663,
  41391. "threehangzhou",
  41392. 0x3023,
  41393. "threeideographicparen",
  41394. 0x3222,
  41395. "threeinferior",
  41396. 0x2083,
  41397. "threemonospace",
  41398. 0xff13,
  41399. "threenumeratorbengali",
  41400. 0x09f6,
  41401. "threeoldstyle",
  41402. 0xf733,
  41403. "threeparen",
  41404. 0x2476,
  41405. "threeperiod",
  41406. 0x248a,
  41407. "threepersian",
  41408. 0x06f3,
  41409. "threequarters",
  41410. 0x00be,
  41411. "threequartersemdash",
  41412. 0xf6de,
  41413. "threeroman",
  41414. 0x2172,
  41415. "threesuperior",
  41416. 0x00b3,
  41417. "threethai",
  41418. 0x0e53,
  41419. "thzsquare",
  41420. 0x3394,
  41421. "tihiragana",
  41422. 0x3061,
  41423. "tikatakana",
  41424. 0x30c1,
  41425. "tikatakanahalfwidth",
  41426. 0xff81,
  41427. "tikeutacirclekorean",
  41428. 0x3270,
  41429. "tikeutaparenkorean",
  41430. 0x3210,
  41431. "tikeutcirclekorean",
  41432. 0x3262,
  41433. "tikeutkorean",
  41434. 0x3137,
  41435. "tikeutparenkorean",
  41436. 0x3202,
  41437. "tilde",
  41438. 0x02dc,
  41439. "tildebelowcmb",
  41440. 0x0330,
  41441. "tildecmb",
  41442. 0x0303,
  41443. "tildecomb",
  41444. 0x0303,
  41445. "tildedoublecmb",
  41446. 0x0360,
  41447. "tildeoperator",
  41448. 0x223c,
  41449. "tildeoverlaycmb",
  41450. 0x0334,
  41451. "tildeverticalcmb",
  41452. 0x033e,
  41453. "timescircle",
  41454. 0x2297,
  41455. "tipehahebrew",
  41456. 0x0596,
  41457. "tipehalefthebrew",
  41458. 0x0596,
  41459. "tippigurmukhi",
  41460. 0x0a70,
  41461. "titlocyrilliccmb",
  41462. 0x0483,
  41463. "tiwnarmenian",
  41464. 0x057f,
  41465. "tlinebelow",
  41466. 0x1e6f,
  41467. "tmonospace",
  41468. 0xff54,
  41469. "toarmenian",
  41470. 0x0569,
  41471. "tohiragana",
  41472. 0x3068,
  41473. "tokatakana",
  41474. 0x30c8,
  41475. "tokatakanahalfwidth",
  41476. 0xff84,
  41477. "tonebarextrahighmod",
  41478. 0x02e5,
  41479. "tonebarextralowmod",
  41480. 0x02e9,
  41481. "tonebarhighmod",
  41482. 0x02e6,
  41483. "tonebarlowmod",
  41484. 0x02e8,
  41485. "tonebarmidmod",
  41486. 0x02e7,
  41487. "tonefive",
  41488. 0x01bd,
  41489. "tonesix",
  41490. 0x0185,
  41491. "tonetwo",
  41492. 0x01a8,
  41493. "tonos",
  41494. 0x0384,
  41495. "tonsquare",
  41496. 0x3327,
  41497. "topatakthai",
  41498. 0x0e0f,
  41499. "tortoiseshellbracketleft",
  41500. 0x3014,
  41501. "tortoiseshellbracketleftsmall",
  41502. 0xfe5d,
  41503. "tortoiseshellbracketleftvertical",
  41504. 0xfe39,
  41505. "tortoiseshellbracketright",
  41506. 0x3015,
  41507. "tortoiseshellbracketrightsmall",
  41508. 0xfe5e,
  41509. "tortoiseshellbracketrightvertical",
  41510. 0xfe3a,
  41511. "totaothai",
  41512. 0x0e15,
  41513. "tpalatalhook",
  41514. 0x01ab,
  41515. "tparen",
  41516. 0x24af,
  41517. "trademark",
  41518. 0x2122,
  41519. "trademarksans",
  41520. 0xf8ea,
  41521. "trademarkserif",
  41522. 0xf6db,
  41523. "tretroflexhook",
  41524. 0x0288,
  41525. "triagdn",
  41526. 0x25bc,
  41527. "triaglf",
  41528. 0x25c4,
  41529. "triagrt",
  41530. 0x25ba,
  41531. "triagup",
  41532. 0x25b2,
  41533. "ts",
  41534. 0x02a6,
  41535. "tsadi",
  41536. 0x05e6,
  41537. "tsadidagesh",
  41538. 0xfb46,
  41539. "tsadidageshhebrew",
  41540. 0xfb46,
  41541. "tsadihebrew",
  41542. 0x05e6,
  41543. "tsecyrillic",
  41544. 0x0446,
  41545. "tsere",
  41546. 0x05b5,
  41547. "tsere12",
  41548. 0x05b5,
  41549. "tsere1e",
  41550. 0x05b5,
  41551. "tsere2b",
  41552. 0x05b5,
  41553. "tserehebrew",
  41554. 0x05b5,
  41555. "tserenarrowhebrew",
  41556. 0x05b5,
  41557. "tserequarterhebrew",
  41558. 0x05b5,
  41559. "tserewidehebrew",
  41560. 0x05b5,
  41561. "tshecyrillic",
  41562. 0x045b,
  41563. "tsuperior",
  41564. 0xf6f3,
  41565. "ttabengali",
  41566. 0x099f,
  41567. "ttadeva",
  41568. 0x091f,
  41569. "ttagujarati",
  41570. 0x0a9f,
  41571. "ttagurmukhi",
  41572. 0x0a1f,
  41573. "tteharabic",
  41574. 0x0679,
  41575. "ttehfinalarabic",
  41576. 0xfb67,
  41577. "ttehinitialarabic",
  41578. 0xfb68,
  41579. "ttehmedialarabic",
  41580. 0xfb69,
  41581. "tthabengali",
  41582. 0x09a0,
  41583. "tthadeva",
  41584. 0x0920,
  41585. "tthagujarati",
  41586. 0x0aa0,
  41587. "tthagurmukhi",
  41588. 0x0a20,
  41589. "tturned",
  41590. 0x0287,
  41591. "tuhiragana",
  41592. 0x3064,
  41593. "tukatakana",
  41594. 0x30c4,
  41595. "tukatakanahalfwidth",
  41596. 0xff82,
  41597. "tusmallhiragana",
  41598. 0x3063,
  41599. "tusmallkatakana",
  41600. 0x30c3,
  41601. "tusmallkatakanahalfwidth",
  41602. 0xff6f,
  41603. "twelvecircle",
  41604. 0x246b,
  41605. "twelveparen",
  41606. 0x247f,
  41607. "twelveperiod",
  41608. 0x2493,
  41609. "twelveroman",
  41610. 0x217b,
  41611. "twentycircle",
  41612. 0x2473,
  41613. "twentyhangzhou",
  41614. 0x5344,
  41615. "twentyparen",
  41616. 0x2487,
  41617. "twentyperiod",
  41618. 0x249b,
  41619. "two",
  41620. 0x0032,
  41621. "twoarabic",
  41622. 0x0662,
  41623. "twobengali",
  41624. 0x09e8,
  41625. "twocircle",
  41626. 0x2461,
  41627. "twocircleinversesansserif",
  41628. 0x278b,
  41629. "twodeva",
  41630. 0x0968,
  41631. "twodotenleader",
  41632. 0x2025,
  41633. "twodotleader",
  41634. 0x2025,
  41635. "twodotleadervertical",
  41636. 0xfe30,
  41637. "twogujarati",
  41638. 0x0ae8,
  41639. "twogurmukhi",
  41640. 0x0a68,
  41641. "twohackarabic",
  41642. 0x0662,
  41643. "twohangzhou",
  41644. 0x3022,
  41645. "twoideographicparen",
  41646. 0x3221,
  41647. "twoinferior",
  41648. 0x2082,
  41649. "twomonospace",
  41650. 0xff12,
  41651. "twonumeratorbengali",
  41652. 0x09f5,
  41653. "twooldstyle",
  41654. 0xf732,
  41655. "twoparen",
  41656. 0x2475,
  41657. "twoperiod",
  41658. 0x2489,
  41659. "twopersian",
  41660. 0x06f2,
  41661. "tworoman",
  41662. 0x2171,
  41663. "twostroke",
  41664. 0x01bb,
  41665. "twosuperior",
  41666. 0x00b2,
  41667. "twothai",
  41668. 0x0e52,
  41669. "twothirds",
  41670. 0x2154,
  41671. "u",
  41672. 0x0075,
  41673. "uacute",
  41674. 0x00fa,
  41675. "ubar",
  41676. 0x0289,
  41677. "ubengali",
  41678. 0x0989,
  41679. "ubopomofo",
  41680. 0x3128,
  41681. "ubreve",
  41682. 0x016d,
  41683. "ucaron",
  41684. 0x01d4,
  41685. "ucircle",
  41686. 0x24e4,
  41687. "ucircumflex",
  41688. 0x00fb,
  41689. "ucircumflexbelow",
  41690. 0x1e77,
  41691. "ucyrillic",
  41692. 0x0443,
  41693. "udattadeva",
  41694. 0x0951,
  41695. "udblacute",
  41696. 0x0171,
  41697. "udblgrave",
  41698. 0x0215,
  41699. "udeva",
  41700. 0x0909,
  41701. "udieresis",
  41702. 0x00fc,
  41703. "udieresisacute",
  41704. 0x01d8,
  41705. "udieresisbelow",
  41706. 0x1e73,
  41707. "udieresiscaron",
  41708. 0x01da,
  41709. "udieresiscyrillic",
  41710. 0x04f1,
  41711. "udieresisgrave",
  41712. 0x01dc,
  41713. "udieresismacron",
  41714. 0x01d6,
  41715. "udotbelow",
  41716. 0x1ee5,
  41717. "ugrave",
  41718. 0x00f9,
  41719. "ugujarati",
  41720. 0x0a89,
  41721. "ugurmukhi",
  41722. 0x0a09,
  41723. "uhiragana",
  41724. 0x3046,
  41725. "uhookabove",
  41726. 0x1ee7,
  41727. "uhorn",
  41728. 0x01b0,
  41729. "uhornacute",
  41730. 0x1ee9,
  41731. "uhorndotbelow",
  41732. 0x1ef1,
  41733. "uhorngrave",
  41734. 0x1eeb,
  41735. "uhornhookabove",
  41736. 0x1eed,
  41737. "uhorntilde",
  41738. 0x1eef,
  41739. "uhungarumlaut",
  41740. 0x0171,
  41741. "uhungarumlautcyrillic",
  41742. 0x04f3,
  41743. "uinvertedbreve",
  41744. 0x0217,
  41745. "ukatakana",
  41746. 0x30a6,
  41747. "ukatakanahalfwidth",
  41748. 0xff73,
  41749. "ukcyrillic",
  41750. 0x0479,
  41751. "ukorean",
  41752. 0x315c,
  41753. "umacron",
  41754. 0x016b,
  41755. "umacroncyrillic",
  41756. 0x04ef,
  41757. "umacrondieresis",
  41758. 0x1e7b,
  41759. "umatragurmukhi",
  41760. 0x0a41,
  41761. "umonospace",
  41762. 0xff55,
  41763. "underscore",
  41764. 0x005f,
  41765. "underscoredbl",
  41766. 0x2017,
  41767. "underscoremonospace",
  41768. 0xff3f,
  41769. "underscorevertical",
  41770. 0xfe33,
  41771. "underscorewavy",
  41772. 0xfe4f,
  41773. "union",
  41774. 0x222a,
  41775. "universal",
  41776. 0x2200,
  41777. "uogonek",
  41778. 0x0173,
  41779. "uparen",
  41780. 0x24b0,
  41781. "upblock",
  41782. 0x2580,
  41783. "upperdothebrew",
  41784. 0x05c4,
  41785. "upsilon",
  41786. 0x03c5,
  41787. "upsilondieresis",
  41788. 0x03cb,
  41789. "upsilondieresistonos",
  41790. 0x03b0,
  41791. "upsilonlatin",
  41792. 0x028a,
  41793. "upsilontonos",
  41794. 0x03cd,
  41795. "uptackbelowcmb",
  41796. 0x031d,
  41797. "uptackmod",
  41798. 0x02d4,
  41799. "uragurmukhi",
  41800. 0x0a73,
  41801. "uring",
  41802. 0x016f,
  41803. "ushortcyrillic",
  41804. 0x045e,
  41805. "usmallhiragana",
  41806. 0x3045,
  41807. "usmallkatakana",
  41808. 0x30a5,
  41809. "usmallkatakanahalfwidth",
  41810. 0xff69,
  41811. "ustraightcyrillic",
  41812. 0x04af,
  41813. "ustraightstrokecyrillic",
  41814. 0x04b1,
  41815. "utilde",
  41816. 0x0169,
  41817. "utildeacute",
  41818. 0x1e79,
  41819. "utildebelow",
  41820. 0x1e75,
  41821. "uubengali",
  41822. 0x098a,
  41823. "uudeva",
  41824. 0x090a,
  41825. "uugujarati",
  41826. 0x0a8a,
  41827. "uugurmukhi",
  41828. 0x0a0a,
  41829. "uumatragurmukhi",
  41830. 0x0a42,
  41831. "uuvowelsignbengali",
  41832. 0x09c2,
  41833. "uuvowelsigndeva",
  41834. 0x0942,
  41835. "uuvowelsigngujarati",
  41836. 0x0ac2,
  41837. "uvowelsignbengali",
  41838. 0x09c1,
  41839. "uvowelsigndeva",
  41840. 0x0941,
  41841. "uvowelsigngujarati",
  41842. 0x0ac1,
  41843. "v",
  41844. 0x0076,
  41845. "vadeva",
  41846. 0x0935,
  41847. "vagujarati",
  41848. 0x0ab5,
  41849. "vagurmukhi",
  41850. 0x0a35,
  41851. "vakatakana",
  41852. 0x30f7,
  41853. "vav",
  41854. 0x05d5,
  41855. "vavdagesh",
  41856. 0xfb35,
  41857. "vavdagesh65",
  41858. 0xfb35,
  41859. "vavdageshhebrew",
  41860. 0xfb35,
  41861. "vavhebrew",
  41862. 0x05d5,
  41863. "vavholam",
  41864. 0xfb4b,
  41865. "vavholamhebrew",
  41866. 0xfb4b,
  41867. "vavvavhebrew",
  41868. 0x05f0,
  41869. "vavyodhebrew",
  41870. 0x05f1,
  41871. "vcircle",
  41872. 0x24e5,
  41873. "vdotbelow",
  41874. 0x1e7f,
  41875. "vecyrillic",
  41876. 0x0432,
  41877. "veharabic",
  41878. 0x06a4,
  41879. "vehfinalarabic",
  41880. 0xfb6b,
  41881. "vehinitialarabic",
  41882. 0xfb6c,
  41883. "vehmedialarabic",
  41884. 0xfb6d,
  41885. "vekatakana",
  41886. 0x30f9,
  41887. "venus",
  41888. 0x2640,
  41889. "verticalbar",
  41890. 0x007c,
  41891. "verticallineabovecmb",
  41892. 0x030d,
  41893. "verticallinebelowcmb",
  41894. 0x0329,
  41895. "verticallinelowmod",
  41896. 0x02cc,
  41897. "verticallinemod",
  41898. 0x02c8,
  41899. "vewarmenian",
  41900. 0x057e,
  41901. "vhook",
  41902. 0x028b,
  41903. "vikatakana",
  41904. 0x30f8,
  41905. "viramabengali",
  41906. 0x09cd,
  41907. "viramadeva",
  41908. 0x094d,
  41909. "viramagujarati",
  41910. 0x0acd,
  41911. "visargabengali",
  41912. 0x0983,
  41913. "visargadeva",
  41914. 0x0903,
  41915. "visargagujarati",
  41916. 0x0a83,
  41917. "vmonospace",
  41918. 0xff56,
  41919. "voarmenian",
  41920. 0x0578,
  41921. "voicediterationhiragana",
  41922. 0x309e,
  41923. "voicediterationkatakana",
  41924. 0x30fe,
  41925. "voicedmarkkana",
  41926. 0x309b,
  41927. "voicedmarkkanahalfwidth",
  41928. 0xff9e,
  41929. "vokatakana",
  41930. 0x30fa,
  41931. "vparen",
  41932. 0x24b1,
  41933. "vtilde",
  41934. 0x1e7d,
  41935. "vturned",
  41936. 0x028c,
  41937. "vuhiragana",
  41938. 0x3094,
  41939. "vukatakana",
  41940. 0x30f4,
  41941. "w",
  41942. 0x0077,
  41943. "wacute",
  41944. 0x1e83,
  41945. "waekorean",
  41946. 0x3159,
  41947. "wahiragana",
  41948. 0x308f,
  41949. "wakatakana",
  41950. 0x30ef,
  41951. "wakatakanahalfwidth",
  41952. 0xff9c,
  41953. "wakorean",
  41954. 0x3158,
  41955. "wasmallhiragana",
  41956. 0x308e,
  41957. "wasmallkatakana",
  41958. 0x30ee,
  41959. "wattosquare",
  41960. 0x3357,
  41961. "wavedash",
  41962. 0x301c,
  41963. "wavyunderscorevertical",
  41964. 0xfe34,
  41965. "wawarabic",
  41966. 0x0648,
  41967. "wawfinalarabic",
  41968. 0xfeee,
  41969. "wawhamzaabovearabic",
  41970. 0x0624,
  41971. "wawhamzaabovefinalarabic",
  41972. 0xfe86,
  41973. "wbsquare",
  41974. 0x33dd,
  41975. "wcircle",
  41976. 0x24e6,
  41977. "wcircumflex",
  41978. 0x0175,
  41979. "wdieresis",
  41980. 0x1e85,
  41981. "wdotaccent",
  41982. 0x1e87,
  41983. "wdotbelow",
  41984. 0x1e89,
  41985. "wehiragana",
  41986. 0x3091,
  41987. "weierstrass",
  41988. 0x2118,
  41989. "wekatakana",
  41990. 0x30f1,
  41991. "wekorean",
  41992. 0x315e,
  41993. "weokorean",
  41994. 0x315d,
  41995. "wgrave",
  41996. 0x1e81,
  41997. "whitebullet",
  41998. 0x25e6,
  41999. "whitecircle",
  42000. 0x25cb,
  42001. "whitecircleinverse",
  42002. 0x25d9,
  42003. "whitecornerbracketleft",
  42004. 0x300e,
  42005. "whitecornerbracketleftvertical",
  42006. 0xfe43,
  42007. "whitecornerbracketright",
  42008. 0x300f,
  42009. "whitecornerbracketrightvertical",
  42010. 0xfe44,
  42011. "whitediamond",
  42012. 0x25c7,
  42013. "whitediamondcontainingblacksmalldiamond",
  42014. 0x25c8,
  42015. "whitedownpointingsmalltriangle",
  42016. 0x25bf,
  42017. "whitedownpointingtriangle",
  42018. 0x25bd,
  42019. "whiteleftpointingsmalltriangle",
  42020. 0x25c3,
  42021. "whiteleftpointingtriangle",
  42022. 0x25c1,
  42023. "whitelenticularbracketleft",
  42024. 0x3016,
  42025. "whitelenticularbracketright",
  42026. 0x3017,
  42027. "whiterightpointingsmalltriangle",
  42028. 0x25b9,
  42029. "whiterightpointingtriangle",
  42030. 0x25b7,
  42031. "whitesmallsquare",
  42032. 0x25ab,
  42033. "whitesmilingface",
  42034. 0x263a,
  42035. "whitesquare",
  42036. 0x25a1,
  42037. "whitestar",
  42038. 0x2606,
  42039. "whitetelephone",
  42040. 0x260f,
  42041. "whitetortoiseshellbracketleft",
  42042. 0x3018,
  42043. "whitetortoiseshellbracketright",
  42044. 0x3019,
  42045. "whiteuppointingsmalltriangle",
  42046. 0x25b5,
  42047. "whiteuppointingtriangle",
  42048. 0x25b3,
  42049. "wihiragana",
  42050. 0x3090,
  42051. "wikatakana",
  42052. 0x30f0,
  42053. "wikorean",
  42054. 0x315f,
  42055. "wmonospace",
  42056. 0xff57,
  42057. "wohiragana",
  42058. 0x3092,
  42059. "wokatakana",
  42060. 0x30f2,
  42061. "wokatakanahalfwidth",
  42062. 0xff66,
  42063. "won",
  42064. 0x20a9,
  42065. "wonmonospace",
  42066. 0xffe6,
  42067. "wowaenthai",
  42068. 0x0e27,
  42069. "wparen",
  42070. 0x24b2,
  42071. "wring",
  42072. 0x1e98,
  42073. "wsuperior",
  42074. 0x02b7,
  42075. "wturned",
  42076. 0x028d,
  42077. "wynn",
  42078. 0x01bf,
  42079. "x",
  42080. 0x0078,
  42081. "xabovecmb",
  42082. 0x033d,
  42083. "xbopomofo",
  42084. 0x3112,
  42085. "xcircle",
  42086. 0x24e7,
  42087. "xdieresis",
  42088. 0x1e8d,
  42089. "xdotaccent",
  42090. 0x1e8b,
  42091. "xeharmenian",
  42092. 0x056d,
  42093. "xi",
  42094. 0x03be,
  42095. "xmonospace",
  42096. 0xff58,
  42097. "xparen",
  42098. 0x24b3,
  42099. "xsuperior",
  42100. 0x02e3,
  42101. "y",
  42102. 0x0079,
  42103. "yaadosquare",
  42104. 0x334e,
  42105. "yabengali",
  42106. 0x09af,
  42107. "yacute",
  42108. 0x00fd,
  42109. "yadeva",
  42110. 0x092f,
  42111. "yaekorean",
  42112. 0x3152,
  42113. "yagujarati",
  42114. 0x0aaf,
  42115. "yagurmukhi",
  42116. 0x0a2f,
  42117. "yahiragana",
  42118. 0x3084,
  42119. "yakatakana",
  42120. 0x30e4,
  42121. "yakatakanahalfwidth",
  42122. 0xff94,
  42123. "yakorean",
  42124. 0x3151,
  42125. "yamakkanthai",
  42126. 0x0e4e,
  42127. "yasmallhiragana",
  42128. 0x3083,
  42129. "yasmallkatakana",
  42130. 0x30e3,
  42131. "yasmallkatakanahalfwidth",
  42132. 0xff6c,
  42133. "yatcyrillic",
  42134. 0x0463,
  42135. "ycircle",
  42136. 0x24e8,
  42137. "ycircumflex",
  42138. 0x0177,
  42139. "ydieresis",
  42140. 0x00ff,
  42141. "ydotaccent",
  42142. 0x1e8f,
  42143. "ydotbelow",
  42144. 0x1ef5,
  42145. "yeharabic",
  42146. 0x064a,
  42147. "yehbarreearabic",
  42148. 0x06d2,
  42149. "yehbarreefinalarabic",
  42150. 0xfbaf,
  42151. "yehfinalarabic",
  42152. 0xfef2,
  42153. "yehhamzaabovearabic",
  42154. 0x0626,
  42155. "yehhamzaabovefinalarabic",
  42156. 0xfe8a,
  42157. "yehhamzaaboveinitialarabic",
  42158. 0xfe8b,
  42159. "yehhamzaabovemedialarabic",
  42160. 0xfe8c,
  42161. "yehinitialarabic",
  42162. 0xfef3,
  42163. "yehmedialarabic",
  42164. 0xfef4,
  42165. "yehmeeminitialarabic",
  42166. 0xfcdd,
  42167. "yehmeemisolatedarabic",
  42168. 0xfc58,
  42169. "yehnoonfinalarabic",
  42170. 0xfc94,
  42171. "yehthreedotsbelowarabic",
  42172. 0x06d1,
  42173. "yekorean",
  42174. 0x3156,
  42175. "yen",
  42176. 0x00a5,
  42177. "yenmonospace",
  42178. 0xffe5,
  42179. "yeokorean",
  42180. 0x3155,
  42181. "yeorinhieuhkorean",
  42182. 0x3186,
  42183. "yerahbenyomohebrew",
  42184. 0x05aa,
  42185. "yerahbenyomolefthebrew",
  42186. 0x05aa,
  42187. "yericyrillic",
  42188. 0x044b,
  42189. "yerudieresiscyrillic",
  42190. 0x04f9,
  42191. "yesieungkorean",
  42192. 0x3181,
  42193. "yesieungpansioskorean",
  42194. 0x3183,
  42195. "yesieungsioskorean",
  42196. 0x3182,
  42197. "yetivhebrew",
  42198. 0x059a,
  42199. "ygrave",
  42200. 0x1ef3,
  42201. "yhook",
  42202. 0x01b4,
  42203. "yhookabove",
  42204. 0x1ef7,
  42205. "yiarmenian",
  42206. 0x0575,
  42207. "yicyrillic",
  42208. 0x0457,
  42209. "yikorean",
  42210. 0x3162,
  42211. "yinyang",
  42212. 0x262f,
  42213. "yiwnarmenian",
  42214. 0x0582,
  42215. "ymonospace",
  42216. 0xff59,
  42217. "yod",
  42218. 0x05d9,
  42219. "yoddagesh",
  42220. 0xfb39,
  42221. "yoddageshhebrew",
  42222. 0xfb39,
  42223. "yodhebrew",
  42224. 0x05d9,
  42225. "yodyodhebrew",
  42226. 0x05f2,
  42227. "yodyodpatahhebrew",
  42228. 0xfb1f,
  42229. "yohiragana",
  42230. 0x3088,
  42231. "yoikorean",
  42232. 0x3189,
  42233. "yokatakana",
  42234. 0x30e8,
  42235. "yokatakanahalfwidth",
  42236. 0xff96,
  42237. "yokorean",
  42238. 0x315b,
  42239. "yosmallhiragana",
  42240. 0x3087,
  42241. "yosmallkatakana",
  42242. 0x30e7,
  42243. "yosmallkatakanahalfwidth",
  42244. 0xff6e,
  42245. "yotgreek",
  42246. 0x03f3,
  42247. "yoyaekorean",
  42248. 0x3188,
  42249. "yoyakorean",
  42250. 0x3187,
  42251. "yoyakthai",
  42252. 0x0e22,
  42253. "yoyingthai",
  42254. 0x0e0d,
  42255. "yparen",
  42256. 0x24b4,
  42257. "ypogegrammeni",
  42258. 0x037a,
  42259. "ypogegrammenigreekcmb",
  42260. 0x0345,
  42261. "yr",
  42262. 0x01a6,
  42263. "yring",
  42264. 0x1e99,
  42265. "ysuperior",
  42266. 0x02b8,
  42267. "ytilde",
  42268. 0x1ef9,
  42269. "yturned",
  42270. 0x028e,
  42271. "yuhiragana",
  42272. 0x3086,
  42273. "yuikorean",
  42274. 0x318c,
  42275. "yukatakana",
  42276. 0x30e6,
  42277. "yukatakanahalfwidth",
  42278. 0xff95,
  42279. "yukorean",
  42280. 0x3160,
  42281. "yusbigcyrillic",
  42282. 0x046b,
  42283. "yusbigiotifiedcyrillic",
  42284. 0x046d,
  42285. "yuslittlecyrillic",
  42286. 0x0467,
  42287. "yuslittleiotifiedcyrillic",
  42288. 0x0469,
  42289. "yusmallhiragana",
  42290. 0x3085,
  42291. "yusmallkatakana",
  42292. 0x30e5,
  42293. "yusmallkatakanahalfwidth",
  42294. 0xff6d,
  42295. "yuyekorean",
  42296. 0x318b,
  42297. "yuyeokorean",
  42298. 0x318a,
  42299. "yyabengali",
  42300. 0x09df,
  42301. "yyadeva",
  42302. 0x095f,
  42303. "z",
  42304. 0x007a,
  42305. "zaarmenian",
  42306. 0x0566,
  42307. "zacute",
  42308. 0x017a,
  42309. "zadeva",
  42310. 0x095b,
  42311. "zagurmukhi",
  42312. 0x0a5b,
  42313. "zaharabic",
  42314. 0x0638,
  42315. "zahfinalarabic",
  42316. 0xfec6,
  42317. "zahinitialarabic",
  42318. 0xfec7,
  42319. "zahiragana",
  42320. 0x3056,
  42321. "zahmedialarabic",
  42322. 0xfec8,
  42323. "zainarabic",
  42324. 0x0632,
  42325. "zainfinalarabic",
  42326. 0xfeb0,
  42327. "zakatakana",
  42328. 0x30b6,
  42329. "zaqefgadolhebrew",
  42330. 0x0595,
  42331. "zaqefqatanhebrew",
  42332. 0x0594,
  42333. "zarqahebrew",
  42334. 0x0598,
  42335. "zayin",
  42336. 0x05d6,
  42337. "zayindagesh",
  42338. 0xfb36,
  42339. "zayindageshhebrew",
  42340. 0xfb36,
  42341. "zayinhebrew",
  42342. 0x05d6,
  42343. "zbopomofo",
  42344. 0x3117,
  42345. "zcaron",
  42346. 0x017e,
  42347. "zcircle",
  42348. 0x24e9,
  42349. "zcircumflex",
  42350. 0x1e91,
  42351. "zcurl",
  42352. 0x0291,
  42353. "zdot",
  42354. 0x017c,
  42355. "zdotaccent",
  42356. 0x017c,
  42357. "zdotbelow",
  42358. 0x1e93,
  42359. "zecyrillic",
  42360. 0x0437,
  42361. "zedescendercyrillic",
  42362. 0x0499,
  42363. "zedieresiscyrillic",
  42364. 0x04df,
  42365. "zehiragana",
  42366. 0x305c,
  42367. "zekatakana",
  42368. 0x30bc,
  42369. "zero",
  42370. 0x0030,
  42371. "zeroarabic",
  42372. 0x0660,
  42373. "zerobengali",
  42374. 0x09e6,
  42375. "zerodeva",
  42376. 0x0966,
  42377. "zerogujarati",
  42378. 0x0ae6,
  42379. "zerogurmukhi",
  42380. 0x0a66,
  42381. "zerohackarabic",
  42382. 0x0660,
  42383. "zeroinferior",
  42384. 0x2080,
  42385. "zeromonospace",
  42386. 0xff10,
  42387. "zerooldstyle",
  42388. 0xf730,
  42389. "zeropersian",
  42390. 0x06f0,
  42391. "zerosuperior",
  42392. 0x2070,
  42393. "zerothai",
  42394. 0x0e50,
  42395. "zerowidthjoiner",
  42396. 0xfeff,
  42397. "zerowidthnonjoiner",
  42398. 0x200c,
  42399. "zerowidthspace",
  42400. 0x200b,
  42401. "zeta",
  42402. 0x03b6,
  42403. "zhbopomofo",
  42404. 0x3113,
  42405. "zhearmenian",
  42406. 0x056a,
  42407. "zhebrevecyrillic",
  42408. 0x04c2,
  42409. "zhecyrillic",
  42410. 0x0436,
  42411. "zhedescendercyrillic",
  42412. 0x0497,
  42413. "zhedieresiscyrillic",
  42414. 0x04dd,
  42415. "zihiragana",
  42416. 0x3058,
  42417. "zikatakana",
  42418. 0x30b8,
  42419. "zinorhebrew",
  42420. 0x05ae,
  42421. "zlinebelow",
  42422. 0x1e95,
  42423. "zmonospace",
  42424. 0xff5a,
  42425. "zohiragana",
  42426. 0x305e,
  42427. "zokatakana",
  42428. 0x30be,
  42429. "zparen",
  42430. 0x24b5,
  42431. "zretroflexhook",
  42432. 0x0290,
  42433. "zstroke",
  42434. 0x01b6,
  42435. "zuhiragana",
  42436. 0x305a,
  42437. "zukatakana",
  42438. 0x30ba,
  42439. ".notdef",
  42440. 0x0000,
  42441. "angbracketleftbig",
  42442. 0x2329,
  42443. "angbracketleftBig",
  42444. 0x2329,
  42445. "angbracketleftbigg",
  42446. 0x2329,
  42447. "angbracketleftBigg",
  42448. 0x2329,
  42449. "angbracketrightBig",
  42450. 0x232a,
  42451. "angbracketrightbig",
  42452. 0x232a,
  42453. "angbracketrightBigg",
  42454. 0x232a,
  42455. "angbracketrightbigg",
  42456. 0x232a,
  42457. "arrowhookleft",
  42458. 0x21aa,
  42459. "arrowhookright",
  42460. 0x21a9,
  42461. "arrowlefttophalf",
  42462. 0x21bc,
  42463. "arrowleftbothalf",
  42464. 0x21bd,
  42465. "arrownortheast",
  42466. 0x2197,
  42467. "arrownorthwest",
  42468. 0x2196,
  42469. "arrowrighttophalf",
  42470. 0x21c0,
  42471. "arrowrightbothalf",
  42472. 0x21c1,
  42473. "arrowsoutheast",
  42474. 0x2198,
  42475. "arrowsouthwest",
  42476. 0x2199,
  42477. "backslashbig",
  42478. 0x2216,
  42479. "backslashBig",
  42480. 0x2216,
  42481. "backslashBigg",
  42482. 0x2216,
  42483. "backslashbigg",
  42484. 0x2216,
  42485. "bardbl",
  42486. 0x2016,
  42487. "bracehtipdownleft",
  42488. 0xfe37,
  42489. "bracehtipdownright",
  42490. 0xfe37,
  42491. "bracehtipupleft",
  42492. 0xfe38,
  42493. "bracehtipupright",
  42494. 0xfe38,
  42495. "braceleftBig",
  42496. 0x007b,
  42497. "braceleftbig",
  42498. 0x007b,
  42499. "braceleftbigg",
  42500. 0x007b,
  42501. "braceleftBigg",
  42502. 0x007b,
  42503. "bracerightBig",
  42504. 0x007d,
  42505. "bracerightbig",
  42506. 0x007d,
  42507. "bracerightbigg",
  42508. 0x007d,
  42509. "bracerightBigg",
  42510. 0x007d,
  42511. "bracketleftbig",
  42512. 0x005b,
  42513. "bracketleftBig",
  42514. 0x005b,
  42515. "bracketleftbigg",
  42516. 0x005b,
  42517. "bracketleftBigg",
  42518. 0x005b,
  42519. "bracketrightBig",
  42520. 0x005d,
  42521. "bracketrightbig",
  42522. 0x005d,
  42523. "bracketrightbigg",
  42524. 0x005d,
  42525. "bracketrightBigg",
  42526. 0x005d,
  42527. "ceilingleftbig",
  42528. 0x2308,
  42529. "ceilingleftBig",
  42530. 0x2308,
  42531. "ceilingleftBigg",
  42532. 0x2308,
  42533. "ceilingleftbigg",
  42534. 0x2308,
  42535. "ceilingrightbig",
  42536. 0x2309,
  42537. "ceilingrightBig",
  42538. 0x2309,
  42539. "ceilingrightbigg",
  42540. 0x2309,
  42541. "ceilingrightBigg",
  42542. 0x2309,
  42543. "circledotdisplay",
  42544. 0x2299,
  42545. "circledottext",
  42546. 0x2299,
  42547. "circlemultiplydisplay",
  42548. 0x2297,
  42549. "circlemultiplytext",
  42550. 0x2297,
  42551. "circleplusdisplay",
  42552. 0x2295,
  42553. "circleplustext",
  42554. 0x2295,
  42555. "contintegraldisplay",
  42556. 0x222e,
  42557. "contintegraltext",
  42558. 0x222e,
  42559. "coproductdisplay",
  42560. 0x2210,
  42561. "coproducttext",
  42562. 0x2210,
  42563. "floorleftBig",
  42564. 0x230a,
  42565. "floorleftbig",
  42566. 0x230a,
  42567. "floorleftbigg",
  42568. 0x230a,
  42569. "floorleftBigg",
  42570. 0x230a,
  42571. "floorrightbig",
  42572. 0x230b,
  42573. "floorrightBig",
  42574. 0x230b,
  42575. "floorrightBigg",
  42576. 0x230b,
  42577. "floorrightbigg",
  42578. 0x230b,
  42579. "hatwide",
  42580. 0x0302,
  42581. "hatwider",
  42582. 0x0302,
  42583. "hatwidest",
  42584. 0x0302,
  42585. "intercal",
  42586. 0x1d40,
  42587. "integraldisplay",
  42588. 0x222b,
  42589. "integraltext",
  42590. 0x222b,
  42591. "intersectiondisplay",
  42592. 0x22c2,
  42593. "intersectiontext",
  42594. 0x22c2,
  42595. "logicalanddisplay",
  42596. 0x2227,
  42597. "logicalandtext",
  42598. 0x2227,
  42599. "logicalordisplay",
  42600. 0x2228,
  42601. "logicalortext",
  42602. 0x2228,
  42603. "parenleftBig",
  42604. 0x0028,
  42605. "parenleftbig",
  42606. 0x0028,
  42607. "parenleftBigg",
  42608. 0x0028,
  42609. "parenleftbigg",
  42610. 0x0028,
  42611. "parenrightBig",
  42612. 0x0029,
  42613. "parenrightbig",
  42614. 0x0029,
  42615. "parenrightBigg",
  42616. 0x0029,
  42617. "parenrightbigg",
  42618. 0x0029,
  42619. "prime",
  42620. 0x2032,
  42621. "productdisplay",
  42622. 0x220f,
  42623. "producttext",
  42624. 0x220f,
  42625. "radicalbig",
  42626. 0x221a,
  42627. "radicalBig",
  42628. 0x221a,
  42629. "radicalBigg",
  42630. 0x221a,
  42631. "radicalbigg",
  42632. 0x221a,
  42633. "radicalbt",
  42634. 0x221a,
  42635. "radicaltp",
  42636. 0x221a,
  42637. "radicalvertex",
  42638. 0x221a,
  42639. "slashbig",
  42640. 0x002f,
  42641. "slashBig",
  42642. 0x002f,
  42643. "slashBigg",
  42644. 0x002f,
  42645. "slashbigg",
  42646. 0x002f,
  42647. "summationdisplay",
  42648. 0x2211,
  42649. "summationtext",
  42650. 0x2211,
  42651. "tildewide",
  42652. 0x02dc,
  42653. "tildewider",
  42654. 0x02dc,
  42655. "tildewidest",
  42656. 0x02dc,
  42657. "uniondisplay",
  42658. 0x22c3,
  42659. "unionmultidisplay",
  42660. 0x228e,
  42661. "unionmultitext",
  42662. 0x228e,
  42663. "unionsqdisplay",
  42664. 0x2294,
  42665. "unionsqtext",
  42666. 0x2294,
  42667. "uniontext",
  42668. 0x22c3,
  42669. "vextenddouble",
  42670. 0x2225,
  42671. "vextendsingle",
  42672. 0x2223,
  42673. ];
  42674. }
  42675. );
  42676. const getDingbatsGlyphsUnicode = (0,
  42677. _core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(
  42678. function () {
  42679. return [
  42680. "space",
  42681. 0x0020,
  42682. "a1",
  42683. 0x2701,
  42684. "a2",
  42685. 0x2702,
  42686. "a202",
  42687. 0x2703,
  42688. "a3",
  42689. 0x2704,
  42690. "a4",
  42691. 0x260e,
  42692. "a5",
  42693. 0x2706,
  42694. "a119",
  42695. 0x2707,
  42696. "a118",
  42697. 0x2708,
  42698. "a117",
  42699. 0x2709,
  42700. "a11",
  42701. 0x261b,
  42702. "a12",
  42703. 0x261e,
  42704. "a13",
  42705. 0x270c,
  42706. "a14",
  42707. 0x270d,
  42708. "a15",
  42709. 0x270e,
  42710. "a16",
  42711. 0x270f,
  42712. "a105",
  42713. 0x2710,
  42714. "a17",
  42715. 0x2711,
  42716. "a18",
  42717. 0x2712,
  42718. "a19",
  42719. 0x2713,
  42720. "a20",
  42721. 0x2714,
  42722. "a21",
  42723. 0x2715,
  42724. "a22",
  42725. 0x2716,
  42726. "a23",
  42727. 0x2717,
  42728. "a24",
  42729. 0x2718,
  42730. "a25",
  42731. 0x2719,
  42732. "a26",
  42733. 0x271a,
  42734. "a27",
  42735. 0x271b,
  42736. "a28",
  42737. 0x271c,
  42738. "a6",
  42739. 0x271d,
  42740. "a7",
  42741. 0x271e,
  42742. "a8",
  42743. 0x271f,
  42744. "a9",
  42745. 0x2720,
  42746. "a10",
  42747. 0x2721,
  42748. "a29",
  42749. 0x2722,
  42750. "a30",
  42751. 0x2723,
  42752. "a31",
  42753. 0x2724,
  42754. "a32",
  42755. 0x2725,
  42756. "a33",
  42757. 0x2726,
  42758. "a34",
  42759. 0x2727,
  42760. "a35",
  42761. 0x2605,
  42762. "a36",
  42763. 0x2729,
  42764. "a37",
  42765. 0x272a,
  42766. "a38",
  42767. 0x272b,
  42768. "a39",
  42769. 0x272c,
  42770. "a40",
  42771. 0x272d,
  42772. "a41",
  42773. 0x272e,
  42774. "a42",
  42775. 0x272f,
  42776. "a43",
  42777. 0x2730,
  42778. "a44",
  42779. 0x2731,
  42780. "a45",
  42781. 0x2732,
  42782. "a46",
  42783. 0x2733,
  42784. "a47",
  42785. 0x2734,
  42786. "a48",
  42787. 0x2735,
  42788. "a49",
  42789. 0x2736,
  42790. "a50",
  42791. 0x2737,
  42792. "a51",
  42793. 0x2738,
  42794. "a52",
  42795. 0x2739,
  42796. "a53",
  42797. 0x273a,
  42798. "a54",
  42799. 0x273b,
  42800. "a55",
  42801. 0x273c,
  42802. "a56",
  42803. 0x273d,
  42804. "a57",
  42805. 0x273e,
  42806. "a58",
  42807. 0x273f,
  42808. "a59",
  42809. 0x2740,
  42810. "a60",
  42811. 0x2741,
  42812. "a61",
  42813. 0x2742,
  42814. "a62",
  42815. 0x2743,
  42816. "a63",
  42817. 0x2744,
  42818. "a64",
  42819. 0x2745,
  42820. "a65",
  42821. 0x2746,
  42822. "a66",
  42823. 0x2747,
  42824. "a67",
  42825. 0x2748,
  42826. "a68",
  42827. 0x2749,
  42828. "a69",
  42829. 0x274a,
  42830. "a70",
  42831. 0x274b,
  42832. "a71",
  42833. 0x25cf,
  42834. "a72",
  42835. 0x274d,
  42836. "a73",
  42837. 0x25a0,
  42838. "a74",
  42839. 0x274f,
  42840. "a203",
  42841. 0x2750,
  42842. "a75",
  42843. 0x2751,
  42844. "a204",
  42845. 0x2752,
  42846. "a76",
  42847. 0x25b2,
  42848. "a77",
  42849. 0x25bc,
  42850. "a78",
  42851. 0x25c6,
  42852. "a79",
  42853. 0x2756,
  42854. "a81",
  42855. 0x25d7,
  42856. "a82",
  42857. 0x2758,
  42858. "a83",
  42859. 0x2759,
  42860. "a84",
  42861. 0x275a,
  42862. "a97",
  42863. 0x275b,
  42864. "a98",
  42865. 0x275c,
  42866. "a99",
  42867. 0x275d,
  42868. "a100",
  42869. 0x275e,
  42870. "a101",
  42871. 0x2761,
  42872. "a102",
  42873. 0x2762,
  42874. "a103",
  42875. 0x2763,
  42876. "a104",
  42877. 0x2764,
  42878. "a106",
  42879. 0x2765,
  42880. "a107",
  42881. 0x2766,
  42882. "a108",
  42883. 0x2767,
  42884. "a112",
  42885. 0x2663,
  42886. "a111",
  42887. 0x2666,
  42888. "a110",
  42889. 0x2665,
  42890. "a109",
  42891. 0x2660,
  42892. "a120",
  42893. 0x2460,
  42894. "a121",
  42895. 0x2461,
  42896. "a122",
  42897. 0x2462,
  42898. "a123",
  42899. 0x2463,
  42900. "a124",
  42901. 0x2464,
  42902. "a125",
  42903. 0x2465,
  42904. "a126",
  42905. 0x2466,
  42906. "a127",
  42907. 0x2467,
  42908. "a128",
  42909. 0x2468,
  42910. "a129",
  42911. 0x2469,
  42912. "a130",
  42913. 0x2776,
  42914. "a131",
  42915. 0x2777,
  42916. "a132",
  42917. 0x2778,
  42918. "a133",
  42919. 0x2779,
  42920. "a134",
  42921. 0x277a,
  42922. "a135",
  42923. 0x277b,
  42924. "a136",
  42925. 0x277c,
  42926. "a137",
  42927. 0x277d,
  42928. "a138",
  42929. 0x277e,
  42930. "a139",
  42931. 0x277f,
  42932. "a140",
  42933. 0x2780,
  42934. "a141",
  42935. 0x2781,
  42936. "a142",
  42937. 0x2782,
  42938. "a143",
  42939. 0x2783,
  42940. "a144",
  42941. 0x2784,
  42942. "a145",
  42943. 0x2785,
  42944. "a146",
  42945. 0x2786,
  42946. "a147",
  42947. 0x2787,
  42948. "a148",
  42949. 0x2788,
  42950. "a149",
  42951. 0x2789,
  42952. "a150",
  42953. 0x278a,
  42954. "a151",
  42955. 0x278b,
  42956. "a152",
  42957. 0x278c,
  42958. "a153",
  42959. 0x278d,
  42960. "a154",
  42961. 0x278e,
  42962. "a155",
  42963. 0x278f,
  42964. "a156",
  42965. 0x2790,
  42966. "a157",
  42967. 0x2791,
  42968. "a158",
  42969. 0x2792,
  42970. "a159",
  42971. 0x2793,
  42972. "a160",
  42973. 0x2794,
  42974. "a161",
  42975. 0x2192,
  42976. "a163",
  42977. 0x2194,
  42978. "a164",
  42979. 0x2195,
  42980. "a196",
  42981. 0x2798,
  42982. "a165",
  42983. 0x2799,
  42984. "a192",
  42985. 0x279a,
  42986. "a166",
  42987. 0x279b,
  42988. "a167",
  42989. 0x279c,
  42990. "a168",
  42991. 0x279d,
  42992. "a169",
  42993. 0x279e,
  42994. "a170",
  42995. 0x279f,
  42996. "a171",
  42997. 0x27a0,
  42998. "a172",
  42999. 0x27a1,
  43000. "a173",
  43001. 0x27a2,
  43002. "a162",
  43003. 0x27a3,
  43004. "a174",
  43005. 0x27a4,
  43006. "a175",
  43007. 0x27a5,
  43008. "a176",
  43009. 0x27a6,
  43010. "a177",
  43011. 0x27a7,
  43012. "a178",
  43013. 0x27a8,
  43014. "a179",
  43015. 0x27a9,
  43016. "a193",
  43017. 0x27aa,
  43018. "a180",
  43019. 0x27ab,
  43020. "a199",
  43021. 0x27ac,
  43022. "a181",
  43023. 0x27ad,
  43024. "a200",
  43025. 0x27ae,
  43026. "a182",
  43027. 0x27af,
  43028. "a201",
  43029. 0x27b1,
  43030. "a183",
  43031. 0x27b2,
  43032. "a184",
  43033. 0x27b3,
  43034. "a197",
  43035. 0x27b4,
  43036. "a185",
  43037. 0x27b5,
  43038. "a194",
  43039. 0x27b6,
  43040. "a198",
  43041. 0x27b7,
  43042. "a186",
  43043. 0x27b8,
  43044. "a195",
  43045. 0x27b9,
  43046. "a187",
  43047. 0x27ba,
  43048. "a188",
  43049. 0x27bb,
  43050. "a189",
  43051. 0x27bc,
  43052. "a190",
  43053. 0x27bd,
  43054. "a191",
  43055. 0x27be,
  43056. "a89",
  43057. 0x2768,
  43058. "a90",
  43059. 0x2769,
  43060. "a93",
  43061. 0x276a,
  43062. "a94",
  43063. 0x276b,
  43064. "a91",
  43065. 0x276c,
  43066. "a92",
  43067. 0x276d,
  43068. "a205",
  43069. 0x276e,
  43070. "a85",
  43071. 0x276f,
  43072. "a206",
  43073. 0x2770,
  43074. "a86",
  43075. 0x2771,
  43076. "a87",
  43077. 0x2772,
  43078. "a88",
  43079. 0x2773,
  43080. "a95",
  43081. 0x2774,
  43082. "a96",
  43083. 0x2775,
  43084. ".notdef",
  43085. 0x0000,
  43086. ];
  43087. }
  43088. );
  43089. /***/
  43090. },
  43091. /* 40 */
  43092. /***/ (
  43093. __unused_webpack_module,
  43094. __webpack_exports__,
  43095. __w_pdfjs_require__
  43096. ) => {
  43097. __w_pdfjs_require__.r(__webpack_exports__);
  43098. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  43099. /* harmony export */ clearUnicodeCaches: () =>
  43100. /* binding */ clearUnicodeCaches,
  43101. /* harmony export */ getCharUnicodeCategory: () =>
  43102. /* binding */ getCharUnicodeCategory,
  43103. /* harmony export */ getNormalizedUnicodes: () =>
  43104. /* binding */ getNormalizedUnicodes,
  43105. /* harmony export */ getUnicodeForGlyph: () =>
  43106. /* binding */ getUnicodeForGlyph,
  43107. /* harmony export */ getUnicodeRangeFor: () =>
  43108. /* binding */ getUnicodeRangeFor,
  43109. /* harmony export */ mapSpecialUnicodeValues: () =>
  43110. /* binding */ mapSpecialUnicodeValues,
  43111. /* harmony export */ reverseIfRtl: () => /* binding */ reverseIfRtl,
  43112. /* harmony export */
  43113. });
  43114. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ =
  43115. __w_pdfjs_require__(6);
  43116. const getSpecialPUASymbols = (0,
  43117. _core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getLookupTableFactory)(
  43118. function (t) {
  43119. t[63721] = 0x00a9;
  43120. t[63193] = 0x00a9;
  43121. t[63720] = 0x00ae;
  43122. t[63194] = 0x00ae;
  43123. t[63722] = 0x2122;
  43124. t[63195] = 0x2122;
  43125. t[63729] = 0x23a7;
  43126. t[63730] = 0x23a8;
  43127. t[63731] = 0x23a9;
  43128. t[63740] = 0x23ab;
  43129. t[63741] = 0x23ac;
  43130. t[63742] = 0x23ad;
  43131. t[63726] = 0x23a1;
  43132. t[63727] = 0x23a2;
  43133. t[63728] = 0x23a3;
  43134. t[63737] = 0x23a4;
  43135. t[63738] = 0x23a5;
  43136. t[63739] = 0x23a6;
  43137. t[63723] = 0x239b;
  43138. t[63724] = 0x239c;
  43139. t[63725] = 0x239d;
  43140. t[63734] = 0x239e;
  43141. t[63735] = 0x239f;
  43142. t[63736] = 0x23a0;
  43143. }
  43144. );
  43145. function mapSpecialUnicodeValues(code) {
  43146. if (code >= 0xfff0 && code <= 0xffff) {
  43147. return 0;
  43148. } else if (code >= 0xf600 && code <= 0xf8ff) {
  43149. return getSpecialPUASymbols()[code] || code;
  43150. } else if (code === 0x00ad) {
  43151. return 0x002d;
  43152. }
  43153. return code;
  43154. }
  43155. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  43156. let unicode = glyphsUnicodeMap[name];
  43157. if (unicode !== undefined) {
  43158. return unicode;
  43159. }
  43160. if (!name) {
  43161. return -1;
  43162. }
  43163. if (name[0] === "u") {
  43164. const nameLen = name.length;
  43165. let hexStr;
  43166. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  43167. hexStr = name.substring(3);
  43168. } else if (nameLen >= 5 && nameLen <= 7) {
  43169. hexStr = name.substring(1);
  43170. } else {
  43171. return -1;
  43172. }
  43173. if (hexStr === hexStr.toUpperCase()) {
  43174. unicode = parseInt(hexStr, 16);
  43175. if (unicode >= 0) {
  43176. return unicode;
  43177. }
  43178. }
  43179. }
  43180. return -1;
  43181. }
  43182. const UnicodeRanges = [
  43183. {
  43184. begin: 0x0000,
  43185. end: 0x007f,
  43186. },
  43187. {
  43188. begin: 0x0080,
  43189. end: 0x00ff,
  43190. },
  43191. {
  43192. begin: 0x0100,
  43193. end: 0x017f,
  43194. },
  43195. {
  43196. begin: 0x0180,
  43197. end: 0x024f,
  43198. },
  43199. {
  43200. begin: 0x0250,
  43201. end: 0x02af,
  43202. },
  43203. {
  43204. begin: 0x02b0,
  43205. end: 0x02ff,
  43206. },
  43207. {
  43208. begin: 0x0300,
  43209. end: 0x036f,
  43210. },
  43211. {
  43212. begin: 0x0370,
  43213. end: 0x03ff,
  43214. },
  43215. {
  43216. begin: 0x2c80,
  43217. end: 0x2cff,
  43218. },
  43219. {
  43220. begin: 0x0400,
  43221. end: 0x04ff,
  43222. },
  43223. {
  43224. begin: 0x0530,
  43225. end: 0x058f,
  43226. },
  43227. {
  43228. begin: 0x0590,
  43229. end: 0x05ff,
  43230. },
  43231. {
  43232. begin: 0xa500,
  43233. end: 0xa63f,
  43234. },
  43235. {
  43236. begin: 0x0600,
  43237. end: 0x06ff,
  43238. },
  43239. {
  43240. begin: 0x07c0,
  43241. end: 0x07ff,
  43242. },
  43243. {
  43244. begin: 0x0900,
  43245. end: 0x097f,
  43246. },
  43247. {
  43248. begin: 0x0980,
  43249. end: 0x09ff,
  43250. },
  43251. {
  43252. begin: 0x0a00,
  43253. end: 0x0a7f,
  43254. },
  43255. {
  43256. begin: 0x0a80,
  43257. end: 0x0aff,
  43258. },
  43259. {
  43260. begin: 0x0b00,
  43261. end: 0x0b7f,
  43262. },
  43263. {
  43264. begin: 0x0b80,
  43265. end: 0x0bff,
  43266. },
  43267. {
  43268. begin: 0x0c00,
  43269. end: 0x0c7f,
  43270. },
  43271. {
  43272. begin: 0x0c80,
  43273. end: 0x0cff,
  43274. },
  43275. {
  43276. begin: 0x0d00,
  43277. end: 0x0d7f,
  43278. },
  43279. {
  43280. begin: 0x0e00,
  43281. end: 0x0e7f,
  43282. },
  43283. {
  43284. begin: 0x0e80,
  43285. end: 0x0eff,
  43286. },
  43287. {
  43288. begin: 0x10a0,
  43289. end: 0x10ff,
  43290. },
  43291. {
  43292. begin: 0x1b00,
  43293. end: 0x1b7f,
  43294. },
  43295. {
  43296. begin: 0x1100,
  43297. end: 0x11ff,
  43298. },
  43299. {
  43300. begin: 0x1e00,
  43301. end: 0x1eff,
  43302. },
  43303. {
  43304. begin: 0x1f00,
  43305. end: 0x1fff,
  43306. },
  43307. {
  43308. begin: 0x2000,
  43309. end: 0x206f,
  43310. },
  43311. {
  43312. begin: 0x2070,
  43313. end: 0x209f,
  43314. },
  43315. {
  43316. begin: 0x20a0,
  43317. end: 0x20cf,
  43318. },
  43319. {
  43320. begin: 0x20d0,
  43321. end: 0x20ff,
  43322. },
  43323. {
  43324. begin: 0x2100,
  43325. end: 0x214f,
  43326. },
  43327. {
  43328. begin: 0x2150,
  43329. end: 0x218f,
  43330. },
  43331. {
  43332. begin: 0x2190,
  43333. end: 0x21ff,
  43334. },
  43335. {
  43336. begin: 0x2200,
  43337. end: 0x22ff,
  43338. },
  43339. {
  43340. begin: 0x2300,
  43341. end: 0x23ff,
  43342. },
  43343. {
  43344. begin: 0x2400,
  43345. end: 0x243f,
  43346. },
  43347. {
  43348. begin: 0x2440,
  43349. end: 0x245f,
  43350. },
  43351. {
  43352. begin: 0x2460,
  43353. end: 0x24ff,
  43354. },
  43355. {
  43356. begin: 0x2500,
  43357. end: 0x257f,
  43358. },
  43359. {
  43360. begin: 0x2580,
  43361. end: 0x259f,
  43362. },
  43363. {
  43364. begin: 0x25a0,
  43365. end: 0x25ff,
  43366. },
  43367. {
  43368. begin: 0x2600,
  43369. end: 0x26ff,
  43370. },
  43371. {
  43372. begin: 0x2700,
  43373. end: 0x27bf,
  43374. },
  43375. {
  43376. begin: 0x3000,
  43377. end: 0x303f,
  43378. },
  43379. {
  43380. begin: 0x3040,
  43381. end: 0x309f,
  43382. },
  43383. {
  43384. begin: 0x30a0,
  43385. end: 0x30ff,
  43386. },
  43387. {
  43388. begin: 0x3100,
  43389. end: 0x312f,
  43390. },
  43391. {
  43392. begin: 0x3130,
  43393. end: 0x318f,
  43394. },
  43395. {
  43396. begin: 0xa840,
  43397. end: 0xa87f,
  43398. },
  43399. {
  43400. begin: 0x3200,
  43401. end: 0x32ff,
  43402. },
  43403. {
  43404. begin: 0x3300,
  43405. end: 0x33ff,
  43406. },
  43407. {
  43408. begin: 0xac00,
  43409. end: 0xd7af,
  43410. },
  43411. {
  43412. begin: 0xd800,
  43413. end: 0xdfff,
  43414. },
  43415. {
  43416. begin: 0x10900,
  43417. end: 0x1091f,
  43418. },
  43419. {
  43420. begin: 0x4e00,
  43421. end: 0x9fff,
  43422. },
  43423. {
  43424. begin: 0xe000,
  43425. end: 0xf8ff,
  43426. },
  43427. {
  43428. begin: 0x31c0,
  43429. end: 0x31ef,
  43430. },
  43431. {
  43432. begin: 0xfb00,
  43433. end: 0xfb4f,
  43434. },
  43435. {
  43436. begin: 0xfb50,
  43437. end: 0xfdff,
  43438. },
  43439. {
  43440. begin: 0xfe20,
  43441. end: 0xfe2f,
  43442. },
  43443. {
  43444. begin: 0xfe10,
  43445. end: 0xfe1f,
  43446. },
  43447. {
  43448. begin: 0xfe50,
  43449. end: 0xfe6f,
  43450. },
  43451. {
  43452. begin: 0xfe70,
  43453. end: 0xfeff,
  43454. },
  43455. {
  43456. begin: 0xff00,
  43457. end: 0xffef,
  43458. },
  43459. {
  43460. begin: 0xfff0,
  43461. end: 0xffff,
  43462. },
  43463. {
  43464. begin: 0x0f00,
  43465. end: 0x0fff,
  43466. },
  43467. {
  43468. begin: 0x0700,
  43469. end: 0x074f,
  43470. },
  43471. {
  43472. begin: 0x0780,
  43473. end: 0x07bf,
  43474. },
  43475. {
  43476. begin: 0x0d80,
  43477. end: 0x0dff,
  43478. },
  43479. {
  43480. begin: 0x1000,
  43481. end: 0x109f,
  43482. },
  43483. {
  43484. begin: 0x1200,
  43485. end: 0x137f,
  43486. },
  43487. {
  43488. begin: 0x13a0,
  43489. end: 0x13ff,
  43490. },
  43491. {
  43492. begin: 0x1400,
  43493. end: 0x167f,
  43494. },
  43495. {
  43496. begin: 0x1680,
  43497. end: 0x169f,
  43498. },
  43499. {
  43500. begin: 0x16a0,
  43501. end: 0x16ff,
  43502. },
  43503. {
  43504. begin: 0x1780,
  43505. end: 0x17ff,
  43506. },
  43507. {
  43508. begin: 0x1800,
  43509. end: 0x18af,
  43510. },
  43511. {
  43512. begin: 0x2800,
  43513. end: 0x28ff,
  43514. },
  43515. {
  43516. begin: 0xa000,
  43517. end: 0xa48f,
  43518. },
  43519. {
  43520. begin: 0x1700,
  43521. end: 0x171f,
  43522. },
  43523. {
  43524. begin: 0x10300,
  43525. end: 0x1032f,
  43526. },
  43527. {
  43528. begin: 0x10330,
  43529. end: 0x1034f,
  43530. },
  43531. {
  43532. begin: 0x10400,
  43533. end: 0x1044f,
  43534. },
  43535. {
  43536. begin: 0x1d000,
  43537. end: 0x1d0ff,
  43538. },
  43539. {
  43540. begin: 0x1d400,
  43541. end: 0x1d7ff,
  43542. },
  43543. {
  43544. begin: 0xff000,
  43545. end: 0xffffd,
  43546. },
  43547. {
  43548. begin: 0xfe00,
  43549. end: 0xfe0f,
  43550. },
  43551. {
  43552. begin: 0xe0000,
  43553. end: 0xe007f,
  43554. },
  43555. {
  43556. begin: 0x1900,
  43557. end: 0x194f,
  43558. },
  43559. {
  43560. begin: 0x1950,
  43561. end: 0x197f,
  43562. },
  43563. {
  43564. begin: 0x1980,
  43565. end: 0x19df,
  43566. },
  43567. {
  43568. begin: 0x1a00,
  43569. end: 0x1a1f,
  43570. },
  43571. {
  43572. begin: 0x2c00,
  43573. end: 0x2c5f,
  43574. },
  43575. {
  43576. begin: 0x2d30,
  43577. end: 0x2d7f,
  43578. },
  43579. {
  43580. begin: 0x4dc0,
  43581. end: 0x4dff,
  43582. },
  43583. {
  43584. begin: 0xa800,
  43585. end: 0xa82f,
  43586. },
  43587. {
  43588. begin: 0x10000,
  43589. end: 0x1007f,
  43590. },
  43591. {
  43592. begin: 0x10140,
  43593. end: 0x1018f,
  43594. },
  43595. {
  43596. begin: 0x10380,
  43597. end: 0x1039f,
  43598. },
  43599. {
  43600. begin: 0x103a0,
  43601. end: 0x103df,
  43602. },
  43603. {
  43604. begin: 0x10450,
  43605. end: 0x1047f,
  43606. },
  43607. {
  43608. begin: 0x10480,
  43609. end: 0x104af,
  43610. },
  43611. {
  43612. begin: 0x10800,
  43613. end: 0x1083f,
  43614. },
  43615. {
  43616. begin: 0x10a00,
  43617. end: 0x10a5f,
  43618. },
  43619. {
  43620. begin: 0x1d300,
  43621. end: 0x1d35f,
  43622. },
  43623. {
  43624. begin: 0x12000,
  43625. end: 0x123ff,
  43626. },
  43627. {
  43628. begin: 0x1d360,
  43629. end: 0x1d37f,
  43630. },
  43631. {
  43632. begin: 0x1b80,
  43633. end: 0x1bbf,
  43634. },
  43635. {
  43636. begin: 0x1c00,
  43637. end: 0x1c4f,
  43638. },
  43639. {
  43640. begin: 0x1c50,
  43641. end: 0x1c7f,
  43642. },
  43643. {
  43644. begin: 0xa880,
  43645. end: 0xa8df,
  43646. },
  43647. {
  43648. begin: 0xa900,
  43649. end: 0xa92f,
  43650. },
  43651. {
  43652. begin: 0xa930,
  43653. end: 0xa95f,
  43654. },
  43655. {
  43656. begin: 0xaa00,
  43657. end: 0xaa5f,
  43658. },
  43659. {
  43660. begin: 0x10190,
  43661. end: 0x101cf,
  43662. },
  43663. {
  43664. begin: 0x101d0,
  43665. end: 0x101ff,
  43666. },
  43667. {
  43668. begin: 0x102a0,
  43669. end: 0x102df,
  43670. },
  43671. {
  43672. begin: 0x1f030,
  43673. end: 0x1f09f,
  43674. },
  43675. ];
  43676. function getUnicodeRangeFor(value) {
  43677. for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  43678. const range = UnicodeRanges[i];
  43679. if (value >= range.begin && value < range.end) {
  43680. return i;
  43681. }
  43682. }
  43683. return -1;
  43684. }
  43685. function isRTLRangeFor(value) {
  43686. let range = UnicodeRanges[13];
  43687. if (value >= range.begin && value < range.end) {
  43688. return true;
  43689. }
  43690. range = UnicodeRanges[11];
  43691. if (value >= range.begin && value < range.end) {
  43692. return true;
  43693. }
  43694. return false;
  43695. }
  43696. const getNormalizedUnicodes = (0,
  43697. _core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(
  43698. function () {
  43699. return [
  43700. "\u00A8",
  43701. "\u0020\u0308",
  43702. "\u00AF",
  43703. "\u0020\u0304",
  43704. "\u00B4",
  43705. "\u0020\u0301",
  43706. "\u00B5",
  43707. "\u03BC",
  43708. "\u00B8",
  43709. "\u0020\u0327",
  43710. "\u0132",
  43711. "\u0049\u004A",
  43712. "\u0133",
  43713. "\u0069\u006A",
  43714. "\u013F",
  43715. "\u004C\u00B7",
  43716. "\u0140",
  43717. "\u006C\u00B7",
  43718. "\u0149",
  43719. "\u02BC\u006E",
  43720. "\u017F",
  43721. "\u0073",
  43722. "\u01C4",
  43723. "\u0044\u017D",
  43724. "\u01C5",
  43725. "\u0044\u017E",
  43726. "\u01C6",
  43727. "\u0064\u017E",
  43728. "\u01C7",
  43729. "\u004C\u004A",
  43730. "\u01C8",
  43731. "\u004C\u006A",
  43732. "\u01C9",
  43733. "\u006C\u006A",
  43734. "\u01CA",
  43735. "\u004E\u004A",
  43736. "\u01CB",
  43737. "\u004E\u006A",
  43738. "\u01CC",
  43739. "\u006E\u006A",
  43740. "\u01F1",
  43741. "\u0044\u005A",
  43742. "\u01F2",
  43743. "\u0044\u007A",
  43744. "\u01F3",
  43745. "\u0064\u007A",
  43746. "\u02D8",
  43747. "\u0020\u0306",
  43748. "\u02D9",
  43749. "\u0020\u0307",
  43750. "\u02DA",
  43751. "\u0020\u030A",
  43752. "\u02DB",
  43753. "\u0020\u0328",
  43754. "\u02DC",
  43755. "\u0020\u0303",
  43756. "\u02DD",
  43757. "\u0020\u030B",
  43758. "\u037A",
  43759. "\u0020\u0345",
  43760. "\u0384",
  43761. "\u0020\u0301",
  43762. "\u03D0",
  43763. "\u03B2",
  43764. "\u03D1",
  43765. "\u03B8",
  43766. "\u03D2",
  43767. "\u03A5",
  43768. "\u03D5",
  43769. "\u03C6",
  43770. "\u03D6",
  43771. "\u03C0",
  43772. "\u03F0",
  43773. "\u03BA",
  43774. "\u03F1",
  43775. "\u03C1",
  43776. "\u03F2",
  43777. "\u03C2",
  43778. "\u03F4",
  43779. "\u0398",
  43780. "\u03F5",
  43781. "\u03B5",
  43782. "\u03F9",
  43783. "\u03A3",
  43784. "\u0587",
  43785. "\u0565\u0582",
  43786. "\u0675",
  43787. "\u0627\u0674",
  43788. "\u0676",
  43789. "\u0648\u0674",
  43790. "\u0677",
  43791. "\u06C7\u0674",
  43792. "\u0678",
  43793. "\u064A\u0674",
  43794. "\u0E33",
  43795. "\u0E4D\u0E32",
  43796. "\u0EB3",
  43797. "\u0ECD\u0EB2",
  43798. "\u0EDC",
  43799. "\u0EAB\u0E99",
  43800. "\u0EDD",
  43801. "\u0EAB\u0EA1",
  43802. "\u0F77",
  43803. "\u0FB2\u0F81",
  43804. "\u0F79",
  43805. "\u0FB3\u0F81",
  43806. "\u1E9A",
  43807. "\u0061\u02BE",
  43808. "\u1FBD",
  43809. "\u0020\u0313",
  43810. "\u1FBF",
  43811. "\u0020\u0313",
  43812. "\u1FC0",
  43813. "\u0020\u0342",
  43814. "\u1FFE",
  43815. "\u0020\u0314",
  43816. "\u2002",
  43817. "\u0020",
  43818. "\u2003",
  43819. "\u0020",
  43820. "\u2004",
  43821. "\u0020",
  43822. "\u2005",
  43823. "\u0020",
  43824. "\u2006",
  43825. "\u0020",
  43826. "\u2008",
  43827. "\u0020",
  43828. "\u2009",
  43829. "\u0020",
  43830. "\u200A",
  43831. "\u0020",
  43832. "\u2017",
  43833. "\u0020\u0333",
  43834. "\u2024",
  43835. "\u002E",
  43836. "\u2025",
  43837. "\u002E\u002E",
  43838. "\u2026",
  43839. "\u002E\u002E\u002E",
  43840. "\u2033",
  43841. "\u2032\u2032",
  43842. "\u2034",
  43843. "\u2032\u2032\u2032",
  43844. "\u2036",
  43845. "\u2035\u2035",
  43846. "\u2037",
  43847. "\u2035\u2035\u2035",
  43848. "\u203C",
  43849. "\u0021\u0021",
  43850. "\u203E",
  43851. "\u0020\u0305",
  43852. "\u2047",
  43853. "\u003F\u003F",
  43854. "\u2048",
  43855. "\u003F\u0021",
  43856. "\u2049",
  43857. "\u0021\u003F",
  43858. "\u2057",
  43859. "\u2032\u2032\u2032\u2032",
  43860. "\u205F",
  43861. "\u0020",
  43862. "\u20A8",
  43863. "\u0052\u0073",
  43864. "\u2100",
  43865. "\u0061\u002F\u0063",
  43866. "\u2101",
  43867. "\u0061\u002F\u0073",
  43868. "\u2103",
  43869. "\u00B0\u0043",
  43870. "\u2105",
  43871. "\u0063\u002F\u006F",
  43872. "\u2106",
  43873. "\u0063\u002F\u0075",
  43874. "\u2107",
  43875. "\u0190",
  43876. "\u2109",
  43877. "\u00B0\u0046",
  43878. "\u2116",
  43879. "\u004E\u006F",
  43880. "\u2121",
  43881. "\u0054\u0045\u004C",
  43882. "\u2135",
  43883. "\u05D0",
  43884. "\u2136",
  43885. "\u05D1",
  43886. "\u2137",
  43887. "\u05D2",
  43888. "\u2138",
  43889. "\u05D3",
  43890. "\u213B",
  43891. "\u0046\u0041\u0058",
  43892. "\u2160",
  43893. "\u0049",
  43894. "\u2161",
  43895. "\u0049\u0049",
  43896. "\u2162",
  43897. "\u0049\u0049\u0049",
  43898. "\u2163",
  43899. "\u0049\u0056",
  43900. "\u2164",
  43901. "\u0056",
  43902. "\u2165",
  43903. "\u0056\u0049",
  43904. "\u2166",
  43905. "\u0056\u0049\u0049",
  43906. "\u2167",
  43907. "\u0056\u0049\u0049\u0049",
  43908. "\u2168",
  43909. "\u0049\u0058",
  43910. "\u2169",
  43911. "\u0058",
  43912. "\u216A",
  43913. "\u0058\u0049",
  43914. "\u216B",
  43915. "\u0058\u0049\u0049",
  43916. "\u216C",
  43917. "\u004C",
  43918. "\u216D",
  43919. "\u0043",
  43920. "\u216E",
  43921. "\u0044",
  43922. "\u216F",
  43923. "\u004D",
  43924. "\u2170",
  43925. "\u0069",
  43926. "\u2171",
  43927. "\u0069\u0069",
  43928. "\u2172",
  43929. "\u0069\u0069\u0069",
  43930. "\u2173",
  43931. "\u0069\u0076",
  43932. "\u2174",
  43933. "\u0076",
  43934. "\u2175",
  43935. "\u0076\u0069",
  43936. "\u2176",
  43937. "\u0076\u0069\u0069",
  43938. "\u2177",
  43939. "\u0076\u0069\u0069\u0069",
  43940. "\u2178",
  43941. "\u0069\u0078",
  43942. "\u2179",
  43943. "\u0078",
  43944. "\u217A",
  43945. "\u0078\u0069",
  43946. "\u217B",
  43947. "\u0078\u0069\u0069",
  43948. "\u217C",
  43949. "\u006C",
  43950. "\u217D",
  43951. "\u0063",
  43952. "\u217E",
  43953. "\u0064",
  43954. "\u217F",
  43955. "\u006D",
  43956. "\u222C",
  43957. "\u222B\u222B",
  43958. "\u222D",
  43959. "\u222B\u222B\u222B",
  43960. "\u222F",
  43961. "\u222E\u222E",
  43962. "\u2230",
  43963. "\u222E\u222E\u222E",
  43964. "\u2474",
  43965. "\u0028\u0031\u0029",
  43966. "\u2475",
  43967. "\u0028\u0032\u0029",
  43968. "\u2476",
  43969. "\u0028\u0033\u0029",
  43970. "\u2477",
  43971. "\u0028\u0034\u0029",
  43972. "\u2478",
  43973. "\u0028\u0035\u0029",
  43974. "\u2479",
  43975. "\u0028\u0036\u0029",
  43976. "\u247A",
  43977. "\u0028\u0037\u0029",
  43978. "\u247B",
  43979. "\u0028\u0038\u0029",
  43980. "\u247C",
  43981. "\u0028\u0039\u0029",
  43982. "\u247D",
  43983. "\u0028\u0031\u0030\u0029",
  43984. "\u247E",
  43985. "\u0028\u0031\u0031\u0029",
  43986. "\u247F",
  43987. "\u0028\u0031\u0032\u0029",
  43988. "\u2480",
  43989. "\u0028\u0031\u0033\u0029",
  43990. "\u2481",
  43991. "\u0028\u0031\u0034\u0029",
  43992. "\u2482",
  43993. "\u0028\u0031\u0035\u0029",
  43994. "\u2483",
  43995. "\u0028\u0031\u0036\u0029",
  43996. "\u2484",
  43997. "\u0028\u0031\u0037\u0029",
  43998. "\u2485",
  43999. "\u0028\u0031\u0038\u0029",
  44000. "\u2486",
  44001. "\u0028\u0031\u0039\u0029",
  44002. "\u2487",
  44003. "\u0028\u0032\u0030\u0029",
  44004. "\u2488",
  44005. "\u0031\u002E",
  44006. "\u2489",
  44007. "\u0032\u002E",
  44008. "\u248A",
  44009. "\u0033\u002E",
  44010. "\u248B",
  44011. "\u0034\u002E",
  44012. "\u248C",
  44013. "\u0035\u002E",
  44014. "\u248D",
  44015. "\u0036\u002E",
  44016. "\u248E",
  44017. "\u0037\u002E",
  44018. "\u248F",
  44019. "\u0038\u002E",
  44020. "\u2490",
  44021. "\u0039\u002E",
  44022. "\u2491",
  44023. "\u0031\u0030\u002E",
  44024. "\u2492",
  44025. "\u0031\u0031\u002E",
  44026. "\u2493",
  44027. "\u0031\u0032\u002E",
  44028. "\u2494",
  44029. "\u0031\u0033\u002E",
  44030. "\u2495",
  44031. "\u0031\u0034\u002E",
  44032. "\u2496",
  44033. "\u0031\u0035\u002E",
  44034. "\u2497",
  44035. "\u0031\u0036\u002E",
  44036. "\u2498",
  44037. "\u0031\u0037\u002E",
  44038. "\u2499",
  44039. "\u0031\u0038\u002E",
  44040. "\u249A",
  44041. "\u0031\u0039\u002E",
  44042. "\u249B",
  44043. "\u0032\u0030\u002E",
  44044. "\u249C",
  44045. "\u0028\u0061\u0029",
  44046. "\u249D",
  44047. "\u0028\u0062\u0029",
  44048. "\u249E",
  44049. "\u0028\u0063\u0029",
  44050. "\u249F",
  44051. "\u0028\u0064\u0029",
  44052. "\u24A0",
  44053. "\u0028\u0065\u0029",
  44054. "\u24A1",
  44055. "\u0028\u0066\u0029",
  44056. "\u24A2",
  44057. "\u0028\u0067\u0029",
  44058. "\u24A3",
  44059. "\u0028\u0068\u0029",
  44060. "\u24A4",
  44061. "\u0028\u0069\u0029",
  44062. "\u24A5",
  44063. "\u0028\u006A\u0029",
  44064. "\u24A6",
  44065. "\u0028\u006B\u0029",
  44066. "\u24A7",
  44067. "\u0028\u006C\u0029",
  44068. "\u24A8",
  44069. "\u0028\u006D\u0029",
  44070. "\u24A9",
  44071. "\u0028\u006E\u0029",
  44072. "\u24AA",
  44073. "\u0028\u006F\u0029",
  44074. "\u24AB",
  44075. "\u0028\u0070\u0029",
  44076. "\u24AC",
  44077. "\u0028\u0071\u0029",
  44078. "\u24AD",
  44079. "\u0028\u0072\u0029",
  44080. "\u24AE",
  44081. "\u0028\u0073\u0029",
  44082. "\u24AF",
  44083. "\u0028\u0074\u0029",
  44084. "\u24B0",
  44085. "\u0028\u0075\u0029",
  44086. "\u24B1",
  44087. "\u0028\u0076\u0029",
  44088. "\u24B2",
  44089. "\u0028\u0077\u0029",
  44090. "\u24B3",
  44091. "\u0028\u0078\u0029",
  44092. "\u24B4",
  44093. "\u0028\u0079\u0029",
  44094. "\u24B5",
  44095. "\u0028\u007A\u0029",
  44096. "\u2A0C",
  44097. "\u222B\u222B\u222B\u222B",
  44098. "\u2A74",
  44099. "\u003A\u003A\u003D",
  44100. "\u2A75",
  44101. "\u003D\u003D",
  44102. "\u2A76",
  44103. "\u003D\u003D\u003D",
  44104. "\u2E9F",
  44105. "\u6BCD",
  44106. "\u2EF3",
  44107. "\u9F9F",
  44108. "\u2F00",
  44109. "\u4E00",
  44110. "\u2F01",
  44111. "\u4E28",
  44112. "\u2F02",
  44113. "\u4E36",
  44114. "\u2F03",
  44115. "\u4E3F",
  44116. "\u2F04",
  44117. "\u4E59",
  44118. "\u2F05",
  44119. "\u4E85",
  44120. "\u2F06",
  44121. "\u4E8C",
  44122. "\u2F07",
  44123. "\u4EA0",
  44124. "\u2F08",
  44125. "\u4EBA",
  44126. "\u2F09",
  44127. "\u513F",
  44128. "\u2F0A",
  44129. "\u5165",
  44130. "\u2F0B",
  44131. "\u516B",
  44132. "\u2F0C",
  44133. "\u5182",
  44134. "\u2F0D",
  44135. "\u5196",
  44136. "\u2F0E",
  44137. "\u51AB",
  44138. "\u2F0F",
  44139. "\u51E0",
  44140. "\u2F10",
  44141. "\u51F5",
  44142. "\u2F11",
  44143. "\u5200",
  44144. "\u2F12",
  44145. "\u529B",
  44146. "\u2F13",
  44147. "\u52F9",
  44148. "\u2F14",
  44149. "\u5315",
  44150. "\u2F15",
  44151. "\u531A",
  44152. "\u2F16",
  44153. "\u5338",
  44154. "\u2F17",
  44155. "\u5341",
  44156. "\u2F18",
  44157. "\u535C",
  44158. "\u2F19",
  44159. "\u5369",
  44160. "\u2F1A",
  44161. "\u5382",
  44162. "\u2F1B",
  44163. "\u53B6",
  44164. "\u2F1C",
  44165. "\u53C8",
  44166. "\u2F1D",
  44167. "\u53E3",
  44168. "\u2F1E",
  44169. "\u56D7",
  44170. "\u2F1F",
  44171. "\u571F",
  44172. "\u2F20",
  44173. "\u58EB",
  44174. "\u2F21",
  44175. "\u5902",
  44176. "\u2F22",
  44177. "\u590A",
  44178. "\u2F23",
  44179. "\u5915",
  44180. "\u2F24",
  44181. "\u5927",
  44182. "\u2F25",
  44183. "\u5973",
  44184. "\u2F26",
  44185. "\u5B50",
  44186. "\u2F27",
  44187. "\u5B80",
  44188. "\u2F28",
  44189. "\u5BF8",
  44190. "\u2F29",
  44191. "\u5C0F",
  44192. "\u2F2A",
  44193. "\u5C22",
  44194. "\u2F2B",
  44195. "\u5C38",
  44196. "\u2F2C",
  44197. "\u5C6E",
  44198. "\u2F2D",
  44199. "\u5C71",
  44200. "\u2F2E",
  44201. "\u5DDB",
  44202. "\u2F2F",
  44203. "\u5DE5",
  44204. "\u2F30",
  44205. "\u5DF1",
  44206. "\u2F31",
  44207. "\u5DFE",
  44208. "\u2F32",
  44209. "\u5E72",
  44210. "\u2F33",
  44211. "\u5E7A",
  44212. "\u2F34",
  44213. "\u5E7F",
  44214. "\u2F35",
  44215. "\u5EF4",
  44216. "\u2F36",
  44217. "\u5EFE",
  44218. "\u2F37",
  44219. "\u5F0B",
  44220. "\u2F38",
  44221. "\u5F13",
  44222. "\u2F39",
  44223. "\u5F50",
  44224. "\u2F3A",
  44225. "\u5F61",
  44226. "\u2F3B",
  44227. "\u5F73",
  44228. "\u2F3C",
  44229. "\u5FC3",
  44230. "\u2F3D",
  44231. "\u6208",
  44232. "\u2F3E",
  44233. "\u6236",
  44234. "\u2F3F",
  44235. "\u624B",
  44236. "\u2F40",
  44237. "\u652F",
  44238. "\u2F41",
  44239. "\u6534",
  44240. "\u2F42",
  44241. "\u6587",
  44242. "\u2F43",
  44243. "\u6597",
  44244. "\u2F44",
  44245. "\u65A4",
  44246. "\u2F45",
  44247. "\u65B9",
  44248. "\u2F46",
  44249. "\u65E0",
  44250. "\u2F47",
  44251. "\u65E5",
  44252. "\u2F48",
  44253. "\u66F0",
  44254. "\u2F49",
  44255. "\u6708",
  44256. "\u2F4A",
  44257. "\u6728",
  44258. "\u2F4B",
  44259. "\u6B20",
  44260. "\u2F4C",
  44261. "\u6B62",
  44262. "\u2F4D",
  44263. "\u6B79",
  44264. "\u2F4E",
  44265. "\u6BB3",
  44266. "\u2F4F",
  44267. "\u6BCB",
  44268. "\u2F50",
  44269. "\u6BD4",
  44270. "\u2F51",
  44271. "\u6BDB",
  44272. "\u2F52",
  44273. "\u6C0F",
  44274. "\u2F53",
  44275. "\u6C14",
  44276. "\u2F54",
  44277. "\u6C34",
  44278. "\u2F55",
  44279. "\u706B",
  44280. "\u2F56",
  44281. "\u722A",
  44282. "\u2F57",
  44283. "\u7236",
  44284. "\u2F58",
  44285. "\u723B",
  44286. "\u2F59",
  44287. "\u723F",
  44288. "\u2F5A",
  44289. "\u7247",
  44290. "\u2F5B",
  44291. "\u7259",
  44292. "\u2F5C",
  44293. "\u725B",
  44294. "\u2F5D",
  44295. "\u72AC",
  44296. "\u2F5E",
  44297. "\u7384",
  44298. "\u2F5F",
  44299. "\u7389",
  44300. "\u2F60",
  44301. "\u74DC",
  44302. "\u2F61",
  44303. "\u74E6",
  44304. "\u2F62",
  44305. "\u7518",
  44306. "\u2F63",
  44307. "\u751F",
  44308. "\u2F64",
  44309. "\u7528",
  44310. "\u2F65",
  44311. "\u7530",
  44312. "\u2F66",
  44313. "\u758B",
  44314. "\u2F67",
  44315. "\u7592",
  44316. "\u2F68",
  44317. "\u7676",
  44318. "\u2F69",
  44319. "\u767D",
  44320. "\u2F6A",
  44321. "\u76AE",
  44322. "\u2F6B",
  44323. "\u76BF",
  44324. "\u2F6C",
  44325. "\u76EE",
  44326. "\u2F6D",
  44327. "\u77DB",
  44328. "\u2F6E",
  44329. "\u77E2",
  44330. "\u2F6F",
  44331. "\u77F3",
  44332. "\u2F70",
  44333. "\u793A",
  44334. "\u2F71",
  44335. "\u79B8",
  44336. "\u2F72",
  44337. "\u79BE",
  44338. "\u2F73",
  44339. "\u7A74",
  44340. "\u2F74",
  44341. "\u7ACB",
  44342. "\u2F75",
  44343. "\u7AF9",
  44344. "\u2F76",
  44345. "\u7C73",
  44346. "\u2F77",
  44347. "\u7CF8",
  44348. "\u2F78",
  44349. "\u7F36",
  44350. "\u2F79",
  44351. "\u7F51",
  44352. "\u2F7A",
  44353. "\u7F8A",
  44354. "\u2F7B",
  44355. "\u7FBD",
  44356. "\u2F7C",
  44357. "\u8001",
  44358. "\u2F7D",
  44359. "\u800C",
  44360. "\u2F7E",
  44361. "\u8012",
  44362. "\u2F7F",
  44363. "\u8033",
  44364. "\u2F80",
  44365. "\u807F",
  44366. "\u2F81",
  44367. "\u8089",
  44368. "\u2F82",
  44369. "\u81E3",
  44370. "\u2F83",
  44371. "\u81EA",
  44372. "\u2F84",
  44373. "\u81F3",
  44374. "\u2F85",
  44375. "\u81FC",
  44376. "\u2F86",
  44377. "\u820C",
  44378. "\u2F87",
  44379. "\u821B",
  44380. "\u2F88",
  44381. "\u821F",
  44382. "\u2F89",
  44383. "\u826E",
  44384. "\u2F8A",
  44385. "\u8272",
  44386. "\u2F8B",
  44387. "\u8278",
  44388. "\u2F8C",
  44389. "\u864D",
  44390. "\u2F8D",
  44391. "\u866B",
  44392. "\u2F8E",
  44393. "\u8840",
  44394. "\u2F8F",
  44395. "\u884C",
  44396. "\u2F90",
  44397. "\u8863",
  44398. "\u2F91",
  44399. "\u897E",
  44400. "\u2F92",
  44401. "\u898B",
  44402. "\u2F93",
  44403. "\u89D2",
  44404. "\u2F94",
  44405. "\u8A00",
  44406. "\u2F95",
  44407. "\u8C37",
  44408. "\u2F96",
  44409. "\u8C46",
  44410. "\u2F97",
  44411. "\u8C55",
  44412. "\u2F98",
  44413. "\u8C78",
  44414. "\u2F99",
  44415. "\u8C9D",
  44416. "\u2F9A",
  44417. "\u8D64",
  44418. "\u2F9B",
  44419. "\u8D70",
  44420. "\u2F9C",
  44421. "\u8DB3",
  44422. "\u2F9D",
  44423. "\u8EAB",
  44424. "\u2F9E",
  44425. "\u8ECA",
  44426. "\u2F9F",
  44427. "\u8F9B",
  44428. "\u2FA0",
  44429. "\u8FB0",
  44430. "\u2FA1",
  44431. "\u8FB5",
  44432. "\u2FA2",
  44433. "\u9091",
  44434. "\u2FA3",
  44435. "\u9149",
  44436. "\u2FA4",
  44437. "\u91C6",
  44438. "\u2FA5",
  44439. "\u91CC",
  44440. "\u2FA6",
  44441. "\u91D1",
  44442. "\u2FA7",
  44443. "\u9577",
  44444. "\u2FA8",
  44445. "\u9580",
  44446. "\u2FA9",
  44447. "\u961C",
  44448. "\u2FAA",
  44449. "\u96B6",
  44450. "\u2FAB",
  44451. "\u96B9",
  44452. "\u2FAC",
  44453. "\u96E8",
  44454. "\u2FAD",
  44455. "\u9751",
  44456. "\u2FAE",
  44457. "\u975E",
  44458. "\u2FAF",
  44459. "\u9762",
  44460. "\u2FB0",
  44461. "\u9769",
  44462. "\u2FB1",
  44463. "\u97CB",
  44464. "\u2FB2",
  44465. "\u97ED",
  44466. "\u2FB3",
  44467. "\u97F3",
  44468. "\u2FB4",
  44469. "\u9801",
  44470. "\u2FB5",
  44471. "\u98A8",
  44472. "\u2FB6",
  44473. "\u98DB",
  44474. "\u2FB7",
  44475. "\u98DF",
  44476. "\u2FB8",
  44477. "\u9996",
  44478. "\u2FB9",
  44479. "\u9999",
  44480. "\u2FBA",
  44481. "\u99AC",
  44482. "\u2FBB",
  44483. "\u9AA8",
  44484. "\u2FBC",
  44485. "\u9AD8",
  44486. "\u2FBD",
  44487. "\u9ADF",
  44488. "\u2FBE",
  44489. "\u9B25",
  44490. "\u2FBF",
  44491. "\u9B2F",
  44492. "\u2FC0",
  44493. "\u9B32",
  44494. "\u2FC1",
  44495. "\u9B3C",
  44496. "\u2FC2",
  44497. "\u9B5A",
  44498. "\u2FC3",
  44499. "\u9CE5",
  44500. "\u2FC4",
  44501. "\u9E75",
  44502. "\u2FC5",
  44503. "\u9E7F",
  44504. "\u2FC6",
  44505. "\u9EA5",
  44506. "\u2FC7",
  44507. "\u9EBB",
  44508. "\u2FC8",
  44509. "\u9EC3",
  44510. "\u2FC9",
  44511. "\u9ECD",
  44512. "\u2FCA",
  44513. "\u9ED1",
  44514. "\u2FCB",
  44515. "\u9EF9",
  44516. "\u2FCC",
  44517. "\u9EFD",
  44518. "\u2FCD",
  44519. "\u9F0E",
  44520. "\u2FCE",
  44521. "\u9F13",
  44522. "\u2FCF",
  44523. "\u9F20",
  44524. "\u2FD0",
  44525. "\u9F3B",
  44526. "\u2FD1",
  44527. "\u9F4A",
  44528. "\u2FD2",
  44529. "\u9F52",
  44530. "\u2FD3",
  44531. "\u9F8D",
  44532. "\u2FD4",
  44533. "\u9F9C",
  44534. "\u2FD5",
  44535. "\u9FA0",
  44536. "\u3036",
  44537. "\u3012",
  44538. "\u3038",
  44539. "\u5341",
  44540. "\u3039",
  44541. "\u5344",
  44542. "\u303A",
  44543. "\u5345",
  44544. "\u309B",
  44545. "\u0020\u3099",
  44546. "\u309C",
  44547. "\u0020\u309A",
  44548. "\u3131",
  44549. "\u1100",
  44550. "\u3132",
  44551. "\u1101",
  44552. "\u3133",
  44553. "\u11AA",
  44554. "\u3134",
  44555. "\u1102",
  44556. "\u3135",
  44557. "\u11AC",
  44558. "\u3136",
  44559. "\u11AD",
  44560. "\u3137",
  44561. "\u1103",
  44562. "\u3138",
  44563. "\u1104",
  44564. "\u3139",
  44565. "\u1105",
  44566. "\u313A",
  44567. "\u11B0",
  44568. "\u313B",
  44569. "\u11B1",
  44570. "\u313C",
  44571. "\u11B2",
  44572. "\u313D",
  44573. "\u11B3",
  44574. "\u313E",
  44575. "\u11B4",
  44576. "\u313F",
  44577. "\u11B5",
  44578. "\u3140",
  44579. "\u111A",
  44580. "\u3141",
  44581. "\u1106",
  44582. "\u3142",
  44583. "\u1107",
  44584. "\u3143",
  44585. "\u1108",
  44586. "\u3144",
  44587. "\u1121",
  44588. "\u3145",
  44589. "\u1109",
  44590. "\u3146",
  44591. "\u110A",
  44592. "\u3147",
  44593. "\u110B",
  44594. "\u3148",
  44595. "\u110C",
  44596. "\u3149",
  44597. "\u110D",
  44598. "\u314A",
  44599. "\u110E",
  44600. "\u314B",
  44601. "\u110F",
  44602. "\u314C",
  44603. "\u1110",
  44604. "\u314D",
  44605. "\u1111",
  44606. "\u314E",
  44607. "\u1112",
  44608. "\u314F",
  44609. "\u1161",
  44610. "\u3150",
  44611. "\u1162",
  44612. "\u3151",
  44613. "\u1163",
  44614. "\u3152",
  44615. "\u1164",
  44616. "\u3153",
  44617. "\u1165",
  44618. "\u3154",
  44619. "\u1166",
  44620. "\u3155",
  44621. "\u1167",
  44622. "\u3156",
  44623. "\u1168",
  44624. "\u3157",
  44625. "\u1169",
  44626. "\u3158",
  44627. "\u116A",
  44628. "\u3159",
  44629. "\u116B",
  44630. "\u315A",
  44631. "\u116C",
  44632. "\u315B",
  44633. "\u116D",
  44634. "\u315C",
  44635. "\u116E",
  44636. "\u315D",
  44637. "\u116F",
  44638. "\u315E",
  44639. "\u1170",
  44640. "\u315F",
  44641. "\u1171",
  44642. "\u3160",
  44643. "\u1172",
  44644. "\u3161",
  44645. "\u1173",
  44646. "\u3162",
  44647. "\u1174",
  44648. "\u3163",
  44649. "\u1175",
  44650. "\u3164",
  44651. "\u1160",
  44652. "\u3165",
  44653. "\u1114",
  44654. "\u3166",
  44655. "\u1115",
  44656. "\u3167",
  44657. "\u11C7",
  44658. "\u3168",
  44659. "\u11C8",
  44660. "\u3169",
  44661. "\u11CC",
  44662. "\u316A",
  44663. "\u11CE",
  44664. "\u316B",
  44665. "\u11D3",
  44666. "\u316C",
  44667. "\u11D7",
  44668. "\u316D",
  44669. "\u11D9",
  44670. "\u316E",
  44671. "\u111C",
  44672. "\u316F",
  44673. "\u11DD",
  44674. "\u3170",
  44675. "\u11DF",
  44676. "\u3171",
  44677. "\u111D",
  44678. "\u3172",
  44679. "\u111E",
  44680. "\u3173",
  44681. "\u1120",
  44682. "\u3174",
  44683. "\u1122",
  44684. "\u3175",
  44685. "\u1123",
  44686. "\u3176",
  44687. "\u1127",
  44688. "\u3177",
  44689. "\u1129",
  44690. "\u3178",
  44691. "\u112B",
  44692. "\u3179",
  44693. "\u112C",
  44694. "\u317A",
  44695. "\u112D",
  44696. "\u317B",
  44697. "\u112E",
  44698. "\u317C",
  44699. "\u112F",
  44700. "\u317D",
  44701. "\u1132",
  44702. "\u317E",
  44703. "\u1136",
  44704. "\u317F",
  44705. "\u1140",
  44706. "\u3180",
  44707. "\u1147",
  44708. "\u3181",
  44709. "\u114C",
  44710. "\u3182",
  44711. "\u11F1",
  44712. "\u3183",
  44713. "\u11F2",
  44714. "\u3184",
  44715. "\u1157",
  44716. "\u3185",
  44717. "\u1158",
  44718. "\u3186",
  44719. "\u1159",
  44720. "\u3187",
  44721. "\u1184",
  44722. "\u3188",
  44723. "\u1185",
  44724. "\u3189",
  44725. "\u1188",
  44726. "\u318A",
  44727. "\u1191",
  44728. "\u318B",
  44729. "\u1192",
  44730. "\u318C",
  44731. "\u1194",
  44732. "\u318D",
  44733. "\u119E",
  44734. "\u318E",
  44735. "\u11A1",
  44736. "\u3200",
  44737. "\u0028\u1100\u0029",
  44738. "\u3201",
  44739. "\u0028\u1102\u0029",
  44740. "\u3202",
  44741. "\u0028\u1103\u0029",
  44742. "\u3203",
  44743. "\u0028\u1105\u0029",
  44744. "\u3204",
  44745. "\u0028\u1106\u0029",
  44746. "\u3205",
  44747. "\u0028\u1107\u0029",
  44748. "\u3206",
  44749. "\u0028\u1109\u0029",
  44750. "\u3207",
  44751. "\u0028\u110B\u0029",
  44752. "\u3208",
  44753. "\u0028\u110C\u0029",
  44754. "\u3209",
  44755. "\u0028\u110E\u0029",
  44756. "\u320A",
  44757. "\u0028\u110F\u0029",
  44758. "\u320B",
  44759. "\u0028\u1110\u0029",
  44760. "\u320C",
  44761. "\u0028\u1111\u0029",
  44762. "\u320D",
  44763. "\u0028\u1112\u0029",
  44764. "\u320E",
  44765. "\u0028\u1100\u1161\u0029",
  44766. "\u320F",
  44767. "\u0028\u1102\u1161\u0029",
  44768. "\u3210",
  44769. "\u0028\u1103\u1161\u0029",
  44770. "\u3211",
  44771. "\u0028\u1105\u1161\u0029",
  44772. "\u3212",
  44773. "\u0028\u1106\u1161\u0029",
  44774. "\u3213",
  44775. "\u0028\u1107\u1161\u0029",
  44776. "\u3214",
  44777. "\u0028\u1109\u1161\u0029",
  44778. "\u3215",
  44779. "\u0028\u110B\u1161\u0029",
  44780. "\u3216",
  44781. "\u0028\u110C\u1161\u0029",
  44782. "\u3217",
  44783. "\u0028\u110E\u1161\u0029",
  44784. "\u3218",
  44785. "\u0028\u110F\u1161\u0029",
  44786. "\u3219",
  44787. "\u0028\u1110\u1161\u0029",
  44788. "\u321A",
  44789. "\u0028\u1111\u1161\u0029",
  44790. "\u321B",
  44791. "\u0028\u1112\u1161\u0029",
  44792. "\u321C",
  44793. "\u0028\u110C\u116E\u0029",
  44794. "\u321D",
  44795. "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029",
  44796. "\u321E",
  44797. "\u0028\u110B\u1169\u1112\u116E\u0029",
  44798. "\u3220",
  44799. "\u0028\u4E00\u0029",
  44800. "\u3221",
  44801. "\u0028\u4E8C\u0029",
  44802. "\u3222",
  44803. "\u0028\u4E09\u0029",
  44804. "\u3223",
  44805. "\u0028\u56DB\u0029",
  44806. "\u3224",
  44807. "\u0028\u4E94\u0029",
  44808. "\u3225",
  44809. "\u0028\u516D\u0029",
  44810. "\u3226",
  44811. "\u0028\u4E03\u0029",
  44812. "\u3227",
  44813. "\u0028\u516B\u0029",
  44814. "\u3228",
  44815. "\u0028\u4E5D\u0029",
  44816. "\u3229",
  44817. "\u0028\u5341\u0029",
  44818. "\u322A",
  44819. "\u0028\u6708\u0029",
  44820. "\u322B",
  44821. "\u0028\u706B\u0029",
  44822. "\u322C",
  44823. "\u0028\u6C34\u0029",
  44824. "\u322D",
  44825. "\u0028\u6728\u0029",
  44826. "\u322E",
  44827. "\u0028\u91D1\u0029",
  44828. "\u322F",
  44829. "\u0028\u571F\u0029",
  44830. "\u3230",
  44831. "\u0028\u65E5\u0029",
  44832. "\u3231",
  44833. "\u0028\u682A\u0029",
  44834. "\u3232",
  44835. "\u0028\u6709\u0029",
  44836. "\u3233",
  44837. "\u0028\u793E\u0029",
  44838. "\u3234",
  44839. "\u0028\u540D\u0029",
  44840. "\u3235",
  44841. "\u0028\u7279\u0029",
  44842. "\u3236",
  44843. "\u0028\u8CA1\u0029",
  44844. "\u3237",
  44845. "\u0028\u795D\u0029",
  44846. "\u3238",
  44847. "\u0028\u52B4\u0029",
  44848. "\u3239",
  44849. "\u0028\u4EE3\u0029",
  44850. "\u323A",
  44851. "\u0028\u547C\u0029",
  44852. "\u323B",
  44853. "\u0028\u5B66\u0029",
  44854. "\u323C",
  44855. "\u0028\u76E3\u0029",
  44856. "\u323D",
  44857. "\u0028\u4F01\u0029",
  44858. "\u323E",
  44859. "\u0028\u8CC7\u0029",
  44860. "\u323F",
  44861. "\u0028\u5354\u0029",
  44862. "\u3240",
  44863. "\u0028\u796D\u0029",
  44864. "\u3241",
  44865. "\u0028\u4F11\u0029",
  44866. "\u3242",
  44867. "\u0028\u81EA\u0029",
  44868. "\u3243",
  44869. "\u0028\u81F3\u0029",
  44870. "\u32C0",
  44871. "\u0031\u6708",
  44872. "\u32C1",
  44873. "\u0032\u6708",
  44874. "\u32C2",
  44875. "\u0033\u6708",
  44876. "\u32C3",
  44877. "\u0034\u6708",
  44878. "\u32C4",
  44879. "\u0035\u6708",
  44880. "\u32C5",
  44881. "\u0036\u6708",
  44882. "\u32C6",
  44883. "\u0037\u6708",
  44884. "\u32C7",
  44885. "\u0038\u6708",
  44886. "\u32C8",
  44887. "\u0039\u6708",
  44888. "\u32C9",
  44889. "\u0031\u0030\u6708",
  44890. "\u32CA",
  44891. "\u0031\u0031\u6708",
  44892. "\u32CB",
  44893. "\u0031\u0032\u6708",
  44894. "\u3358",
  44895. "\u0030\u70B9",
  44896. "\u3359",
  44897. "\u0031\u70B9",
  44898. "\u335A",
  44899. "\u0032\u70B9",
  44900. "\u335B",
  44901. "\u0033\u70B9",
  44902. "\u335C",
  44903. "\u0034\u70B9",
  44904. "\u335D",
  44905. "\u0035\u70B9",
  44906. "\u335E",
  44907. "\u0036\u70B9",
  44908. "\u335F",
  44909. "\u0037\u70B9",
  44910. "\u3360",
  44911. "\u0038\u70B9",
  44912. "\u3361",
  44913. "\u0039\u70B9",
  44914. "\u3362",
  44915. "\u0031\u0030\u70B9",
  44916. "\u3363",
  44917. "\u0031\u0031\u70B9",
  44918. "\u3364",
  44919. "\u0031\u0032\u70B9",
  44920. "\u3365",
  44921. "\u0031\u0033\u70B9",
  44922. "\u3366",
  44923. "\u0031\u0034\u70B9",
  44924. "\u3367",
  44925. "\u0031\u0035\u70B9",
  44926. "\u3368",
  44927. "\u0031\u0036\u70B9",
  44928. "\u3369",
  44929. "\u0031\u0037\u70B9",
  44930. "\u336A",
  44931. "\u0031\u0038\u70B9",
  44932. "\u336B",
  44933. "\u0031\u0039\u70B9",
  44934. "\u336C",
  44935. "\u0032\u0030\u70B9",
  44936. "\u336D",
  44937. "\u0032\u0031\u70B9",
  44938. "\u336E",
  44939. "\u0032\u0032\u70B9",
  44940. "\u336F",
  44941. "\u0032\u0033\u70B9",
  44942. "\u3370",
  44943. "\u0032\u0034\u70B9",
  44944. "\u33E0",
  44945. "\u0031\u65E5",
  44946. "\u33E1",
  44947. "\u0032\u65E5",
  44948. "\u33E2",
  44949. "\u0033\u65E5",
  44950. "\u33E3",
  44951. "\u0034\u65E5",
  44952. "\u33E4",
  44953. "\u0035\u65E5",
  44954. "\u33E5",
  44955. "\u0036\u65E5",
  44956. "\u33E6",
  44957. "\u0037\u65E5",
  44958. "\u33E7",
  44959. "\u0038\u65E5",
  44960. "\u33E8",
  44961. "\u0039\u65E5",
  44962. "\u33E9",
  44963. "\u0031\u0030\u65E5",
  44964. "\u33EA",
  44965. "\u0031\u0031\u65E5",
  44966. "\u33EB",
  44967. "\u0031\u0032\u65E5",
  44968. "\u33EC",
  44969. "\u0031\u0033\u65E5",
  44970. "\u33ED",
  44971. "\u0031\u0034\u65E5",
  44972. "\u33EE",
  44973. "\u0031\u0035\u65E5",
  44974. "\u33EF",
  44975. "\u0031\u0036\u65E5",
  44976. "\u33F0",
  44977. "\u0031\u0037\u65E5",
  44978. "\u33F1",
  44979. "\u0031\u0038\u65E5",
  44980. "\u33F2",
  44981. "\u0031\u0039\u65E5",
  44982. "\u33F3",
  44983. "\u0032\u0030\u65E5",
  44984. "\u33F4",
  44985. "\u0032\u0031\u65E5",
  44986. "\u33F5",
  44987. "\u0032\u0032\u65E5",
  44988. "\u33F6",
  44989. "\u0032\u0033\u65E5",
  44990. "\u33F7",
  44991. "\u0032\u0034\u65E5",
  44992. "\u33F8",
  44993. "\u0032\u0035\u65E5",
  44994. "\u33F9",
  44995. "\u0032\u0036\u65E5",
  44996. "\u33FA",
  44997. "\u0032\u0037\u65E5",
  44998. "\u33FB",
  44999. "\u0032\u0038\u65E5",
  45000. "\u33FC",
  45001. "\u0032\u0039\u65E5",
  45002. "\u33FD",
  45003. "\u0033\u0030\u65E5",
  45004. "\u33FE",
  45005. "\u0033\u0031\u65E5",
  45006. "\uFB00",
  45007. "\u0066\u0066",
  45008. "\uFB01",
  45009. "\u0066\u0069",
  45010. "\uFB02",
  45011. "\u0066\u006C",
  45012. "\uFB03",
  45013. "\u0066\u0066\u0069",
  45014. "\uFB04",
  45015. "\u0066\u0066\u006C",
  45016. "\uFB05",
  45017. "\u017F\u0074",
  45018. "\uFB06",
  45019. "\u0073\u0074",
  45020. "\uFB13",
  45021. "\u0574\u0576",
  45022. "\uFB14",
  45023. "\u0574\u0565",
  45024. "\uFB15",
  45025. "\u0574\u056B",
  45026. "\uFB16",
  45027. "\u057E\u0576",
  45028. "\uFB17",
  45029. "\u0574\u056D",
  45030. "\uFB4F",
  45031. "\u05D0\u05DC",
  45032. "\uFB50",
  45033. "\u0671",
  45034. "\uFB51",
  45035. "\u0671",
  45036. "\uFB52",
  45037. "\u067B",
  45038. "\uFB53",
  45039. "\u067B",
  45040. "\uFB54",
  45041. "\u067B",
  45042. "\uFB55",
  45043. "\u067B",
  45044. "\uFB56",
  45045. "\u067E",
  45046. "\uFB57",
  45047. "\u067E",
  45048. "\uFB58",
  45049. "\u067E",
  45050. "\uFB59",
  45051. "\u067E",
  45052. "\uFB5A",
  45053. "\u0680",
  45054. "\uFB5B",
  45055. "\u0680",
  45056. "\uFB5C",
  45057. "\u0680",
  45058. "\uFB5D",
  45059. "\u0680",
  45060. "\uFB5E",
  45061. "\u067A",
  45062. "\uFB5F",
  45063. "\u067A",
  45064. "\uFB60",
  45065. "\u067A",
  45066. "\uFB61",
  45067. "\u067A",
  45068. "\uFB62",
  45069. "\u067F",
  45070. "\uFB63",
  45071. "\u067F",
  45072. "\uFB64",
  45073. "\u067F",
  45074. "\uFB65",
  45075. "\u067F",
  45076. "\uFB66",
  45077. "\u0679",
  45078. "\uFB67",
  45079. "\u0679",
  45080. "\uFB68",
  45081. "\u0679",
  45082. "\uFB69",
  45083. "\u0679",
  45084. "\uFB6A",
  45085. "\u06A4",
  45086. "\uFB6B",
  45087. "\u06A4",
  45088. "\uFB6C",
  45089. "\u06A4",
  45090. "\uFB6D",
  45091. "\u06A4",
  45092. "\uFB6E",
  45093. "\u06A6",
  45094. "\uFB6F",
  45095. "\u06A6",
  45096. "\uFB70",
  45097. "\u06A6",
  45098. "\uFB71",
  45099. "\u06A6",
  45100. "\uFB72",
  45101. "\u0684",
  45102. "\uFB73",
  45103. "\u0684",
  45104. "\uFB74",
  45105. "\u0684",
  45106. "\uFB75",
  45107. "\u0684",
  45108. "\uFB76",
  45109. "\u0683",
  45110. "\uFB77",
  45111. "\u0683",
  45112. "\uFB78",
  45113. "\u0683",
  45114. "\uFB79",
  45115. "\u0683",
  45116. "\uFB7A",
  45117. "\u0686",
  45118. "\uFB7B",
  45119. "\u0686",
  45120. "\uFB7C",
  45121. "\u0686",
  45122. "\uFB7D",
  45123. "\u0686",
  45124. "\uFB7E",
  45125. "\u0687",
  45126. "\uFB7F",
  45127. "\u0687",
  45128. "\uFB80",
  45129. "\u0687",
  45130. "\uFB81",
  45131. "\u0687",
  45132. "\uFB82",
  45133. "\u068D",
  45134. "\uFB83",
  45135. "\u068D",
  45136. "\uFB84",
  45137. "\u068C",
  45138. "\uFB85",
  45139. "\u068C",
  45140. "\uFB86",
  45141. "\u068E",
  45142. "\uFB87",
  45143. "\u068E",
  45144. "\uFB88",
  45145. "\u0688",
  45146. "\uFB89",
  45147. "\u0688",
  45148. "\uFB8A",
  45149. "\u0698",
  45150. "\uFB8B",
  45151. "\u0698",
  45152. "\uFB8C",
  45153. "\u0691",
  45154. "\uFB8D",
  45155. "\u0691",
  45156. "\uFB8E",
  45157. "\u06A9",
  45158. "\uFB8F",
  45159. "\u06A9",
  45160. "\uFB90",
  45161. "\u06A9",
  45162. "\uFB91",
  45163. "\u06A9",
  45164. "\uFB92",
  45165. "\u06AF",
  45166. "\uFB93",
  45167. "\u06AF",
  45168. "\uFB94",
  45169. "\u06AF",
  45170. "\uFB95",
  45171. "\u06AF",
  45172. "\uFB96",
  45173. "\u06B3",
  45174. "\uFB97",
  45175. "\u06B3",
  45176. "\uFB98",
  45177. "\u06B3",
  45178. "\uFB99",
  45179. "\u06B3",
  45180. "\uFB9A",
  45181. "\u06B1",
  45182. "\uFB9B",
  45183. "\u06B1",
  45184. "\uFB9C",
  45185. "\u06B1",
  45186. "\uFB9D",
  45187. "\u06B1",
  45188. "\uFB9E",
  45189. "\u06BA",
  45190. "\uFB9F",
  45191. "\u06BA",
  45192. "\uFBA0",
  45193. "\u06BB",
  45194. "\uFBA1",
  45195. "\u06BB",
  45196. "\uFBA2",
  45197. "\u06BB",
  45198. "\uFBA3",
  45199. "\u06BB",
  45200. "\uFBA4",
  45201. "\u06C0",
  45202. "\uFBA5",
  45203. "\u06C0",
  45204. "\uFBA6",
  45205. "\u06C1",
  45206. "\uFBA7",
  45207. "\u06C1",
  45208. "\uFBA8",
  45209. "\u06C1",
  45210. "\uFBA9",
  45211. "\u06C1",
  45212. "\uFBAA",
  45213. "\u06BE",
  45214. "\uFBAB",
  45215. "\u06BE",
  45216. "\uFBAC",
  45217. "\u06BE",
  45218. "\uFBAD",
  45219. "\u06BE",
  45220. "\uFBAE",
  45221. "\u06D2",
  45222. "\uFBAF",
  45223. "\u06D2",
  45224. "\uFBB0",
  45225. "\u06D3",
  45226. "\uFBB1",
  45227. "\u06D3",
  45228. "\uFBD3",
  45229. "\u06AD",
  45230. "\uFBD4",
  45231. "\u06AD",
  45232. "\uFBD5",
  45233. "\u06AD",
  45234. "\uFBD6",
  45235. "\u06AD",
  45236. "\uFBD7",
  45237. "\u06C7",
  45238. "\uFBD8",
  45239. "\u06C7",
  45240. "\uFBD9",
  45241. "\u06C6",
  45242. "\uFBDA",
  45243. "\u06C6",
  45244. "\uFBDB",
  45245. "\u06C8",
  45246. "\uFBDC",
  45247. "\u06C8",
  45248. "\uFBDD",
  45249. "\u0677",
  45250. "\uFBDE",
  45251. "\u06CB",
  45252. "\uFBDF",
  45253. "\u06CB",
  45254. "\uFBE0",
  45255. "\u06C5",
  45256. "\uFBE1",
  45257. "\u06C5",
  45258. "\uFBE2",
  45259. "\u06C9",
  45260. "\uFBE3",
  45261. "\u06C9",
  45262. "\uFBE4",
  45263. "\u06D0",
  45264. "\uFBE5",
  45265. "\u06D0",
  45266. "\uFBE6",
  45267. "\u06D0",
  45268. "\uFBE7",
  45269. "\u06D0",
  45270. "\uFBE8",
  45271. "\u0649",
  45272. "\uFBE9",
  45273. "\u0649",
  45274. "\uFBEA",
  45275. "\u0626\u0627",
  45276. "\uFBEB",
  45277. "\u0626\u0627",
  45278. "\uFBEC",
  45279. "\u0626\u06D5",
  45280. "\uFBED",
  45281. "\u0626\u06D5",
  45282. "\uFBEE",
  45283. "\u0626\u0648",
  45284. "\uFBEF",
  45285. "\u0626\u0648",
  45286. "\uFBF0",
  45287. "\u0626\u06C7",
  45288. "\uFBF1",
  45289. "\u0626\u06C7",
  45290. "\uFBF2",
  45291. "\u0626\u06C6",
  45292. "\uFBF3",
  45293. "\u0626\u06C6",
  45294. "\uFBF4",
  45295. "\u0626\u06C8",
  45296. "\uFBF5",
  45297. "\u0626\u06C8",
  45298. "\uFBF6",
  45299. "\u0626\u06D0",
  45300. "\uFBF7",
  45301. "\u0626\u06D0",
  45302. "\uFBF8",
  45303. "\u0626\u06D0",
  45304. "\uFBF9",
  45305. "\u0626\u0649",
  45306. "\uFBFA",
  45307. "\u0626\u0649",
  45308. "\uFBFB",
  45309. "\u0626\u0649",
  45310. "\uFBFC",
  45311. "\u06CC",
  45312. "\uFBFD",
  45313. "\u06CC",
  45314. "\uFBFE",
  45315. "\u06CC",
  45316. "\uFBFF",
  45317. "\u06CC",
  45318. "\uFC00",
  45319. "\u0626\u062C",
  45320. "\uFC01",
  45321. "\u0626\u062D",
  45322. "\uFC02",
  45323. "\u0626\u0645",
  45324. "\uFC03",
  45325. "\u0626\u0649",
  45326. "\uFC04",
  45327. "\u0626\u064A",
  45328. "\uFC05",
  45329. "\u0628\u062C",
  45330. "\uFC06",
  45331. "\u0628\u062D",
  45332. "\uFC07",
  45333. "\u0628\u062E",
  45334. "\uFC08",
  45335. "\u0628\u0645",
  45336. "\uFC09",
  45337. "\u0628\u0649",
  45338. "\uFC0A",
  45339. "\u0628\u064A",
  45340. "\uFC0B",
  45341. "\u062A\u062C",
  45342. "\uFC0C",
  45343. "\u062A\u062D",
  45344. "\uFC0D",
  45345. "\u062A\u062E",
  45346. "\uFC0E",
  45347. "\u062A\u0645",
  45348. "\uFC0F",
  45349. "\u062A\u0649",
  45350. "\uFC10",
  45351. "\u062A\u064A",
  45352. "\uFC11",
  45353. "\u062B\u062C",
  45354. "\uFC12",
  45355. "\u062B\u0645",
  45356. "\uFC13",
  45357. "\u062B\u0649",
  45358. "\uFC14",
  45359. "\u062B\u064A",
  45360. "\uFC15",
  45361. "\u062C\u062D",
  45362. "\uFC16",
  45363. "\u062C\u0645",
  45364. "\uFC17",
  45365. "\u062D\u062C",
  45366. "\uFC18",
  45367. "\u062D\u0645",
  45368. "\uFC19",
  45369. "\u062E\u062C",
  45370. "\uFC1A",
  45371. "\u062E\u062D",
  45372. "\uFC1B",
  45373. "\u062E\u0645",
  45374. "\uFC1C",
  45375. "\u0633\u062C",
  45376. "\uFC1D",
  45377. "\u0633\u062D",
  45378. "\uFC1E",
  45379. "\u0633\u062E",
  45380. "\uFC1F",
  45381. "\u0633\u0645",
  45382. "\uFC20",
  45383. "\u0635\u062D",
  45384. "\uFC21",
  45385. "\u0635\u0645",
  45386. "\uFC22",
  45387. "\u0636\u062C",
  45388. "\uFC23",
  45389. "\u0636\u062D",
  45390. "\uFC24",
  45391. "\u0636\u062E",
  45392. "\uFC25",
  45393. "\u0636\u0645",
  45394. "\uFC26",
  45395. "\u0637\u062D",
  45396. "\uFC27",
  45397. "\u0637\u0645",
  45398. "\uFC28",
  45399. "\u0638\u0645",
  45400. "\uFC29",
  45401. "\u0639\u062C",
  45402. "\uFC2A",
  45403. "\u0639\u0645",
  45404. "\uFC2B",
  45405. "\u063A\u062C",
  45406. "\uFC2C",
  45407. "\u063A\u0645",
  45408. "\uFC2D",
  45409. "\u0641\u062C",
  45410. "\uFC2E",
  45411. "\u0641\u062D",
  45412. "\uFC2F",
  45413. "\u0641\u062E",
  45414. "\uFC30",
  45415. "\u0641\u0645",
  45416. "\uFC31",
  45417. "\u0641\u0649",
  45418. "\uFC32",
  45419. "\u0641\u064A",
  45420. "\uFC33",
  45421. "\u0642\u062D",
  45422. "\uFC34",
  45423. "\u0642\u0645",
  45424. "\uFC35",
  45425. "\u0642\u0649",
  45426. "\uFC36",
  45427. "\u0642\u064A",
  45428. "\uFC37",
  45429. "\u0643\u0627",
  45430. "\uFC38",
  45431. "\u0643\u062C",
  45432. "\uFC39",
  45433. "\u0643\u062D",
  45434. "\uFC3A",
  45435. "\u0643\u062E",
  45436. "\uFC3B",
  45437. "\u0643\u0644",
  45438. "\uFC3C",
  45439. "\u0643\u0645",
  45440. "\uFC3D",
  45441. "\u0643\u0649",
  45442. "\uFC3E",
  45443. "\u0643\u064A",
  45444. "\uFC3F",
  45445. "\u0644\u062C",
  45446. "\uFC40",
  45447. "\u0644\u062D",
  45448. "\uFC41",
  45449. "\u0644\u062E",
  45450. "\uFC42",
  45451. "\u0644\u0645",
  45452. "\uFC43",
  45453. "\u0644\u0649",
  45454. "\uFC44",
  45455. "\u0644\u064A",
  45456. "\uFC45",
  45457. "\u0645\u062C",
  45458. "\uFC46",
  45459. "\u0645\u062D",
  45460. "\uFC47",
  45461. "\u0645\u062E",
  45462. "\uFC48",
  45463. "\u0645\u0645",
  45464. "\uFC49",
  45465. "\u0645\u0649",
  45466. "\uFC4A",
  45467. "\u0645\u064A",
  45468. "\uFC4B",
  45469. "\u0646\u062C",
  45470. "\uFC4C",
  45471. "\u0646\u062D",
  45472. "\uFC4D",
  45473. "\u0646\u062E",
  45474. "\uFC4E",
  45475. "\u0646\u0645",
  45476. "\uFC4F",
  45477. "\u0646\u0649",
  45478. "\uFC50",
  45479. "\u0646\u064A",
  45480. "\uFC51",
  45481. "\u0647\u062C",
  45482. "\uFC52",
  45483. "\u0647\u0645",
  45484. "\uFC53",
  45485. "\u0647\u0649",
  45486. "\uFC54",
  45487. "\u0647\u064A",
  45488. "\uFC55",
  45489. "\u064A\u062C",
  45490. "\uFC56",
  45491. "\u064A\u062D",
  45492. "\uFC57",
  45493. "\u064A\u062E",
  45494. "\uFC58",
  45495. "\u064A\u0645",
  45496. "\uFC59",
  45497. "\u064A\u0649",
  45498. "\uFC5A",
  45499. "\u064A\u064A",
  45500. "\uFC5B",
  45501. "\u0630\u0670",
  45502. "\uFC5C",
  45503. "\u0631\u0670",
  45504. "\uFC5D",
  45505. "\u0649\u0670",
  45506. "\uFC5E",
  45507. "\u0020\u064C\u0651",
  45508. "\uFC5F",
  45509. "\u0020\u064D\u0651",
  45510. "\uFC60",
  45511. "\u0020\u064E\u0651",
  45512. "\uFC61",
  45513. "\u0020\u064F\u0651",
  45514. "\uFC62",
  45515. "\u0020\u0650\u0651",
  45516. "\uFC63",
  45517. "\u0020\u0651\u0670",
  45518. "\uFC64",
  45519. "\u0626\u0631",
  45520. "\uFC65",
  45521. "\u0626\u0632",
  45522. "\uFC66",
  45523. "\u0626\u0645",
  45524. "\uFC67",
  45525. "\u0626\u0646",
  45526. "\uFC68",
  45527. "\u0626\u0649",
  45528. "\uFC69",
  45529. "\u0626\u064A",
  45530. "\uFC6A",
  45531. "\u0628\u0631",
  45532. "\uFC6B",
  45533. "\u0628\u0632",
  45534. "\uFC6C",
  45535. "\u0628\u0645",
  45536. "\uFC6D",
  45537. "\u0628\u0646",
  45538. "\uFC6E",
  45539. "\u0628\u0649",
  45540. "\uFC6F",
  45541. "\u0628\u064A",
  45542. "\uFC70",
  45543. "\u062A\u0631",
  45544. "\uFC71",
  45545. "\u062A\u0632",
  45546. "\uFC72",
  45547. "\u062A\u0645",
  45548. "\uFC73",
  45549. "\u062A\u0646",
  45550. "\uFC74",
  45551. "\u062A\u0649",
  45552. "\uFC75",
  45553. "\u062A\u064A",
  45554. "\uFC76",
  45555. "\u062B\u0631",
  45556. "\uFC77",
  45557. "\u062B\u0632",
  45558. "\uFC78",
  45559. "\u062B\u0645",
  45560. "\uFC79",
  45561. "\u062B\u0646",
  45562. "\uFC7A",
  45563. "\u062B\u0649",
  45564. "\uFC7B",
  45565. "\u062B\u064A",
  45566. "\uFC7C",
  45567. "\u0641\u0649",
  45568. "\uFC7D",
  45569. "\u0641\u064A",
  45570. "\uFC7E",
  45571. "\u0642\u0649",
  45572. "\uFC7F",
  45573. "\u0642\u064A",
  45574. "\uFC80",
  45575. "\u0643\u0627",
  45576. "\uFC81",
  45577. "\u0643\u0644",
  45578. "\uFC82",
  45579. "\u0643\u0645",
  45580. "\uFC83",
  45581. "\u0643\u0649",
  45582. "\uFC84",
  45583. "\u0643\u064A",
  45584. "\uFC85",
  45585. "\u0644\u0645",
  45586. "\uFC86",
  45587. "\u0644\u0649",
  45588. "\uFC87",
  45589. "\u0644\u064A",
  45590. "\uFC88",
  45591. "\u0645\u0627",
  45592. "\uFC89",
  45593. "\u0645\u0645",
  45594. "\uFC8A",
  45595. "\u0646\u0631",
  45596. "\uFC8B",
  45597. "\u0646\u0632",
  45598. "\uFC8C",
  45599. "\u0646\u0645",
  45600. "\uFC8D",
  45601. "\u0646\u0646",
  45602. "\uFC8E",
  45603. "\u0646\u0649",
  45604. "\uFC8F",
  45605. "\u0646\u064A",
  45606. "\uFC90",
  45607. "\u0649\u0670",
  45608. "\uFC91",
  45609. "\u064A\u0631",
  45610. "\uFC92",
  45611. "\u064A\u0632",
  45612. "\uFC93",
  45613. "\u064A\u0645",
  45614. "\uFC94",
  45615. "\u064A\u0646",
  45616. "\uFC95",
  45617. "\u064A\u0649",
  45618. "\uFC96",
  45619. "\u064A\u064A",
  45620. "\uFC97",
  45621. "\u0626\u062C",
  45622. "\uFC98",
  45623. "\u0626\u062D",
  45624. "\uFC99",
  45625. "\u0626\u062E",
  45626. "\uFC9A",
  45627. "\u0626\u0645",
  45628. "\uFC9B",
  45629. "\u0626\u0647",
  45630. "\uFC9C",
  45631. "\u0628\u062C",
  45632. "\uFC9D",
  45633. "\u0628\u062D",
  45634. "\uFC9E",
  45635. "\u0628\u062E",
  45636. "\uFC9F",
  45637. "\u0628\u0645",
  45638. "\uFCA0",
  45639. "\u0628\u0647",
  45640. "\uFCA1",
  45641. "\u062A\u062C",
  45642. "\uFCA2",
  45643. "\u062A\u062D",
  45644. "\uFCA3",
  45645. "\u062A\u062E",
  45646. "\uFCA4",
  45647. "\u062A\u0645",
  45648. "\uFCA5",
  45649. "\u062A\u0647",
  45650. "\uFCA6",
  45651. "\u062B\u0645",
  45652. "\uFCA7",
  45653. "\u062C\u062D",
  45654. "\uFCA8",
  45655. "\u062C\u0645",
  45656. "\uFCA9",
  45657. "\u062D\u062C",
  45658. "\uFCAA",
  45659. "\u062D\u0645",
  45660. "\uFCAB",
  45661. "\u062E\u062C",
  45662. "\uFCAC",
  45663. "\u062E\u0645",
  45664. "\uFCAD",
  45665. "\u0633\u062C",
  45666. "\uFCAE",
  45667. "\u0633\u062D",
  45668. "\uFCAF",
  45669. "\u0633\u062E",
  45670. "\uFCB0",
  45671. "\u0633\u0645",
  45672. "\uFCB1",
  45673. "\u0635\u062D",
  45674. "\uFCB2",
  45675. "\u0635\u062E",
  45676. "\uFCB3",
  45677. "\u0635\u0645",
  45678. "\uFCB4",
  45679. "\u0636\u062C",
  45680. "\uFCB5",
  45681. "\u0636\u062D",
  45682. "\uFCB6",
  45683. "\u0636\u062E",
  45684. "\uFCB7",
  45685. "\u0636\u0645",
  45686. "\uFCB8",
  45687. "\u0637\u062D",
  45688. "\uFCB9",
  45689. "\u0638\u0645",
  45690. "\uFCBA",
  45691. "\u0639\u062C",
  45692. "\uFCBB",
  45693. "\u0639\u0645",
  45694. "\uFCBC",
  45695. "\u063A\u062C",
  45696. "\uFCBD",
  45697. "\u063A\u0645",
  45698. "\uFCBE",
  45699. "\u0641\u062C",
  45700. "\uFCBF",
  45701. "\u0641\u062D",
  45702. "\uFCC0",
  45703. "\u0641\u062E",
  45704. "\uFCC1",
  45705. "\u0641\u0645",
  45706. "\uFCC2",
  45707. "\u0642\u062D",
  45708. "\uFCC3",
  45709. "\u0642\u0645",
  45710. "\uFCC4",
  45711. "\u0643\u062C",
  45712. "\uFCC5",
  45713. "\u0643\u062D",
  45714. "\uFCC6",
  45715. "\u0643\u062E",
  45716. "\uFCC7",
  45717. "\u0643\u0644",
  45718. "\uFCC8",
  45719. "\u0643\u0645",
  45720. "\uFCC9",
  45721. "\u0644\u062C",
  45722. "\uFCCA",
  45723. "\u0644\u062D",
  45724. "\uFCCB",
  45725. "\u0644\u062E",
  45726. "\uFCCC",
  45727. "\u0644\u0645",
  45728. "\uFCCD",
  45729. "\u0644\u0647",
  45730. "\uFCCE",
  45731. "\u0645\u062C",
  45732. "\uFCCF",
  45733. "\u0645\u062D",
  45734. "\uFCD0",
  45735. "\u0645\u062E",
  45736. "\uFCD1",
  45737. "\u0645\u0645",
  45738. "\uFCD2",
  45739. "\u0646\u062C",
  45740. "\uFCD3",
  45741. "\u0646\u062D",
  45742. "\uFCD4",
  45743. "\u0646\u062E",
  45744. "\uFCD5",
  45745. "\u0646\u0645",
  45746. "\uFCD6",
  45747. "\u0646\u0647",
  45748. "\uFCD7",
  45749. "\u0647\u062C",
  45750. "\uFCD8",
  45751. "\u0647\u0645",
  45752. "\uFCD9",
  45753. "\u0647\u0670",
  45754. "\uFCDA",
  45755. "\u064A\u062C",
  45756. "\uFCDB",
  45757. "\u064A\u062D",
  45758. "\uFCDC",
  45759. "\u064A\u062E",
  45760. "\uFCDD",
  45761. "\u064A\u0645",
  45762. "\uFCDE",
  45763. "\u064A\u0647",
  45764. "\uFCDF",
  45765. "\u0626\u0645",
  45766. "\uFCE0",
  45767. "\u0626\u0647",
  45768. "\uFCE1",
  45769. "\u0628\u0645",
  45770. "\uFCE2",
  45771. "\u0628\u0647",
  45772. "\uFCE3",
  45773. "\u062A\u0645",
  45774. "\uFCE4",
  45775. "\u062A\u0647",
  45776. "\uFCE5",
  45777. "\u062B\u0645",
  45778. "\uFCE6",
  45779. "\u062B\u0647",
  45780. "\uFCE7",
  45781. "\u0633\u0645",
  45782. "\uFCE8",
  45783. "\u0633\u0647",
  45784. "\uFCE9",
  45785. "\u0634\u0645",
  45786. "\uFCEA",
  45787. "\u0634\u0647",
  45788. "\uFCEB",
  45789. "\u0643\u0644",
  45790. "\uFCEC",
  45791. "\u0643\u0645",
  45792. "\uFCED",
  45793. "\u0644\u0645",
  45794. "\uFCEE",
  45795. "\u0646\u0645",
  45796. "\uFCEF",
  45797. "\u0646\u0647",
  45798. "\uFCF0",
  45799. "\u064A\u0645",
  45800. "\uFCF1",
  45801. "\u064A\u0647",
  45802. "\uFCF2",
  45803. "\u0640\u064E\u0651",
  45804. "\uFCF3",
  45805. "\u0640\u064F\u0651",
  45806. "\uFCF4",
  45807. "\u0640\u0650\u0651",
  45808. "\uFCF5",
  45809. "\u0637\u0649",
  45810. "\uFCF6",
  45811. "\u0637\u064A",
  45812. "\uFCF7",
  45813. "\u0639\u0649",
  45814. "\uFCF8",
  45815. "\u0639\u064A",
  45816. "\uFCF9",
  45817. "\u063A\u0649",
  45818. "\uFCFA",
  45819. "\u063A\u064A",
  45820. "\uFCFB",
  45821. "\u0633\u0649",
  45822. "\uFCFC",
  45823. "\u0633\u064A",
  45824. "\uFCFD",
  45825. "\u0634\u0649",
  45826. "\uFCFE",
  45827. "\u0634\u064A",
  45828. "\uFCFF",
  45829. "\u062D\u0649",
  45830. "\uFD00",
  45831. "\u062D\u064A",
  45832. "\uFD01",
  45833. "\u062C\u0649",
  45834. "\uFD02",
  45835. "\u062C\u064A",
  45836. "\uFD03",
  45837. "\u062E\u0649",
  45838. "\uFD04",
  45839. "\u062E\u064A",
  45840. "\uFD05",
  45841. "\u0635\u0649",
  45842. "\uFD06",
  45843. "\u0635\u064A",
  45844. "\uFD07",
  45845. "\u0636\u0649",
  45846. "\uFD08",
  45847. "\u0636\u064A",
  45848. "\uFD09",
  45849. "\u0634\u062C",
  45850. "\uFD0A",
  45851. "\u0634\u062D",
  45852. "\uFD0B",
  45853. "\u0634\u062E",
  45854. "\uFD0C",
  45855. "\u0634\u0645",
  45856. "\uFD0D",
  45857. "\u0634\u0631",
  45858. "\uFD0E",
  45859. "\u0633\u0631",
  45860. "\uFD0F",
  45861. "\u0635\u0631",
  45862. "\uFD10",
  45863. "\u0636\u0631",
  45864. "\uFD11",
  45865. "\u0637\u0649",
  45866. "\uFD12",
  45867. "\u0637\u064A",
  45868. "\uFD13",
  45869. "\u0639\u0649",
  45870. "\uFD14",
  45871. "\u0639\u064A",
  45872. "\uFD15",
  45873. "\u063A\u0649",
  45874. "\uFD16",
  45875. "\u063A\u064A",
  45876. "\uFD17",
  45877. "\u0633\u0649",
  45878. "\uFD18",
  45879. "\u0633\u064A",
  45880. "\uFD19",
  45881. "\u0634\u0649",
  45882. "\uFD1A",
  45883. "\u0634\u064A",
  45884. "\uFD1B",
  45885. "\u062D\u0649",
  45886. "\uFD1C",
  45887. "\u062D\u064A",
  45888. "\uFD1D",
  45889. "\u062C\u0649",
  45890. "\uFD1E",
  45891. "\u062C\u064A",
  45892. "\uFD1F",
  45893. "\u062E\u0649",
  45894. "\uFD20",
  45895. "\u062E\u064A",
  45896. "\uFD21",
  45897. "\u0635\u0649",
  45898. "\uFD22",
  45899. "\u0635\u064A",
  45900. "\uFD23",
  45901. "\u0636\u0649",
  45902. "\uFD24",
  45903. "\u0636\u064A",
  45904. "\uFD25",
  45905. "\u0634\u062C",
  45906. "\uFD26",
  45907. "\u0634\u062D",
  45908. "\uFD27",
  45909. "\u0634\u062E",
  45910. "\uFD28",
  45911. "\u0634\u0645",
  45912. "\uFD29",
  45913. "\u0634\u0631",
  45914. "\uFD2A",
  45915. "\u0633\u0631",
  45916. "\uFD2B",
  45917. "\u0635\u0631",
  45918. "\uFD2C",
  45919. "\u0636\u0631",
  45920. "\uFD2D",
  45921. "\u0634\u062C",
  45922. "\uFD2E",
  45923. "\u0634\u062D",
  45924. "\uFD2F",
  45925. "\u0634\u062E",
  45926. "\uFD30",
  45927. "\u0634\u0645",
  45928. "\uFD31",
  45929. "\u0633\u0647",
  45930. "\uFD32",
  45931. "\u0634\u0647",
  45932. "\uFD33",
  45933. "\u0637\u0645",
  45934. "\uFD34",
  45935. "\u0633\u062C",
  45936. "\uFD35",
  45937. "\u0633\u062D",
  45938. "\uFD36",
  45939. "\u0633\u062E",
  45940. "\uFD37",
  45941. "\u0634\u062C",
  45942. "\uFD38",
  45943. "\u0634\u062D",
  45944. "\uFD39",
  45945. "\u0634\u062E",
  45946. "\uFD3A",
  45947. "\u0637\u0645",
  45948. "\uFD3B",
  45949. "\u0638\u0645",
  45950. "\uFD3C",
  45951. "\u0627\u064B",
  45952. "\uFD3D",
  45953. "\u0627\u064B",
  45954. "\uFD50",
  45955. "\u062A\u062C\u0645",
  45956. "\uFD51",
  45957. "\u062A\u062D\u062C",
  45958. "\uFD52",
  45959. "\u062A\u062D\u062C",
  45960. "\uFD53",
  45961. "\u062A\u062D\u0645",
  45962. "\uFD54",
  45963. "\u062A\u062E\u0645",
  45964. "\uFD55",
  45965. "\u062A\u0645\u062C",
  45966. "\uFD56",
  45967. "\u062A\u0645\u062D",
  45968. "\uFD57",
  45969. "\u062A\u0645\u062E",
  45970. "\uFD58",
  45971. "\u062C\u0645\u062D",
  45972. "\uFD59",
  45973. "\u062C\u0645\u062D",
  45974. "\uFD5A",
  45975. "\u062D\u0645\u064A",
  45976. "\uFD5B",
  45977. "\u062D\u0645\u0649",
  45978. "\uFD5C",
  45979. "\u0633\u062D\u062C",
  45980. "\uFD5D",
  45981. "\u0633\u062C\u062D",
  45982. "\uFD5E",
  45983. "\u0633\u062C\u0649",
  45984. "\uFD5F",
  45985. "\u0633\u0645\u062D",
  45986. "\uFD60",
  45987. "\u0633\u0645\u062D",
  45988. "\uFD61",
  45989. "\u0633\u0645\u062C",
  45990. "\uFD62",
  45991. "\u0633\u0645\u0645",
  45992. "\uFD63",
  45993. "\u0633\u0645\u0645",
  45994. "\uFD64",
  45995. "\u0635\u062D\u062D",
  45996. "\uFD65",
  45997. "\u0635\u062D\u062D",
  45998. "\uFD66",
  45999. "\u0635\u0645\u0645",
  46000. "\uFD67",
  46001. "\u0634\u062D\u0645",
  46002. "\uFD68",
  46003. "\u0634\u062D\u0645",
  46004. "\uFD69",
  46005. "\u0634\u062C\u064A",
  46006. "\uFD6A",
  46007. "\u0634\u0645\u062E",
  46008. "\uFD6B",
  46009. "\u0634\u0645\u062E",
  46010. "\uFD6C",
  46011. "\u0634\u0645\u0645",
  46012. "\uFD6D",
  46013. "\u0634\u0645\u0645",
  46014. "\uFD6E",
  46015. "\u0636\u062D\u0649",
  46016. "\uFD6F",
  46017. "\u0636\u062E\u0645",
  46018. "\uFD70",
  46019. "\u0636\u062E\u0645",
  46020. "\uFD71",
  46021. "\u0637\u0645\u062D",
  46022. "\uFD72",
  46023. "\u0637\u0645\u062D",
  46024. "\uFD73",
  46025. "\u0637\u0645\u0645",
  46026. "\uFD74",
  46027. "\u0637\u0645\u064A",
  46028. "\uFD75",
  46029. "\u0639\u062C\u0645",
  46030. "\uFD76",
  46031. "\u0639\u0645\u0645",
  46032. "\uFD77",
  46033. "\u0639\u0645\u0645",
  46034. "\uFD78",
  46035. "\u0639\u0645\u0649",
  46036. "\uFD79",
  46037. "\u063A\u0645\u0645",
  46038. "\uFD7A",
  46039. "\u063A\u0645\u064A",
  46040. "\uFD7B",
  46041. "\u063A\u0645\u0649",
  46042. "\uFD7C",
  46043. "\u0641\u062E\u0645",
  46044. "\uFD7D",
  46045. "\u0641\u062E\u0645",
  46046. "\uFD7E",
  46047. "\u0642\u0645\u062D",
  46048. "\uFD7F",
  46049. "\u0642\u0645\u0645",
  46050. "\uFD80",
  46051. "\u0644\u062D\u0645",
  46052. "\uFD81",
  46053. "\u0644\u062D\u064A",
  46054. "\uFD82",
  46055. "\u0644\u062D\u0649",
  46056. "\uFD83",
  46057. "\u0644\u062C\u062C",
  46058. "\uFD84",
  46059. "\u0644\u062C\u062C",
  46060. "\uFD85",
  46061. "\u0644\u062E\u0645",
  46062. "\uFD86",
  46063. "\u0644\u062E\u0645",
  46064. "\uFD87",
  46065. "\u0644\u0645\u062D",
  46066. "\uFD88",
  46067. "\u0644\u0645\u062D",
  46068. "\uFD89",
  46069. "\u0645\u062D\u062C",
  46070. "\uFD8A",
  46071. "\u0645\u062D\u0645",
  46072. "\uFD8B",
  46073. "\u0645\u062D\u064A",
  46074. "\uFD8C",
  46075. "\u0645\u062C\u062D",
  46076. "\uFD8D",
  46077. "\u0645\u062C\u0645",
  46078. "\uFD8E",
  46079. "\u0645\u062E\u062C",
  46080. "\uFD8F",
  46081. "\u0645\u062E\u0645",
  46082. "\uFD92",
  46083. "\u0645\u062C\u062E",
  46084. "\uFD93",
  46085. "\u0647\u0645\u062C",
  46086. "\uFD94",
  46087. "\u0647\u0645\u0645",
  46088. "\uFD95",
  46089. "\u0646\u062D\u0645",
  46090. "\uFD96",
  46091. "\u0646\u062D\u0649",
  46092. "\uFD97",
  46093. "\u0646\u062C\u0645",
  46094. "\uFD98",
  46095. "\u0646\u062C\u0645",
  46096. "\uFD99",
  46097. "\u0646\u062C\u0649",
  46098. "\uFD9A",
  46099. "\u0646\u0645\u064A",
  46100. "\uFD9B",
  46101. "\u0646\u0645\u0649",
  46102. "\uFD9C",
  46103. "\u064A\u0645\u0645",
  46104. "\uFD9D",
  46105. "\u064A\u0645\u0645",
  46106. "\uFD9E",
  46107. "\u0628\u062E\u064A",
  46108. "\uFD9F",
  46109. "\u062A\u062C\u064A",
  46110. "\uFDA0",
  46111. "\u062A\u062C\u0649",
  46112. "\uFDA1",
  46113. "\u062A\u062E\u064A",
  46114. "\uFDA2",
  46115. "\u062A\u062E\u0649",
  46116. "\uFDA3",
  46117. "\u062A\u0645\u064A",
  46118. "\uFDA4",
  46119. "\u062A\u0645\u0649",
  46120. "\uFDA5",
  46121. "\u062C\u0645\u064A",
  46122. "\uFDA6",
  46123. "\u062C\u062D\u0649",
  46124. "\uFDA7",
  46125. "\u062C\u0645\u0649",
  46126. "\uFDA8",
  46127. "\u0633\u062E\u0649",
  46128. "\uFDA9",
  46129. "\u0635\u062D\u064A",
  46130. "\uFDAA",
  46131. "\u0634\u062D\u064A",
  46132. "\uFDAB",
  46133. "\u0636\u062D\u064A",
  46134. "\uFDAC",
  46135. "\u0644\u062C\u064A",
  46136. "\uFDAD",
  46137. "\u0644\u0645\u064A",
  46138. "\uFDAE",
  46139. "\u064A\u062D\u064A",
  46140. "\uFDAF",
  46141. "\u064A\u062C\u064A",
  46142. "\uFDB0",
  46143. "\u064A\u0645\u064A",
  46144. "\uFDB1",
  46145. "\u0645\u0645\u064A",
  46146. "\uFDB2",
  46147. "\u0642\u0645\u064A",
  46148. "\uFDB3",
  46149. "\u0646\u062D\u064A",
  46150. "\uFDB4",
  46151. "\u0642\u0645\u062D",
  46152. "\uFDB5",
  46153. "\u0644\u062D\u0645",
  46154. "\uFDB6",
  46155. "\u0639\u0645\u064A",
  46156. "\uFDB7",
  46157. "\u0643\u0645\u064A",
  46158. "\uFDB8",
  46159. "\u0646\u062C\u062D",
  46160. "\uFDB9",
  46161. "\u0645\u062E\u064A",
  46162. "\uFDBA",
  46163. "\u0644\u062C\u0645",
  46164. "\uFDBB",
  46165. "\u0643\u0645\u0645",
  46166. "\uFDBC",
  46167. "\u0644\u062C\u0645",
  46168. "\uFDBD",
  46169. "\u0646\u062C\u062D",
  46170. "\uFDBE",
  46171. "\u062C\u062D\u064A",
  46172. "\uFDBF",
  46173. "\u062D\u062C\u064A",
  46174. "\uFDC0",
  46175. "\u0645\u062C\u064A",
  46176. "\uFDC1",
  46177. "\u0641\u0645\u064A",
  46178. "\uFDC2",
  46179. "\u0628\u062D\u064A",
  46180. "\uFDC3",
  46181. "\u0643\u0645\u0645",
  46182. "\uFDC4",
  46183. "\u0639\u062C\u0645",
  46184. "\uFDC5",
  46185. "\u0635\u0645\u0645",
  46186. "\uFDC6",
  46187. "\u0633\u062E\u064A",
  46188. "\uFDC7",
  46189. "\u0646\u062C\u064A",
  46190. "\uFE49",
  46191. "\u203E",
  46192. "\uFE4A",
  46193. "\u203E",
  46194. "\uFE4B",
  46195. "\u203E",
  46196. "\uFE4C",
  46197. "\u203E",
  46198. "\uFE4D",
  46199. "\u005F",
  46200. "\uFE4E",
  46201. "\u005F",
  46202. "\uFE4F",
  46203. "\u005F",
  46204. "\uFE80",
  46205. "\u0621",
  46206. "\uFE81",
  46207. "\u0622",
  46208. "\uFE82",
  46209. "\u0622",
  46210. "\uFE83",
  46211. "\u0623",
  46212. "\uFE84",
  46213. "\u0623",
  46214. "\uFE85",
  46215. "\u0624",
  46216. "\uFE86",
  46217. "\u0624",
  46218. "\uFE87",
  46219. "\u0625",
  46220. "\uFE88",
  46221. "\u0625",
  46222. "\uFE89",
  46223. "\u0626",
  46224. "\uFE8A",
  46225. "\u0626",
  46226. "\uFE8B",
  46227. "\u0626",
  46228. "\uFE8C",
  46229. "\u0626",
  46230. "\uFE8D",
  46231. "\u0627",
  46232. "\uFE8E",
  46233. "\u0627",
  46234. "\uFE8F",
  46235. "\u0628",
  46236. "\uFE90",
  46237. "\u0628",
  46238. "\uFE91",
  46239. "\u0628",
  46240. "\uFE92",
  46241. "\u0628",
  46242. "\uFE93",
  46243. "\u0629",
  46244. "\uFE94",
  46245. "\u0629",
  46246. "\uFE95",
  46247. "\u062A",
  46248. "\uFE96",
  46249. "\u062A",
  46250. "\uFE97",
  46251. "\u062A",
  46252. "\uFE98",
  46253. "\u062A",
  46254. "\uFE99",
  46255. "\u062B",
  46256. "\uFE9A",
  46257. "\u062B",
  46258. "\uFE9B",
  46259. "\u062B",
  46260. "\uFE9C",
  46261. "\u062B",
  46262. "\uFE9D",
  46263. "\u062C",
  46264. "\uFE9E",
  46265. "\u062C",
  46266. "\uFE9F",
  46267. "\u062C",
  46268. "\uFEA0",
  46269. "\u062C",
  46270. "\uFEA1",
  46271. "\u062D",
  46272. "\uFEA2",
  46273. "\u062D",
  46274. "\uFEA3",
  46275. "\u062D",
  46276. "\uFEA4",
  46277. "\u062D",
  46278. "\uFEA5",
  46279. "\u062E",
  46280. "\uFEA6",
  46281. "\u062E",
  46282. "\uFEA7",
  46283. "\u062E",
  46284. "\uFEA8",
  46285. "\u062E",
  46286. "\uFEA9",
  46287. "\u062F",
  46288. "\uFEAA",
  46289. "\u062F",
  46290. "\uFEAB",
  46291. "\u0630",
  46292. "\uFEAC",
  46293. "\u0630",
  46294. "\uFEAD",
  46295. "\u0631",
  46296. "\uFEAE",
  46297. "\u0631",
  46298. "\uFEAF",
  46299. "\u0632",
  46300. "\uFEB0",
  46301. "\u0632",
  46302. "\uFEB1",
  46303. "\u0633",
  46304. "\uFEB2",
  46305. "\u0633",
  46306. "\uFEB3",
  46307. "\u0633",
  46308. "\uFEB4",
  46309. "\u0633",
  46310. "\uFEB5",
  46311. "\u0634",
  46312. "\uFEB6",
  46313. "\u0634",
  46314. "\uFEB7",
  46315. "\u0634",
  46316. "\uFEB8",
  46317. "\u0634",
  46318. "\uFEB9",
  46319. "\u0635",
  46320. "\uFEBA",
  46321. "\u0635",
  46322. "\uFEBB",
  46323. "\u0635",
  46324. "\uFEBC",
  46325. "\u0635",
  46326. "\uFEBD",
  46327. "\u0636",
  46328. "\uFEBE",
  46329. "\u0636",
  46330. "\uFEBF",
  46331. "\u0636",
  46332. "\uFEC0",
  46333. "\u0636",
  46334. "\uFEC1",
  46335. "\u0637",
  46336. "\uFEC2",
  46337. "\u0637",
  46338. "\uFEC3",
  46339. "\u0637",
  46340. "\uFEC4",
  46341. "\u0637",
  46342. "\uFEC5",
  46343. "\u0638",
  46344. "\uFEC6",
  46345. "\u0638",
  46346. "\uFEC7",
  46347. "\u0638",
  46348. "\uFEC8",
  46349. "\u0638",
  46350. "\uFEC9",
  46351. "\u0639",
  46352. "\uFECA",
  46353. "\u0639",
  46354. "\uFECB",
  46355. "\u0639",
  46356. "\uFECC",
  46357. "\u0639",
  46358. "\uFECD",
  46359. "\u063A",
  46360. "\uFECE",
  46361. "\u063A",
  46362. "\uFECF",
  46363. "\u063A",
  46364. "\uFED0",
  46365. "\u063A",
  46366. "\uFED1",
  46367. "\u0641",
  46368. "\uFED2",
  46369. "\u0641",
  46370. "\uFED3",
  46371. "\u0641",
  46372. "\uFED4",
  46373. "\u0641",
  46374. "\uFED5",
  46375. "\u0642",
  46376. "\uFED6",
  46377. "\u0642",
  46378. "\uFED7",
  46379. "\u0642",
  46380. "\uFED8",
  46381. "\u0642",
  46382. "\uFED9",
  46383. "\u0643",
  46384. "\uFEDA",
  46385. "\u0643",
  46386. "\uFEDB",
  46387. "\u0643",
  46388. "\uFEDC",
  46389. "\u0643",
  46390. "\uFEDD",
  46391. "\u0644",
  46392. "\uFEDE",
  46393. "\u0644",
  46394. "\uFEDF",
  46395. "\u0644",
  46396. "\uFEE0",
  46397. "\u0644",
  46398. "\uFEE1",
  46399. "\u0645",
  46400. "\uFEE2",
  46401. "\u0645",
  46402. "\uFEE3",
  46403. "\u0645",
  46404. "\uFEE4",
  46405. "\u0645",
  46406. "\uFEE5",
  46407. "\u0646",
  46408. "\uFEE6",
  46409. "\u0646",
  46410. "\uFEE7",
  46411. "\u0646",
  46412. "\uFEE8",
  46413. "\u0646",
  46414. "\uFEE9",
  46415. "\u0647",
  46416. "\uFEEA",
  46417. "\u0647",
  46418. "\uFEEB",
  46419. "\u0647",
  46420. "\uFEEC",
  46421. "\u0647",
  46422. "\uFEED",
  46423. "\u0648",
  46424. "\uFEEE",
  46425. "\u0648",
  46426. "\uFEEF",
  46427. "\u0649",
  46428. "\uFEF0",
  46429. "\u0649",
  46430. "\uFEF1",
  46431. "\u064A",
  46432. "\uFEF2",
  46433. "\u064A",
  46434. "\uFEF3",
  46435. "\u064A",
  46436. "\uFEF4",
  46437. "\u064A",
  46438. "\uFEF5",
  46439. "\u0644\u0622",
  46440. "\uFEF6",
  46441. "\u0644\u0622",
  46442. "\uFEF7",
  46443. "\u0644\u0623",
  46444. "\uFEF8",
  46445. "\u0644\u0623",
  46446. "\uFEF9",
  46447. "\u0644\u0625",
  46448. "\uFEFA",
  46449. "\u0644\u0625",
  46450. "\uFEFB",
  46451. "\u0644\u0627",
  46452. "\uFEFC",
  46453. "\u0644\u0627",
  46454. ];
  46455. }
  46456. );
  46457. function reverseIfRtl(chars) {
  46458. const charsLength = chars.length;
  46459. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  46460. return chars;
  46461. }
  46462. const buf = [];
  46463. for (let ii = charsLength - 1; ii >= 0; ii--) {
  46464. buf.push(chars[ii]);
  46465. }
  46466. return buf.join("");
  46467. }
  46468. const SpecialCharRegExp = new RegExp(
  46469. "^(\\s)|(\\p{Mn})|(\\p{Cf})$",
  46470. "u"
  46471. );
  46472. const CategoryCache = new Map();
  46473. function getCharUnicodeCategory(char) {
  46474. const cachedCategory = CategoryCache.get(char);
  46475. if (cachedCategory) {
  46476. return cachedCategory;
  46477. }
  46478. const groups = char.match(SpecialCharRegExp);
  46479. const category = {
  46480. isWhitespace: !!(groups && groups[1]),
  46481. isZeroWidthDiacritic: !!(groups && groups[2]),
  46482. isInvisibleFormatMark: !!(groups && groups[3]),
  46483. };
  46484. CategoryCache.set(char, category);
  46485. return category;
  46486. }
  46487. function clearUnicodeCaches() {
  46488. CategoryCache.clear();
  46489. }
  46490. /***/
  46491. },
  46492. /* 41 */
  46493. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46494. Object.defineProperty(exports, "__esModule", {
  46495. value: true,
  46496. });
  46497. exports.getSerifFonts =
  46498. exports.getNonStdFontMap =
  46499. exports.getGlyphMapForStandardFonts =
  46500. exports.getFontNameToFileMap =
  46501. void 0;
  46502. exports.getStandardFontName = getStandardFontName;
  46503. exports.getSymbolsFonts =
  46504. exports.getSupplementalGlyphMapForCalibri =
  46505. exports.getSupplementalGlyphMapForArialBlack =
  46506. exports.getStdFontMap =
  46507. void 0;
  46508. var _core_utils = __w_pdfjs_require__(6);
  46509. var _fonts_utils = __w_pdfjs_require__(38);
  46510. const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (
  46511. t
  46512. ) {
  46513. t["Times-Roman"] = "Times-Roman";
  46514. t.Helvetica = "Helvetica";
  46515. t.Courier = "Courier";
  46516. t.Symbol = "Symbol";
  46517. t["Times-Bold"] = "Times-Bold";
  46518. t["Helvetica-Bold"] = "Helvetica-Bold";
  46519. t["Courier-Bold"] = "Courier-Bold";
  46520. t.ZapfDingbats = "ZapfDingbats";
  46521. t["Times-Italic"] = "Times-Italic";
  46522. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  46523. t["Courier-Oblique"] = "Courier-Oblique";
  46524. t["Times-BoldItalic"] = "Times-BoldItalic";
  46525. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  46526. t["Courier-BoldOblique"] = "Courier-BoldOblique";
  46527. t.ArialNarrow = "Helvetica";
  46528. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  46529. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  46530. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  46531. t.ArialBlack = "Helvetica";
  46532. t["ArialBlack-Bold"] = "Helvetica-Bold";
  46533. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  46534. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  46535. t["Arial-Black"] = "Helvetica";
  46536. t["Arial-Black-Bold"] = "Helvetica-Bold";
  46537. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  46538. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  46539. t.Arial = "Helvetica";
  46540. t["Arial-Bold"] = "Helvetica-Bold";
  46541. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  46542. t["Arial-Italic"] = "Helvetica-Oblique";
  46543. t.ArialMT = "Helvetica";
  46544. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  46545. t["Arial-BoldMT"] = "Helvetica-Bold";
  46546. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  46547. t.ArialUnicodeMS = "Helvetica";
  46548. t["ArialUnicodeMS-Bold"] = "Helvetica-Bold";
  46549. t["ArialUnicodeMS-BoldItalic"] = "Helvetica-BoldOblique";
  46550. t["ArialUnicodeMS-Italic"] = "Helvetica-Oblique";
  46551. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  46552. t["Courier-Italic"] = "Courier-Oblique";
  46553. t.CourierNew = "Courier";
  46554. t["CourierNew-Bold"] = "Courier-Bold";
  46555. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  46556. t["CourierNew-Italic"] = "Courier-Oblique";
  46557. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  46558. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  46559. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  46560. t.CourierNewPSMT = "Courier";
  46561. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  46562. t["Helvetica-Italic"] = "Helvetica-Oblique";
  46563. t["Symbol-Bold"] = "Symbol";
  46564. t["Symbol-BoldItalic"] = "Symbol";
  46565. t["Symbol-Italic"] = "Symbol";
  46566. t.TimesNewRoman = "Times-Roman";
  46567. t["TimesNewRoman-Bold"] = "Times-Bold";
  46568. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  46569. t["TimesNewRoman-Italic"] = "Times-Italic";
  46570. t.TimesNewRomanPS = "Times-Roman";
  46571. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  46572. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  46573. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  46574. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  46575. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  46576. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  46577. t.TimesNewRomanPSMT = "Times-Roman";
  46578. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  46579. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  46580. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  46581. });
  46582. exports.getStdFontMap = getStdFontMap;
  46583. const getFontNameToFileMap = (0, _core_utils.getLookupTableFactory)(
  46584. function (t) {
  46585. t.Courier = "FoxitFixed.pfb";
  46586. t["Courier-Bold"] = "FoxitFixedBold.pfb";
  46587. t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb";
  46588. t["Courier-Oblique"] = "FoxitFixedItalic.pfb";
  46589. t.Helvetica = "FoxitSans.pfb";
  46590. t["Helvetica-Bold"] = "FoxitSansBold.pfb";
  46591. t["Helvetica-BoldOblique"] = "FoxitSansBoldItalic.pfb";
  46592. t["Helvetica-Oblique"] = "FoxitSansItalic.pfb";
  46593. t["Times-Roman"] = "FoxitSerif.pfb";
  46594. t["Times-Bold"] = "FoxitSerifBold.pfb";
  46595. t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb";
  46596. t["Times-Italic"] = "FoxitSerifItalic.pfb";
  46597. t.Symbol = "FoxitSymbol.pfb";
  46598. t.ZapfDingbats = "FoxitDingbats.pfb";
  46599. t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf";
  46600. t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf";
  46601. t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf";
  46602. t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf";
  46603. }
  46604. );
  46605. exports.getFontNameToFileMap = getFontNameToFileMap;
  46606. const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(
  46607. function (t) {
  46608. t.Calibri = "Helvetica";
  46609. t["Calibri-Bold"] = "Helvetica-Bold";
  46610. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  46611. t["Calibri-Italic"] = "Helvetica-Oblique";
  46612. t.CenturyGothic = "Helvetica";
  46613. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  46614. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  46615. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  46616. t.ComicSansMS = "Comic Sans MS";
  46617. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  46618. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  46619. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  46620. t["ItcSymbol-Bold"] = "Helvetica-Bold";
  46621. t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique";
  46622. t["ItcSymbol-Book"] = "Helvetica";
  46623. t["ItcSymbol-BookItalic"] = "Helvetica-Oblique";
  46624. t["ItcSymbol-Medium"] = "Helvetica";
  46625. t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique";
  46626. t.LucidaConsole = "Courier";
  46627. t["LucidaConsole-Bold"] = "Courier-Bold";
  46628. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  46629. t["LucidaConsole-Italic"] = "Courier-Oblique";
  46630. t["LucidaSans-Demi"] = "Helvetica-Bold";
  46631. t["MS-Gothic"] = "MS Gothic";
  46632. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  46633. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  46634. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  46635. t["MS-Mincho"] = "MS Mincho";
  46636. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  46637. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  46638. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  46639. t["MS-PGothic"] = "MS PGothic";
  46640. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  46641. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  46642. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  46643. t["MS-PMincho"] = "MS PMincho";
  46644. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  46645. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  46646. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  46647. t.NuptialScript = "Times-Italic";
  46648. t.SegoeUISymbol = "Helvetica";
  46649. t.Wingdings = "ZapfDingbats";
  46650. t["Wingdings-Regular"] = "ZapfDingbats";
  46651. }
  46652. );
  46653. exports.getNonStdFontMap = getNonStdFontMap;
  46654. const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (
  46655. t
  46656. ) {
  46657. t["Adobe Jenson"] = true;
  46658. t["Adobe Text"] = true;
  46659. t.Albertus = true;
  46660. t.Aldus = true;
  46661. t.Alexandria = true;
  46662. t.Algerian = true;
  46663. t["American Typewriter"] = true;
  46664. t.Antiqua = true;
  46665. t.Apex = true;
  46666. t.Arno = true;
  46667. t.Aster = true;
  46668. t.Aurora = true;
  46669. t.Baskerville = true;
  46670. t.Bell = true;
  46671. t.Bembo = true;
  46672. t["Bembo Schoolbook"] = true;
  46673. t.Benguiat = true;
  46674. t["Berkeley Old Style"] = true;
  46675. t["Bernhard Modern"] = true;
  46676. t["Berthold City"] = true;
  46677. t.Bodoni = true;
  46678. t["Bauer Bodoni"] = true;
  46679. t["Book Antiqua"] = true;
  46680. t.Bookman = true;
  46681. t["Bordeaux Roman"] = true;
  46682. t["Californian FB"] = true;
  46683. t.Calisto = true;
  46684. t.Calvert = true;
  46685. t.Capitals = true;
  46686. t.Cambria = true;
  46687. t.Cartier = true;
  46688. t.Caslon = true;
  46689. t.Catull = true;
  46690. t.Centaur = true;
  46691. t["Century Old Style"] = true;
  46692. t["Century Schoolbook"] = true;
  46693. t.Chaparral = true;
  46694. t["Charis SIL"] = true;
  46695. t.Cheltenham = true;
  46696. t["Cholla Slab"] = true;
  46697. t.Clarendon = true;
  46698. t.Clearface = true;
  46699. t.Cochin = true;
  46700. t.Colonna = true;
  46701. t["Computer Modern"] = true;
  46702. t["Concrete Roman"] = true;
  46703. t.Constantia = true;
  46704. t["Cooper Black"] = true;
  46705. t.Corona = true;
  46706. t.Ecotype = true;
  46707. t.Egyptienne = true;
  46708. t.Elephant = true;
  46709. t.Excelsior = true;
  46710. t.Fairfield = true;
  46711. t["FF Scala"] = true;
  46712. t.Folkard = true;
  46713. t.Footlight = true;
  46714. t.FreeSerif = true;
  46715. t["Friz Quadrata"] = true;
  46716. t.Garamond = true;
  46717. t.Gentium = true;
  46718. t.Georgia = true;
  46719. t.Gloucester = true;
  46720. t["Goudy Old Style"] = true;
  46721. t["Goudy Schoolbook"] = true;
  46722. t["Goudy Pro Font"] = true;
  46723. t.Granjon = true;
  46724. t["Guardian Egyptian"] = true;
  46725. t.Heather = true;
  46726. t.Hercules = true;
  46727. t["High Tower Text"] = true;
  46728. t.Hiroshige = true;
  46729. t["Hoefler Text"] = true;
  46730. t["Humana Serif"] = true;
  46731. t.Imprint = true;
  46732. t["Ionic No. 5"] = true;
  46733. t.Janson = true;
  46734. t.Joanna = true;
  46735. t.Korinna = true;
  46736. t.Lexicon = true;
  46737. t.LiberationSerif = true;
  46738. t["Liberation Serif"] = true;
  46739. t["Linux Libertine"] = true;
  46740. t.Literaturnaya = true;
  46741. t.Lucida = true;
  46742. t["Lucida Bright"] = true;
  46743. t.Melior = true;
  46744. t.Memphis = true;
  46745. t.Miller = true;
  46746. t.Minion = true;
  46747. t.Modern = true;
  46748. t["Mona Lisa"] = true;
  46749. t["Mrs Eaves"] = true;
  46750. t["MS Serif"] = true;
  46751. t["Museo Slab"] = true;
  46752. t["New York"] = true;
  46753. t["Nimbus Roman"] = true;
  46754. t["NPS Rawlinson Roadway"] = true;
  46755. t.NuptialScript = true;
  46756. t.Palatino = true;
  46757. t.Perpetua = true;
  46758. t.Plantin = true;
  46759. t["Plantin Schoolbook"] = true;
  46760. t.Playbill = true;
  46761. t["Poor Richard"] = true;
  46762. t["Rawlinson Roadway"] = true;
  46763. t.Renault = true;
  46764. t.Requiem = true;
  46765. t.Rockwell = true;
  46766. t.Roman = true;
  46767. t["Rotis Serif"] = true;
  46768. t.Sabon = true;
  46769. t.Scala = true;
  46770. t.Seagull = true;
  46771. t.Sistina = true;
  46772. t.Souvenir = true;
  46773. t.STIX = true;
  46774. t["Stone Informal"] = true;
  46775. t["Stone Serif"] = true;
  46776. t.Sylfaen = true;
  46777. t.Times = true;
  46778. t.Trajan = true;
  46779. t["Trinité"] = true;
  46780. t["Trump Mediaeval"] = true;
  46781. t.Utopia = true;
  46782. t["Vale Type"] = true;
  46783. t["Bitstream Vera"] = true;
  46784. t["Vera Serif"] = true;
  46785. t.Versailles = true;
  46786. t.Wanted = true;
  46787. t.Weiss = true;
  46788. t["Wide Latin"] = true;
  46789. t.Windsor = true;
  46790. t.XITS = true;
  46791. });
  46792. exports.getSerifFonts = getSerifFonts;
  46793. const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(
  46794. function (t) {
  46795. t.Dingbats = true;
  46796. t.Symbol = true;
  46797. t.ZapfDingbats = true;
  46798. }
  46799. );
  46800. exports.getSymbolsFonts = getSymbolsFonts;
  46801. const getGlyphMapForStandardFonts = (0,
  46802. _core_utils.getLookupTableFactory)(function (t) {
  46803. t[2] = 10;
  46804. t[3] = 32;
  46805. t[4] = 33;
  46806. t[5] = 34;
  46807. t[6] = 35;
  46808. t[7] = 36;
  46809. t[8] = 37;
  46810. t[9] = 38;
  46811. t[10] = 39;
  46812. t[11] = 40;
  46813. t[12] = 41;
  46814. t[13] = 42;
  46815. t[14] = 43;
  46816. t[15] = 44;
  46817. t[16] = 45;
  46818. t[17] = 46;
  46819. t[18] = 47;
  46820. t[19] = 48;
  46821. t[20] = 49;
  46822. t[21] = 50;
  46823. t[22] = 51;
  46824. t[23] = 52;
  46825. t[24] = 53;
  46826. t[25] = 54;
  46827. t[26] = 55;
  46828. t[27] = 56;
  46829. t[28] = 57;
  46830. t[29] = 58;
  46831. t[30] = 894;
  46832. t[31] = 60;
  46833. t[32] = 61;
  46834. t[33] = 62;
  46835. t[34] = 63;
  46836. t[35] = 64;
  46837. t[36] = 65;
  46838. t[37] = 66;
  46839. t[38] = 67;
  46840. t[39] = 68;
  46841. t[40] = 69;
  46842. t[41] = 70;
  46843. t[42] = 71;
  46844. t[43] = 72;
  46845. t[44] = 73;
  46846. t[45] = 74;
  46847. t[46] = 75;
  46848. t[47] = 76;
  46849. t[48] = 77;
  46850. t[49] = 78;
  46851. t[50] = 79;
  46852. t[51] = 80;
  46853. t[52] = 81;
  46854. t[53] = 82;
  46855. t[54] = 83;
  46856. t[55] = 84;
  46857. t[56] = 85;
  46858. t[57] = 86;
  46859. t[58] = 87;
  46860. t[59] = 88;
  46861. t[60] = 89;
  46862. t[61] = 90;
  46863. t[62] = 91;
  46864. t[63] = 92;
  46865. t[64] = 93;
  46866. t[65] = 94;
  46867. t[66] = 95;
  46868. t[67] = 96;
  46869. t[68] = 97;
  46870. t[69] = 98;
  46871. t[70] = 99;
  46872. t[71] = 100;
  46873. t[72] = 101;
  46874. t[73] = 102;
  46875. t[74] = 103;
  46876. t[75] = 104;
  46877. t[76] = 105;
  46878. t[77] = 106;
  46879. t[78] = 107;
  46880. t[79] = 108;
  46881. t[80] = 109;
  46882. t[81] = 110;
  46883. t[82] = 111;
  46884. t[83] = 112;
  46885. t[84] = 113;
  46886. t[85] = 114;
  46887. t[86] = 115;
  46888. t[87] = 116;
  46889. t[88] = 117;
  46890. t[89] = 118;
  46891. t[90] = 119;
  46892. t[91] = 120;
  46893. t[92] = 121;
  46894. t[93] = 122;
  46895. t[94] = 123;
  46896. t[95] = 124;
  46897. t[96] = 125;
  46898. t[97] = 126;
  46899. t[98] = 196;
  46900. t[99] = 197;
  46901. t[100] = 199;
  46902. t[101] = 201;
  46903. t[102] = 209;
  46904. t[103] = 214;
  46905. t[104] = 220;
  46906. t[105] = 225;
  46907. t[106] = 224;
  46908. t[107] = 226;
  46909. t[108] = 228;
  46910. t[109] = 227;
  46911. t[110] = 229;
  46912. t[111] = 231;
  46913. t[112] = 233;
  46914. t[113] = 232;
  46915. t[114] = 234;
  46916. t[115] = 235;
  46917. t[116] = 237;
  46918. t[117] = 236;
  46919. t[118] = 238;
  46920. t[119] = 239;
  46921. t[120] = 241;
  46922. t[121] = 243;
  46923. t[122] = 242;
  46924. t[123] = 244;
  46925. t[124] = 246;
  46926. t[125] = 245;
  46927. t[126] = 250;
  46928. t[127] = 249;
  46929. t[128] = 251;
  46930. t[129] = 252;
  46931. t[130] = 8224;
  46932. t[131] = 176;
  46933. t[132] = 162;
  46934. t[133] = 163;
  46935. t[134] = 167;
  46936. t[135] = 8226;
  46937. t[136] = 182;
  46938. t[137] = 223;
  46939. t[138] = 174;
  46940. t[139] = 169;
  46941. t[140] = 8482;
  46942. t[141] = 180;
  46943. t[142] = 168;
  46944. t[143] = 8800;
  46945. t[144] = 198;
  46946. t[145] = 216;
  46947. t[146] = 8734;
  46948. t[147] = 177;
  46949. t[148] = 8804;
  46950. t[149] = 8805;
  46951. t[150] = 165;
  46952. t[151] = 181;
  46953. t[152] = 8706;
  46954. t[153] = 8721;
  46955. t[154] = 8719;
  46956. t[156] = 8747;
  46957. t[157] = 170;
  46958. t[158] = 186;
  46959. t[159] = 8486;
  46960. t[160] = 230;
  46961. t[161] = 248;
  46962. t[162] = 191;
  46963. t[163] = 161;
  46964. t[164] = 172;
  46965. t[165] = 8730;
  46966. t[166] = 402;
  46967. t[167] = 8776;
  46968. t[168] = 8710;
  46969. t[169] = 171;
  46970. t[170] = 187;
  46971. t[171] = 8230;
  46972. t[200] = 193;
  46973. t[203] = 205;
  46974. t[210] = 218;
  46975. t[223] = 711;
  46976. t[224] = 321;
  46977. t[225] = 322;
  46978. t[226] = 352;
  46979. t[227] = 353;
  46980. t[228] = 381;
  46981. t[229] = 382;
  46982. t[233] = 221;
  46983. t[234] = 253;
  46984. t[252] = 263;
  46985. t[253] = 268;
  46986. t[254] = 269;
  46987. t[258] = 258;
  46988. t[260] = 260;
  46989. t[261] = 261;
  46990. t[265] = 280;
  46991. t[266] = 281;
  46992. t[267] = 282;
  46993. t[268] = 283;
  46994. t[269] = 313;
  46995. t[275] = 323;
  46996. t[276] = 324;
  46997. t[278] = 328;
  46998. t[283] = 344;
  46999. t[284] = 345;
  47000. t[285] = 346;
  47001. t[286] = 347;
  47002. t[292] = 367;
  47003. t[295] = 377;
  47004. t[296] = 378;
  47005. t[298] = 380;
  47006. t[305] = 963;
  47007. t[306] = 964;
  47008. t[307] = 966;
  47009. t[308] = 8215;
  47010. t[309] = 8252;
  47011. t[310] = 8319;
  47012. t[311] = 8359;
  47013. t[312] = 8592;
  47014. t[313] = 8593;
  47015. t[337] = 9552;
  47016. t[493] = 1039;
  47017. t[494] = 1040;
  47018. t[672] = 1488;
  47019. t[673] = 1489;
  47020. t[674] = 1490;
  47021. t[675] = 1491;
  47022. t[676] = 1492;
  47023. t[677] = 1493;
  47024. t[678] = 1494;
  47025. t[679] = 1495;
  47026. t[680] = 1496;
  47027. t[681] = 1497;
  47028. t[682] = 1498;
  47029. t[683] = 1499;
  47030. t[684] = 1500;
  47031. t[685] = 1501;
  47032. t[686] = 1502;
  47033. t[687] = 1503;
  47034. t[688] = 1504;
  47035. t[689] = 1505;
  47036. t[690] = 1506;
  47037. t[691] = 1507;
  47038. t[692] = 1508;
  47039. t[693] = 1509;
  47040. t[694] = 1510;
  47041. t[695] = 1511;
  47042. t[696] = 1512;
  47043. t[697] = 1513;
  47044. t[698] = 1514;
  47045. t[705] = 1524;
  47046. t[706] = 8362;
  47047. t[710] = 64288;
  47048. t[711] = 64298;
  47049. t[759] = 1617;
  47050. t[761] = 1776;
  47051. t[763] = 1778;
  47052. t[775] = 1652;
  47053. t[777] = 1764;
  47054. t[778] = 1780;
  47055. t[779] = 1781;
  47056. t[780] = 1782;
  47057. t[782] = 771;
  47058. t[783] = 64726;
  47059. t[786] = 8363;
  47060. t[788] = 8532;
  47061. t[790] = 768;
  47062. t[791] = 769;
  47063. t[792] = 768;
  47064. t[795] = 803;
  47065. t[797] = 64336;
  47066. t[798] = 64337;
  47067. t[799] = 64342;
  47068. t[800] = 64343;
  47069. t[801] = 64344;
  47070. t[802] = 64345;
  47071. t[803] = 64362;
  47072. t[804] = 64363;
  47073. t[805] = 64364;
  47074. t[2424] = 7821;
  47075. t[2425] = 7822;
  47076. t[2426] = 7823;
  47077. t[2427] = 7824;
  47078. t[2428] = 7825;
  47079. t[2429] = 7826;
  47080. t[2430] = 7827;
  47081. t[2433] = 7682;
  47082. t[2678] = 8045;
  47083. t[2679] = 8046;
  47084. t[2830] = 1552;
  47085. t[2838] = 686;
  47086. t[2840] = 751;
  47087. t[2842] = 753;
  47088. t[2843] = 754;
  47089. t[2844] = 755;
  47090. t[2846] = 757;
  47091. t[2856] = 767;
  47092. t[2857] = 848;
  47093. t[2858] = 849;
  47094. t[2862] = 853;
  47095. t[2863] = 854;
  47096. t[2864] = 855;
  47097. t[2865] = 861;
  47098. t[2866] = 862;
  47099. t[2906] = 7460;
  47100. t[2908] = 7462;
  47101. t[2909] = 7463;
  47102. t[2910] = 7464;
  47103. t[2912] = 7466;
  47104. t[2913] = 7467;
  47105. t[2914] = 7468;
  47106. t[2916] = 7470;
  47107. t[2917] = 7471;
  47108. t[2918] = 7472;
  47109. t[2920] = 7474;
  47110. t[2921] = 7475;
  47111. t[2922] = 7476;
  47112. t[2924] = 7478;
  47113. t[2925] = 7479;
  47114. t[2926] = 7480;
  47115. t[2928] = 7482;
  47116. t[2929] = 7483;
  47117. t[2930] = 7484;
  47118. t[2932] = 7486;
  47119. t[2933] = 7487;
  47120. t[2934] = 7488;
  47121. t[2936] = 7490;
  47122. t[2937] = 7491;
  47123. t[2938] = 7492;
  47124. t[2940] = 7494;
  47125. t[2941] = 7495;
  47126. t[2942] = 7496;
  47127. t[2944] = 7498;
  47128. t[2946] = 7500;
  47129. t[2948] = 7502;
  47130. t[2950] = 7504;
  47131. t[2951] = 7505;
  47132. t[2952] = 7506;
  47133. t[2954] = 7508;
  47134. t[2955] = 7509;
  47135. t[2956] = 7510;
  47136. t[2958] = 7512;
  47137. t[2959] = 7513;
  47138. t[2960] = 7514;
  47139. t[2962] = 7516;
  47140. t[2963] = 7517;
  47141. t[2964] = 7518;
  47142. t[2966] = 7520;
  47143. t[2967] = 7521;
  47144. t[2968] = 7522;
  47145. t[2970] = 7524;
  47146. t[2971] = 7525;
  47147. t[2972] = 7526;
  47148. t[2974] = 7528;
  47149. t[2975] = 7529;
  47150. t[2976] = 7530;
  47151. t[2978] = 1537;
  47152. t[2979] = 1538;
  47153. t[2980] = 1539;
  47154. t[2982] = 1549;
  47155. t[2983] = 1551;
  47156. t[2984] = 1552;
  47157. t[2986] = 1554;
  47158. t[2987] = 1555;
  47159. t[2988] = 1556;
  47160. t[2990] = 1623;
  47161. t[2991] = 1624;
  47162. t[2995] = 1775;
  47163. t[2999] = 1791;
  47164. t[3002] = 64290;
  47165. t[3003] = 64291;
  47166. t[3004] = 64292;
  47167. t[3006] = 64294;
  47168. t[3007] = 64295;
  47169. t[3008] = 64296;
  47170. t[3011] = 1900;
  47171. t[3014] = 8223;
  47172. t[3015] = 8244;
  47173. t[3017] = 7532;
  47174. t[3018] = 7533;
  47175. t[3019] = 7534;
  47176. t[3075] = 7590;
  47177. t[3076] = 7591;
  47178. t[3079] = 7594;
  47179. t[3080] = 7595;
  47180. t[3083] = 7598;
  47181. t[3084] = 7599;
  47182. t[3087] = 7602;
  47183. t[3088] = 7603;
  47184. t[3091] = 7606;
  47185. t[3092] = 7607;
  47186. t[3095] = 7610;
  47187. t[3096] = 7611;
  47188. t[3099] = 7614;
  47189. t[3100] = 7615;
  47190. t[3103] = 7618;
  47191. t[3104] = 7619;
  47192. t[3107] = 8337;
  47193. t[3108] = 8338;
  47194. t[3116] = 1884;
  47195. t[3119] = 1885;
  47196. t[3120] = 1885;
  47197. t[3123] = 1886;
  47198. t[3124] = 1886;
  47199. t[3127] = 1887;
  47200. t[3128] = 1887;
  47201. t[3131] = 1888;
  47202. t[3132] = 1888;
  47203. t[3135] = 1889;
  47204. t[3136] = 1889;
  47205. t[3139] = 1890;
  47206. t[3140] = 1890;
  47207. t[3143] = 1891;
  47208. t[3144] = 1891;
  47209. t[3147] = 1892;
  47210. t[3148] = 1892;
  47211. t[3153] = 580;
  47212. t[3154] = 581;
  47213. t[3157] = 584;
  47214. t[3158] = 585;
  47215. t[3161] = 588;
  47216. t[3162] = 589;
  47217. t[3165] = 891;
  47218. t[3166] = 892;
  47219. t[3169] = 1274;
  47220. t[3170] = 1275;
  47221. t[3173] = 1278;
  47222. t[3174] = 1279;
  47223. t[3181] = 7622;
  47224. t[3182] = 7623;
  47225. t[3282] = 11799;
  47226. t[3316] = 578;
  47227. t[3379] = 42785;
  47228. t[3393] = 1159;
  47229. t[3416] = 8377;
  47230. });
  47231. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  47232. const getSupplementalGlyphMapForArialBlack = (0,
  47233. _core_utils.getLookupTableFactory)(function (t) {
  47234. t[227] = 322;
  47235. t[264] = 261;
  47236. t[291] = 346;
  47237. });
  47238. exports.getSupplementalGlyphMapForArialBlack =
  47239. getSupplementalGlyphMapForArialBlack;
  47240. const getSupplementalGlyphMapForCalibri = (0,
  47241. _core_utils.getLookupTableFactory)(function (t) {
  47242. t[1] = 32;
  47243. t[4] = 65;
  47244. t[6] = 193;
  47245. t[17] = 66;
  47246. t[18] = 67;
  47247. t[21] = 268;
  47248. t[24] = 68;
  47249. t[28] = 69;
  47250. t[30] = 201;
  47251. t[32] = 282;
  47252. t[38] = 70;
  47253. t[39] = 71;
  47254. t[44] = 72;
  47255. t[47] = 73;
  47256. t[49] = 205;
  47257. t[58] = 74;
  47258. t[60] = 75;
  47259. t[62] = 76;
  47260. t[68] = 77;
  47261. t[69] = 78;
  47262. t[75] = 79;
  47263. t[87] = 80;
  47264. t[89] = 81;
  47265. t[90] = 82;
  47266. t[92] = 344;
  47267. t[94] = 83;
  47268. t[97] = 352;
  47269. t[100] = 84;
  47270. t[104] = 85;
  47271. t[115] = 86;
  47272. t[116] = 87;
  47273. t[121] = 88;
  47274. t[122] = 89;
  47275. t[124] = 221;
  47276. t[127] = 90;
  47277. t[129] = 381;
  47278. t[258] = 97;
  47279. t[260] = 225;
  47280. t[268] = 261;
  47281. t[271] = 98;
  47282. t[272] = 99;
  47283. t[273] = 263;
  47284. t[275] = 269;
  47285. t[282] = 100;
  47286. t[286] = 101;
  47287. t[288] = 233;
  47288. t[290] = 283;
  47289. t[295] = 281;
  47290. t[296] = 102;
  47291. t[336] = 103;
  47292. t[346] = 104;
  47293. t[349] = 105;
  47294. t[351] = 237;
  47295. t[361] = 106;
  47296. t[364] = 107;
  47297. t[367] = 108;
  47298. t[371] = 322;
  47299. t[373] = 109;
  47300. t[374] = 110;
  47301. t[381] = 111;
  47302. t[383] = 243;
  47303. t[393] = 112;
  47304. t[395] = 113;
  47305. t[396] = 114;
  47306. t[398] = 345;
  47307. t[400] = 115;
  47308. t[401] = 347;
  47309. t[403] = 353;
  47310. t[410] = 116;
  47311. t[437] = 117;
  47312. t[448] = 118;
  47313. t[449] = 119;
  47314. t[454] = 120;
  47315. t[455] = 121;
  47316. t[457] = 253;
  47317. t[460] = 122;
  47318. t[462] = 382;
  47319. t[463] = 380;
  47320. t[853] = 44;
  47321. t[855] = 58;
  47322. t[856] = 46;
  47323. t[876] = 47;
  47324. t[878] = 45;
  47325. t[882] = 45;
  47326. t[894] = 40;
  47327. t[895] = 41;
  47328. t[896] = 91;
  47329. t[897] = 93;
  47330. t[923] = 64;
  47331. t[1004] = 48;
  47332. t[1005] = 49;
  47333. t[1006] = 50;
  47334. t[1007] = 51;
  47335. t[1008] = 52;
  47336. t[1009] = 53;
  47337. t[1010] = 54;
  47338. t[1011] = 55;
  47339. t[1012] = 56;
  47340. t[1013] = 57;
  47341. t[1081] = 37;
  47342. t[1085] = 43;
  47343. t[1086] = 45;
  47344. });
  47345. exports.getSupplementalGlyphMapForCalibri =
  47346. getSupplementalGlyphMapForCalibri;
  47347. function getStandardFontName(name) {
  47348. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  47349. const stdFontMap = getStdFontMap();
  47350. return stdFontMap[fontName];
  47351. }
  47352. /***/
  47353. },
  47354. /* 42 */
  47355. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47356. Object.defineProperty(exports, "__esModule", {
  47357. value: true,
  47358. });
  47359. exports.ToUnicodeMap = exports.IdentityToUnicodeMap = void 0;
  47360. var _util = __w_pdfjs_require__(2);
  47361. class ToUnicodeMap {
  47362. constructor(cmap = []) {
  47363. this._map = cmap;
  47364. }
  47365. get length() {
  47366. return this._map.length;
  47367. }
  47368. forEach(callback) {
  47369. for (const charCode in this._map) {
  47370. callback(charCode, this._map[charCode].charCodeAt(0));
  47371. }
  47372. }
  47373. has(i) {
  47374. return this._map[i] !== undefined;
  47375. }
  47376. get(i) {
  47377. return this._map[i];
  47378. }
  47379. charCodeOf(value) {
  47380. const map = this._map;
  47381. if (map.length <= 0x10000) {
  47382. return map.indexOf(value);
  47383. }
  47384. for (const charCode in map) {
  47385. if (map[charCode] === value) {
  47386. return charCode | 0;
  47387. }
  47388. }
  47389. return -1;
  47390. }
  47391. amend(map) {
  47392. for (const charCode in map) {
  47393. this._map[charCode] = map[charCode];
  47394. }
  47395. }
  47396. }
  47397. exports.ToUnicodeMap = ToUnicodeMap;
  47398. class IdentityToUnicodeMap {
  47399. constructor(firstChar, lastChar) {
  47400. this.firstChar = firstChar;
  47401. this.lastChar = lastChar;
  47402. }
  47403. get length() {
  47404. return this.lastChar + 1 - this.firstChar;
  47405. }
  47406. forEach(callback) {
  47407. for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  47408. callback(i, i);
  47409. }
  47410. }
  47411. has(i) {
  47412. return this.firstChar <= i && i <= this.lastChar;
  47413. }
  47414. get(i) {
  47415. if (this.firstChar <= i && i <= this.lastChar) {
  47416. return String.fromCharCode(i);
  47417. }
  47418. return undefined;
  47419. }
  47420. charCodeOf(v) {
  47421. return Number.isInteger(v) &&
  47422. v >= this.firstChar &&
  47423. v <= this.lastChar
  47424. ? v
  47425. : -1;
  47426. }
  47427. amend(map) {
  47428. (0, _util.unreachable)("Should not call amend()");
  47429. }
  47430. }
  47431. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  47432. /***/
  47433. },
  47434. /* 43 */
  47435. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47436. Object.defineProperty(exports, "__esModule", {
  47437. value: true,
  47438. });
  47439. exports.CFFFont = void 0;
  47440. var _cff_parser = __w_pdfjs_require__(35);
  47441. var _fonts_utils = __w_pdfjs_require__(38);
  47442. var _util = __w_pdfjs_require__(2);
  47443. class CFFFont {
  47444. constructor(file, properties) {
  47445. this.properties = properties;
  47446. const parser = new _cff_parser.CFFParser(
  47447. file,
  47448. properties,
  47449. _fonts_utils.SEAC_ANALYSIS_ENABLED
  47450. );
  47451. this.cff = parser.parse();
  47452. this.cff.duplicateFirstGlyph();
  47453. const compiler = new _cff_parser.CFFCompiler(this.cff);
  47454. this.seacs = this.cff.seacs;
  47455. try {
  47456. this.data = compiler.compile();
  47457. } catch (e) {
  47458. (0, _util.warn)(
  47459. "Failed to compile font " + properties.loadedName
  47460. );
  47461. this.data = file;
  47462. }
  47463. this._createBuiltInEncoding();
  47464. }
  47465. get numGlyphs() {
  47466. return this.cff.charStrings.count;
  47467. }
  47468. getCharset() {
  47469. return this.cff.charset.charset;
  47470. }
  47471. getGlyphMapping() {
  47472. const cff = this.cff;
  47473. const properties = this.properties;
  47474. const charsets = cff.charset.charset;
  47475. let charCodeToGlyphId;
  47476. let glyphId;
  47477. if (properties.composite) {
  47478. charCodeToGlyphId = Object.create(null);
  47479. let charCode;
  47480. if (cff.isCIDFont) {
  47481. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  47482. const cid = charsets[glyphId];
  47483. charCode = properties.cMap.charCodeOf(cid);
  47484. charCodeToGlyphId[charCode] = glyphId;
  47485. }
  47486. } else {
  47487. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  47488. charCode = properties.cMap.charCodeOf(glyphId);
  47489. charCodeToGlyphId[charCode] = glyphId;
  47490. }
  47491. }
  47492. return charCodeToGlyphId;
  47493. }
  47494. let encoding = cff.encoding ? cff.encoding.encoding : null;
  47495. if (properties.isInternalFont) {
  47496. encoding = properties.defaultEncoding;
  47497. }
  47498. charCodeToGlyphId = (0, _fonts_utils.type1FontGlyphMapping)(
  47499. properties,
  47500. encoding,
  47501. charsets
  47502. );
  47503. return charCodeToGlyphId;
  47504. }
  47505. hasGlyphId(id) {
  47506. return this.cff.hasGlyphId(id);
  47507. }
  47508. _createBuiltInEncoding() {
  47509. const { charset, encoding } = this.cff;
  47510. if (!charset || !encoding) {
  47511. return;
  47512. }
  47513. const charsets = charset.charset,
  47514. encodings = encoding.encoding;
  47515. const map = [];
  47516. for (const charCode in encodings) {
  47517. const glyphId = encodings[charCode];
  47518. if (glyphId >= 0) {
  47519. const glyphName = charsets[glyphId];
  47520. if (glyphName) {
  47521. map[charCode] = glyphName;
  47522. }
  47523. }
  47524. }
  47525. if (map.length > 0) {
  47526. this.properties.builtInEncoding = map;
  47527. }
  47528. }
  47529. }
  47530. exports.CFFFont = CFFFont;
  47531. /***/
  47532. },
  47533. /* 44 */
  47534. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47535. Object.defineProperty(exports, "__esModule", {
  47536. value: true,
  47537. });
  47538. exports.FontRendererFactory = void 0;
  47539. var _util = __w_pdfjs_require__(2);
  47540. var _cff_parser = __w_pdfjs_require__(35);
  47541. var _glyphlist = __w_pdfjs_require__(39);
  47542. var _encodings = __w_pdfjs_require__(37);
  47543. var _stream = __w_pdfjs_require__(10);
  47544. function getUint32(data, offset) {
  47545. return (
  47546. ((data[offset] << 24) |
  47547. (data[offset + 1] << 16) |
  47548. (data[offset + 2] << 8) |
  47549. data[offset + 3]) >>>
  47550. 0
  47551. );
  47552. }
  47553. function getUint16(data, offset) {
  47554. return (data[offset] << 8) | data[offset + 1];
  47555. }
  47556. function getInt16(data, offset) {
  47557. return ((data[offset] << 24) | (data[offset + 1] << 16)) >> 16;
  47558. }
  47559. function getInt8(data, offset) {
  47560. return (data[offset] << 24) >> 24;
  47561. }
  47562. function getFloat214(data, offset) {
  47563. return getInt16(data, offset) / 16384;
  47564. }
  47565. function getSubroutineBias(subrs) {
  47566. const numSubrs = subrs.length;
  47567. let bias = 32768;
  47568. if (numSubrs < 1240) {
  47569. bias = 107;
  47570. } else if (numSubrs < 33900) {
  47571. bias = 1131;
  47572. }
  47573. return bias;
  47574. }
  47575. function parseCmap(data, start, end) {
  47576. const offset =
  47577. getUint16(data, start + 2) === 1
  47578. ? getUint32(data, start + 8)
  47579. : getUint32(data, start + 16);
  47580. const format = getUint16(data, start + offset);
  47581. let ranges, p, i;
  47582. if (format === 4) {
  47583. getUint16(data, start + offset + 2);
  47584. const segCount = getUint16(data, start + offset + 6) >> 1;
  47585. p = start + offset + 14;
  47586. ranges = [];
  47587. for (i = 0; i < segCount; i++, p += 2) {
  47588. ranges[i] = {
  47589. end: getUint16(data, p),
  47590. };
  47591. }
  47592. p += 2;
  47593. for (i = 0; i < segCount; i++, p += 2) {
  47594. ranges[i].start = getUint16(data, p);
  47595. }
  47596. for (i = 0; i < segCount; i++, p += 2) {
  47597. ranges[i].idDelta = getUint16(data, p);
  47598. }
  47599. for (i = 0; i < segCount; i++, p += 2) {
  47600. let idOffset = getUint16(data, p);
  47601. if (idOffset === 0) {
  47602. continue;
  47603. }
  47604. ranges[i].ids = [];
  47605. for (
  47606. let j = 0, jj = ranges[i].end - ranges[i].start + 1;
  47607. j < jj;
  47608. j++
  47609. ) {
  47610. ranges[i].ids[j] = getUint16(data, p + idOffset);
  47611. idOffset += 2;
  47612. }
  47613. }
  47614. return ranges;
  47615. } else if (format === 12) {
  47616. const groups = getUint32(data, start + offset + 12);
  47617. p = start + offset + 16;
  47618. ranges = [];
  47619. for (i = 0; i < groups; i++) {
  47620. start = getUint32(data, p);
  47621. ranges.push({
  47622. start,
  47623. end: getUint32(data, p + 4),
  47624. idDelta: getUint32(data, p + 8) - start,
  47625. });
  47626. p += 12;
  47627. }
  47628. return ranges;
  47629. }
  47630. throw new _util.FormatError(`unsupported cmap: ${format}`);
  47631. }
  47632. function parseCff(data, start, end, seacAnalysisEnabled) {
  47633. const properties = {};
  47634. const parser = new _cff_parser.CFFParser(
  47635. new _stream.Stream(data, start, end - start),
  47636. properties,
  47637. seacAnalysisEnabled
  47638. );
  47639. const cff = parser.parse();
  47640. return {
  47641. glyphs: cff.charStrings.objects,
  47642. subrs:
  47643. cff.topDict.privateDict &&
  47644. cff.topDict.privateDict.subrsIndex &&
  47645. cff.topDict.privateDict.subrsIndex.objects,
  47646. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
  47647. isCFFCIDFont: cff.isCIDFont,
  47648. fdSelect: cff.fdSelect,
  47649. fdArray: cff.fdArray,
  47650. };
  47651. }
  47652. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  47653. let itemSize, itemDecode;
  47654. if (isGlyphLocationsLong) {
  47655. itemSize = 4;
  47656. itemDecode = getUint32;
  47657. } else {
  47658. itemSize = 2;
  47659. itemDecode = (data, offset) => 2 * getUint16(data, offset);
  47660. }
  47661. const glyphs = [];
  47662. let startOffset = itemDecode(loca, 0);
  47663. for (let j = itemSize; j < loca.length; j += itemSize) {
  47664. const endOffset = itemDecode(loca, j);
  47665. glyphs.push(glyf.subarray(startOffset, endOffset));
  47666. startOffset = endOffset;
  47667. }
  47668. return glyphs;
  47669. }
  47670. function lookupCmap(ranges, unicode) {
  47671. const code = unicode.codePointAt(0);
  47672. let gid = 0,
  47673. l = 0,
  47674. r = ranges.length - 1;
  47675. while (l < r) {
  47676. const c = (l + r + 1) >> 1;
  47677. if (code < ranges[c].start) {
  47678. r = c - 1;
  47679. } else {
  47680. l = c;
  47681. }
  47682. }
  47683. if (ranges[l].start <= code && code <= ranges[l].end) {
  47684. gid =
  47685. (ranges[l].idDelta +
  47686. (ranges[l].ids
  47687. ? ranges[l].ids[code - ranges[l].start]
  47688. : code)) &
  47689. 0xffff;
  47690. }
  47691. return {
  47692. charCode: code,
  47693. glyphId: gid,
  47694. };
  47695. }
  47696. function compileGlyf(code, cmds, font) {
  47697. function moveTo(x, y) {
  47698. cmds.push({
  47699. cmd: "moveTo",
  47700. args: [x, y],
  47701. });
  47702. }
  47703. function lineTo(x, y) {
  47704. cmds.push({
  47705. cmd: "lineTo",
  47706. args: [x, y],
  47707. });
  47708. }
  47709. function quadraticCurveTo(xa, ya, x, y) {
  47710. cmds.push({
  47711. cmd: "quadraticCurveTo",
  47712. args: [xa, ya, x, y],
  47713. });
  47714. }
  47715. let i = 0;
  47716. const numberOfContours = getInt16(code, i);
  47717. let flags;
  47718. let x = 0,
  47719. y = 0;
  47720. i += 10;
  47721. if (numberOfContours < 0) {
  47722. do {
  47723. flags = getUint16(code, i);
  47724. const glyphIndex = getUint16(code, i + 2);
  47725. i += 4;
  47726. let arg1, arg2;
  47727. if (flags & 0x01) {
  47728. if (flags & 0x02) {
  47729. arg1 = getInt16(code, i);
  47730. arg2 = getInt16(code, i + 2);
  47731. } else {
  47732. arg1 = getUint16(code, i);
  47733. arg2 = getUint16(code, i + 2);
  47734. }
  47735. i += 4;
  47736. } else {
  47737. if (flags & 0x02) {
  47738. arg1 = getInt8(code, i++);
  47739. arg2 = getInt8(code, i++);
  47740. } else {
  47741. arg1 = code[i++];
  47742. arg2 = code[i++];
  47743. }
  47744. }
  47745. if (flags & 0x02) {
  47746. x = arg1;
  47747. y = arg2;
  47748. } else {
  47749. x = 0;
  47750. y = 0;
  47751. }
  47752. let scaleX = 1,
  47753. scaleY = 1,
  47754. scale01 = 0,
  47755. scale10 = 0;
  47756. if (flags & 0x08) {
  47757. scaleX = scaleY = getFloat214(code, i);
  47758. i += 2;
  47759. } else if (flags & 0x40) {
  47760. scaleX = getFloat214(code, i);
  47761. scaleY = getFloat214(code, i + 2);
  47762. i += 4;
  47763. } else if (flags & 0x80) {
  47764. scaleX = getFloat214(code, i);
  47765. scale01 = getFloat214(code, i + 2);
  47766. scale10 = getFloat214(code, i + 4);
  47767. scaleY = getFloat214(code, i + 6);
  47768. i += 8;
  47769. }
  47770. const subglyph = font.glyphs[glyphIndex];
  47771. if (subglyph) {
  47772. cmds.push(
  47773. {
  47774. cmd: "save",
  47775. },
  47776. {
  47777. cmd: "transform",
  47778. args: [scaleX, scale01, scale10, scaleY, x, y],
  47779. }
  47780. );
  47781. if (!(flags & 0x02)) {
  47782. }
  47783. compileGlyf(subglyph, cmds, font);
  47784. cmds.push({
  47785. cmd: "restore",
  47786. });
  47787. }
  47788. } while (flags & 0x20);
  47789. } else {
  47790. const endPtsOfContours = [];
  47791. let j, jj;
  47792. for (j = 0; j < numberOfContours; j++) {
  47793. endPtsOfContours.push(getUint16(code, i));
  47794. i += 2;
  47795. }
  47796. const instructionLength = getUint16(code, i);
  47797. i += 2 + instructionLength;
  47798. const numberOfPoints = endPtsOfContours.at(-1) + 1;
  47799. const points = [];
  47800. while (points.length < numberOfPoints) {
  47801. flags = code[i++];
  47802. let repeat = 1;
  47803. if (flags & 0x08) {
  47804. repeat += code[i++];
  47805. }
  47806. while (repeat-- > 0) {
  47807. points.push({
  47808. flags,
  47809. });
  47810. }
  47811. }
  47812. for (j = 0; j < numberOfPoints; j++) {
  47813. switch (points[j].flags & 0x12) {
  47814. case 0x00:
  47815. x += getInt16(code, i);
  47816. i += 2;
  47817. break;
  47818. case 0x02:
  47819. x -= code[i++];
  47820. break;
  47821. case 0x12:
  47822. x += code[i++];
  47823. break;
  47824. }
  47825. points[j].x = x;
  47826. }
  47827. for (j = 0; j < numberOfPoints; j++) {
  47828. switch (points[j].flags & 0x24) {
  47829. case 0x00:
  47830. y += getInt16(code, i);
  47831. i += 2;
  47832. break;
  47833. case 0x04:
  47834. y -= code[i++];
  47835. break;
  47836. case 0x24:
  47837. y += code[i++];
  47838. break;
  47839. }
  47840. points[j].y = y;
  47841. }
  47842. let startPoint = 0;
  47843. for (i = 0; i < numberOfContours; i++) {
  47844. const endPoint = endPtsOfContours[i];
  47845. const contour = points.slice(startPoint, endPoint + 1);
  47846. if (contour[0].flags & 1) {
  47847. contour.push(contour[0]);
  47848. } else if (contour.at(-1).flags & 1) {
  47849. contour.unshift(contour.at(-1));
  47850. } else {
  47851. const p = {
  47852. flags: 1,
  47853. x: (contour[0].x + contour.at(-1).x) / 2,
  47854. y: (contour[0].y + contour.at(-1).y) / 2,
  47855. };
  47856. contour.unshift(p);
  47857. contour.push(p);
  47858. }
  47859. moveTo(contour[0].x, contour[0].y);
  47860. for (j = 1, jj = contour.length; j < jj; j++) {
  47861. if (contour[j].flags & 1) {
  47862. lineTo(contour[j].x, contour[j].y);
  47863. } else if (contour[j + 1].flags & 1) {
  47864. quadraticCurveTo(
  47865. contour[j].x,
  47866. contour[j].y,
  47867. contour[j + 1].x,
  47868. contour[j + 1].y
  47869. );
  47870. j++;
  47871. } else {
  47872. quadraticCurveTo(
  47873. contour[j].x,
  47874. contour[j].y,
  47875. (contour[j].x + contour[j + 1].x) / 2,
  47876. (contour[j].y + contour[j + 1].y) / 2
  47877. );
  47878. }
  47879. }
  47880. startPoint = endPoint + 1;
  47881. }
  47882. }
  47883. }
  47884. function compileCharString(charStringCode, cmds, font, glyphId) {
  47885. function moveTo(x, y) {
  47886. cmds.push({
  47887. cmd: "moveTo",
  47888. args: [x, y],
  47889. });
  47890. }
  47891. function lineTo(x, y) {
  47892. cmds.push({
  47893. cmd: "lineTo",
  47894. args: [x, y],
  47895. });
  47896. }
  47897. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  47898. cmds.push({
  47899. cmd: "bezierCurveTo",
  47900. args: [x1, y1, x2, y2, x, y],
  47901. });
  47902. }
  47903. const stack = [];
  47904. let x = 0,
  47905. y = 0;
  47906. let stems = 0;
  47907. function parse(code) {
  47908. let i = 0;
  47909. while (i < code.length) {
  47910. let stackClean = false;
  47911. let v = code[i++];
  47912. let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  47913. switch (v) {
  47914. case 1:
  47915. stems += stack.length >> 1;
  47916. stackClean = true;
  47917. break;
  47918. case 3:
  47919. stems += stack.length >> 1;
  47920. stackClean = true;
  47921. break;
  47922. case 4:
  47923. y += stack.pop();
  47924. moveTo(x, y);
  47925. stackClean = true;
  47926. break;
  47927. case 5:
  47928. while (stack.length > 0) {
  47929. x += stack.shift();
  47930. y += stack.shift();
  47931. lineTo(x, y);
  47932. }
  47933. break;
  47934. case 6:
  47935. while (stack.length > 0) {
  47936. x += stack.shift();
  47937. lineTo(x, y);
  47938. if (stack.length === 0) {
  47939. break;
  47940. }
  47941. y += stack.shift();
  47942. lineTo(x, y);
  47943. }
  47944. break;
  47945. case 7:
  47946. while (stack.length > 0) {
  47947. y += stack.shift();
  47948. lineTo(x, y);
  47949. if (stack.length === 0) {
  47950. break;
  47951. }
  47952. x += stack.shift();
  47953. lineTo(x, y);
  47954. }
  47955. break;
  47956. case 8:
  47957. while (stack.length > 0) {
  47958. xa = x + stack.shift();
  47959. ya = y + stack.shift();
  47960. xb = xa + stack.shift();
  47961. yb = ya + stack.shift();
  47962. x = xb + stack.shift();
  47963. y = yb + stack.shift();
  47964. bezierCurveTo(xa, ya, xb, yb, x, y);
  47965. }
  47966. break;
  47967. case 10:
  47968. n = stack.pop();
  47969. subrCode = null;
  47970. if (font.isCFFCIDFont) {
  47971. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  47972. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  47973. const fontDict = font.fdArray[fdIndex];
  47974. let subrs;
  47975. if (
  47976. fontDict.privateDict &&
  47977. fontDict.privateDict.subrsIndex
  47978. ) {
  47979. subrs = fontDict.privateDict.subrsIndex.objects;
  47980. }
  47981. if (subrs) {
  47982. n += getSubroutineBias(subrs);
  47983. subrCode = subrs[n];
  47984. }
  47985. } else {
  47986. (0, _util.warn)("Invalid fd index for glyph index.");
  47987. }
  47988. } else {
  47989. subrCode = font.subrs[n + font.subrsBias];
  47990. }
  47991. if (subrCode) {
  47992. parse(subrCode);
  47993. }
  47994. break;
  47995. case 11:
  47996. return;
  47997. case 12:
  47998. v = code[i++];
  47999. switch (v) {
  48000. case 34:
  48001. xa = x + stack.shift();
  48002. xb = xa + stack.shift();
  48003. y1 = y + stack.shift();
  48004. x = xb + stack.shift();
  48005. bezierCurveTo(xa, y, xb, y1, x, y1);
  48006. xa = x + stack.shift();
  48007. xb = xa + stack.shift();
  48008. x = xb + stack.shift();
  48009. bezierCurveTo(xa, y1, xb, y, x, y);
  48010. break;
  48011. case 35:
  48012. xa = x + stack.shift();
  48013. ya = y + stack.shift();
  48014. xb = xa + stack.shift();
  48015. yb = ya + stack.shift();
  48016. x = xb + stack.shift();
  48017. y = yb + stack.shift();
  48018. bezierCurveTo(xa, ya, xb, yb, x, y);
  48019. xa = x + stack.shift();
  48020. ya = y + stack.shift();
  48021. xb = xa + stack.shift();
  48022. yb = ya + stack.shift();
  48023. x = xb + stack.shift();
  48024. y = yb + stack.shift();
  48025. bezierCurveTo(xa, ya, xb, yb, x, y);
  48026. stack.pop();
  48027. break;
  48028. case 36:
  48029. xa = x + stack.shift();
  48030. y1 = y + stack.shift();
  48031. xb = xa + stack.shift();
  48032. y2 = y1 + stack.shift();
  48033. x = xb + stack.shift();
  48034. bezierCurveTo(xa, y1, xb, y2, x, y2);
  48035. xa = x + stack.shift();
  48036. xb = xa + stack.shift();
  48037. y3 = y2 + stack.shift();
  48038. x = xb + stack.shift();
  48039. bezierCurveTo(xa, y2, xb, y3, x, y);
  48040. break;
  48041. case 37:
  48042. const x0 = x,
  48043. y0 = y;
  48044. xa = x + stack.shift();
  48045. ya = y + stack.shift();
  48046. xb = xa + stack.shift();
  48047. yb = ya + stack.shift();
  48048. x = xb + stack.shift();
  48049. y = yb + stack.shift();
  48050. bezierCurveTo(xa, ya, xb, yb, x, y);
  48051. xa = x + stack.shift();
  48052. ya = y + stack.shift();
  48053. xb = xa + stack.shift();
  48054. yb = ya + stack.shift();
  48055. x = xb;
  48056. y = yb;
  48057. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  48058. x += stack.shift();
  48059. } else {
  48060. y += stack.shift();
  48061. }
  48062. bezierCurveTo(xa, ya, xb, yb, x, y);
  48063. break;
  48064. default:
  48065. throw new _util.FormatError(`unknown operator: 12 ${v}`);
  48066. }
  48067. break;
  48068. case 14:
  48069. if (stack.length >= 4) {
  48070. const achar = stack.pop();
  48071. const bchar = stack.pop();
  48072. y = stack.pop();
  48073. x = stack.pop();
  48074. cmds.push(
  48075. {
  48076. cmd: "save",
  48077. },
  48078. {
  48079. cmd: "translate",
  48080. args: [x, y],
  48081. }
  48082. );
  48083. let cmap = lookupCmap(
  48084. font.cmap,
  48085. String.fromCharCode(
  48086. font.glyphNameMap[_encodings.StandardEncoding[achar]]
  48087. )
  48088. );
  48089. compileCharString(
  48090. font.glyphs[cmap.glyphId],
  48091. cmds,
  48092. font,
  48093. cmap.glyphId
  48094. );
  48095. cmds.push({
  48096. cmd: "restore",
  48097. });
  48098. cmap = lookupCmap(
  48099. font.cmap,
  48100. String.fromCharCode(
  48101. font.glyphNameMap[_encodings.StandardEncoding[bchar]]
  48102. )
  48103. );
  48104. compileCharString(
  48105. font.glyphs[cmap.glyphId],
  48106. cmds,
  48107. font,
  48108. cmap.glyphId
  48109. );
  48110. }
  48111. return;
  48112. case 18:
  48113. stems += stack.length >> 1;
  48114. stackClean = true;
  48115. break;
  48116. case 19:
  48117. stems += stack.length >> 1;
  48118. i += (stems + 7) >> 3;
  48119. stackClean = true;
  48120. break;
  48121. case 20:
  48122. stems += stack.length >> 1;
  48123. i += (stems + 7) >> 3;
  48124. stackClean = true;
  48125. break;
  48126. case 21:
  48127. y += stack.pop();
  48128. x += stack.pop();
  48129. moveTo(x, y);
  48130. stackClean = true;
  48131. break;
  48132. case 22:
  48133. x += stack.pop();
  48134. moveTo(x, y);
  48135. stackClean = true;
  48136. break;
  48137. case 23:
  48138. stems += stack.length >> 1;
  48139. stackClean = true;
  48140. break;
  48141. case 24:
  48142. while (stack.length > 2) {
  48143. xa = x + stack.shift();
  48144. ya = y + stack.shift();
  48145. xb = xa + stack.shift();
  48146. yb = ya + stack.shift();
  48147. x = xb + stack.shift();
  48148. y = yb + stack.shift();
  48149. bezierCurveTo(xa, ya, xb, yb, x, y);
  48150. }
  48151. x += stack.shift();
  48152. y += stack.shift();
  48153. lineTo(x, y);
  48154. break;
  48155. case 25:
  48156. while (stack.length > 6) {
  48157. x += stack.shift();
  48158. y += stack.shift();
  48159. lineTo(x, y);
  48160. }
  48161. xa = x + stack.shift();
  48162. ya = y + stack.shift();
  48163. xb = xa + stack.shift();
  48164. yb = ya + stack.shift();
  48165. x = xb + stack.shift();
  48166. y = yb + stack.shift();
  48167. bezierCurveTo(xa, ya, xb, yb, x, y);
  48168. break;
  48169. case 26:
  48170. if (stack.length % 2) {
  48171. x += stack.shift();
  48172. }
  48173. while (stack.length > 0) {
  48174. xa = x;
  48175. ya = y + stack.shift();
  48176. xb = xa + stack.shift();
  48177. yb = ya + stack.shift();
  48178. x = xb;
  48179. y = yb + stack.shift();
  48180. bezierCurveTo(xa, ya, xb, yb, x, y);
  48181. }
  48182. break;
  48183. case 27:
  48184. if (stack.length % 2) {
  48185. y += stack.shift();
  48186. }
  48187. while (stack.length > 0) {
  48188. xa = x + stack.shift();
  48189. ya = y;
  48190. xb = xa + stack.shift();
  48191. yb = ya + stack.shift();
  48192. x = xb + stack.shift();
  48193. y = yb;
  48194. bezierCurveTo(xa, ya, xb, yb, x, y);
  48195. }
  48196. break;
  48197. case 28:
  48198. stack.push(((code[i] << 24) | (code[i + 1] << 16)) >> 16);
  48199. i += 2;
  48200. break;
  48201. case 29:
  48202. n = stack.pop() + font.gsubrsBias;
  48203. subrCode = font.gsubrs[n];
  48204. if (subrCode) {
  48205. parse(subrCode);
  48206. }
  48207. break;
  48208. case 30:
  48209. while (stack.length > 0) {
  48210. xa = x;
  48211. ya = y + stack.shift();
  48212. xb = xa + stack.shift();
  48213. yb = ya + stack.shift();
  48214. x = xb + stack.shift();
  48215. y = yb + (stack.length === 1 ? stack.shift() : 0);
  48216. bezierCurveTo(xa, ya, xb, yb, x, y);
  48217. if (stack.length === 0) {
  48218. break;
  48219. }
  48220. xa = x + stack.shift();
  48221. ya = y;
  48222. xb = xa + stack.shift();
  48223. yb = ya + stack.shift();
  48224. y = yb + stack.shift();
  48225. x = xb + (stack.length === 1 ? stack.shift() : 0);
  48226. bezierCurveTo(xa, ya, xb, yb, x, y);
  48227. }
  48228. break;
  48229. case 31:
  48230. while (stack.length > 0) {
  48231. xa = x + stack.shift();
  48232. ya = y;
  48233. xb = xa + stack.shift();
  48234. yb = ya + stack.shift();
  48235. y = yb + stack.shift();
  48236. x = xb + (stack.length === 1 ? stack.shift() : 0);
  48237. bezierCurveTo(xa, ya, xb, yb, x, y);
  48238. if (stack.length === 0) {
  48239. break;
  48240. }
  48241. xa = x;
  48242. ya = y + stack.shift();
  48243. xb = xa + stack.shift();
  48244. yb = ya + stack.shift();
  48245. x = xb + stack.shift();
  48246. y = yb + (stack.length === 1 ? stack.shift() : 0);
  48247. bezierCurveTo(xa, ya, xb, yb, x, y);
  48248. }
  48249. break;
  48250. default:
  48251. if (v < 32) {
  48252. throw new _util.FormatError(`unknown operator: ${v}`);
  48253. }
  48254. if (v < 247) {
  48255. stack.push(v - 139);
  48256. } else if (v < 251) {
  48257. stack.push((v - 247) * 256 + code[i++] + 108);
  48258. } else if (v < 255) {
  48259. stack.push(-(v - 251) * 256 - code[i++] - 108);
  48260. } else {
  48261. stack.push(
  48262. ((code[i] << 24) |
  48263. (code[i + 1] << 16) |
  48264. (code[i + 2] << 8) |
  48265. code[i + 3]) /
  48266. 65536
  48267. );
  48268. i += 4;
  48269. }
  48270. break;
  48271. }
  48272. if (stackClean) {
  48273. stack.length = 0;
  48274. }
  48275. }
  48276. }
  48277. parse(charStringCode);
  48278. }
  48279. const NOOP = [];
  48280. class CompiledFont {
  48281. constructor(fontMatrix) {
  48282. if (this.constructor === CompiledFont) {
  48283. (0, _util.unreachable)("Cannot initialize CompiledFont.");
  48284. }
  48285. this.fontMatrix = fontMatrix;
  48286. this.compiledGlyphs = Object.create(null);
  48287. this.compiledCharCodeToGlyphId = Object.create(null);
  48288. }
  48289. getPathJs(unicode) {
  48290. const { charCode, glyphId } = lookupCmap(this.cmap, unicode);
  48291. let fn = this.compiledGlyphs[glyphId];
  48292. if (!fn) {
  48293. try {
  48294. fn = this.compileGlyph(this.glyphs[glyphId], glyphId);
  48295. this.compiledGlyphs[glyphId] = fn;
  48296. } catch (ex) {
  48297. this.compiledGlyphs[glyphId] = NOOP;
  48298. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  48299. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  48300. }
  48301. throw ex;
  48302. }
  48303. }
  48304. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  48305. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  48306. }
  48307. return fn;
  48308. }
  48309. compileGlyph(code, glyphId) {
  48310. if (!code || code.length === 0 || code[0] === 14) {
  48311. return NOOP;
  48312. }
  48313. let fontMatrix = this.fontMatrix;
  48314. if (this.isCFFCIDFont) {
  48315. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  48316. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  48317. const fontDict = this.fdArray[fdIndex];
  48318. fontMatrix =
  48319. fontDict.getByName("FontMatrix") ||
  48320. _util.FONT_IDENTITY_MATRIX;
  48321. } else {
  48322. (0, _util.warn)("Invalid fd index for glyph index.");
  48323. }
  48324. }
  48325. const cmds = [
  48326. {
  48327. cmd: "save",
  48328. },
  48329. {
  48330. cmd: "transform",
  48331. args: fontMatrix.slice(),
  48332. },
  48333. {
  48334. cmd: "scale",
  48335. args: ["size", "-size"],
  48336. },
  48337. ];
  48338. this.compileGlyphImpl(code, cmds, glyphId);
  48339. cmds.push({
  48340. cmd: "restore",
  48341. });
  48342. return cmds;
  48343. }
  48344. compileGlyphImpl() {
  48345. (0, _util.unreachable)("Children classes should implement this.");
  48346. }
  48347. hasBuiltPath(unicode) {
  48348. const { charCode, glyphId } = lookupCmap(this.cmap, unicode);
  48349. return (
  48350. this.compiledGlyphs[glyphId] !== undefined &&
  48351. this.compiledCharCodeToGlyphId[charCode] !== undefined
  48352. );
  48353. }
  48354. }
  48355. class TrueTypeCompiled extends CompiledFont {
  48356. constructor(glyphs, cmap, fontMatrix) {
  48357. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  48358. this.glyphs = glyphs;
  48359. this.cmap = cmap;
  48360. }
  48361. compileGlyphImpl(code, cmds) {
  48362. compileGlyf(code, cmds, this);
  48363. }
  48364. }
  48365. class Type2Compiled extends CompiledFont {
  48366. constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
  48367. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  48368. this.glyphs = cffInfo.glyphs;
  48369. this.gsubrs = cffInfo.gsubrs || [];
  48370. this.subrs = cffInfo.subrs || [];
  48371. this.cmap = cmap;
  48372. this.glyphNameMap =
  48373. glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
  48374. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  48375. this.subrsBias = getSubroutineBias(this.subrs);
  48376. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  48377. this.fdSelect = cffInfo.fdSelect;
  48378. this.fdArray = cffInfo.fdArray;
  48379. }
  48380. compileGlyphImpl(code, cmds, glyphId) {
  48381. compileCharString(code, cmds, this, glyphId);
  48382. }
  48383. }
  48384. class FontRendererFactory {
  48385. static create(font, seacAnalysisEnabled) {
  48386. const data = new Uint8Array(font.data);
  48387. let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  48388. const numTables = getUint16(data, 4);
  48389. for (let i = 0, p = 12; i < numTables; i++, p += 16) {
  48390. const tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
  48391. const offset = getUint32(data, p + 8);
  48392. const length = getUint32(data, p + 12);
  48393. switch (tag) {
  48394. case "cmap":
  48395. cmap = parseCmap(data, offset, offset + length);
  48396. break;
  48397. case "glyf":
  48398. glyf = data.subarray(offset, offset + length);
  48399. break;
  48400. case "loca":
  48401. loca = data.subarray(offset, offset + length);
  48402. break;
  48403. case "head":
  48404. unitsPerEm = getUint16(data, offset + 18);
  48405. indexToLocFormat = getUint16(data, offset + 50);
  48406. break;
  48407. case "CFF ":
  48408. cff = parseCff(
  48409. data,
  48410. offset,
  48411. offset + length,
  48412. seacAnalysisEnabled
  48413. );
  48414. break;
  48415. }
  48416. }
  48417. if (glyf) {
  48418. const fontMatrix = !unitsPerEm
  48419. ? font.fontMatrix
  48420. : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  48421. return new TrueTypeCompiled(
  48422. parseGlyfTable(glyf, loca, indexToLocFormat),
  48423. cmap,
  48424. fontMatrix
  48425. );
  48426. }
  48427. return new Type2Compiled(
  48428. cff,
  48429. cmap,
  48430. font.fontMatrix,
  48431. font.glyphNameMap
  48432. );
  48433. }
  48434. }
  48435. exports.FontRendererFactory = FontRendererFactory;
  48436. /***/
  48437. },
  48438. /* 45 */
  48439. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48440. Object.defineProperty(exports, "__esModule", {
  48441. value: true,
  48442. });
  48443. exports.getMetrics = exports.getFontBasicMetrics = void 0;
  48444. var _core_utils = __w_pdfjs_require__(6);
  48445. const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  48446. t.Courier = 600;
  48447. t["Courier-Bold"] = 600;
  48448. t["Courier-BoldOblique"] = 600;
  48449. t["Courier-Oblique"] = 600;
  48450. t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) {
  48451. t.space = 278;
  48452. t.exclam = 278;
  48453. t.quotedbl = 355;
  48454. t.numbersign = 556;
  48455. t.dollar = 556;
  48456. t.percent = 889;
  48457. t.ampersand = 667;
  48458. t.quoteright = 222;
  48459. t.parenleft = 333;
  48460. t.parenright = 333;
  48461. t.asterisk = 389;
  48462. t.plus = 584;
  48463. t.comma = 278;
  48464. t.hyphen = 333;
  48465. t.period = 278;
  48466. t.slash = 278;
  48467. t.zero = 556;
  48468. t.one = 556;
  48469. t.two = 556;
  48470. t.three = 556;
  48471. t.four = 556;
  48472. t.five = 556;
  48473. t.six = 556;
  48474. t.seven = 556;
  48475. t.eight = 556;
  48476. t.nine = 556;
  48477. t.colon = 278;
  48478. t.semicolon = 278;
  48479. t.less = 584;
  48480. t.equal = 584;
  48481. t.greater = 584;
  48482. t.question = 556;
  48483. t.at = 1015;
  48484. t.A = 667;
  48485. t.B = 667;
  48486. t.C = 722;
  48487. t.D = 722;
  48488. t.E = 667;
  48489. t.F = 611;
  48490. t.G = 778;
  48491. t.H = 722;
  48492. t.I = 278;
  48493. t.J = 500;
  48494. t.K = 667;
  48495. t.L = 556;
  48496. t.M = 833;
  48497. t.N = 722;
  48498. t.O = 778;
  48499. t.P = 667;
  48500. t.Q = 778;
  48501. t.R = 722;
  48502. t.S = 667;
  48503. t.T = 611;
  48504. t.U = 722;
  48505. t.V = 667;
  48506. t.W = 944;
  48507. t.X = 667;
  48508. t.Y = 667;
  48509. t.Z = 611;
  48510. t.bracketleft = 278;
  48511. t.backslash = 278;
  48512. t.bracketright = 278;
  48513. t.asciicircum = 469;
  48514. t.underscore = 556;
  48515. t.quoteleft = 222;
  48516. t.a = 556;
  48517. t.b = 556;
  48518. t.c = 500;
  48519. t.d = 556;
  48520. t.e = 556;
  48521. t.f = 278;
  48522. t.g = 556;
  48523. t.h = 556;
  48524. t.i = 222;
  48525. t.j = 222;
  48526. t.k = 500;
  48527. t.l = 222;
  48528. t.m = 833;
  48529. t.n = 556;
  48530. t.o = 556;
  48531. t.p = 556;
  48532. t.q = 556;
  48533. t.r = 333;
  48534. t.s = 500;
  48535. t.t = 278;
  48536. t.u = 556;
  48537. t.v = 500;
  48538. t.w = 722;
  48539. t.x = 500;
  48540. t.y = 500;
  48541. t.z = 500;
  48542. t.braceleft = 334;
  48543. t.bar = 260;
  48544. t.braceright = 334;
  48545. t.asciitilde = 584;
  48546. t.exclamdown = 333;
  48547. t.cent = 556;
  48548. t.sterling = 556;
  48549. t.fraction = 167;
  48550. t.yen = 556;
  48551. t.florin = 556;
  48552. t.section = 556;
  48553. t.currency = 556;
  48554. t.quotesingle = 191;
  48555. t.quotedblleft = 333;
  48556. t.guillemotleft = 556;
  48557. t.guilsinglleft = 333;
  48558. t.guilsinglright = 333;
  48559. t.fi = 500;
  48560. t.fl = 500;
  48561. t.endash = 556;
  48562. t.dagger = 556;
  48563. t.daggerdbl = 556;
  48564. t.periodcentered = 278;
  48565. t.paragraph = 537;
  48566. t.bullet = 350;
  48567. t.quotesinglbase = 222;
  48568. t.quotedblbase = 333;
  48569. t.quotedblright = 333;
  48570. t.guillemotright = 556;
  48571. t.ellipsis = 1000;
  48572. t.perthousand = 1000;
  48573. t.questiondown = 611;
  48574. t.grave = 333;
  48575. t.acute = 333;
  48576. t.circumflex = 333;
  48577. t.tilde = 333;
  48578. t.macron = 333;
  48579. t.breve = 333;
  48580. t.dotaccent = 333;
  48581. t.dieresis = 333;
  48582. t.ring = 333;
  48583. t.cedilla = 333;
  48584. t.hungarumlaut = 333;
  48585. t.ogonek = 333;
  48586. t.caron = 333;
  48587. t.emdash = 1000;
  48588. t.AE = 1000;
  48589. t.ordfeminine = 370;
  48590. t.Lslash = 556;
  48591. t.Oslash = 778;
  48592. t.OE = 1000;
  48593. t.ordmasculine = 365;
  48594. t.ae = 889;
  48595. t.dotlessi = 278;
  48596. t.lslash = 222;
  48597. t.oslash = 611;
  48598. t.oe = 944;
  48599. t.germandbls = 611;
  48600. t.Idieresis = 278;
  48601. t.eacute = 556;
  48602. t.abreve = 556;
  48603. t.uhungarumlaut = 556;
  48604. t.ecaron = 556;
  48605. t.Ydieresis = 667;
  48606. t.divide = 584;
  48607. t.Yacute = 667;
  48608. t.Acircumflex = 667;
  48609. t.aacute = 556;
  48610. t.Ucircumflex = 722;
  48611. t.yacute = 500;
  48612. t.scommaaccent = 500;
  48613. t.ecircumflex = 556;
  48614. t.Uring = 722;
  48615. t.Udieresis = 722;
  48616. t.aogonek = 556;
  48617. t.Uacute = 722;
  48618. t.uogonek = 556;
  48619. t.Edieresis = 667;
  48620. t.Dcroat = 722;
  48621. t.commaaccent = 250;
  48622. t.copyright = 737;
  48623. t.Emacron = 667;
  48624. t.ccaron = 500;
  48625. t.aring = 556;
  48626. t.Ncommaaccent = 722;
  48627. t.lacute = 222;
  48628. t.agrave = 556;
  48629. t.Tcommaaccent = 611;
  48630. t.Cacute = 722;
  48631. t.atilde = 556;
  48632. t.Edotaccent = 667;
  48633. t.scaron = 500;
  48634. t.scedilla = 500;
  48635. t.iacute = 278;
  48636. t.lozenge = 471;
  48637. t.Rcaron = 722;
  48638. t.Gcommaaccent = 778;
  48639. t.ucircumflex = 556;
  48640. t.acircumflex = 556;
  48641. t.Amacron = 667;
  48642. t.rcaron = 333;
  48643. t.ccedilla = 500;
  48644. t.Zdotaccent = 611;
  48645. t.Thorn = 667;
  48646. t.Omacron = 778;
  48647. t.Racute = 722;
  48648. t.Sacute = 667;
  48649. t.dcaron = 643;
  48650. t.Umacron = 722;
  48651. t.uring = 556;
  48652. t.threesuperior = 333;
  48653. t.Ograve = 778;
  48654. t.Agrave = 667;
  48655. t.Abreve = 667;
  48656. t.multiply = 584;
  48657. t.uacute = 556;
  48658. t.Tcaron = 611;
  48659. t.partialdiff = 476;
  48660. t.ydieresis = 500;
  48661. t.Nacute = 722;
  48662. t.icircumflex = 278;
  48663. t.Ecircumflex = 667;
  48664. t.adieresis = 556;
  48665. t.edieresis = 556;
  48666. t.cacute = 500;
  48667. t.nacute = 556;
  48668. t.umacron = 556;
  48669. t.Ncaron = 722;
  48670. t.Iacute = 278;
  48671. t.plusminus = 584;
  48672. t.brokenbar = 260;
  48673. t.registered = 737;
  48674. t.Gbreve = 778;
  48675. t.Idotaccent = 278;
  48676. t.summation = 600;
  48677. t.Egrave = 667;
  48678. t.racute = 333;
  48679. t.omacron = 556;
  48680. t.Zacute = 611;
  48681. t.Zcaron = 611;
  48682. t.greaterequal = 549;
  48683. t.Eth = 722;
  48684. t.Ccedilla = 722;
  48685. t.lcommaaccent = 222;
  48686. t.tcaron = 317;
  48687. t.eogonek = 556;
  48688. t.Uogonek = 722;
  48689. t.Aacute = 667;
  48690. t.Adieresis = 667;
  48691. t.egrave = 556;
  48692. t.zacute = 500;
  48693. t.iogonek = 222;
  48694. t.Oacute = 778;
  48695. t.oacute = 556;
  48696. t.amacron = 556;
  48697. t.sacute = 500;
  48698. t.idieresis = 278;
  48699. t.Ocircumflex = 778;
  48700. t.Ugrave = 722;
  48701. t.Delta = 612;
  48702. t.thorn = 556;
  48703. t.twosuperior = 333;
  48704. t.Odieresis = 778;
  48705. t.mu = 556;
  48706. t.igrave = 278;
  48707. t.ohungarumlaut = 556;
  48708. t.Eogonek = 667;
  48709. t.dcroat = 556;
  48710. t.threequarters = 834;
  48711. t.Scedilla = 667;
  48712. t.lcaron = 299;
  48713. t.Kcommaaccent = 667;
  48714. t.Lacute = 556;
  48715. t.trademark = 1000;
  48716. t.edotaccent = 556;
  48717. t.Igrave = 278;
  48718. t.Imacron = 278;
  48719. t.Lcaron = 556;
  48720. t.onehalf = 834;
  48721. t.lessequal = 549;
  48722. t.ocircumflex = 556;
  48723. t.ntilde = 556;
  48724. t.Uhungarumlaut = 722;
  48725. t.Eacute = 667;
  48726. t.emacron = 556;
  48727. t.gbreve = 556;
  48728. t.onequarter = 834;
  48729. t.Scaron = 667;
  48730. t.Scommaaccent = 667;
  48731. t.Ohungarumlaut = 778;
  48732. t.degree = 400;
  48733. t.ograve = 556;
  48734. t.Ccaron = 722;
  48735. t.ugrave = 556;
  48736. t.radical = 453;
  48737. t.Dcaron = 722;
  48738. t.rcommaaccent = 333;
  48739. t.Ntilde = 722;
  48740. t.otilde = 556;
  48741. t.Rcommaaccent = 722;
  48742. t.Lcommaaccent = 556;
  48743. t.Atilde = 667;
  48744. t.Aogonek = 667;
  48745. t.Aring = 667;
  48746. t.Otilde = 778;
  48747. t.zdotaccent = 500;
  48748. t.Ecaron = 667;
  48749. t.Iogonek = 278;
  48750. t.kcommaaccent = 500;
  48751. t.minus = 584;
  48752. t.Icircumflex = 278;
  48753. t.ncaron = 556;
  48754. t.tcommaaccent = 278;
  48755. t.logicalnot = 584;
  48756. t.odieresis = 556;
  48757. t.udieresis = 556;
  48758. t.notequal = 549;
  48759. t.gcommaaccent = 556;
  48760. t.eth = 556;
  48761. t.zcaron = 500;
  48762. t.ncommaaccent = 556;
  48763. t.onesuperior = 333;
  48764. t.imacron = 278;
  48765. t.Euro = 556;
  48766. });
  48767. t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(
  48768. function (t) {
  48769. t.space = 278;
  48770. t.exclam = 333;
  48771. t.quotedbl = 474;
  48772. t.numbersign = 556;
  48773. t.dollar = 556;
  48774. t.percent = 889;
  48775. t.ampersand = 722;
  48776. t.quoteright = 278;
  48777. t.parenleft = 333;
  48778. t.parenright = 333;
  48779. t.asterisk = 389;
  48780. t.plus = 584;
  48781. t.comma = 278;
  48782. t.hyphen = 333;
  48783. t.period = 278;
  48784. t.slash = 278;
  48785. t.zero = 556;
  48786. t.one = 556;
  48787. t.two = 556;
  48788. t.three = 556;
  48789. t.four = 556;
  48790. t.five = 556;
  48791. t.six = 556;
  48792. t.seven = 556;
  48793. t.eight = 556;
  48794. t.nine = 556;
  48795. t.colon = 333;
  48796. t.semicolon = 333;
  48797. t.less = 584;
  48798. t.equal = 584;
  48799. t.greater = 584;
  48800. t.question = 611;
  48801. t.at = 975;
  48802. t.A = 722;
  48803. t.B = 722;
  48804. t.C = 722;
  48805. t.D = 722;
  48806. t.E = 667;
  48807. t.F = 611;
  48808. t.G = 778;
  48809. t.H = 722;
  48810. t.I = 278;
  48811. t.J = 556;
  48812. t.K = 722;
  48813. t.L = 611;
  48814. t.M = 833;
  48815. t.N = 722;
  48816. t.O = 778;
  48817. t.P = 667;
  48818. t.Q = 778;
  48819. t.R = 722;
  48820. t.S = 667;
  48821. t.T = 611;
  48822. t.U = 722;
  48823. t.V = 667;
  48824. t.W = 944;
  48825. t.X = 667;
  48826. t.Y = 667;
  48827. t.Z = 611;
  48828. t.bracketleft = 333;
  48829. t.backslash = 278;
  48830. t.bracketright = 333;
  48831. t.asciicircum = 584;
  48832. t.underscore = 556;
  48833. t.quoteleft = 278;
  48834. t.a = 556;
  48835. t.b = 611;
  48836. t.c = 556;
  48837. t.d = 611;
  48838. t.e = 556;
  48839. t.f = 333;
  48840. t.g = 611;
  48841. t.h = 611;
  48842. t.i = 278;
  48843. t.j = 278;
  48844. t.k = 556;
  48845. t.l = 278;
  48846. t.m = 889;
  48847. t.n = 611;
  48848. t.o = 611;
  48849. t.p = 611;
  48850. t.q = 611;
  48851. t.r = 389;
  48852. t.s = 556;
  48853. t.t = 333;
  48854. t.u = 611;
  48855. t.v = 556;
  48856. t.w = 778;
  48857. t.x = 556;
  48858. t.y = 556;
  48859. t.z = 500;
  48860. t.braceleft = 389;
  48861. t.bar = 280;
  48862. t.braceright = 389;
  48863. t.asciitilde = 584;
  48864. t.exclamdown = 333;
  48865. t.cent = 556;
  48866. t.sterling = 556;
  48867. t.fraction = 167;
  48868. t.yen = 556;
  48869. t.florin = 556;
  48870. t.section = 556;
  48871. t.currency = 556;
  48872. t.quotesingle = 238;
  48873. t.quotedblleft = 500;
  48874. t.guillemotleft = 556;
  48875. t.guilsinglleft = 333;
  48876. t.guilsinglright = 333;
  48877. t.fi = 611;
  48878. t.fl = 611;
  48879. t.endash = 556;
  48880. t.dagger = 556;
  48881. t.daggerdbl = 556;
  48882. t.periodcentered = 278;
  48883. t.paragraph = 556;
  48884. t.bullet = 350;
  48885. t.quotesinglbase = 278;
  48886. t.quotedblbase = 500;
  48887. t.quotedblright = 500;
  48888. t.guillemotright = 556;
  48889. t.ellipsis = 1000;
  48890. t.perthousand = 1000;
  48891. t.questiondown = 611;
  48892. t.grave = 333;
  48893. t.acute = 333;
  48894. t.circumflex = 333;
  48895. t.tilde = 333;
  48896. t.macron = 333;
  48897. t.breve = 333;
  48898. t.dotaccent = 333;
  48899. t.dieresis = 333;
  48900. t.ring = 333;
  48901. t.cedilla = 333;
  48902. t.hungarumlaut = 333;
  48903. t.ogonek = 333;
  48904. t.caron = 333;
  48905. t.emdash = 1000;
  48906. t.AE = 1000;
  48907. t.ordfeminine = 370;
  48908. t.Lslash = 611;
  48909. t.Oslash = 778;
  48910. t.OE = 1000;
  48911. t.ordmasculine = 365;
  48912. t.ae = 889;
  48913. t.dotlessi = 278;
  48914. t.lslash = 278;
  48915. t.oslash = 611;
  48916. t.oe = 944;
  48917. t.germandbls = 611;
  48918. t.Idieresis = 278;
  48919. t.eacute = 556;
  48920. t.abreve = 556;
  48921. t.uhungarumlaut = 611;
  48922. t.ecaron = 556;
  48923. t.Ydieresis = 667;
  48924. t.divide = 584;
  48925. t.Yacute = 667;
  48926. t.Acircumflex = 722;
  48927. t.aacute = 556;
  48928. t.Ucircumflex = 722;
  48929. t.yacute = 556;
  48930. t.scommaaccent = 556;
  48931. t.ecircumflex = 556;
  48932. t.Uring = 722;
  48933. t.Udieresis = 722;
  48934. t.aogonek = 556;
  48935. t.Uacute = 722;
  48936. t.uogonek = 611;
  48937. t.Edieresis = 667;
  48938. t.Dcroat = 722;
  48939. t.commaaccent = 250;
  48940. t.copyright = 737;
  48941. t.Emacron = 667;
  48942. t.ccaron = 556;
  48943. t.aring = 556;
  48944. t.Ncommaaccent = 722;
  48945. t.lacute = 278;
  48946. t.agrave = 556;
  48947. t.Tcommaaccent = 611;
  48948. t.Cacute = 722;
  48949. t.atilde = 556;
  48950. t.Edotaccent = 667;
  48951. t.scaron = 556;
  48952. t.scedilla = 556;
  48953. t.iacute = 278;
  48954. t.lozenge = 494;
  48955. t.Rcaron = 722;
  48956. t.Gcommaaccent = 778;
  48957. t.ucircumflex = 611;
  48958. t.acircumflex = 556;
  48959. t.Amacron = 722;
  48960. t.rcaron = 389;
  48961. t.ccedilla = 556;
  48962. t.Zdotaccent = 611;
  48963. t.Thorn = 667;
  48964. t.Omacron = 778;
  48965. t.Racute = 722;
  48966. t.Sacute = 667;
  48967. t.dcaron = 743;
  48968. t.Umacron = 722;
  48969. t.uring = 611;
  48970. t.threesuperior = 333;
  48971. t.Ograve = 778;
  48972. t.Agrave = 722;
  48973. t.Abreve = 722;
  48974. t.multiply = 584;
  48975. t.uacute = 611;
  48976. t.Tcaron = 611;
  48977. t.partialdiff = 494;
  48978. t.ydieresis = 556;
  48979. t.Nacute = 722;
  48980. t.icircumflex = 278;
  48981. t.Ecircumflex = 667;
  48982. t.adieresis = 556;
  48983. t.edieresis = 556;
  48984. t.cacute = 556;
  48985. t.nacute = 611;
  48986. t.umacron = 611;
  48987. t.Ncaron = 722;
  48988. t.Iacute = 278;
  48989. t.plusminus = 584;
  48990. t.brokenbar = 280;
  48991. t.registered = 737;
  48992. t.Gbreve = 778;
  48993. t.Idotaccent = 278;
  48994. t.summation = 600;
  48995. t.Egrave = 667;
  48996. t.racute = 389;
  48997. t.omacron = 611;
  48998. t.Zacute = 611;
  48999. t.Zcaron = 611;
  49000. t.greaterequal = 549;
  49001. t.Eth = 722;
  49002. t.Ccedilla = 722;
  49003. t.lcommaaccent = 278;
  49004. t.tcaron = 389;
  49005. t.eogonek = 556;
  49006. t.Uogonek = 722;
  49007. t.Aacute = 722;
  49008. t.Adieresis = 722;
  49009. t.egrave = 556;
  49010. t.zacute = 500;
  49011. t.iogonek = 278;
  49012. t.Oacute = 778;
  49013. t.oacute = 611;
  49014. t.amacron = 556;
  49015. t.sacute = 556;
  49016. t.idieresis = 278;
  49017. t.Ocircumflex = 778;
  49018. t.Ugrave = 722;
  49019. t.Delta = 612;
  49020. t.thorn = 611;
  49021. t.twosuperior = 333;
  49022. t.Odieresis = 778;
  49023. t.mu = 611;
  49024. t.igrave = 278;
  49025. t.ohungarumlaut = 611;
  49026. t.Eogonek = 667;
  49027. t.dcroat = 611;
  49028. t.threequarters = 834;
  49029. t.Scedilla = 667;
  49030. t.lcaron = 400;
  49031. t.Kcommaaccent = 722;
  49032. t.Lacute = 611;
  49033. t.trademark = 1000;
  49034. t.edotaccent = 556;
  49035. t.Igrave = 278;
  49036. t.Imacron = 278;
  49037. t.Lcaron = 611;
  49038. t.onehalf = 834;
  49039. t.lessequal = 549;
  49040. t.ocircumflex = 611;
  49041. t.ntilde = 611;
  49042. t.Uhungarumlaut = 722;
  49043. t.Eacute = 667;
  49044. t.emacron = 556;
  49045. t.gbreve = 611;
  49046. t.onequarter = 834;
  49047. t.Scaron = 667;
  49048. t.Scommaaccent = 667;
  49049. t.Ohungarumlaut = 778;
  49050. t.degree = 400;
  49051. t.ograve = 611;
  49052. t.Ccaron = 722;
  49053. t.ugrave = 611;
  49054. t.radical = 549;
  49055. t.Dcaron = 722;
  49056. t.rcommaaccent = 389;
  49057. t.Ntilde = 722;
  49058. t.otilde = 611;
  49059. t.Rcommaaccent = 722;
  49060. t.Lcommaaccent = 611;
  49061. t.Atilde = 722;
  49062. t.Aogonek = 722;
  49063. t.Aring = 722;
  49064. t.Otilde = 778;
  49065. t.zdotaccent = 500;
  49066. t.Ecaron = 667;
  49067. t.Iogonek = 278;
  49068. t.kcommaaccent = 556;
  49069. t.minus = 584;
  49070. t.Icircumflex = 278;
  49071. t.ncaron = 611;
  49072. t.tcommaaccent = 333;
  49073. t.logicalnot = 584;
  49074. t.odieresis = 611;
  49075. t.udieresis = 611;
  49076. t.notequal = 549;
  49077. t.gcommaaccent = 611;
  49078. t.eth = 611;
  49079. t.zcaron = 500;
  49080. t.ncommaaccent = 611;
  49081. t.onesuperior = 333;
  49082. t.imacron = 278;
  49083. t.Euro = 556;
  49084. }
  49085. );
  49086. t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(
  49087. function (t) {
  49088. t.space = 278;
  49089. t.exclam = 333;
  49090. t.quotedbl = 474;
  49091. t.numbersign = 556;
  49092. t.dollar = 556;
  49093. t.percent = 889;
  49094. t.ampersand = 722;
  49095. t.quoteright = 278;
  49096. t.parenleft = 333;
  49097. t.parenright = 333;
  49098. t.asterisk = 389;
  49099. t.plus = 584;
  49100. t.comma = 278;
  49101. t.hyphen = 333;
  49102. t.period = 278;
  49103. t.slash = 278;
  49104. t.zero = 556;
  49105. t.one = 556;
  49106. t.two = 556;
  49107. t.three = 556;
  49108. t.four = 556;
  49109. t.five = 556;
  49110. t.six = 556;
  49111. t.seven = 556;
  49112. t.eight = 556;
  49113. t.nine = 556;
  49114. t.colon = 333;
  49115. t.semicolon = 333;
  49116. t.less = 584;
  49117. t.equal = 584;
  49118. t.greater = 584;
  49119. t.question = 611;
  49120. t.at = 975;
  49121. t.A = 722;
  49122. t.B = 722;
  49123. t.C = 722;
  49124. t.D = 722;
  49125. t.E = 667;
  49126. t.F = 611;
  49127. t.G = 778;
  49128. t.H = 722;
  49129. t.I = 278;
  49130. t.J = 556;
  49131. t.K = 722;
  49132. t.L = 611;
  49133. t.M = 833;
  49134. t.N = 722;
  49135. t.O = 778;
  49136. t.P = 667;
  49137. t.Q = 778;
  49138. t.R = 722;
  49139. t.S = 667;
  49140. t.T = 611;
  49141. t.U = 722;
  49142. t.V = 667;
  49143. t.W = 944;
  49144. t.X = 667;
  49145. t.Y = 667;
  49146. t.Z = 611;
  49147. t.bracketleft = 333;
  49148. t.backslash = 278;
  49149. t.bracketright = 333;
  49150. t.asciicircum = 584;
  49151. t.underscore = 556;
  49152. t.quoteleft = 278;
  49153. t.a = 556;
  49154. t.b = 611;
  49155. t.c = 556;
  49156. t.d = 611;
  49157. t.e = 556;
  49158. t.f = 333;
  49159. t.g = 611;
  49160. t.h = 611;
  49161. t.i = 278;
  49162. t.j = 278;
  49163. t.k = 556;
  49164. t.l = 278;
  49165. t.m = 889;
  49166. t.n = 611;
  49167. t.o = 611;
  49168. t.p = 611;
  49169. t.q = 611;
  49170. t.r = 389;
  49171. t.s = 556;
  49172. t.t = 333;
  49173. t.u = 611;
  49174. t.v = 556;
  49175. t.w = 778;
  49176. t.x = 556;
  49177. t.y = 556;
  49178. t.z = 500;
  49179. t.braceleft = 389;
  49180. t.bar = 280;
  49181. t.braceright = 389;
  49182. t.asciitilde = 584;
  49183. t.exclamdown = 333;
  49184. t.cent = 556;
  49185. t.sterling = 556;
  49186. t.fraction = 167;
  49187. t.yen = 556;
  49188. t.florin = 556;
  49189. t.section = 556;
  49190. t.currency = 556;
  49191. t.quotesingle = 238;
  49192. t.quotedblleft = 500;
  49193. t.guillemotleft = 556;
  49194. t.guilsinglleft = 333;
  49195. t.guilsinglright = 333;
  49196. t.fi = 611;
  49197. t.fl = 611;
  49198. t.endash = 556;
  49199. t.dagger = 556;
  49200. t.daggerdbl = 556;
  49201. t.periodcentered = 278;
  49202. t.paragraph = 556;
  49203. t.bullet = 350;
  49204. t.quotesinglbase = 278;
  49205. t.quotedblbase = 500;
  49206. t.quotedblright = 500;
  49207. t.guillemotright = 556;
  49208. t.ellipsis = 1000;
  49209. t.perthousand = 1000;
  49210. t.questiondown = 611;
  49211. t.grave = 333;
  49212. t.acute = 333;
  49213. t.circumflex = 333;
  49214. t.tilde = 333;
  49215. t.macron = 333;
  49216. t.breve = 333;
  49217. t.dotaccent = 333;
  49218. t.dieresis = 333;
  49219. t.ring = 333;
  49220. t.cedilla = 333;
  49221. t.hungarumlaut = 333;
  49222. t.ogonek = 333;
  49223. t.caron = 333;
  49224. t.emdash = 1000;
  49225. t.AE = 1000;
  49226. t.ordfeminine = 370;
  49227. t.Lslash = 611;
  49228. t.Oslash = 778;
  49229. t.OE = 1000;
  49230. t.ordmasculine = 365;
  49231. t.ae = 889;
  49232. t.dotlessi = 278;
  49233. t.lslash = 278;
  49234. t.oslash = 611;
  49235. t.oe = 944;
  49236. t.germandbls = 611;
  49237. t.Idieresis = 278;
  49238. t.eacute = 556;
  49239. t.abreve = 556;
  49240. t.uhungarumlaut = 611;
  49241. t.ecaron = 556;
  49242. t.Ydieresis = 667;
  49243. t.divide = 584;
  49244. t.Yacute = 667;
  49245. t.Acircumflex = 722;
  49246. t.aacute = 556;
  49247. t.Ucircumflex = 722;
  49248. t.yacute = 556;
  49249. t.scommaaccent = 556;
  49250. t.ecircumflex = 556;
  49251. t.Uring = 722;
  49252. t.Udieresis = 722;
  49253. t.aogonek = 556;
  49254. t.Uacute = 722;
  49255. t.uogonek = 611;
  49256. t.Edieresis = 667;
  49257. t.Dcroat = 722;
  49258. t.commaaccent = 250;
  49259. t.copyright = 737;
  49260. t.Emacron = 667;
  49261. t.ccaron = 556;
  49262. t.aring = 556;
  49263. t.Ncommaaccent = 722;
  49264. t.lacute = 278;
  49265. t.agrave = 556;
  49266. t.Tcommaaccent = 611;
  49267. t.Cacute = 722;
  49268. t.atilde = 556;
  49269. t.Edotaccent = 667;
  49270. t.scaron = 556;
  49271. t.scedilla = 556;
  49272. t.iacute = 278;
  49273. t.lozenge = 494;
  49274. t.Rcaron = 722;
  49275. t.Gcommaaccent = 778;
  49276. t.ucircumflex = 611;
  49277. t.acircumflex = 556;
  49278. t.Amacron = 722;
  49279. t.rcaron = 389;
  49280. t.ccedilla = 556;
  49281. t.Zdotaccent = 611;
  49282. t.Thorn = 667;
  49283. t.Omacron = 778;
  49284. t.Racute = 722;
  49285. t.Sacute = 667;
  49286. t.dcaron = 743;
  49287. t.Umacron = 722;
  49288. t.uring = 611;
  49289. t.threesuperior = 333;
  49290. t.Ograve = 778;
  49291. t.Agrave = 722;
  49292. t.Abreve = 722;
  49293. t.multiply = 584;
  49294. t.uacute = 611;
  49295. t.Tcaron = 611;
  49296. t.partialdiff = 494;
  49297. t.ydieresis = 556;
  49298. t.Nacute = 722;
  49299. t.icircumflex = 278;
  49300. t.Ecircumflex = 667;
  49301. t.adieresis = 556;
  49302. t.edieresis = 556;
  49303. t.cacute = 556;
  49304. t.nacute = 611;
  49305. t.umacron = 611;
  49306. t.Ncaron = 722;
  49307. t.Iacute = 278;
  49308. t.plusminus = 584;
  49309. t.brokenbar = 280;
  49310. t.registered = 737;
  49311. t.Gbreve = 778;
  49312. t.Idotaccent = 278;
  49313. t.summation = 600;
  49314. t.Egrave = 667;
  49315. t.racute = 389;
  49316. t.omacron = 611;
  49317. t.Zacute = 611;
  49318. t.Zcaron = 611;
  49319. t.greaterequal = 549;
  49320. t.Eth = 722;
  49321. t.Ccedilla = 722;
  49322. t.lcommaaccent = 278;
  49323. t.tcaron = 389;
  49324. t.eogonek = 556;
  49325. t.Uogonek = 722;
  49326. t.Aacute = 722;
  49327. t.Adieresis = 722;
  49328. t.egrave = 556;
  49329. t.zacute = 500;
  49330. t.iogonek = 278;
  49331. t.Oacute = 778;
  49332. t.oacute = 611;
  49333. t.amacron = 556;
  49334. t.sacute = 556;
  49335. t.idieresis = 278;
  49336. t.Ocircumflex = 778;
  49337. t.Ugrave = 722;
  49338. t.Delta = 612;
  49339. t.thorn = 611;
  49340. t.twosuperior = 333;
  49341. t.Odieresis = 778;
  49342. t.mu = 611;
  49343. t.igrave = 278;
  49344. t.ohungarumlaut = 611;
  49345. t.Eogonek = 667;
  49346. t.dcroat = 611;
  49347. t.threequarters = 834;
  49348. t.Scedilla = 667;
  49349. t.lcaron = 400;
  49350. t.Kcommaaccent = 722;
  49351. t.Lacute = 611;
  49352. t.trademark = 1000;
  49353. t.edotaccent = 556;
  49354. t.Igrave = 278;
  49355. t.Imacron = 278;
  49356. t.Lcaron = 611;
  49357. t.onehalf = 834;
  49358. t.lessequal = 549;
  49359. t.ocircumflex = 611;
  49360. t.ntilde = 611;
  49361. t.Uhungarumlaut = 722;
  49362. t.Eacute = 667;
  49363. t.emacron = 556;
  49364. t.gbreve = 611;
  49365. t.onequarter = 834;
  49366. t.Scaron = 667;
  49367. t.Scommaaccent = 667;
  49368. t.Ohungarumlaut = 778;
  49369. t.degree = 400;
  49370. t.ograve = 611;
  49371. t.Ccaron = 722;
  49372. t.ugrave = 611;
  49373. t.radical = 549;
  49374. t.Dcaron = 722;
  49375. t.rcommaaccent = 389;
  49376. t.Ntilde = 722;
  49377. t.otilde = 611;
  49378. t.Rcommaaccent = 722;
  49379. t.Lcommaaccent = 611;
  49380. t.Atilde = 722;
  49381. t.Aogonek = 722;
  49382. t.Aring = 722;
  49383. t.Otilde = 778;
  49384. t.zdotaccent = 500;
  49385. t.Ecaron = 667;
  49386. t.Iogonek = 278;
  49387. t.kcommaaccent = 556;
  49388. t.minus = 584;
  49389. t.Icircumflex = 278;
  49390. t.ncaron = 611;
  49391. t.tcommaaccent = 333;
  49392. t.logicalnot = 584;
  49393. t.odieresis = 611;
  49394. t.udieresis = 611;
  49395. t.notequal = 549;
  49396. t.gcommaaccent = 611;
  49397. t.eth = 611;
  49398. t.zcaron = 500;
  49399. t.ncommaaccent = 611;
  49400. t.onesuperior = 333;
  49401. t.imacron = 278;
  49402. t.Euro = 556;
  49403. }
  49404. );
  49405. t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(
  49406. function (t) {
  49407. t.space = 278;
  49408. t.exclam = 278;
  49409. t.quotedbl = 355;
  49410. t.numbersign = 556;
  49411. t.dollar = 556;
  49412. t.percent = 889;
  49413. t.ampersand = 667;
  49414. t.quoteright = 222;
  49415. t.parenleft = 333;
  49416. t.parenright = 333;
  49417. t.asterisk = 389;
  49418. t.plus = 584;
  49419. t.comma = 278;
  49420. t.hyphen = 333;
  49421. t.period = 278;
  49422. t.slash = 278;
  49423. t.zero = 556;
  49424. t.one = 556;
  49425. t.two = 556;
  49426. t.three = 556;
  49427. t.four = 556;
  49428. t.five = 556;
  49429. t.six = 556;
  49430. t.seven = 556;
  49431. t.eight = 556;
  49432. t.nine = 556;
  49433. t.colon = 278;
  49434. t.semicolon = 278;
  49435. t.less = 584;
  49436. t.equal = 584;
  49437. t.greater = 584;
  49438. t.question = 556;
  49439. t.at = 1015;
  49440. t.A = 667;
  49441. t.B = 667;
  49442. t.C = 722;
  49443. t.D = 722;
  49444. t.E = 667;
  49445. t.F = 611;
  49446. t.G = 778;
  49447. t.H = 722;
  49448. t.I = 278;
  49449. t.J = 500;
  49450. t.K = 667;
  49451. t.L = 556;
  49452. t.M = 833;
  49453. t.N = 722;
  49454. t.O = 778;
  49455. t.P = 667;
  49456. t.Q = 778;
  49457. t.R = 722;
  49458. t.S = 667;
  49459. t.T = 611;
  49460. t.U = 722;
  49461. t.V = 667;
  49462. t.W = 944;
  49463. t.X = 667;
  49464. t.Y = 667;
  49465. t.Z = 611;
  49466. t.bracketleft = 278;
  49467. t.backslash = 278;
  49468. t.bracketright = 278;
  49469. t.asciicircum = 469;
  49470. t.underscore = 556;
  49471. t.quoteleft = 222;
  49472. t.a = 556;
  49473. t.b = 556;
  49474. t.c = 500;
  49475. t.d = 556;
  49476. t.e = 556;
  49477. t.f = 278;
  49478. t.g = 556;
  49479. t.h = 556;
  49480. t.i = 222;
  49481. t.j = 222;
  49482. t.k = 500;
  49483. t.l = 222;
  49484. t.m = 833;
  49485. t.n = 556;
  49486. t.o = 556;
  49487. t.p = 556;
  49488. t.q = 556;
  49489. t.r = 333;
  49490. t.s = 500;
  49491. t.t = 278;
  49492. t.u = 556;
  49493. t.v = 500;
  49494. t.w = 722;
  49495. t.x = 500;
  49496. t.y = 500;
  49497. t.z = 500;
  49498. t.braceleft = 334;
  49499. t.bar = 260;
  49500. t.braceright = 334;
  49501. t.asciitilde = 584;
  49502. t.exclamdown = 333;
  49503. t.cent = 556;
  49504. t.sterling = 556;
  49505. t.fraction = 167;
  49506. t.yen = 556;
  49507. t.florin = 556;
  49508. t.section = 556;
  49509. t.currency = 556;
  49510. t.quotesingle = 191;
  49511. t.quotedblleft = 333;
  49512. t.guillemotleft = 556;
  49513. t.guilsinglleft = 333;
  49514. t.guilsinglright = 333;
  49515. t.fi = 500;
  49516. t.fl = 500;
  49517. t.endash = 556;
  49518. t.dagger = 556;
  49519. t.daggerdbl = 556;
  49520. t.periodcentered = 278;
  49521. t.paragraph = 537;
  49522. t.bullet = 350;
  49523. t.quotesinglbase = 222;
  49524. t.quotedblbase = 333;
  49525. t.quotedblright = 333;
  49526. t.guillemotright = 556;
  49527. t.ellipsis = 1000;
  49528. t.perthousand = 1000;
  49529. t.questiondown = 611;
  49530. t.grave = 333;
  49531. t.acute = 333;
  49532. t.circumflex = 333;
  49533. t.tilde = 333;
  49534. t.macron = 333;
  49535. t.breve = 333;
  49536. t.dotaccent = 333;
  49537. t.dieresis = 333;
  49538. t.ring = 333;
  49539. t.cedilla = 333;
  49540. t.hungarumlaut = 333;
  49541. t.ogonek = 333;
  49542. t.caron = 333;
  49543. t.emdash = 1000;
  49544. t.AE = 1000;
  49545. t.ordfeminine = 370;
  49546. t.Lslash = 556;
  49547. t.Oslash = 778;
  49548. t.OE = 1000;
  49549. t.ordmasculine = 365;
  49550. t.ae = 889;
  49551. t.dotlessi = 278;
  49552. t.lslash = 222;
  49553. t.oslash = 611;
  49554. t.oe = 944;
  49555. t.germandbls = 611;
  49556. t.Idieresis = 278;
  49557. t.eacute = 556;
  49558. t.abreve = 556;
  49559. t.uhungarumlaut = 556;
  49560. t.ecaron = 556;
  49561. t.Ydieresis = 667;
  49562. t.divide = 584;
  49563. t.Yacute = 667;
  49564. t.Acircumflex = 667;
  49565. t.aacute = 556;
  49566. t.Ucircumflex = 722;
  49567. t.yacute = 500;
  49568. t.scommaaccent = 500;
  49569. t.ecircumflex = 556;
  49570. t.Uring = 722;
  49571. t.Udieresis = 722;
  49572. t.aogonek = 556;
  49573. t.Uacute = 722;
  49574. t.uogonek = 556;
  49575. t.Edieresis = 667;
  49576. t.Dcroat = 722;
  49577. t.commaaccent = 250;
  49578. t.copyright = 737;
  49579. t.Emacron = 667;
  49580. t.ccaron = 500;
  49581. t.aring = 556;
  49582. t.Ncommaaccent = 722;
  49583. t.lacute = 222;
  49584. t.agrave = 556;
  49585. t.Tcommaaccent = 611;
  49586. t.Cacute = 722;
  49587. t.atilde = 556;
  49588. t.Edotaccent = 667;
  49589. t.scaron = 500;
  49590. t.scedilla = 500;
  49591. t.iacute = 278;
  49592. t.lozenge = 471;
  49593. t.Rcaron = 722;
  49594. t.Gcommaaccent = 778;
  49595. t.ucircumflex = 556;
  49596. t.acircumflex = 556;
  49597. t.Amacron = 667;
  49598. t.rcaron = 333;
  49599. t.ccedilla = 500;
  49600. t.Zdotaccent = 611;
  49601. t.Thorn = 667;
  49602. t.Omacron = 778;
  49603. t.Racute = 722;
  49604. t.Sacute = 667;
  49605. t.dcaron = 643;
  49606. t.Umacron = 722;
  49607. t.uring = 556;
  49608. t.threesuperior = 333;
  49609. t.Ograve = 778;
  49610. t.Agrave = 667;
  49611. t.Abreve = 667;
  49612. t.multiply = 584;
  49613. t.uacute = 556;
  49614. t.Tcaron = 611;
  49615. t.partialdiff = 476;
  49616. t.ydieresis = 500;
  49617. t.Nacute = 722;
  49618. t.icircumflex = 278;
  49619. t.Ecircumflex = 667;
  49620. t.adieresis = 556;
  49621. t.edieresis = 556;
  49622. t.cacute = 500;
  49623. t.nacute = 556;
  49624. t.umacron = 556;
  49625. t.Ncaron = 722;
  49626. t.Iacute = 278;
  49627. t.plusminus = 584;
  49628. t.brokenbar = 260;
  49629. t.registered = 737;
  49630. t.Gbreve = 778;
  49631. t.Idotaccent = 278;
  49632. t.summation = 600;
  49633. t.Egrave = 667;
  49634. t.racute = 333;
  49635. t.omacron = 556;
  49636. t.Zacute = 611;
  49637. t.Zcaron = 611;
  49638. t.greaterequal = 549;
  49639. t.Eth = 722;
  49640. t.Ccedilla = 722;
  49641. t.lcommaaccent = 222;
  49642. t.tcaron = 317;
  49643. t.eogonek = 556;
  49644. t.Uogonek = 722;
  49645. t.Aacute = 667;
  49646. t.Adieresis = 667;
  49647. t.egrave = 556;
  49648. t.zacute = 500;
  49649. t.iogonek = 222;
  49650. t.Oacute = 778;
  49651. t.oacute = 556;
  49652. t.amacron = 556;
  49653. t.sacute = 500;
  49654. t.idieresis = 278;
  49655. t.Ocircumflex = 778;
  49656. t.Ugrave = 722;
  49657. t.Delta = 612;
  49658. t.thorn = 556;
  49659. t.twosuperior = 333;
  49660. t.Odieresis = 778;
  49661. t.mu = 556;
  49662. t.igrave = 278;
  49663. t.ohungarumlaut = 556;
  49664. t.Eogonek = 667;
  49665. t.dcroat = 556;
  49666. t.threequarters = 834;
  49667. t.Scedilla = 667;
  49668. t.lcaron = 299;
  49669. t.Kcommaaccent = 667;
  49670. t.Lacute = 556;
  49671. t.trademark = 1000;
  49672. t.edotaccent = 556;
  49673. t.Igrave = 278;
  49674. t.Imacron = 278;
  49675. t.Lcaron = 556;
  49676. t.onehalf = 834;
  49677. t.lessequal = 549;
  49678. t.ocircumflex = 556;
  49679. t.ntilde = 556;
  49680. t.Uhungarumlaut = 722;
  49681. t.Eacute = 667;
  49682. t.emacron = 556;
  49683. t.gbreve = 556;
  49684. t.onequarter = 834;
  49685. t.Scaron = 667;
  49686. t.Scommaaccent = 667;
  49687. t.Ohungarumlaut = 778;
  49688. t.degree = 400;
  49689. t.ograve = 556;
  49690. t.Ccaron = 722;
  49691. t.ugrave = 556;
  49692. t.radical = 453;
  49693. t.Dcaron = 722;
  49694. t.rcommaaccent = 333;
  49695. t.Ntilde = 722;
  49696. t.otilde = 556;
  49697. t.Rcommaaccent = 722;
  49698. t.Lcommaaccent = 556;
  49699. t.Atilde = 667;
  49700. t.Aogonek = 667;
  49701. t.Aring = 667;
  49702. t.Otilde = 778;
  49703. t.zdotaccent = 500;
  49704. t.Ecaron = 667;
  49705. t.Iogonek = 278;
  49706. t.kcommaaccent = 500;
  49707. t.minus = 584;
  49708. t.Icircumflex = 278;
  49709. t.ncaron = 556;
  49710. t.tcommaaccent = 278;
  49711. t.logicalnot = 584;
  49712. t.odieresis = 556;
  49713. t.udieresis = 556;
  49714. t.notequal = 549;
  49715. t.gcommaaccent = 556;
  49716. t.eth = 556;
  49717. t.zcaron = 500;
  49718. t.ncommaaccent = 556;
  49719. t.onesuperior = 333;
  49720. t.imacron = 278;
  49721. t.Euro = 556;
  49722. }
  49723. );
  49724. t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) {
  49725. t.space = 250;
  49726. t.exclam = 333;
  49727. t.universal = 713;
  49728. t.numbersign = 500;
  49729. t.existential = 549;
  49730. t.percent = 833;
  49731. t.ampersand = 778;
  49732. t.suchthat = 439;
  49733. t.parenleft = 333;
  49734. t.parenright = 333;
  49735. t.asteriskmath = 500;
  49736. t.plus = 549;
  49737. t.comma = 250;
  49738. t.minus = 549;
  49739. t.period = 250;
  49740. t.slash = 278;
  49741. t.zero = 500;
  49742. t.one = 500;
  49743. t.two = 500;
  49744. t.three = 500;
  49745. t.four = 500;
  49746. t.five = 500;
  49747. t.six = 500;
  49748. t.seven = 500;
  49749. t.eight = 500;
  49750. t.nine = 500;
  49751. t.colon = 278;
  49752. t.semicolon = 278;
  49753. t.less = 549;
  49754. t.equal = 549;
  49755. t.greater = 549;
  49756. t.question = 444;
  49757. t.congruent = 549;
  49758. t.Alpha = 722;
  49759. t.Beta = 667;
  49760. t.Chi = 722;
  49761. t.Delta = 612;
  49762. t.Epsilon = 611;
  49763. t.Phi = 763;
  49764. t.Gamma = 603;
  49765. t.Eta = 722;
  49766. t.Iota = 333;
  49767. t.theta1 = 631;
  49768. t.Kappa = 722;
  49769. t.Lambda = 686;
  49770. t.Mu = 889;
  49771. t.Nu = 722;
  49772. t.Omicron = 722;
  49773. t.Pi = 768;
  49774. t.Theta = 741;
  49775. t.Rho = 556;
  49776. t.Sigma = 592;
  49777. t.Tau = 611;
  49778. t.Upsilon = 690;
  49779. t.sigma1 = 439;
  49780. t.Omega = 768;
  49781. t.Xi = 645;
  49782. t.Psi = 795;
  49783. t.Zeta = 611;
  49784. t.bracketleft = 333;
  49785. t.therefore = 863;
  49786. t.bracketright = 333;
  49787. t.perpendicular = 658;
  49788. t.underscore = 500;
  49789. t.radicalex = 500;
  49790. t.alpha = 631;
  49791. t.beta = 549;
  49792. t.chi = 549;
  49793. t.delta = 494;
  49794. t.epsilon = 439;
  49795. t.phi = 521;
  49796. t.gamma = 411;
  49797. t.eta = 603;
  49798. t.iota = 329;
  49799. t.phi1 = 603;
  49800. t.kappa = 549;
  49801. t.lambda = 549;
  49802. t.mu = 576;
  49803. t.nu = 521;
  49804. t.omicron = 549;
  49805. t.pi = 549;
  49806. t.theta = 521;
  49807. t.rho = 549;
  49808. t.sigma = 603;
  49809. t.tau = 439;
  49810. t.upsilon = 576;
  49811. t.omega1 = 713;
  49812. t.omega = 686;
  49813. t.xi = 493;
  49814. t.psi = 686;
  49815. t.zeta = 494;
  49816. t.braceleft = 480;
  49817. t.bar = 200;
  49818. t.braceright = 480;
  49819. t.similar = 549;
  49820. t.Euro = 750;
  49821. t.Upsilon1 = 620;
  49822. t.minute = 247;
  49823. t.lessequal = 549;
  49824. t.fraction = 167;
  49825. t.infinity = 713;
  49826. t.florin = 500;
  49827. t.club = 753;
  49828. t.diamond = 753;
  49829. t.heart = 753;
  49830. t.spade = 753;
  49831. t.arrowboth = 1042;
  49832. t.arrowleft = 987;
  49833. t.arrowup = 603;
  49834. t.arrowright = 987;
  49835. t.arrowdown = 603;
  49836. t.degree = 400;
  49837. t.plusminus = 549;
  49838. t.second = 411;
  49839. t.greaterequal = 549;
  49840. t.multiply = 549;
  49841. t.proportional = 713;
  49842. t.partialdiff = 494;
  49843. t.bullet = 460;
  49844. t.divide = 549;
  49845. t.notequal = 549;
  49846. t.equivalence = 549;
  49847. t.approxequal = 549;
  49848. t.ellipsis = 1000;
  49849. t.arrowvertex = 603;
  49850. t.arrowhorizex = 1000;
  49851. t.carriagereturn = 658;
  49852. t.aleph = 823;
  49853. t.Ifraktur = 686;
  49854. t.Rfraktur = 795;
  49855. t.weierstrass = 987;
  49856. t.circlemultiply = 768;
  49857. t.circleplus = 768;
  49858. t.emptyset = 823;
  49859. t.intersection = 768;
  49860. t.union = 768;
  49861. t.propersuperset = 713;
  49862. t.reflexsuperset = 713;
  49863. t.notsubset = 713;
  49864. t.propersubset = 713;
  49865. t.reflexsubset = 713;
  49866. t.element = 713;
  49867. t.notelement = 713;
  49868. t.angle = 768;
  49869. t.gradient = 713;
  49870. t.registerserif = 790;
  49871. t.copyrightserif = 790;
  49872. t.trademarkserif = 890;
  49873. t.product = 823;
  49874. t.radical = 549;
  49875. t.dotmath = 250;
  49876. t.logicalnot = 713;
  49877. t.logicaland = 603;
  49878. t.logicalor = 603;
  49879. t.arrowdblboth = 1042;
  49880. t.arrowdblleft = 987;
  49881. t.arrowdblup = 603;
  49882. t.arrowdblright = 987;
  49883. t.arrowdbldown = 603;
  49884. t.lozenge = 494;
  49885. t.angleleft = 329;
  49886. t.registersans = 790;
  49887. t.copyrightsans = 790;
  49888. t.trademarksans = 786;
  49889. t.summation = 713;
  49890. t.parenlefttp = 384;
  49891. t.parenleftex = 384;
  49892. t.parenleftbt = 384;
  49893. t.bracketlefttp = 384;
  49894. t.bracketleftex = 384;
  49895. t.bracketleftbt = 384;
  49896. t.bracelefttp = 494;
  49897. t.braceleftmid = 494;
  49898. t.braceleftbt = 494;
  49899. t.braceex = 494;
  49900. t.angleright = 329;
  49901. t.integral = 274;
  49902. t.integraltp = 686;
  49903. t.integralex = 686;
  49904. t.integralbt = 686;
  49905. t.parenrighttp = 384;
  49906. t.parenrightex = 384;
  49907. t.parenrightbt = 384;
  49908. t.bracketrighttp = 384;
  49909. t.bracketrightex = 384;
  49910. t.bracketrightbt = 384;
  49911. t.bracerighttp = 494;
  49912. t.bracerightmid = 494;
  49913. t.bracerightbt = 494;
  49914. t.apple = 790;
  49915. });
  49916. t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (
  49917. t
  49918. ) {
  49919. t.space = 250;
  49920. t.exclam = 333;
  49921. t.quotedbl = 408;
  49922. t.numbersign = 500;
  49923. t.dollar = 500;
  49924. t.percent = 833;
  49925. t.ampersand = 778;
  49926. t.quoteright = 333;
  49927. t.parenleft = 333;
  49928. t.parenright = 333;
  49929. t.asterisk = 500;
  49930. t.plus = 564;
  49931. t.comma = 250;
  49932. t.hyphen = 333;
  49933. t.period = 250;
  49934. t.slash = 278;
  49935. t.zero = 500;
  49936. t.one = 500;
  49937. t.two = 500;
  49938. t.three = 500;
  49939. t.four = 500;
  49940. t.five = 500;
  49941. t.six = 500;
  49942. t.seven = 500;
  49943. t.eight = 500;
  49944. t.nine = 500;
  49945. t.colon = 278;
  49946. t.semicolon = 278;
  49947. t.less = 564;
  49948. t.equal = 564;
  49949. t.greater = 564;
  49950. t.question = 444;
  49951. t.at = 921;
  49952. t.A = 722;
  49953. t.B = 667;
  49954. t.C = 667;
  49955. t.D = 722;
  49956. t.E = 611;
  49957. t.F = 556;
  49958. t.G = 722;
  49959. t.H = 722;
  49960. t.I = 333;
  49961. t.J = 389;
  49962. t.K = 722;
  49963. t.L = 611;
  49964. t.M = 889;
  49965. t.N = 722;
  49966. t.O = 722;
  49967. t.P = 556;
  49968. t.Q = 722;
  49969. t.R = 667;
  49970. t.S = 556;
  49971. t.T = 611;
  49972. t.U = 722;
  49973. t.V = 722;
  49974. t.W = 944;
  49975. t.X = 722;
  49976. t.Y = 722;
  49977. t.Z = 611;
  49978. t.bracketleft = 333;
  49979. t.backslash = 278;
  49980. t.bracketright = 333;
  49981. t.asciicircum = 469;
  49982. t.underscore = 500;
  49983. t.quoteleft = 333;
  49984. t.a = 444;
  49985. t.b = 500;
  49986. t.c = 444;
  49987. t.d = 500;
  49988. t.e = 444;
  49989. t.f = 333;
  49990. t.g = 500;
  49991. t.h = 500;
  49992. t.i = 278;
  49993. t.j = 278;
  49994. t.k = 500;
  49995. t.l = 278;
  49996. t.m = 778;
  49997. t.n = 500;
  49998. t.o = 500;
  49999. t.p = 500;
  50000. t.q = 500;
  50001. t.r = 333;
  50002. t.s = 389;
  50003. t.t = 278;
  50004. t.u = 500;
  50005. t.v = 500;
  50006. t.w = 722;
  50007. t.x = 500;
  50008. t.y = 500;
  50009. t.z = 444;
  50010. t.braceleft = 480;
  50011. t.bar = 200;
  50012. t.braceright = 480;
  50013. t.asciitilde = 541;
  50014. t.exclamdown = 333;
  50015. t.cent = 500;
  50016. t.sterling = 500;
  50017. t.fraction = 167;
  50018. t.yen = 500;
  50019. t.florin = 500;
  50020. t.section = 500;
  50021. t.currency = 500;
  50022. t.quotesingle = 180;
  50023. t.quotedblleft = 444;
  50024. t.guillemotleft = 500;
  50025. t.guilsinglleft = 333;
  50026. t.guilsinglright = 333;
  50027. t.fi = 556;
  50028. t.fl = 556;
  50029. t.endash = 500;
  50030. t.dagger = 500;
  50031. t.daggerdbl = 500;
  50032. t.periodcentered = 250;
  50033. t.paragraph = 453;
  50034. t.bullet = 350;
  50035. t.quotesinglbase = 333;
  50036. t.quotedblbase = 444;
  50037. t.quotedblright = 444;
  50038. t.guillemotright = 500;
  50039. t.ellipsis = 1000;
  50040. t.perthousand = 1000;
  50041. t.questiondown = 444;
  50042. t.grave = 333;
  50043. t.acute = 333;
  50044. t.circumflex = 333;
  50045. t.tilde = 333;
  50046. t.macron = 333;
  50047. t.breve = 333;
  50048. t.dotaccent = 333;
  50049. t.dieresis = 333;
  50050. t.ring = 333;
  50051. t.cedilla = 333;
  50052. t.hungarumlaut = 333;
  50053. t.ogonek = 333;
  50054. t.caron = 333;
  50055. t.emdash = 1000;
  50056. t.AE = 889;
  50057. t.ordfeminine = 276;
  50058. t.Lslash = 611;
  50059. t.Oslash = 722;
  50060. t.OE = 889;
  50061. t.ordmasculine = 310;
  50062. t.ae = 667;
  50063. t.dotlessi = 278;
  50064. t.lslash = 278;
  50065. t.oslash = 500;
  50066. t.oe = 722;
  50067. t.germandbls = 500;
  50068. t.Idieresis = 333;
  50069. t.eacute = 444;
  50070. t.abreve = 444;
  50071. t.uhungarumlaut = 500;
  50072. t.ecaron = 444;
  50073. t.Ydieresis = 722;
  50074. t.divide = 564;
  50075. t.Yacute = 722;
  50076. t.Acircumflex = 722;
  50077. t.aacute = 444;
  50078. t.Ucircumflex = 722;
  50079. t.yacute = 500;
  50080. t.scommaaccent = 389;
  50081. t.ecircumflex = 444;
  50082. t.Uring = 722;
  50083. t.Udieresis = 722;
  50084. t.aogonek = 444;
  50085. t.Uacute = 722;
  50086. t.uogonek = 500;
  50087. t.Edieresis = 611;
  50088. t.Dcroat = 722;
  50089. t.commaaccent = 250;
  50090. t.copyright = 760;
  50091. t.Emacron = 611;
  50092. t.ccaron = 444;
  50093. t.aring = 444;
  50094. t.Ncommaaccent = 722;
  50095. t.lacute = 278;
  50096. t.agrave = 444;
  50097. t.Tcommaaccent = 611;
  50098. t.Cacute = 667;
  50099. t.atilde = 444;
  50100. t.Edotaccent = 611;
  50101. t.scaron = 389;
  50102. t.scedilla = 389;
  50103. t.iacute = 278;
  50104. t.lozenge = 471;
  50105. t.Rcaron = 667;
  50106. t.Gcommaaccent = 722;
  50107. t.ucircumflex = 500;
  50108. t.acircumflex = 444;
  50109. t.Amacron = 722;
  50110. t.rcaron = 333;
  50111. t.ccedilla = 444;
  50112. t.Zdotaccent = 611;
  50113. t.Thorn = 556;
  50114. t.Omacron = 722;
  50115. t.Racute = 667;
  50116. t.Sacute = 556;
  50117. t.dcaron = 588;
  50118. t.Umacron = 722;
  50119. t.uring = 500;
  50120. t.threesuperior = 300;
  50121. t.Ograve = 722;
  50122. t.Agrave = 722;
  50123. t.Abreve = 722;
  50124. t.multiply = 564;
  50125. t.uacute = 500;
  50126. t.Tcaron = 611;
  50127. t.partialdiff = 476;
  50128. t.ydieresis = 500;
  50129. t.Nacute = 722;
  50130. t.icircumflex = 278;
  50131. t.Ecircumflex = 611;
  50132. t.adieresis = 444;
  50133. t.edieresis = 444;
  50134. t.cacute = 444;
  50135. t.nacute = 500;
  50136. t.umacron = 500;
  50137. t.Ncaron = 722;
  50138. t.Iacute = 333;
  50139. t.plusminus = 564;
  50140. t.brokenbar = 200;
  50141. t.registered = 760;
  50142. t.Gbreve = 722;
  50143. t.Idotaccent = 333;
  50144. t.summation = 600;
  50145. t.Egrave = 611;
  50146. t.racute = 333;
  50147. t.omacron = 500;
  50148. t.Zacute = 611;
  50149. t.Zcaron = 611;
  50150. t.greaterequal = 549;
  50151. t.Eth = 722;
  50152. t.Ccedilla = 667;
  50153. t.lcommaaccent = 278;
  50154. t.tcaron = 326;
  50155. t.eogonek = 444;
  50156. t.Uogonek = 722;
  50157. t.Aacute = 722;
  50158. t.Adieresis = 722;
  50159. t.egrave = 444;
  50160. t.zacute = 444;
  50161. t.iogonek = 278;
  50162. t.Oacute = 722;
  50163. t.oacute = 500;
  50164. t.amacron = 444;
  50165. t.sacute = 389;
  50166. t.idieresis = 278;
  50167. t.Ocircumflex = 722;
  50168. t.Ugrave = 722;
  50169. t.Delta = 612;
  50170. t.thorn = 500;
  50171. t.twosuperior = 300;
  50172. t.Odieresis = 722;
  50173. t.mu = 500;
  50174. t.igrave = 278;
  50175. t.ohungarumlaut = 500;
  50176. t.Eogonek = 611;
  50177. t.dcroat = 500;
  50178. t.threequarters = 750;
  50179. t.Scedilla = 556;
  50180. t.lcaron = 344;
  50181. t.Kcommaaccent = 722;
  50182. t.Lacute = 611;
  50183. t.trademark = 980;
  50184. t.edotaccent = 444;
  50185. t.Igrave = 333;
  50186. t.Imacron = 333;
  50187. t.Lcaron = 611;
  50188. t.onehalf = 750;
  50189. t.lessequal = 549;
  50190. t.ocircumflex = 500;
  50191. t.ntilde = 500;
  50192. t.Uhungarumlaut = 722;
  50193. t.Eacute = 611;
  50194. t.emacron = 444;
  50195. t.gbreve = 500;
  50196. t.onequarter = 750;
  50197. t.Scaron = 556;
  50198. t.Scommaaccent = 556;
  50199. t.Ohungarumlaut = 722;
  50200. t.degree = 400;
  50201. t.ograve = 500;
  50202. t.Ccaron = 667;
  50203. t.ugrave = 500;
  50204. t.radical = 453;
  50205. t.Dcaron = 722;
  50206. t.rcommaaccent = 333;
  50207. t.Ntilde = 722;
  50208. t.otilde = 500;
  50209. t.Rcommaaccent = 667;
  50210. t.Lcommaaccent = 611;
  50211. t.Atilde = 722;
  50212. t.Aogonek = 722;
  50213. t.Aring = 722;
  50214. t.Otilde = 722;
  50215. t.zdotaccent = 444;
  50216. t.Ecaron = 611;
  50217. t.Iogonek = 333;
  50218. t.kcommaaccent = 500;
  50219. t.minus = 564;
  50220. t.Icircumflex = 333;
  50221. t.ncaron = 500;
  50222. t.tcommaaccent = 278;
  50223. t.logicalnot = 564;
  50224. t.odieresis = 500;
  50225. t.udieresis = 500;
  50226. t.notequal = 549;
  50227. t.gcommaaccent = 500;
  50228. t.eth = 500;
  50229. t.zcaron = 444;
  50230. t.ncommaaccent = 500;
  50231. t.onesuperior = 300;
  50232. t.imacron = 278;
  50233. t.Euro = 500;
  50234. });
  50235. t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (
  50236. t
  50237. ) {
  50238. t.space = 250;
  50239. t.exclam = 333;
  50240. t.quotedbl = 555;
  50241. t.numbersign = 500;
  50242. t.dollar = 500;
  50243. t.percent = 1000;
  50244. t.ampersand = 833;
  50245. t.quoteright = 333;
  50246. t.parenleft = 333;
  50247. t.parenright = 333;
  50248. t.asterisk = 500;
  50249. t.plus = 570;
  50250. t.comma = 250;
  50251. t.hyphen = 333;
  50252. t.period = 250;
  50253. t.slash = 278;
  50254. t.zero = 500;
  50255. t.one = 500;
  50256. t.two = 500;
  50257. t.three = 500;
  50258. t.four = 500;
  50259. t.five = 500;
  50260. t.six = 500;
  50261. t.seven = 500;
  50262. t.eight = 500;
  50263. t.nine = 500;
  50264. t.colon = 333;
  50265. t.semicolon = 333;
  50266. t.less = 570;
  50267. t.equal = 570;
  50268. t.greater = 570;
  50269. t.question = 500;
  50270. t.at = 930;
  50271. t.A = 722;
  50272. t.B = 667;
  50273. t.C = 722;
  50274. t.D = 722;
  50275. t.E = 667;
  50276. t.F = 611;
  50277. t.G = 778;
  50278. t.H = 778;
  50279. t.I = 389;
  50280. t.J = 500;
  50281. t.K = 778;
  50282. t.L = 667;
  50283. t.M = 944;
  50284. t.N = 722;
  50285. t.O = 778;
  50286. t.P = 611;
  50287. t.Q = 778;
  50288. t.R = 722;
  50289. t.S = 556;
  50290. t.T = 667;
  50291. t.U = 722;
  50292. t.V = 722;
  50293. t.W = 1000;
  50294. t.X = 722;
  50295. t.Y = 722;
  50296. t.Z = 667;
  50297. t.bracketleft = 333;
  50298. t.backslash = 278;
  50299. t.bracketright = 333;
  50300. t.asciicircum = 581;
  50301. t.underscore = 500;
  50302. t.quoteleft = 333;
  50303. t.a = 500;
  50304. t.b = 556;
  50305. t.c = 444;
  50306. t.d = 556;
  50307. t.e = 444;
  50308. t.f = 333;
  50309. t.g = 500;
  50310. t.h = 556;
  50311. t.i = 278;
  50312. t.j = 333;
  50313. t.k = 556;
  50314. t.l = 278;
  50315. t.m = 833;
  50316. t.n = 556;
  50317. t.o = 500;
  50318. t.p = 556;
  50319. t.q = 556;
  50320. t.r = 444;
  50321. t.s = 389;
  50322. t.t = 333;
  50323. t.u = 556;
  50324. t.v = 500;
  50325. t.w = 722;
  50326. t.x = 500;
  50327. t.y = 500;
  50328. t.z = 444;
  50329. t.braceleft = 394;
  50330. t.bar = 220;
  50331. t.braceright = 394;
  50332. t.asciitilde = 520;
  50333. t.exclamdown = 333;
  50334. t.cent = 500;
  50335. t.sterling = 500;
  50336. t.fraction = 167;
  50337. t.yen = 500;
  50338. t.florin = 500;
  50339. t.section = 500;
  50340. t.currency = 500;
  50341. t.quotesingle = 278;
  50342. t.quotedblleft = 500;
  50343. t.guillemotleft = 500;
  50344. t.guilsinglleft = 333;
  50345. t.guilsinglright = 333;
  50346. t.fi = 556;
  50347. t.fl = 556;
  50348. t.endash = 500;
  50349. t.dagger = 500;
  50350. t.daggerdbl = 500;
  50351. t.periodcentered = 250;
  50352. t.paragraph = 540;
  50353. t.bullet = 350;
  50354. t.quotesinglbase = 333;
  50355. t.quotedblbase = 500;
  50356. t.quotedblright = 500;
  50357. t.guillemotright = 500;
  50358. t.ellipsis = 1000;
  50359. t.perthousand = 1000;
  50360. t.questiondown = 500;
  50361. t.grave = 333;
  50362. t.acute = 333;
  50363. t.circumflex = 333;
  50364. t.tilde = 333;
  50365. t.macron = 333;
  50366. t.breve = 333;
  50367. t.dotaccent = 333;
  50368. t.dieresis = 333;
  50369. t.ring = 333;
  50370. t.cedilla = 333;
  50371. t.hungarumlaut = 333;
  50372. t.ogonek = 333;
  50373. t.caron = 333;
  50374. t.emdash = 1000;
  50375. t.AE = 1000;
  50376. t.ordfeminine = 300;
  50377. t.Lslash = 667;
  50378. t.Oslash = 778;
  50379. t.OE = 1000;
  50380. t.ordmasculine = 330;
  50381. t.ae = 722;
  50382. t.dotlessi = 278;
  50383. t.lslash = 278;
  50384. t.oslash = 500;
  50385. t.oe = 722;
  50386. t.germandbls = 556;
  50387. t.Idieresis = 389;
  50388. t.eacute = 444;
  50389. t.abreve = 500;
  50390. t.uhungarumlaut = 556;
  50391. t.ecaron = 444;
  50392. t.Ydieresis = 722;
  50393. t.divide = 570;
  50394. t.Yacute = 722;
  50395. t.Acircumflex = 722;
  50396. t.aacute = 500;
  50397. t.Ucircumflex = 722;
  50398. t.yacute = 500;
  50399. t.scommaaccent = 389;
  50400. t.ecircumflex = 444;
  50401. t.Uring = 722;
  50402. t.Udieresis = 722;
  50403. t.aogonek = 500;
  50404. t.Uacute = 722;
  50405. t.uogonek = 556;
  50406. t.Edieresis = 667;
  50407. t.Dcroat = 722;
  50408. t.commaaccent = 250;
  50409. t.copyright = 747;
  50410. t.Emacron = 667;
  50411. t.ccaron = 444;
  50412. t.aring = 500;
  50413. t.Ncommaaccent = 722;
  50414. t.lacute = 278;
  50415. t.agrave = 500;
  50416. t.Tcommaaccent = 667;
  50417. t.Cacute = 722;
  50418. t.atilde = 500;
  50419. t.Edotaccent = 667;
  50420. t.scaron = 389;
  50421. t.scedilla = 389;
  50422. t.iacute = 278;
  50423. t.lozenge = 494;
  50424. t.Rcaron = 722;
  50425. t.Gcommaaccent = 778;
  50426. t.ucircumflex = 556;
  50427. t.acircumflex = 500;
  50428. t.Amacron = 722;
  50429. t.rcaron = 444;
  50430. t.ccedilla = 444;
  50431. t.Zdotaccent = 667;
  50432. t.Thorn = 611;
  50433. t.Omacron = 778;
  50434. t.Racute = 722;
  50435. t.Sacute = 556;
  50436. t.dcaron = 672;
  50437. t.Umacron = 722;
  50438. t.uring = 556;
  50439. t.threesuperior = 300;
  50440. t.Ograve = 778;
  50441. t.Agrave = 722;
  50442. t.Abreve = 722;
  50443. t.multiply = 570;
  50444. t.uacute = 556;
  50445. t.Tcaron = 667;
  50446. t.partialdiff = 494;
  50447. t.ydieresis = 500;
  50448. t.Nacute = 722;
  50449. t.icircumflex = 278;
  50450. t.Ecircumflex = 667;
  50451. t.adieresis = 500;
  50452. t.edieresis = 444;
  50453. t.cacute = 444;
  50454. t.nacute = 556;
  50455. t.umacron = 556;
  50456. t.Ncaron = 722;
  50457. t.Iacute = 389;
  50458. t.plusminus = 570;
  50459. t.brokenbar = 220;
  50460. t.registered = 747;
  50461. t.Gbreve = 778;
  50462. t.Idotaccent = 389;
  50463. t.summation = 600;
  50464. t.Egrave = 667;
  50465. t.racute = 444;
  50466. t.omacron = 500;
  50467. t.Zacute = 667;
  50468. t.Zcaron = 667;
  50469. t.greaterequal = 549;
  50470. t.Eth = 722;
  50471. t.Ccedilla = 722;
  50472. t.lcommaaccent = 278;
  50473. t.tcaron = 416;
  50474. t.eogonek = 444;
  50475. t.Uogonek = 722;
  50476. t.Aacute = 722;
  50477. t.Adieresis = 722;
  50478. t.egrave = 444;
  50479. t.zacute = 444;
  50480. t.iogonek = 278;
  50481. t.Oacute = 778;
  50482. t.oacute = 500;
  50483. t.amacron = 500;
  50484. t.sacute = 389;
  50485. t.idieresis = 278;
  50486. t.Ocircumflex = 778;
  50487. t.Ugrave = 722;
  50488. t.Delta = 612;
  50489. t.thorn = 556;
  50490. t.twosuperior = 300;
  50491. t.Odieresis = 778;
  50492. t.mu = 556;
  50493. t.igrave = 278;
  50494. t.ohungarumlaut = 500;
  50495. t.Eogonek = 667;
  50496. t.dcroat = 556;
  50497. t.threequarters = 750;
  50498. t.Scedilla = 556;
  50499. t.lcaron = 394;
  50500. t.Kcommaaccent = 778;
  50501. t.Lacute = 667;
  50502. t.trademark = 1000;
  50503. t.edotaccent = 444;
  50504. t.Igrave = 389;
  50505. t.Imacron = 389;
  50506. t.Lcaron = 667;
  50507. t.onehalf = 750;
  50508. t.lessequal = 549;
  50509. t.ocircumflex = 500;
  50510. t.ntilde = 556;
  50511. t.Uhungarumlaut = 722;
  50512. t.Eacute = 667;
  50513. t.emacron = 444;
  50514. t.gbreve = 500;
  50515. t.onequarter = 750;
  50516. t.Scaron = 556;
  50517. t.Scommaaccent = 556;
  50518. t.Ohungarumlaut = 778;
  50519. t.degree = 400;
  50520. t.ograve = 500;
  50521. t.Ccaron = 722;
  50522. t.ugrave = 556;
  50523. t.radical = 549;
  50524. t.Dcaron = 722;
  50525. t.rcommaaccent = 444;
  50526. t.Ntilde = 722;
  50527. t.otilde = 500;
  50528. t.Rcommaaccent = 722;
  50529. t.Lcommaaccent = 667;
  50530. t.Atilde = 722;
  50531. t.Aogonek = 722;
  50532. t.Aring = 722;
  50533. t.Otilde = 778;
  50534. t.zdotaccent = 444;
  50535. t.Ecaron = 667;
  50536. t.Iogonek = 389;
  50537. t.kcommaaccent = 556;
  50538. t.minus = 570;
  50539. t.Icircumflex = 389;
  50540. t.ncaron = 556;
  50541. t.tcommaaccent = 333;
  50542. t.logicalnot = 570;
  50543. t.odieresis = 500;
  50544. t.udieresis = 556;
  50545. t.notequal = 549;
  50546. t.gcommaaccent = 500;
  50547. t.eth = 500;
  50548. t.zcaron = 444;
  50549. t.ncommaaccent = 556;
  50550. t.onesuperior = 300;
  50551. t.imacron = 278;
  50552. t.Euro = 500;
  50553. });
  50554. t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(
  50555. function (t) {
  50556. t.space = 250;
  50557. t.exclam = 389;
  50558. t.quotedbl = 555;
  50559. t.numbersign = 500;
  50560. t.dollar = 500;
  50561. t.percent = 833;
  50562. t.ampersand = 778;
  50563. t.quoteright = 333;
  50564. t.parenleft = 333;
  50565. t.parenright = 333;
  50566. t.asterisk = 500;
  50567. t.plus = 570;
  50568. t.comma = 250;
  50569. t.hyphen = 333;
  50570. t.period = 250;
  50571. t.slash = 278;
  50572. t.zero = 500;
  50573. t.one = 500;
  50574. t.two = 500;
  50575. t.three = 500;
  50576. t.four = 500;
  50577. t.five = 500;
  50578. t.six = 500;
  50579. t.seven = 500;
  50580. t.eight = 500;
  50581. t.nine = 500;
  50582. t.colon = 333;
  50583. t.semicolon = 333;
  50584. t.less = 570;
  50585. t.equal = 570;
  50586. t.greater = 570;
  50587. t.question = 500;
  50588. t.at = 832;
  50589. t.A = 667;
  50590. t.B = 667;
  50591. t.C = 667;
  50592. t.D = 722;
  50593. t.E = 667;
  50594. t.F = 667;
  50595. t.G = 722;
  50596. t.H = 778;
  50597. t.I = 389;
  50598. t.J = 500;
  50599. t.K = 667;
  50600. t.L = 611;
  50601. t.M = 889;
  50602. t.N = 722;
  50603. t.O = 722;
  50604. t.P = 611;
  50605. t.Q = 722;
  50606. t.R = 667;
  50607. t.S = 556;
  50608. t.T = 611;
  50609. t.U = 722;
  50610. t.V = 667;
  50611. t.W = 889;
  50612. t.X = 667;
  50613. t.Y = 611;
  50614. t.Z = 611;
  50615. t.bracketleft = 333;
  50616. t.backslash = 278;
  50617. t.bracketright = 333;
  50618. t.asciicircum = 570;
  50619. t.underscore = 500;
  50620. t.quoteleft = 333;
  50621. t.a = 500;
  50622. t.b = 500;
  50623. t.c = 444;
  50624. t.d = 500;
  50625. t.e = 444;
  50626. t.f = 333;
  50627. t.g = 500;
  50628. t.h = 556;
  50629. t.i = 278;
  50630. t.j = 278;
  50631. t.k = 500;
  50632. t.l = 278;
  50633. t.m = 778;
  50634. t.n = 556;
  50635. t.o = 500;
  50636. t.p = 500;
  50637. t.q = 500;
  50638. t.r = 389;
  50639. t.s = 389;
  50640. t.t = 278;
  50641. t.u = 556;
  50642. t.v = 444;
  50643. t.w = 667;
  50644. t.x = 500;
  50645. t.y = 444;
  50646. t.z = 389;
  50647. t.braceleft = 348;
  50648. t.bar = 220;
  50649. t.braceright = 348;
  50650. t.asciitilde = 570;
  50651. t.exclamdown = 389;
  50652. t.cent = 500;
  50653. t.sterling = 500;
  50654. t.fraction = 167;
  50655. t.yen = 500;
  50656. t.florin = 500;
  50657. t.section = 500;
  50658. t.currency = 500;
  50659. t.quotesingle = 278;
  50660. t.quotedblleft = 500;
  50661. t.guillemotleft = 500;
  50662. t.guilsinglleft = 333;
  50663. t.guilsinglright = 333;
  50664. t.fi = 556;
  50665. t.fl = 556;
  50666. t.endash = 500;
  50667. t.dagger = 500;
  50668. t.daggerdbl = 500;
  50669. t.periodcentered = 250;
  50670. t.paragraph = 500;
  50671. t.bullet = 350;
  50672. t.quotesinglbase = 333;
  50673. t.quotedblbase = 500;
  50674. t.quotedblright = 500;
  50675. t.guillemotright = 500;
  50676. t.ellipsis = 1000;
  50677. t.perthousand = 1000;
  50678. t.questiondown = 500;
  50679. t.grave = 333;
  50680. t.acute = 333;
  50681. t.circumflex = 333;
  50682. t.tilde = 333;
  50683. t.macron = 333;
  50684. t.breve = 333;
  50685. t.dotaccent = 333;
  50686. t.dieresis = 333;
  50687. t.ring = 333;
  50688. t.cedilla = 333;
  50689. t.hungarumlaut = 333;
  50690. t.ogonek = 333;
  50691. t.caron = 333;
  50692. t.emdash = 1000;
  50693. t.AE = 944;
  50694. t.ordfeminine = 266;
  50695. t.Lslash = 611;
  50696. t.Oslash = 722;
  50697. t.OE = 944;
  50698. t.ordmasculine = 300;
  50699. t.ae = 722;
  50700. t.dotlessi = 278;
  50701. t.lslash = 278;
  50702. t.oslash = 500;
  50703. t.oe = 722;
  50704. t.germandbls = 500;
  50705. t.Idieresis = 389;
  50706. t.eacute = 444;
  50707. t.abreve = 500;
  50708. t.uhungarumlaut = 556;
  50709. t.ecaron = 444;
  50710. t.Ydieresis = 611;
  50711. t.divide = 570;
  50712. t.Yacute = 611;
  50713. t.Acircumflex = 667;
  50714. t.aacute = 500;
  50715. t.Ucircumflex = 722;
  50716. t.yacute = 444;
  50717. t.scommaaccent = 389;
  50718. t.ecircumflex = 444;
  50719. t.Uring = 722;
  50720. t.Udieresis = 722;
  50721. t.aogonek = 500;
  50722. t.Uacute = 722;
  50723. t.uogonek = 556;
  50724. t.Edieresis = 667;
  50725. t.Dcroat = 722;
  50726. t.commaaccent = 250;
  50727. t.copyright = 747;
  50728. t.Emacron = 667;
  50729. t.ccaron = 444;
  50730. t.aring = 500;
  50731. t.Ncommaaccent = 722;
  50732. t.lacute = 278;
  50733. t.agrave = 500;
  50734. t.Tcommaaccent = 611;
  50735. t.Cacute = 667;
  50736. t.atilde = 500;
  50737. t.Edotaccent = 667;
  50738. t.scaron = 389;
  50739. t.scedilla = 389;
  50740. t.iacute = 278;
  50741. t.lozenge = 494;
  50742. t.Rcaron = 667;
  50743. t.Gcommaaccent = 722;
  50744. t.ucircumflex = 556;
  50745. t.acircumflex = 500;
  50746. t.Amacron = 667;
  50747. t.rcaron = 389;
  50748. t.ccedilla = 444;
  50749. t.Zdotaccent = 611;
  50750. t.Thorn = 611;
  50751. t.Omacron = 722;
  50752. t.Racute = 667;
  50753. t.Sacute = 556;
  50754. t.dcaron = 608;
  50755. t.Umacron = 722;
  50756. t.uring = 556;
  50757. t.threesuperior = 300;
  50758. t.Ograve = 722;
  50759. t.Agrave = 667;
  50760. t.Abreve = 667;
  50761. t.multiply = 570;
  50762. t.uacute = 556;
  50763. t.Tcaron = 611;
  50764. t.partialdiff = 494;
  50765. t.ydieresis = 444;
  50766. t.Nacute = 722;
  50767. t.icircumflex = 278;
  50768. t.Ecircumflex = 667;
  50769. t.adieresis = 500;
  50770. t.edieresis = 444;
  50771. t.cacute = 444;
  50772. t.nacute = 556;
  50773. t.umacron = 556;
  50774. t.Ncaron = 722;
  50775. t.Iacute = 389;
  50776. t.plusminus = 570;
  50777. t.brokenbar = 220;
  50778. t.registered = 747;
  50779. t.Gbreve = 722;
  50780. t.Idotaccent = 389;
  50781. t.summation = 600;
  50782. t.Egrave = 667;
  50783. t.racute = 389;
  50784. t.omacron = 500;
  50785. t.Zacute = 611;
  50786. t.Zcaron = 611;
  50787. t.greaterequal = 549;
  50788. t.Eth = 722;
  50789. t.Ccedilla = 667;
  50790. t.lcommaaccent = 278;
  50791. t.tcaron = 366;
  50792. t.eogonek = 444;
  50793. t.Uogonek = 722;
  50794. t.Aacute = 667;
  50795. t.Adieresis = 667;
  50796. t.egrave = 444;
  50797. t.zacute = 389;
  50798. t.iogonek = 278;
  50799. t.Oacute = 722;
  50800. t.oacute = 500;
  50801. t.amacron = 500;
  50802. t.sacute = 389;
  50803. t.idieresis = 278;
  50804. t.Ocircumflex = 722;
  50805. t.Ugrave = 722;
  50806. t.Delta = 612;
  50807. t.thorn = 500;
  50808. t.twosuperior = 300;
  50809. t.Odieresis = 722;
  50810. t.mu = 576;
  50811. t.igrave = 278;
  50812. t.ohungarumlaut = 500;
  50813. t.Eogonek = 667;
  50814. t.dcroat = 500;
  50815. t.threequarters = 750;
  50816. t.Scedilla = 556;
  50817. t.lcaron = 382;
  50818. t.Kcommaaccent = 667;
  50819. t.Lacute = 611;
  50820. t.trademark = 1000;
  50821. t.edotaccent = 444;
  50822. t.Igrave = 389;
  50823. t.Imacron = 389;
  50824. t.Lcaron = 611;
  50825. t.onehalf = 750;
  50826. t.lessequal = 549;
  50827. t.ocircumflex = 500;
  50828. t.ntilde = 556;
  50829. t.Uhungarumlaut = 722;
  50830. t.Eacute = 667;
  50831. t.emacron = 444;
  50832. t.gbreve = 500;
  50833. t.onequarter = 750;
  50834. t.Scaron = 556;
  50835. t.Scommaaccent = 556;
  50836. t.Ohungarumlaut = 722;
  50837. t.degree = 400;
  50838. t.ograve = 500;
  50839. t.Ccaron = 667;
  50840. t.ugrave = 556;
  50841. t.radical = 549;
  50842. t.Dcaron = 722;
  50843. t.rcommaaccent = 389;
  50844. t.Ntilde = 722;
  50845. t.otilde = 500;
  50846. t.Rcommaaccent = 667;
  50847. t.Lcommaaccent = 611;
  50848. t.Atilde = 667;
  50849. t.Aogonek = 667;
  50850. t.Aring = 667;
  50851. t.Otilde = 722;
  50852. t.zdotaccent = 389;
  50853. t.Ecaron = 667;
  50854. t.Iogonek = 389;
  50855. t.kcommaaccent = 500;
  50856. t.minus = 606;
  50857. t.Icircumflex = 389;
  50858. t.ncaron = 556;
  50859. t.tcommaaccent = 278;
  50860. t.logicalnot = 606;
  50861. t.odieresis = 500;
  50862. t.udieresis = 556;
  50863. t.notequal = 549;
  50864. t.gcommaaccent = 500;
  50865. t.eth = 500;
  50866. t.zcaron = 389;
  50867. t.ncommaaccent = 556;
  50868. t.onesuperior = 300;
  50869. t.imacron = 278;
  50870. t.Euro = 500;
  50871. }
  50872. );
  50873. t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (
  50874. t
  50875. ) {
  50876. t.space = 250;
  50877. t.exclam = 333;
  50878. t.quotedbl = 420;
  50879. t.numbersign = 500;
  50880. t.dollar = 500;
  50881. t.percent = 833;
  50882. t.ampersand = 778;
  50883. t.quoteright = 333;
  50884. t.parenleft = 333;
  50885. t.parenright = 333;
  50886. t.asterisk = 500;
  50887. t.plus = 675;
  50888. t.comma = 250;
  50889. t.hyphen = 333;
  50890. t.period = 250;
  50891. t.slash = 278;
  50892. t.zero = 500;
  50893. t.one = 500;
  50894. t.two = 500;
  50895. t.three = 500;
  50896. t.four = 500;
  50897. t.five = 500;
  50898. t.six = 500;
  50899. t.seven = 500;
  50900. t.eight = 500;
  50901. t.nine = 500;
  50902. t.colon = 333;
  50903. t.semicolon = 333;
  50904. t.less = 675;
  50905. t.equal = 675;
  50906. t.greater = 675;
  50907. t.question = 500;
  50908. t.at = 920;
  50909. t.A = 611;
  50910. t.B = 611;
  50911. t.C = 667;
  50912. t.D = 722;
  50913. t.E = 611;
  50914. t.F = 611;
  50915. t.G = 722;
  50916. t.H = 722;
  50917. t.I = 333;
  50918. t.J = 444;
  50919. t.K = 667;
  50920. t.L = 556;
  50921. t.M = 833;
  50922. t.N = 667;
  50923. t.O = 722;
  50924. t.P = 611;
  50925. t.Q = 722;
  50926. t.R = 611;
  50927. t.S = 500;
  50928. t.T = 556;
  50929. t.U = 722;
  50930. t.V = 611;
  50931. t.W = 833;
  50932. t.X = 611;
  50933. t.Y = 556;
  50934. t.Z = 556;
  50935. t.bracketleft = 389;
  50936. t.backslash = 278;
  50937. t.bracketright = 389;
  50938. t.asciicircum = 422;
  50939. t.underscore = 500;
  50940. t.quoteleft = 333;
  50941. t.a = 500;
  50942. t.b = 500;
  50943. t.c = 444;
  50944. t.d = 500;
  50945. t.e = 444;
  50946. t.f = 278;
  50947. t.g = 500;
  50948. t.h = 500;
  50949. t.i = 278;
  50950. t.j = 278;
  50951. t.k = 444;
  50952. t.l = 278;
  50953. t.m = 722;
  50954. t.n = 500;
  50955. t.o = 500;
  50956. t.p = 500;
  50957. t.q = 500;
  50958. t.r = 389;
  50959. t.s = 389;
  50960. t.t = 278;
  50961. t.u = 500;
  50962. t.v = 444;
  50963. t.w = 667;
  50964. t.x = 444;
  50965. t.y = 444;
  50966. t.z = 389;
  50967. t.braceleft = 400;
  50968. t.bar = 275;
  50969. t.braceright = 400;
  50970. t.asciitilde = 541;
  50971. t.exclamdown = 389;
  50972. t.cent = 500;
  50973. t.sterling = 500;
  50974. t.fraction = 167;
  50975. t.yen = 500;
  50976. t.florin = 500;
  50977. t.section = 500;
  50978. t.currency = 500;
  50979. t.quotesingle = 214;
  50980. t.quotedblleft = 556;
  50981. t.guillemotleft = 500;
  50982. t.guilsinglleft = 333;
  50983. t.guilsinglright = 333;
  50984. t.fi = 500;
  50985. t.fl = 500;
  50986. t.endash = 500;
  50987. t.dagger = 500;
  50988. t.daggerdbl = 500;
  50989. t.periodcentered = 250;
  50990. t.paragraph = 523;
  50991. t.bullet = 350;
  50992. t.quotesinglbase = 333;
  50993. t.quotedblbase = 556;
  50994. t.quotedblright = 556;
  50995. t.guillemotright = 500;
  50996. t.ellipsis = 889;
  50997. t.perthousand = 1000;
  50998. t.questiondown = 500;
  50999. t.grave = 333;
  51000. t.acute = 333;
  51001. t.circumflex = 333;
  51002. t.tilde = 333;
  51003. t.macron = 333;
  51004. t.breve = 333;
  51005. t.dotaccent = 333;
  51006. t.dieresis = 333;
  51007. t.ring = 333;
  51008. t.cedilla = 333;
  51009. t.hungarumlaut = 333;
  51010. t.ogonek = 333;
  51011. t.caron = 333;
  51012. t.emdash = 889;
  51013. t.AE = 889;
  51014. t.ordfeminine = 276;
  51015. t.Lslash = 556;
  51016. t.Oslash = 722;
  51017. t.OE = 944;
  51018. t.ordmasculine = 310;
  51019. t.ae = 667;
  51020. t.dotlessi = 278;
  51021. t.lslash = 278;
  51022. t.oslash = 500;
  51023. t.oe = 667;
  51024. t.germandbls = 500;
  51025. t.Idieresis = 333;
  51026. t.eacute = 444;
  51027. t.abreve = 500;
  51028. t.uhungarumlaut = 500;
  51029. t.ecaron = 444;
  51030. t.Ydieresis = 556;
  51031. t.divide = 675;
  51032. t.Yacute = 556;
  51033. t.Acircumflex = 611;
  51034. t.aacute = 500;
  51035. t.Ucircumflex = 722;
  51036. t.yacute = 444;
  51037. t.scommaaccent = 389;
  51038. t.ecircumflex = 444;
  51039. t.Uring = 722;
  51040. t.Udieresis = 722;
  51041. t.aogonek = 500;
  51042. t.Uacute = 722;
  51043. t.uogonek = 500;
  51044. t.Edieresis = 611;
  51045. t.Dcroat = 722;
  51046. t.commaaccent = 250;
  51047. t.copyright = 760;
  51048. t.Emacron = 611;
  51049. t.ccaron = 444;
  51050. t.aring = 500;
  51051. t.Ncommaaccent = 667;
  51052. t.lacute = 278;
  51053. t.agrave = 500;
  51054. t.Tcommaaccent = 556;
  51055. t.Cacute = 667;
  51056. t.atilde = 500;
  51057. t.Edotaccent = 611;
  51058. t.scaron = 389;
  51059. t.scedilla = 389;
  51060. t.iacute = 278;
  51061. t.lozenge = 471;
  51062. t.Rcaron = 611;
  51063. t.Gcommaaccent = 722;
  51064. t.ucircumflex = 500;
  51065. t.acircumflex = 500;
  51066. t.Amacron = 611;
  51067. t.rcaron = 389;
  51068. t.ccedilla = 444;
  51069. t.Zdotaccent = 556;
  51070. t.Thorn = 611;
  51071. t.Omacron = 722;
  51072. t.Racute = 611;
  51073. t.Sacute = 500;
  51074. t.dcaron = 544;
  51075. t.Umacron = 722;
  51076. t.uring = 500;
  51077. t.threesuperior = 300;
  51078. t.Ograve = 722;
  51079. t.Agrave = 611;
  51080. t.Abreve = 611;
  51081. t.multiply = 675;
  51082. t.uacute = 500;
  51083. t.Tcaron = 556;
  51084. t.partialdiff = 476;
  51085. t.ydieresis = 444;
  51086. t.Nacute = 667;
  51087. t.icircumflex = 278;
  51088. t.Ecircumflex = 611;
  51089. t.adieresis = 500;
  51090. t.edieresis = 444;
  51091. t.cacute = 444;
  51092. t.nacute = 500;
  51093. t.umacron = 500;
  51094. t.Ncaron = 667;
  51095. t.Iacute = 333;
  51096. t.plusminus = 675;
  51097. t.brokenbar = 275;
  51098. t.registered = 760;
  51099. t.Gbreve = 722;
  51100. t.Idotaccent = 333;
  51101. t.summation = 600;
  51102. t.Egrave = 611;
  51103. t.racute = 389;
  51104. t.omacron = 500;
  51105. t.Zacute = 556;
  51106. t.Zcaron = 556;
  51107. t.greaterequal = 549;
  51108. t.Eth = 722;
  51109. t.Ccedilla = 667;
  51110. t.lcommaaccent = 278;
  51111. t.tcaron = 300;
  51112. t.eogonek = 444;
  51113. t.Uogonek = 722;
  51114. t.Aacute = 611;
  51115. t.Adieresis = 611;
  51116. t.egrave = 444;
  51117. t.zacute = 389;
  51118. t.iogonek = 278;
  51119. t.Oacute = 722;
  51120. t.oacute = 500;
  51121. t.amacron = 500;
  51122. t.sacute = 389;
  51123. t.idieresis = 278;
  51124. t.Ocircumflex = 722;
  51125. t.Ugrave = 722;
  51126. t.Delta = 612;
  51127. t.thorn = 500;
  51128. t.twosuperior = 300;
  51129. t.Odieresis = 722;
  51130. t.mu = 500;
  51131. t.igrave = 278;
  51132. t.ohungarumlaut = 500;
  51133. t.Eogonek = 611;
  51134. t.dcroat = 500;
  51135. t.threequarters = 750;
  51136. t.Scedilla = 500;
  51137. t.lcaron = 300;
  51138. t.Kcommaaccent = 667;
  51139. t.Lacute = 556;
  51140. t.trademark = 980;
  51141. t.edotaccent = 444;
  51142. t.Igrave = 333;
  51143. t.Imacron = 333;
  51144. t.Lcaron = 611;
  51145. t.onehalf = 750;
  51146. t.lessequal = 549;
  51147. t.ocircumflex = 500;
  51148. t.ntilde = 500;
  51149. t.Uhungarumlaut = 722;
  51150. t.Eacute = 611;
  51151. t.emacron = 444;
  51152. t.gbreve = 500;
  51153. t.onequarter = 750;
  51154. t.Scaron = 500;
  51155. t.Scommaaccent = 500;
  51156. t.Ohungarumlaut = 722;
  51157. t.degree = 400;
  51158. t.ograve = 500;
  51159. t.Ccaron = 667;
  51160. t.ugrave = 500;
  51161. t.radical = 453;
  51162. t.Dcaron = 722;
  51163. t.rcommaaccent = 389;
  51164. t.Ntilde = 667;
  51165. t.otilde = 500;
  51166. t.Rcommaaccent = 611;
  51167. t.Lcommaaccent = 556;
  51168. t.Atilde = 611;
  51169. t.Aogonek = 611;
  51170. t.Aring = 611;
  51171. t.Otilde = 722;
  51172. t.zdotaccent = 389;
  51173. t.Ecaron = 611;
  51174. t.Iogonek = 333;
  51175. t.kcommaaccent = 444;
  51176. t.minus = 675;
  51177. t.Icircumflex = 333;
  51178. t.ncaron = 500;
  51179. t.tcommaaccent = 278;
  51180. t.logicalnot = 675;
  51181. t.odieresis = 500;
  51182. t.udieresis = 500;
  51183. t.notequal = 549;
  51184. t.gcommaaccent = 500;
  51185. t.eth = 500;
  51186. t.zcaron = 389;
  51187. t.ncommaaccent = 500;
  51188. t.onesuperior = 300;
  51189. t.imacron = 278;
  51190. t.Euro = 500;
  51191. });
  51192. t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) {
  51193. t.space = 278;
  51194. t.a1 = 974;
  51195. t.a2 = 961;
  51196. t.a202 = 974;
  51197. t.a3 = 980;
  51198. t.a4 = 719;
  51199. t.a5 = 789;
  51200. t.a119 = 790;
  51201. t.a118 = 791;
  51202. t.a117 = 690;
  51203. t.a11 = 960;
  51204. t.a12 = 939;
  51205. t.a13 = 549;
  51206. t.a14 = 855;
  51207. t.a15 = 911;
  51208. t.a16 = 933;
  51209. t.a105 = 911;
  51210. t.a17 = 945;
  51211. t.a18 = 974;
  51212. t.a19 = 755;
  51213. t.a20 = 846;
  51214. t.a21 = 762;
  51215. t.a22 = 761;
  51216. t.a23 = 571;
  51217. t.a24 = 677;
  51218. t.a25 = 763;
  51219. t.a26 = 760;
  51220. t.a27 = 759;
  51221. t.a28 = 754;
  51222. t.a6 = 494;
  51223. t.a7 = 552;
  51224. t.a8 = 537;
  51225. t.a9 = 577;
  51226. t.a10 = 692;
  51227. t.a29 = 786;
  51228. t.a30 = 788;
  51229. t.a31 = 788;
  51230. t.a32 = 790;
  51231. t.a33 = 793;
  51232. t.a34 = 794;
  51233. t.a35 = 816;
  51234. t.a36 = 823;
  51235. t.a37 = 789;
  51236. t.a38 = 841;
  51237. t.a39 = 823;
  51238. t.a40 = 833;
  51239. t.a41 = 816;
  51240. t.a42 = 831;
  51241. t.a43 = 923;
  51242. t.a44 = 744;
  51243. t.a45 = 723;
  51244. t.a46 = 749;
  51245. t.a47 = 790;
  51246. t.a48 = 792;
  51247. t.a49 = 695;
  51248. t.a50 = 776;
  51249. t.a51 = 768;
  51250. t.a52 = 792;
  51251. t.a53 = 759;
  51252. t.a54 = 707;
  51253. t.a55 = 708;
  51254. t.a56 = 682;
  51255. t.a57 = 701;
  51256. t.a58 = 826;
  51257. t.a59 = 815;
  51258. t.a60 = 789;
  51259. t.a61 = 789;
  51260. t.a62 = 707;
  51261. t.a63 = 687;
  51262. t.a64 = 696;
  51263. t.a65 = 689;
  51264. t.a66 = 786;
  51265. t.a67 = 787;
  51266. t.a68 = 713;
  51267. t.a69 = 791;
  51268. t.a70 = 785;
  51269. t.a71 = 791;
  51270. t.a72 = 873;
  51271. t.a73 = 761;
  51272. t.a74 = 762;
  51273. t.a203 = 762;
  51274. t.a75 = 759;
  51275. t.a204 = 759;
  51276. t.a76 = 892;
  51277. t.a77 = 892;
  51278. t.a78 = 788;
  51279. t.a79 = 784;
  51280. t.a81 = 438;
  51281. t.a82 = 138;
  51282. t.a83 = 277;
  51283. t.a84 = 415;
  51284. t.a97 = 392;
  51285. t.a98 = 392;
  51286. t.a99 = 668;
  51287. t.a100 = 668;
  51288. t.a89 = 390;
  51289. t.a90 = 390;
  51290. t.a93 = 317;
  51291. t.a94 = 317;
  51292. t.a91 = 276;
  51293. t.a92 = 276;
  51294. t.a205 = 509;
  51295. t.a85 = 509;
  51296. t.a206 = 410;
  51297. t.a86 = 410;
  51298. t.a87 = 234;
  51299. t.a88 = 234;
  51300. t.a95 = 334;
  51301. t.a96 = 334;
  51302. t.a101 = 732;
  51303. t.a102 = 544;
  51304. t.a103 = 544;
  51305. t.a104 = 910;
  51306. t.a106 = 667;
  51307. t.a107 = 760;
  51308. t.a108 = 760;
  51309. t.a112 = 776;
  51310. t.a111 = 595;
  51311. t.a110 = 694;
  51312. t.a109 = 626;
  51313. t.a120 = 788;
  51314. t.a121 = 788;
  51315. t.a122 = 788;
  51316. t.a123 = 788;
  51317. t.a124 = 788;
  51318. t.a125 = 788;
  51319. t.a126 = 788;
  51320. t.a127 = 788;
  51321. t.a128 = 788;
  51322. t.a129 = 788;
  51323. t.a130 = 788;
  51324. t.a131 = 788;
  51325. t.a132 = 788;
  51326. t.a133 = 788;
  51327. t.a134 = 788;
  51328. t.a135 = 788;
  51329. t.a136 = 788;
  51330. t.a137 = 788;
  51331. t.a138 = 788;
  51332. t.a139 = 788;
  51333. t.a140 = 788;
  51334. t.a141 = 788;
  51335. t.a142 = 788;
  51336. t.a143 = 788;
  51337. t.a144 = 788;
  51338. t.a145 = 788;
  51339. t.a146 = 788;
  51340. t.a147 = 788;
  51341. t.a148 = 788;
  51342. t.a149 = 788;
  51343. t.a150 = 788;
  51344. t.a151 = 788;
  51345. t.a152 = 788;
  51346. t.a153 = 788;
  51347. t.a154 = 788;
  51348. t.a155 = 788;
  51349. t.a156 = 788;
  51350. t.a157 = 788;
  51351. t.a158 = 788;
  51352. t.a159 = 788;
  51353. t.a160 = 894;
  51354. t.a161 = 838;
  51355. t.a163 = 1016;
  51356. t.a164 = 458;
  51357. t.a196 = 748;
  51358. t.a165 = 924;
  51359. t.a192 = 748;
  51360. t.a166 = 918;
  51361. t.a167 = 927;
  51362. t.a168 = 928;
  51363. t.a169 = 928;
  51364. t.a170 = 834;
  51365. t.a171 = 873;
  51366. t.a172 = 828;
  51367. t.a173 = 924;
  51368. t.a162 = 924;
  51369. t.a174 = 917;
  51370. t.a175 = 930;
  51371. t.a176 = 931;
  51372. t.a177 = 463;
  51373. t.a178 = 883;
  51374. t.a179 = 836;
  51375. t.a193 = 836;
  51376. t.a180 = 867;
  51377. t.a199 = 867;
  51378. t.a181 = 696;
  51379. t.a200 = 696;
  51380. t.a182 = 874;
  51381. t.a201 = 874;
  51382. t.a183 = 760;
  51383. t.a184 = 946;
  51384. t.a197 = 771;
  51385. t.a185 = 865;
  51386. t.a194 = 771;
  51387. t.a198 = 888;
  51388. t.a186 = 967;
  51389. t.a195 = 888;
  51390. t.a187 = 831;
  51391. t.a188 = 873;
  51392. t.a189 = 927;
  51393. t.a190 = 970;
  51394. t.a191 = 918;
  51395. });
  51396. });
  51397. exports.getMetrics = getMetrics;
  51398. const getFontBasicMetrics = (0, _core_utils.getLookupTableFactory)(
  51399. function (t) {
  51400. t.Courier = {
  51401. ascent: 629,
  51402. descent: -157,
  51403. capHeight: 562,
  51404. xHeight: -426,
  51405. };
  51406. t["Courier-Bold"] = {
  51407. ascent: 629,
  51408. descent: -157,
  51409. capHeight: 562,
  51410. xHeight: 439,
  51411. };
  51412. t["Courier-Oblique"] = {
  51413. ascent: 629,
  51414. descent: -157,
  51415. capHeight: 562,
  51416. xHeight: 426,
  51417. };
  51418. t["Courier-BoldOblique"] = {
  51419. ascent: 629,
  51420. descent: -157,
  51421. capHeight: 562,
  51422. xHeight: 426,
  51423. };
  51424. t.Helvetica = {
  51425. ascent: 718,
  51426. descent: -207,
  51427. capHeight: 718,
  51428. xHeight: 523,
  51429. };
  51430. t["Helvetica-Bold"] = {
  51431. ascent: 718,
  51432. descent: -207,
  51433. capHeight: 718,
  51434. xHeight: 532,
  51435. };
  51436. t["Helvetica-Oblique"] = {
  51437. ascent: 718,
  51438. descent: -207,
  51439. capHeight: 718,
  51440. xHeight: 523,
  51441. };
  51442. t["Helvetica-BoldOblique"] = {
  51443. ascent: 718,
  51444. descent: -207,
  51445. capHeight: 718,
  51446. xHeight: 532,
  51447. };
  51448. t["Times-Roman"] = {
  51449. ascent: 683,
  51450. descent: -217,
  51451. capHeight: 662,
  51452. xHeight: 450,
  51453. };
  51454. t["Times-Bold"] = {
  51455. ascent: 683,
  51456. descent: -217,
  51457. capHeight: 676,
  51458. xHeight: 461,
  51459. };
  51460. t["Times-Italic"] = {
  51461. ascent: 683,
  51462. descent: -217,
  51463. capHeight: 653,
  51464. xHeight: 441,
  51465. };
  51466. t["Times-BoldItalic"] = {
  51467. ascent: 683,
  51468. descent: -217,
  51469. capHeight: 669,
  51470. xHeight: 462,
  51471. };
  51472. t.Symbol = {
  51473. ascent: Math.NaN,
  51474. descent: Math.NaN,
  51475. capHeight: Math.NaN,
  51476. xHeight: Math.NaN,
  51477. };
  51478. t.ZapfDingbats = {
  51479. ascent: Math.NaN,
  51480. descent: Math.NaN,
  51481. capHeight: Math.NaN,
  51482. xHeight: Math.NaN,
  51483. };
  51484. }
  51485. );
  51486. exports.getFontBasicMetrics = getFontBasicMetrics;
  51487. /***/
  51488. },
  51489. /* 46 */
  51490. /***/ (__unused_webpack_module, exports) => {
  51491. Object.defineProperty(exports, "__esModule", {
  51492. value: true,
  51493. });
  51494. exports.GlyfTable = void 0;
  51495. const ON_CURVE_POINT = 1 << 0;
  51496. const X_SHORT_VECTOR = 1 << 1;
  51497. const Y_SHORT_VECTOR = 1 << 2;
  51498. const REPEAT_FLAG = 1 << 3;
  51499. const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4;
  51500. const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5;
  51501. const OVERLAP_SIMPLE = 1 << 6;
  51502. const ARG_1_AND_2_ARE_WORDS = 1 << 0;
  51503. const ARGS_ARE_XY_VALUES = 1 << 1;
  51504. const WE_HAVE_A_SCALE = 1 << 3;
  51505. const MORE_COMPONENTS = 1 << 5;
  51506. const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6;
  51507. const WE_HAVE_A_TWO_BY_TWO = 1 << 7;
  51508. const WE_HAVE_INSTRUCTIONS = 1 << 8;
  51509. class GlyfTable {
  51510. constructor({
  51511. glyfTable,
  51512. isGlyphLocationsLong,
  51513. locaTable,
  51514. numGlyphs,
  51515. }) {
  51516. this.glyphs = [];
  51517. const loca = new DataView(
  51518. locaTable.buffer,
  51519. locaTable.byteOffset,
  51520. locaTable.byteLength
  51521. );
  51522. const glyf = new DataView(
  51523. glyfTable.buffer,
  51524. glyfTable.byteOffset,
  51525. glyfTable.byteLength
  51526. );
  51527. const offsetSize = isGlyphLocationsLong ? 4 : 2;
  51528. let prev = isGlyphLocationsLong
  51529. ? loca.getUint32(0)
  51530. : 2 * loca.getUint16(0);
  51531. let pos = 0;
  51532. for (let i = 0; i < numGlyphs; i++) {
  51533. pos += offsetSize;
  51534. const next = isGlyphLocationsLong
  51535. ? loca.getUint32(pos)
  51536. : 2 * loca.getUint16(pos);
  51537. if (next === prev) {
  51538. this.glyphs.push(new Glyph({}));
  51539. continue;
  51540. }
  51541. const glyph = Glyph.parse(prev, glyf);
  51542. this.glyphs.push(glyph);
  51543. prev = next;
  51544. }
  51545. }
  51546. getSize() {
  51547. return this.glyphs.reduce((a, g) => {
  51548. const size = g.getSize();
  51549. return a + ((size + 3) & ~3);
  51550. }, 0);
  51551. }
  51552. write() {
  51553. const totalSize = this.getSize();
  51554. const glyfTable = new DataView(new ArrayBuffer(totalSize));
  51555. const isLocationLong = totalSize > 0x1fffe;
  51556. const offsetSize = isLocationLong ? 4 : 2;
  51557. const locaTable = new DataView(
  51558. new ArrayBuffer((this.glyphs.length + 1) * offsetSize)
  51559. );
  51560. if (isLocationLong) {
  51561. locaTable.setUint32(0, 0);
  51562. } else {
  51563. locaTable.setUint16(0, 0);
  51564. }
  51565. let pos = 0;
  51566. let locaIndex = 0;
  51567. for (const glyph of this.glyphs) {
  51568. pos += glyph.write(pos, glyfTable);
  51569. pos = (pos + 3) & ~3;
  51570. locaIndex += offsetSize;
  51571. if (isLocationLong) {
  51572. locaTable.setUint32(locaIndex, pos);
  51573. } else {
  51574. locaTable.setUint16(locaIndex, pos >> 1);
  51575. }
  51576. }
  51577. return {
  51578. isLocationLong,
  51579. loca: new Uint8Array(locaTable.buffer),
  51580. glyf: new Uint8Array(glyfTable.buffer),
  51581. };
  51582. }
  51583. scale(factors) {
  51584. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  51585. this.glyphs[i].scale(factors[i]);
  51586. }
  51587. }
  51588. }
  51589. exports.GlyfTable = GlyfTable;
  51590. class Glyph {
  51591. constructor({ header = null, simple = null, composites = null }) {
  51592. this.header = header;
  51593. this.simple = simple;
  51594. this.composites = composites;
  51595. }
  51596. static parse(pos, glyf) {
  51597. const [read, header] = GlyphHeader.parse(pos, glyf);
  51598. pos += read;
  51599. if (header.numberOfContours < 0) {
  51600. const composites = [];
  51601. while (true) {
  51602. const [n, composite] = CompositeGlyph.parse(pos, glyf);
  51603. pos += n;
  51604. composites.push(composite);
  51605. if (!(composite.flags & MORE_COMPONENTS)) {
  51606. break;
  51607. }
  51608. }
  51609. return new Glyph({
  51610. header,
  51611. composites,
  51612. });
  51613. }
  51614. const simple = SimpleGlyph.parse(
  51615. pos,
  51616. glyf,
  51617. header.numberOfContours
  51618. );
  51619. return new Glyph({
  51620. header,
  51621. simple,
  51622. });
  51623. }
  51624. getSize() {
  51625. if (!this.header) {
  51626. return 0;
  51627. }
  51628. const size = this.simple
  51629. ? this.simple.getSize()
  51630. : this.composites.reduce((a, c) => a + c.getSize(), 0);
  51631. return this.header.getSize() + size;
  51632. }
  51633. write(pos, buf) {
  51634. if (!this.header) {
  51635. return 0;
  51636. }
  51637. const spos = pos;
  51638. pos += this.header.write(pos, buf);
  51639. if (this.simple) {
  51640. pos += this.simple.write(pos, buf);
  51641. } else {
  51642. for (const composite of this.composites) {
  51643. pos += composite.write(pos, buf);
  51644. }
  51645. }
  51646. return pos - spos;
  51647. }
  51648. scale(factor) {
  51649. if (!this.header) {
  51650. return;
  51651. }
  51652. const xMiddle = (this.header.xMin + this.header.xMax) / 2;
  51653. this.header.scale(xMiddle, factor);
  51654. if (this.simple) {
  51655. this.simple.scale(xMiddle, factor);
  51656. } else {
  51657. for (const composite of this.composites) {
  51658. composite.scale(xMiddle, factor);
  51659. }
  51660. }
  51661. }
  51662. }
  51663. class GlyphHeader {
  51664. constructor({ numberOfContours, xMin, yMin, xMax, yMax }) {
  51665. this.numberOfContours = numberOfContours;
  51666. this.xMin = xMin;
  51667. this.yMin = yMin;
  51668. this.xMax = xMax;
  51669. this.yMax = yMax;
  51670. }
  51671. static parse(pos, glyf) {
  51672. return [
  51673. 10,
  51674. new GlyphHeader({
  51675. numberOfContours: glyf.getInt16(pos),
  51676. xMin: glyf.getInt16(pos + 2),
  51677. yMin: glyf.getInt16(pos + 4),
  51678. xMax: glyf.getInt16(pos + 6),
  51679. yMax: glyf.getInt16(pos + 8),
  51680. }),
  51681. ];
  51682. }
  51683. getSize() {
  51684. return 10;
  51685. }
  51686. write(pos, buf) {
  51687. buf.setInt16(pos, this.numberOfContours);
  51688. buf.setInt16(pos + 2, this.xMin);
  51689. buf.setInt16(pos + 4, this.yMin);
  51690. buf.setInt16(pos + 6, this.xMax);
  51691. buf.setInt16(pos + 8, this.yMax);
  51692. return 10;
  51693. }
  51694. scale(x, factor) {
  51695. this.xMin = Math.round(x + (this.xMin - x) * factor);
  51696. this.xMax = Math.round(x + (this.xMax - x) * factor);
  51697. }
  51698. }
  51699. class Contour {
  51700. constructor({ flags, xCoordinates, yCoordinates }) {
  51701. this.xCoordinates = xCoordinates;
  51702. this.yCoordinates = yCoordinates;
  51703. this.flags = flags;
  51704. }
  51705. }
  51706. class SimpleGlyph {
  51707. constructor({ contours, instructions }) {
  51708. this.contours = contours;
  51709. this.instructions = instructions;
  51710. }
  51711. static parse(pos, glyf, numberOfContours) {
  51712. const endPtsOfContours = [];
  51713. for (let i = 0; i < numberOfContours; i++) {
  51714. const endPt = glyf.getUint16(pos);
  51715. pos += 2;
  51716. endPtsOfContours.push(endPt);
  51717. }
  51718. const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1;
  51719. const instructionLength = glyf.getUint16(pos);
  51720. pos += 2;
  51721. const instructions = new Uint8Array(glyf).slice(
  51722. pos,
  51723. pos + instructionLength
  51724. );
  51725. pos += instructionLength;
  51726. const flags = [];
  51727. for (let i = 0; i < numberOfPt; pos++, i++) {
  51728. let flag = glyf.getUint8(pos);
  51729. flags.push(flag);
  51730. if (flag & REPEAT_FLAG) {
  51731. const count = glyf.getUint8(++pos);
  51732. flag ^= REPEAT_FLAG;
  51733. for (let m = 0; m < count; m++) {
  51734. flags.push(flag);
  51735. }
  51736. i += count;
  51737. }
  51738. }
  51739. const allXCoordinates = [];
  51740. let xCoordinates = [];
  51741. let yCoordinates = [];
  51742. let pointFlags = [];
  51743. const contours = [];
  51744. let endPtsOfContoursIndex = 0;
  51745. let lastCoordinate = 0;
  51746. for (let i = 0; i < numberOfPt; i++) {
  51747. const flag = flags[i];
  51748. if (flag & X_SHORT_VECTOR) {
  51749. const x = glyf.getUint8(pos++);
  51750. lastCoordinate +=
  51751. flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x;
  51752. xCoordinates.push(lastCoordinate);
  51753. } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) {
  51754. xCoordinates.push(lastCoordinate);
  51755. } else {
  51756. lastCoordinate += glyf.getInt16(pos);
  51757. pos += 2;
  51758. xCoordinates.push(lastCoordinate);
  51759. }
  51760. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  51761. endPtsOfContoursIndex++;
  51762. allXCoordinates.push(xCoordinates);
  51763. xCoordinates = [];
  51764. }
  51765. }
  51766. lastCoordinate = 0;
  51767. endPtsOfContoursIndex = 0;
  51768. for (let i = 0; i < numberOfPt; i++) {
  51769. const flag = flags[i];
  51770. if (flag & Y_SHORT_VECTOR) {
  51771. const y = glyf.getUint8(pos++);
  51772. lastCoordinate +=
  51773. flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y;
  51774. yCoordinates.push(lastCoordinate);
  51775. } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) {
  51776. yCoordinates.push(lastCoordinate);
  51777. } else {
  51778. lastCoordinate += glyf.getInt16(pos);
  51779. pos += 2;
  51780. yCoordinates.push(lastCoordinate);
  51781. }
  51782. pointFlags.push(
  51783. (flag & ON_CURVE_POINT) | (flag & OVERLAP_SIMPLE)
  51784. );
  51785. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  51786. xCoordinates = allXCoordinates[endPtsOfContoursIndex];
  51787. endPtsOfContoursIndex++;
  51788. contours.push(
  51789. new Contour({
  51790. flags: pointFlags,
  51791. xCoordinates,
  51792. yCoordinates,
  51793. })
  51794. );
  51795. yCoordinates = [];
  51796. pointFlags = [];
  51797. }
  51798. }
  51799. return new SimpleGlyph({
  51800. contours,
  51801. instructions,
  51802. });
  51803. }
  51804. getSize() {
  51805. let size = this.contours.length * 2 + 2 + this.instructions.length;
  51806. let lastX = 0;
  51807. let lastY = 0;
  51808. for (const contour of this.contours) {
  51809. size += contour.flags.length;
  51810. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  51811. const x = contour.xCoordinates[i];
  51812. const y = contour.yCoordinates[i];
  51813. let abs = Math.abs(x - lastX);
  51814. if (abs > 255) {
  51815. size += 2;
  51816. } else if (abs > 0) {
  51817. size += 1;
  51818. }
  51819. lastX = x;
  51820. abs = Math.abs(y - lastY);
  51821. if (abs > 255) {
  51822. size += 2;
  51823. } else if (abs > 0) {
  51824. size += 1;
  51825. }
  51826. lastY = y;
  51827. }
  51828. }
  51829. return size;
  51830. }
  51831. write(pos, buf) {
  51832. const spos = pos;
  51833. const xCoordinates = [];
  51834. const yCoordinates = [];
  51835. const flags = [];
  51836. let lastX = 0;
  51837. let lastY = 0;
  51838. for (const contour of this.contours) {
  51839. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  51840. let flag = contour.flags[i];
  51841. const x = contour.xCoordinates[i];
  51842. let delta = x - lastX;
  51843. if (delta === 0) {
  51844. flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR;
  51845. xCoordinates.push(0);
  51846. } else {
  51847. const abs = Math.abs(delta);
  51848. if (abs <= 255) {
  51849. flag |=
  51850. delta >= 0
  51851. ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR
  51852. : X_SHORT_VECTOR;
  51853. xCoordinates.push(abs);
  51854. } else {
  51855. xCoordinates.push(delta);
  51856. }
  51857. }
  51858. lastX = x;
  51859. const y = contour.yCoordinates[i];
  51860. delta = y - lastY;
  51861. if (delta === 0) {
  51862. flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR;
  51863. yCoordinates.push(0);
  51864. } else {
  51865. const abs = Math.abs(delta);
  51866. if (abs <= 255) {
  51867. flag |=
  51868. delta >= 0
  51869. ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR
  51870. : Y_SHORT_VECTOR;
  51871. yCoordinates.push(abs);
  51872. } else {
  51873. yCoordinates.push(delta);
  51874. }
  51875. }
  51876. lastY = y;
  51877. flags.push(flag);
  51878. }
  51879. buf.setUint16(pos, xCoordinates.length - 1);
  51880. pos += 2;
  51881. }
  51882. buf.setUint16(pos, this.instructions.length);
  51883. pos += 2;
  51884. if (this.instructions.length) {
  51885. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(
  51886. this.instructions,
  51887. pos
  51888. );
  51889. pos += this.instructions.length;
  51890. }
  51891. for (const flag of flags) {
  51892. buf.setUint8(pos++, flag);
  51893. }
  51894. for (let i = 0, ii = xCoordinates.length; i < ii; i++) {
  51895. const x = xCoordinates[i];
  51896. const flag = flags[i];
  51897. if (flag & X_SHORT_VECTOR) {
  51898. buf.setUint8(pos++, x);
  51899. } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) {
  51900. buf.setInt16(pos, x);
  51901. pos += 2;
  51902. }
  51903. }
  51904. for (let i = 0, ii = yCoordinates.length; i < ii; i++) {
  51905. const y = yCoordinates[i];
  51906. const flag = flags[i];
  51907. if (flag & Y_SHORT_VECTOR) {
  51908. buf.setUint8(pos++, y);
  51909. } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) {
  51910. buf.setInt16(pos, y);
  51911. pos += 2;
  51912. }
  51913. }
  51914. return pos - spos;
  51915. }
  51916. scale(x, factor) {
  51917. for (const contour of this.contours) {
  51918. if (contour.xCoordinates.length === 0) {
  51919. continue;
  51920. }
  51921. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  51922. contour.xCoordinates[i] = Math.round(
  51923. x + (contour.xCoordinates[i] - x) * factor
  51924. );
  51925. }
  51926. }
  51927. }
  51928. }
  51929. class CompositeGlyph {
  51930. constructor({
  51931. flags,
  51932. glyphIndex,
  51933. argument1,
  51934. argument2,
  51935. transf,
  51936. instructions,
  51937. }) {
  51938. this.flags = flags;
  51939. this.glyphIndex = glyphIndex;
  51940. this.argument1 = argument1;
  51941. this.argument2 = argument2;
  51942. this.transf = transf;
  51943. this.instructions = instructions;
  51944. }
  51945. static parse(pos, glyf) {
  51946. const spos = pos;
  51947. const transf = [];
  51948. let flags = glyf.getUint16(pos);
  51949. const glyphIndex = glyf.getUint16(pos + 2);
  51950. pos += 4;
  51951. let argument1, argument2;
  51952. if (flags & ARG_1_AND_2_ARE_WORDS) {
  51953. if (flags & ARGS_ARE_XY_VALUES) {
  51954. argument1 = glyf.getInt16(pos);
  51955. argument2 = glyf.getInt16(pos + 2);
  51956. } else {
  51957. argument1 = glyf.getUint16(pos);
  51958. argument2 = glyf.getUint16(pos + 2);
  51959. }
  51960. pos += 4;
  51961. flags ^= ARG_1_AND_2_ARE_WORDS;
  51962. } else {
  51963. if (flags & ARGS_ARE_XY_VALUES) {
  51964. argument1 = glyf.getInt8(pos);
  51965. argument2 = glyf.getInt8(pos + 1);
  51966. } else {
  51967. argument1 = glyf.getUint8(pos);
  51968. argument2 = glyf.getUint8(pos + 1);
  51969. }
  51970. pos += 2;
  51971. }
  51972. if (flags & WE_HAVE_A_SCALE) {
  51973. transf.push(glyf.getUint16(pos));
  51974. pos += 2;
  51975. } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
  51976. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2));
  51977. pos += 4;
  51978. } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
  51979. transf.push(
  51980. glyf.getUint16(pos),
  51981. glyf.getUint16(pos + 2),
  51982. glyf.getUint16(pos + 4),
  51983. glyf.getUint16(pos + 6)
  51984. );
  51985. pos += 8;
  51986. }
  51987. let instructions = null;
  51988. if (flags & WE_HAVE_INSTRUCTIONS) {
  51989. const instructionLength = glyf.getUint16(pos);
  51990. pos += 2;
  51991. instructions = new Uint8Array(glyf).slice(
  51992. pos,
  51993. pos + instructionLength
  51994. );
  51995. pos += instructionLength;
  51996. }
  51997. return [
  51998. pos - spos,
  51999. new CompositeGlyph({
  52000. flags,
  52001. glyphIndex,
  52002. argument1,
  52003. argument2,
  52004. transf,
  52005. instructions,
  52006. }),
  52007. ];
  52008. }
  52009. getSize() {
  52010. let size = 2 + 2 + this.transf.length * 2;
  52011. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  52012. size += 2 + this.instructions.length;
  52013. }
  52014. size += 2;
  52015. if (this.flags & 2) {
  52016. if (
  52017. !(
  52018. this.argument1 >= -128 &&
  52019. this.argument1 <= 127 &&
  52020. this.argument2 >= -128 &&
  52021. this.argument2 <= 127
  52022. )
  52023. ) {
  52024. size += 2;
  52025. }
  52026. } else {
  52027. if (
  52028. !(
  52029. this.argument1 >= 0 &&
  52030. this.argument1 <= 255 &&
  52031. this.argument2 >= 0 &&
  52032. this.argument2 <= 255
  52033. )
  52034. ) {
  52035. size += 2;
  52036. }
  52037. }
  52038. return size;
  52039. }
  52040. write(pos, buf) {
  52041. const spos = pos;
  52042. if (this.flags & ARGS_ARE_XY_VALUES) {
  52043. if (
  52044. !(
  52045. this.argument1 >= -128 &&
  52046. this.argument1 <= 127 &&
  52047. this.argument2 >= -128 &&
  52048. this.argument2 <= 127
  52049. )
  52050. ) {
  52051. this.flags |= ARG_1_AND_2_ARE_WORDS;
  52052. }
  52053. } else {
  52054. if (
  52055. !(
  52056. this.argument1 >= 0 &&
  52057. this.argument1 <= 255 &&
  52058. this.argument2 >= 0 &&
  52059. this.argument2 <= 255
  52060. )
  52061. ) {
  52062. this.flags |= ARG_1_AND_2_ARE_WORDS;
  52063. }
  52064. }
  52065. buf.setUint16(pos, this.flags);
  52066. buf.setUint16(pos + 2, this.glyphIndex);
  52067. pos += 4;
  52068. if (this.flags & ARG_1_AND_2_ARE_WORDS) {
  52069. if (this.flags & ARGS_ARE_XY_VALUES) {
  52070. buf.setInt16(pos, this.argument1);
  52071. buf.setInt16(pos + 2, this.argument2);
  52072. } else {
  52073. buf.setUint16(pos, this.argument1);
  52074. buf.setUint16(pos + 2, this.argument2);
  52075. }
  52076. pos += 4;
  52077. } else {
  52078. buf.setUint8(pos, this.argument1);
  52079. buf.setUint8(pos + 1, this.argument2);
  52080. pos += 2;
  52081. }
  52082. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  52083. buf.setUint16(pos, this.instructions.length);
  52084. pos += 2;
  52085. if (this.instructions.length) {
  52086. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(
  52087. this.instructions,
  52088. pos
  52089. );
  52090. pos += this.instructions.length;
  52091. }
  52092. }
  52093. return pos - spos;
  52094. }
  52095. scale(x, factor) {}
  52096. }
  52097. /***/
  52098. },
  52099. /* 47 */
  52100. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52101. Object.defineProperty(exports, "__esModule", {
  52102. value: true,
  52103. });
  52104. exports.OpenTypeFileBuilder = void 0;
  52105. var _core_utils = __w_pdfjs_require__(6);
  52106. var _util = __w_pdfjs_require__(2);
  52107. function writeInt16(dest, offset, num) {
  52108. dest[offset] = (num >> 8) & 0xff;
  52109. dest[offset + 1] = num & 0xff;
  52110. }
  52111. function writeInt32(dest, offset, num) {
  52112. dest[offset] = (num >> 24) & 0xff;
  52113. dest[offset + 1] = (num >> 16) & 0xff;
  52114. dest[offset + 2] = (num >> 8) & 0xff;
  52115. dest[offset + 3] = num & 0xff;
  52116. }
  52117. function writeData(dest, offset, data) {
  52118. if (data instanceof Uint8Array) {
  52119. dest.set(data, offset);
  52120. } else if (typeof data === "string") {
  52121. for (let i = 0, ii = data.length; i < ii; i++) {
  52122. dest[offset++] = data.charCodeAt(i) & 0xff;
  52123. }
  52124. } else {
  52125. for (let i = 0, ii = data.length; i < ii; i++) {
  52126. dest[offset++] = data[i] & 0xff;
  52127. }
  52128. }
  52129. }
  52130. const OTF_HEADER_SIZE = 12;
  52131. const OTF_TABLE_ENTRY_SIZE = 16;
  52132. class OpenTypeFileBuilder {
  52133. constructor(sfnt) {
  52134. this.sfnt = sfnt;
  52135. this.tables = Object.create(null);
  52136. }
  52137. static getSearchParams(entriesCount, entrySize) {
  52138. let maxPower2 = 1,
  52139. log2 = 0;
  52140. while ((maxPower2 ^ entriesCount) > maxPower2) {
  52141. maxPower2 <<= 1;
  52142. log2++;
  52143. }
  52144. const searchRange = maxPower2 * entrySize;
  52145. return {
  52146. range: searchRange,
  52147. entry: log2,
  52148. rangeShift: entrySize * entriesCount - searchRange,
  52149. };
  52150. }
  52151. toArray() {
  52152. let sfnt = this.sfnt;
  52153. const tables = this.tables;
  52154. const tablesNames = Object.keys(tables);
  52155. tablesNames.sort();
  52156. const numTables = tablesNames.length;
  52157. let i, j, jj, table, tableName;
  52158. let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  52159. const tableOffsets = [offset];
  52160. for (i = 0; i < numTables; i++) {
  52161. table = tables[tablesNames[i]];
  52162. const paddedLength = ((table.length + 3) & ~3) >>> 0;
  52163. offset += paddedLength;
  52164. tableOffsets.push(offset);
  52165. }
  52166. const file = new Uint8Array(offset);
  52167. for (i = 0; i < numTables; i++) {
  52168. table = tables[tablesNames[i]];
  52169. writeData(file, tableOffsets[i], table);
  52170. }
  52171. if (sfnt === "true") {
  52172. sfnt = (0, _util.string32)(0x00010000);
  52173. }
  52174. file[0] = sfnt.charCodeAt(0) & 0xff;
  52175. file[1] = sfnt.charCodeAt(1) & 0xff;
  52176. file[2] = sfnt.charCodeAt(2) & 0xff;
  52177. file[3] = sfnt.charCodeAt(3) & 0xff;
  52178. writeInt16(file, 4, numTables);
  52179. const searchParams = OpenTypeFileBuilder.getSearchParams(
  52180. numTables,
  52181. 16
  52182. );
  52183. writeInt16(file, 6, searchParams.range);
  52184. writeInt16(file, 8, searchParams.entry);
  52185. writeInt16(file, 10, searchParams.rangeShift);
  52186. offset = OTF_HEADER_SIZE;
  52187. for (i = 0; i < numTables; i++) {
  52188. tableName = tablesNames[i];
  52189. file[offset] = tableName.charCodeAt(0) & 0xff;
  52190. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  52191. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  52192. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  52193. let checksum = 0;
  52194. for (
  52195. j = tableOffsets[i], jj = tableOffsets[i + 1];
  52196. j < jj;
  52197. j += 4
  52198. ) {
  52199. const quad = (0, _core_utils.readUint32)(file, j);
  52200. checksum = (checksum + quad) >>> 0;
  52201. }
  52202. writeInt32(file, offset + 4, checksum);
  52203. writeInt32(file, offset + 8, tableOffsets[i]);
  52204. writeInt32(file, offset + 12, tables[tableName].length);
  52205. offset += OTF_TABLE_ENTRY_SIZE;
  52206. }
  52207. return file;
  52208. }
  52209. addTable(tag, data) {
  52210. if (tag in this.tables) {
  52211. throw new Error("Table " + tag + " already exists");
  52212. }
  52213. this.tables[tag] = data;
  52214. }
  52215. }
  52216. exports.OpenTypeFileBuilder = OpenTypeFileBuilder;
  52217. /***/
  52218. },
  52219. /* 48 */
  52220. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52221. Object.defineProperty(exports, "__esModule", {
  52222. value: true,
  52223. });
  52224. exports.Type1Font = void 0;
  52225. var _cff_parser = __w_pdfjs_require__(35);
  52226. var _fonts_utils = __w_pdfjs_require__(38);
  52227. var _core_utils = __w_pdfjs_require__(6);
  52228. var _stream = __w_pdfjs_require__(10);
  52229. var _type1_parser = __w_pdfjs_require__(49);
  52230. var _util = __w_pdfjs_require__(2);
  52231. function findBlock(streamBytes, signature, startIndex) {
  52232. const streamBytesLength = streamBytes.length;
  52233. const signatureLength = signature.length;
  52234. const scanLength = streamBytesLength - signatureLength;
  52235. let i = startIndex,
  52236. found = false;
  52237. while (i < scanLength) {
  52238. let j = 0;
  52239. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  52240. j++;
  52241. }
  52242. if (j >= signatureLength) {
  52243. i += j;
  52244. while (
  52245. i < streamBytesLength &&
  52246. (0, _core_utils.isWhiteSpace)(streamBytes[i])
  52247. ) {
  52248. i++;
  52249. }
  52250. found = true;
  52251. break;
  52252. }
  52253. i++;
  52254. }
  52255. return {
  52256. found,
  52257. length: i,
  52258. };
  52259. }
  52260. function getHeaderBlock(stream, suggestedLength) {
  52261. const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  52262. const streamStartPos = stream.pos;
  52263. let headerBytes, headerBytesLength, block;
  52264. try {
  52265. headerBytes = stream.getBytes(suggestedLength);
  52266. headerBytesLength = headerBytes.length;
  52267. } catch (ex) {}
  52268. if (headerBytesLength === suggestedLength) {
  52269. block = findBlock(
  52270. headerBytes,
  52271. EEXEC_SIGNATURE,
  52272. suggestedLength - 2 * EEXEC_SIGNATURE.length
  52273. );
  52274. if (block.found && block.length === suggestedLength) {
  52275. return {
  52276. stream: new _stream.Stream(headerBytes),
  52277. length: suggestedLength,
  52278. };
  52279. }
  52280. }
  52281. (0, _util.warn)(
  52282. 'Invalid "Length1" property in Type1 font -- trying to recover.'
  52283. );
  52284. stream.pos = streamStartPos;
  52285. const SCAN_BLOCK_LENGTH = 2048;
  52286. let actualLength;
  52287. while (true) {
  52288. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  52289. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  52290. if (block.length === 0) {
  52291. break;
  52292. }
  52293. stream.pos += block.length;
  52294. if (block.found) {
  52295. actualLength = stream.pos - streamStartPos;
  52296. break;
  52297. }
  52298. }
  52299. stream.pos = streamStartPos;
  52300. if (actualLength) {
  52301. return {
  52302. stream: new _stream.Stream(stream.getBytes(actualLength)),
  52303. length: actualLength,
  52304. };
  52305. }
  52306. (0, _util.warn)(
  52307. 'Unable to recover "Length1" property in Type1 font -- using as is.'
  52308. );
  52309. return {
  52310. stream: new _stream.Stream(stream.getBytes(suggestedLength)),
  52311. length: suggestedLength,
  52312. };
  52313. }
  52314. function getEexecBlock(stream, suggestedLength) {
  52315. const eexecBytes = stream.getBytes();
  52316. return {
  52317. stream: new _stream.Stream(eexecBytes),
  52318. length: eexecBytes.length,
  52319. };
  52320. }
  52321. class Type1Font {
  52322. constructor(name, file, properties) {
  52323. const PFB_HEADER_SIZE = 6;
  52324. let headerBlockLength = properties.length1;
  52325. let eexecBlockLength = properties.length2;
  52326. let pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  52327. const pfbHeaderPresent =
  52328. pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  52329. if (pfbHeaderPresent) {
  52330. file.skip(PFB_HEADER_SIZE);
  52331. headerBlockLength =
  52332. (pfbHeader[5] << 24) |
  52333. (pfbHeader[4] << 16) |
  52334. (pfbHeader[3] << 8) |
  52335. pfbHeader[2];
  52336. }
  52337. const headerBlock = getHeaderBlock(file, headerBlockLength);
  52338. const headerBlockParser = new _type1_parser.Type1Parser(
  52339. headerBlock.stream,
  52340. false,
  52341. _fonts_utils.SEAC_ANALYSIS_ENABLED
  52342. );
  52343. headerBlockParser.extractFontHeader(properties);
  52344. if (pfbHeaderPresent) {
  52345. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  52346. eexecBlockLength =
  52347. (pfbHeader[5] << 24) |
  52348. (pfbHeader[4] << 16) |
  52349. (pfbHeader[3] << 8) |
  52350. pfbHeader[2];
  52351. }
  52352. const eexecBlock = getEexecBlock(file, eexecBlockLength);
  52353. const eexecBlockParser = new _type1_parser.Type1Parser(
  52354. eexecBlock.stream,
  52355. true,
  52356. _fonts_utils.SEAC_ANALYSIS_ENABLED
  52357. );
  52358. const data = eexecBlockParser.extractFontProgram(properties);
  52359. for (const key in data.properties) {
  52360. properties[key] = data.properties[key];
  52361. }
  52362. const charstrings = data.charstrings;
  52363. const type2Charstrings = this.getType2Charstrings(charstrings);
  52364. const subrs = this.getType2Subrs(data.subrs);
  52365. this.charstrings = charstrings;
  52366. this.data = this.wrap(
  52367. name,
  52368. type2Charstrings,
  52369. this.charstrings,
  52370. subrs,
  52371. properties
  52372. );
  52373. this.seacs = this.getSeacs(data.charstrings);
  52374. }
  52375. get numGlyphs() {
  52376. return this.charstrings.length + 1;
  52377. }
  52378. getCharset() {
  52379. const charset = [".notdef"];
  52380. for (const { glyphName } of this.charstrings) {
  52381. charset.push(glyphName);
  52382. }
  52383. return charset;
  52384. }
  52385. getGlyphMapping(properties) {
  52386. const charstrings = this.charstrings;
  52387. if (properties.composite) {
  52388. const charCodeToGlyphId = Object.create(null);
  52389. for (
  52390. let glyphId = 0, charstringsLen = charstrings.length;
  52391. glyphId < charstringsLen;
  52392. glyphId++
  52393. ) {
  52394. const charCode = properties.cMap.charCodeOf(glyphId);
  52395. charCodeToGlyphId[charCode] = glyphId + 1;
  52396. }
  52397. return charCodeToGlyphId;
  52398. }
  52399. const glyphNames = [".notdef"];
  52400. let builtInEncoding, glyphId;
  52401. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  52402. glyphNames.push(charstrings[glyphId].glyphName);
  52403. }
  52404. const encoding = properties.builtInEncoding;
  52405. if (encoding) {
  52406. builtInEncoding = Object.create(null);
  52407. for (const charCode in encoding) {
  52408. glyphId = glyphNames.indexOf(encoding[charCode]);
  52409. if (glyphId >= 0) {
  52410. builtInEncoding[charCode] = glyphId;
  52411. }
  52412. }
  52413. }
  52414. return (0, _fonts_utils.type1FontGlyphMapping)(
  52415. properties,
  52416. builtInEncoding,
  52417. glyphNames
  52418. );
  52419. }
  52420. hasGlyphId(id) {
  52421. if (id < 0 || id >= this.numGlyphs) {
  52422. return false;
  52423. }
  52424. if (id === 0) {
  52425. return true;
  52426. }
  52427. const glyph = this.charstrings[id - 1];
  52428. return glyph.charstring.length > 0;
  52429. }
  52430. getSeacs(charstrings) {
  52431. const seacMap = [];
  52432. for (let i = 0, ii = charstrings.length; i < ii; i++) {
  52433. const charstring = charstrings[i];
  52434. if (charstring.seac) {
  52435. seacMap[i + 1] = charstring.seac;
  52436. }
  52437. }
  52438. return seacMap;
  52439. }
  52440. getType2Charstrings(type1Charstrings) {
  52441. const type2Charstrings = [];
  52442. for (let i = 0, ii = type1Charstrings.length; i < ii; i++) {
  52443. type2Charstrings.push(type1Charstrings[i].charstring);
  52444. }
  52445. return type2Charstrings;
  52446. }
  52447. getType2Subrs(type1Subrs) {
  52448. let bias = 0;
  52449. const count = type1Subrs.length;
  52450. if (count < 1133) {
  52451. bias = 107;
  52452. } else if (count < 33769) {
  52453. bias = 1131;
  52454. } else {
  52455. bias = 32768;
  52456. }
  52457. const type2Subrs = [];
  52458. let i;
  52459. for (i = 0; i < bias; i++) {
  52460. type2Subrs.push([0x0b]);
  52461. }
  52462. for (i = 0; i < count; i++) {
  52463. type2Subrs.push(type1Subrs[i]);
  52464. }
  52465. return type2Subrs;
  52466. }
  52467. wrap(name, glyphs, charstrings, subrs, properties) {
  52468. const cff = new _cff_parser.CFF();
  52469. cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
  52470. cff.names = [name];
  52471. const topDict = new _cff_parser.CFFTopDict();
  52472. topDict.setByName("version", 391);
  52473. topDict.setByName("Notice", 392);
  52474. topDict.setByName("FullName", 393);
  52475. topDict.setByName("FamilyName", 394);
  52476. topDict.setByName("Weight", 395);
  52477. topDict.setByName("Encoding", null);
  52478. topDict.setByName("FontMatrix", properties.fontMatrix);
  52479. topDict.setByName("FontBBox", properties.bbox);
  52480. topDict.setByName("charset", null);
  52481. topDict.setByName("CharStrings", null);
  52482. topDict.setByName("Private", null);
  52483. cff.topDict = topDict;
  52484. const strings = new _cff_parser.CFFStrings();
  52485. strings.add("Version 0.11");
  52486. strings.add("See original notice");
  52487. strings.add(name);
  52488. strings.add(name);
  52489. strings.add("Medium");
  52490. cff.strings = strings;
  52491. cff.globalSubrIndex = new _cff_parser.CFFIndex();
  52492. const count = glyphs.length;
  52493. const charsetArray = [".notdef"];
  52494. let i, ii;
  52495. for (i = 0; i < count; i++) {
  52496. const glyphName = charstrings[i].glyphName;
  52497. const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
  52498. if (index === -1) {
  52499. strings.add(glyphName);
  52500. }
  52501. charsetArray.push(glyphName);
  52502. }
  52503. cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
  52504. const charStringsIndex = new _cff_parser.CFFIndex();
  52505. charStringsIndex.add([0x8b, 0x0e]);
  52506. for (i = 0; i < count; i++) {
  52507. charStringsIndex.add(glyphs[i]);
  52508. }
  52509. cff.charStrings = charStringsIndex;
  52510. const privateDict = new _cff_parser.CFFPrivateDict();
  52511. privateDict.setByName("Subrs", null);
  52512. const fields = [
  52513. "BlueValues",
  52514. "OtherBlues",
  52515. "FamilyBlues",
  52516. "FamilyOtherBlues",
  52517. "StemSnapH",
  52518. "StemSnapV",
  52519. "BlueShift",
  52520. "BlueFuzz",
  52521. "BlueScale",
  52522. "LanguageGroup",
  52523. "ExpansionFactor",
  52524. "ForceBold",
  52525. "StdHW",
  52526. "StdVW",
  52527. ];
  52528. for (i = 0, ii = fields.length; i < ii; i++) {
  52529. const field = fields[i];
  52530. if (!(field in properties.privateData)) {
  52531. continue;
  52532. }
  52533. const value = properties.privateData[field];
  52534. if (Array.isArray(value)) {
  52535. for (let j = value.length - 1; j > 0; j--) {
  52536. value[j] -= value[j - 1];
  52537. }
  52538. }
  52539. privateDict.setByName(field, value);
  52540. }
  52541. cff.topDict.privateDict = privateDict;
  52542. const subrIndex = new _cff_parser.CFFIndex();
  52543. for (i = 0, ii = subrs.length; i < ii; i++) {
  52544. subrIndex.add(subrs[i]);
  52545. }
  52546. privateDict.subrsIndex = subrIndex;
  52547. const compiler = new _cff_parser.CFFCompiler(cff);
  52548. return compiler.compile();
  52549. }
  52550. }
  52551. exports.Type1Font = Type1Font;
  52552. /***/
  52553. },
  52554. /* 49 */
  52555. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52556. Object.defineProperty(exports, "__esModule", {
  52557. value: true,
  52558. });
  52559. exports.Type1Parser = void 0;
  52560. var _encodings = __w_pdfjs_require__(37);
  52561. var _core_utils = __w_pdfjs_require__(6);
  52562. var _stream = __w_pdfjs_require__(10);
  52563. var _util = __w_pdfjs_require__(2);
  52564. const HINTING_ENABLED = false;
  52565. const COMMAND_MAP = {
  52566. hstem: [1],
  52567. vstem: [3],
  52568. vmoveto: [4],
  52569. rlineto: [5],
  52570. hlineto: [6],
  52571. vlineto: [7],
  52572. rrcurveto: [8],
  52573. callsubr: [10],
  52574. flex: [12, 35],
  52575. drop: [12, 18],
  52576. endchar: [14],
  52577. rmoveto: [21],
  52578. hmoveto: [22],
  52579. vhcurveto: [30],
  52580. hvcurveto: [31],
  52581. };
  52582. class Type1CharString {
  52583. constructor() {
  52584. this.width = 0;
  52585. this.lsb = 0;
  52586. this.flexing = false;
  52587. this.output = [];
  52588. this.stack = [];
  52589. }
  52590. convert(encoded, subrs, seacAnalysisEnabled) {
  52591. const count = encoded.length;
  52592. let error = false;
  52593. let wx, sbx, subrNumber;
  52594. for (let i = 0; i < count; i++) {
  52595. let value = encoded[i];
  52596. if (value < 32) {
  52597. if (value === 12) {
  52598. value = (value << 8) + encoded[++i];
  52599. }
  52600. switch (value) {
  52601. case 1:
  52602. if (!HINTING_ENABLED) {
  52603. this.stack = [];
  52604. break;
  52605. }
  52606. error = this.executeCommand(2, COMMAND_MAP.hstem);
  52607. break;
  52608. case 3:
  52609. if (!HINTING_ENABLED) {
  52610. this.stack = [];
  52611. break;
  52612. }
  52613. error = this.executeCommand(2, COMMAND_MAP.vstem);
  52614. break;
  52615. case 4:
  52616. if (this.flexing) {
  52617. if (this.stack.length < 1) {
  52618. error = true;
  52619. break;
  52620. }
  52621. const dy = this.stack.pop();
  52622. this.stack.push(0, dy);
  52623. break;
  52624. }
  52625. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  52626. break;
  52627. case 5:
  52628. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  52629. break;
  52630. case 6:
  52631. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  52632. break;
  52633. case 7:
  52634. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  52635. break;
  52636. case 8:
  52637. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  52638. break;
  52639. case 9:
  52640. this.stack = [];
  52641. break;
  52642. case 10:
  52643. if (this.stack.length < 1) {
  52644. error = true;
  52645. break;
  52646. }
  52647. subrNumber = this.stack.pop();
  52648. if (!subrs[subrNumber]) {
  52649. error = true;
  52650. break;
  52651. }
  52652. error = this.convert(
  52653. subrs[subrNumber],
  52654. subrs,
  52655. seacAnalysisEnabled
  52656. );
  52657. break;
  52658. case 11:
  52659. return error;
  52660. case 13:
  52661. if (this.stack.length < 2) {
  52662. error = true;
  52663. break;
  52664. }
  52665. wx = this.stack.pop();
  52666. sbx = this.stack.pop();
  52667. this.lsb = sbx;
  52668. this.width = wx;
  52669. this.stack.push(wx, sbx);
  52670. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  52671. break;
  52672. case 14:
  52673. this.output.push(COMMAND_MAP.endchar[0]);
  52674. break;
  52675. case 21:
  52676. if (this.flexing) {
  52677. break;
  52678. }
  52679. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  52680. break;
  52681. case 22:
  52682. if (this.flexing) {
  52683. this.stack.push(0);
  52684. break;
  52685. }
  52686. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  52687. break;
  52688. case 30:
  52689. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  52690. break;
  52691. case 31:
  52692. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  52693. break;
  52694. case (12 << 8) + 0:
  52695. this.stack = [];
  52696. break;
  52697. case (12 << 8) + 1:
  52698. if (!HINTING_ENABLED) {
  52699. this.stack = [];
  52700. break;
  52701. }
  52702. error = this.executeCommand(2, COMMAND_MAP.vstem);
  52703. break;
  52704. case (12 << 8) + 2:
  52705. if (!HINTING_ENABLED) {
  52706. this.stack = [];
  52707. break;
  52708. }
  52709. error = this.executeCommand(2, COMMAND_MAP.hstem);
  52710. break;
  52711. case (12 << 8) + 6:
  52712. if (seacAnalysisEnabled) {
  52713. const asb = this.stack.at(-5);
  52714. this.seac = this.stack.splice(-4, 4);
  52715. this.seac[0] += this.lsb - asb;
  52716. error = this.executeCommand(0, COMMAND_MAP.endchar);
  52717. } else {
  52718. error = this.executeCommand(4, COMMAND_MAP.endchar);
  52719. }
  52720. break;
  52721. case (12 << 8) + 7:
  52722. if (this.stack.length < 4) {
  52723. error = true;
  52724. break;
  52725. }
  52726. this.stack.pop();
  52727. wx = this.stack.pop();
  52728. const sby = this.stack.pop();
  52729. sbx = this.stack.pop();
  52730. this.lsb = sbx;
  52731. this.width = wx;
  52732. this.stack.push(wx, sbx, sby);
  52733. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  52734. break;
  52735. case (12 << 8) + 12:
  52736. if (this.stack.length < 2) {
  52737. error = true;
  52738. break;
  52739. }
  52740. const num2 = this.stack.pop();
  52741. const num1 = this.stack.pop();
  52742. this.stack.push(num1 / num2);
  52743. break;
  52744. case (12 << 8) + 16:
  52745. if (this.stack.length < 2) {
  52746. error = true;
  52747. break;
  52748. }
  52749. subrNumber = this.stack.pop();
  52750. const numArgs = this.stack.pop();
  52751. if (subrNumber === 0 && numArgs === 3) {
  52752. const flexArgs = this.stack.splice(
  52753. this.stack.length - 17,
  52754. 17
  52755. );
  52756. this.stack.push(
  52757. flexArgs[2] + flexArgs[0],
  52758. flexArgs[3] + flexArgs[1],
  52759. flexArgs[4],
  52760. flexArgs[5],
  52761. flexArgs[6],
  52762. flexArgs[7],
  52763. flexArgs[8],
  52764. flexArgs[9],
  52765. flexArgs[10],
  52766. flexArgs[11],
  52767. flexArgs[12],
  52768. flexArgs[13],
  52769. flexArgs[14]
  52770. );
  52771. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  52772. this.flexing = false;
  52773. this.stack.push(flexArgs[15], flexArgs[16]);
  52774. } else if (subrNumber === 1 && numArgs === 0) {
  52775. this.flexing = true;
  52776. }
  52777. break;
  52778. case (12 << 8) + 17:
  52779. break;
  52780. case (12 << 8) + 33:
  52781. this.stack = [];
  52782. break;
  52783. default:
  52784. (0, _util.warn)(
  52785. 'Unknown type 1 charstring command of "' + value + '"'
  52786. );
  52787. break;
  52788. }
  52789. if (error) {
  52790. break;
  52791. }
  52792. continue;
  52793. } else if (value <= 246) {
  52794. value -= 139;
  52795. } else if (value <= 250) {
  52796. value = (value - 247) * 256 + encoded[++i] + 108;
  52797. } else if (value <= 254) {
  52798. value = -((value - 251) * 256) - encoded[++i] - 108;
  52799. } else {
  52800. value =
  52801. ((encoded[++i] & 0xff) << 24) |
  52802. ((encoded[++i] & 0xff) << 16) |
  52803. ((encoded[++i] & 0xff) << 8) |
  52804. ((encoded[++i] & 0xff) << 0);
  52805. }
  52806. this.stack.push(value);
  52807. }
  52808. return error;
  52809. }
  52810. executeCommand(howManyArgs, command, keepStack) {
  52811. const stackLength = this.stack.length;
  52812. if (howManyArgs > stackLength) {
  52813. return true;
  52814. }
  52815. const start = stackLength - howManyArgs;
  52816. for (let i = start; i < stackLength; i++) {
  52817. let value = this.stack[i];
  52818. if (Number.isInteger(value)) {
  52819. this.output.push(28, (value >> 8) & 0xff, value & 0xff);
  52820. } else {
  52821. value = (65536 * value) | 0;
  52822. this.output.push(
  52823. 255,
  52824. (value >> 24) & 0xff,
  52825. (value >> 16) & 0xff,
  52826. (value >> 8) & 0xff,
  52827. value & 0xff
  52828. );
  52829. }
  52830. }
  52831. this.output.push(...command);
  52832. if (keepStack) {
  52833. this.stack.splice(start, howManyArgs);
  52834. } else {
  52835. this.stack.length = 0;
  52836. }
  52837. return false;
  52838. }
  52839. }
  52840. const EEXEC_ENCRYPT_KEY = 55665;
  52841. const CHAR_STRS_ENCRYPT_KEY = 4330;
  52842. function isHexDigit(code) {
  52843. return (
  52844. (code >= 48 && code <= 57) ||
  52845. (code >= 65 && code <= 70) ||
  52846. (code >= 97 && code <= 102)
  52847. );
  52848. }
  52849. function decrypt(data, key, discardNumber) {
  52850. if (discardNumber >= data.length) {
  52851. return new Uint8Array(0);
  52852. }
  52853. const c1 = 52845,
  52854. c2 = 22719;
  52855. let r = key | 0,
  52856. i,
  52857. j;
  52858. for (i = 0; i < discardNumber; i++) {
  52859. r = ((data[i] + r) * c1 + c2) & ((1 << 16) - 1);
  52860. }
  52861. const count = data.length - discardNumber;
  52862. const decrypted = new Uint8Array(count);
  52863. for (i = discardNumber, j = 0; j < count; i++, j++) {
  52864. const value = data[i];
  52865. decrypted[j] = value ^ (r >> 8);
  52866. r = ((value + r) * c1 + c2) & ((1 << 16) - 1);
  52867. }
  52868. return decrypted;
  52869. }
  52870. function decryptAscii(data, key, discardNumber) {
  52871. const c1 = 52845,
  52872. c2 = 22719;
  52873. let r = key | 0;
  52874. const count = data.length,
  52875. maybeLength = count >>> 1;
  52876. const decrypted = new Uint8Array(maybeLength);
  52877. let i, j;
  52878. for (i = 0, j = 0; i < count; i++) {
  52879. const digit1 = data[i];
  52880. if (!isHexDigit(digit1)) {
  52881. continue;
  52882. }
  52883. i++;
  52884. let digit2;
  52885. while (i < count && !isHexDigit((digit2 = data[i]))) {
  52886. i++;
  52887. }
  52888. if (i < count) {
  52889. const value = parseInt(String.fromCharCode(digit1, digit2), 16);
  52890. decrypted[j++] = value ^ (r >> 8);
  52891. r = ((value + r) * c1 + c2) & ((1 << 16) - 1);
  52892. }
  52893. }
  52894. return decrypted.slice(discardNumber, j);
  52895. }
  52896. function isSpecial(c) {
  52897. return (
  52898. c === 0x2f ||
  52899. c === 0x5b ||
  52900. c === 0x5d ||
  52901. c === 0x7b ||
  52902. c === 0x7d ||
  52903. c === 0x28 ||
  52904. c === 0x29
  52905. );
  52906. }
  52907. class Type1Parser {
  52908. constructor(stream, encrypted, seacAnalysisEnabled) {
  52909. if (encrypted) {
  52910. const data = stream.getBytes();
  52911. const isBinary = !(
  52912. (isHexDigit(data[0]) ||
  52913. (0, _core_utils.isWhiteSpace)(data[0])) &&
  52914. isHexDigit(data[1]) &&
  52915. isHexDigit(data[2]) &&
  52916. isHexDigit(data[3]) &&
  52917. isHexDigit(data[4]) &&
  52918. isHexDigit(data[5]) &&
  52919. isHexDigit(data[6]) &&
  52920. isHexDigit(data[7])
  52921. );
  52922. stream = new _stream.Stream(
  52923. isBinary
  52924. ? decrypt(data, EEXEC_ENCRYPT_KEY, 4)
  52925. : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4)
  52926. );
  52927. }
  52928. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  52929. this.stream = stream;
  52930. this.nextChar();
  52931. }
  52932. readNumberArray() {
  52933. this.getToken();
  52934. const array = [];
  52935. while (true) {
  52936. const token = this.getToken();
  52937. if (token === null || token === "]" || token === "}") {
  52938. break;
  52939. }
  52940. array.push(parseFloat(token || 0));
  52941. }
  52942. return array;
  52943. }
  52944. readNumber() {
  52945. const token = this.getToken();
  52946. return parseFloat(token || 0);
  52947. }
  52948. readInt() {
  52949. const token = this.getToken();
  52950. return parseInt(token || 0, 10) | 0;
  52951. }
  52952. readBoolean() {
  52953. const token = this.getToken();
  52954. return token === "true" ? 1 : 0;
  52955. }
  52956. nextChar() {
  52957. return (this.currentChar = this.stream.getByte());
  52958. }
  52959. prevChar() {
  52960. this.stream.skip(-2);
  52961. return (this.currentChar = this.stream.getByte());
  52962. }
  52963. getToken() {
  52964. let comment = false;
  52965. let ch = this.currentChar;
  52966. while (true) {
  52967. if (ch === -1) {
  52968. return null;
  52969. }
  52970. if (comment) {
  52971. if (ch === 0x0a || ch === 0x0d) {
  52972. comment = false;
  52973. }
  52974. } else if (ch === 0x25) {
  52975. comment = true;
  52976. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  52977. break;
  52978. }
  52979. ch = this.nextChar();
  52980. }
  52981. if (isSpecial(ch)) {
  52982. this.nextChar();
  52983. return String.fromCharCode(ch);
  52984. }
  52985. let token = "";
  52986. do {
  52987. token += String.fromCharCode(ch);
  52988. ch = this.nextChar();
  52989. } while (
  52990. ch >= 0 &&
  52991. !(0, _core_utils.isWhiteSpace)(ch) &&
  52992. !isSpecial(ch)
  52993. );
  52994. return token;
  52995. }
  52996. readCharStrings(bytes, lenIV) {
  52997. if (lenIV === -1) {
  52998. return bytes;
  52999. }
  53000. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  53001. }
  53002. extractFontProgram(properties) {
  53003. const stream = this.stream;
  53004. const subrs = [],
  53005. charstrings = [];
  53006. const privateData = Object.create(null);
  53007. privateData.lenIV = 4;
  53008. const program = {
  53009. subrs: [],
  53010. charstrings: [],
  53011. properties: {
  53012. privateData,
  53013. },
  53014. };
  53015. let token, length, data, lenIV;
  53016. while ((token = this.getToken()) !== null) {
  53017. if (token !== "/") {
  53018. continue;
  53019. }
  53020. token = this.getToken();
  53021. switch (token) {
  53022. case "CharStrings":
  53023. this.getToken();
  53024. this.getToken();
  53025. this.getToken();
  53026. this.getToken();
  53027. while (true) {
  53028. token = this.getToken();
  53029. if (token === null || token === "end") {
  53030. break;
  53031. }
  53032. if (token !== "/") {
  53033. continue;
  53034. }
  53035. const glyph = this.getToken();
  53036. length = this.readInt();
  53037. this.getToken();
  53038. data =
  53039. length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  53040. lenIV = program.properties.privateData.lenIV;
  53041. const encoded = this.readCharStrings(data, lenIV);
  53042. this.nextChar();
  53043. token = this.getToken();
  53044. if (token === "noaccess") {
  53045. this.getToken();
  53046. } else if (token === "/") {
  53047. this.prevChar();
  53048. }
  53049. charstrings.push({
  53050. glyph,
  53051. encoded,
  53052. });
  53053. }
  53054. break;
  53055. case "Subrs":
  53056. this.readInt();
  53057. this.getToken();
  53058. while (this.getToken() === "dup") {
  53059. const index = this.readInt();
  53060. length = this.readInt();
  53061. this.getToken();
  53062. data =
  53063. length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  53064. lenIV = program.properties.privateData.lenIV;
  53065. const encoded = this.readCharStrings(data, lenIV);
  53066. this.nextChar();
  53067. token = this.getToken();
  53068. if (token === "noaccess") {
  53069. this.getToken();
  53070. }
  53071. subrs[index] = encoded;
  53072. }
  53073. break;
  53074. case "BlueValues":
  53075. case "OtherBlues":
  53076. case "FamilyBlues":
  53077. case "FamilyOtherBlues":
  53078. const blueArray = this.readNumberArray();
  53079. if (
  53080. blueArray.length > 0 &&
  53081. blueArray.length % 2 === 0 &&
  53082. HINTING_ENABLED
  53083. ) {
  53084. program.properties.privateData[token] = blueArray;
  53085. }
  53086. break;
  53087. case "StemSnapH":
  53088. case "StemSnapV":
  53089. program.properties.privateData[token] =
  53090. this.readNumberArray();
  53091. break;
  53092. case "StdHW":
  53093. case "StdVW":
  53094. program.properties.privateData[token] =
  53095. this.readNumberArray()[0];
  53096. break;
  53097. case "BlueShift":
  53098. case "lenIV":
  53099. case "BlueFuzz":
  53100. case "BlueScale":
  53101. case "LanguageGroup":
  53102. case "ExpansionFactor":
  53103. program.properties.privateData[token] = this.readNumber();
  53104. break;
  53105. case "ForceBold":
  53106. program.properties.privateData[token] = this.readBoolean();
  53107. break;
  53108. }
  53109. }
  53110. for (const { encoded, glyph } of charstrings) {
  53111. const charString = new Type1CharString();
  53112. const error = charString.convert(
  53113. encoded,
  53114. subrs,
  53115. this.seacAnalysisEnabled
  53116. );
  53117. let output = charString.output;
  53118. if (error) {
  53119. output = [14];
  53120. }
  53121. const charStringObject = {
  53122. glyphName: glyph,
  53123. charstring: output,
  53124. width: charString.width,
  53125. lsb: charString.lsb,
  53126. seac: charString.seac,
  53127. };
  53128. if (glyph === ".notdef") {
  53129. program.charstrings.unshift(charStringObject);
  53130. } else {
  53131. program.charstrings.push(charStringObject);
  53132. }
  53133. if (properties.builtInEncoding) {
  53134. const index = properties.builtInEncoding.indexOf(glyph);
  53135. if (
  53136. index > -1 &&
  53137. properties.widths[index] === undefined &&
  53138. index >= properties.firstChar &&
  53139. index <= properties.lastChar
  53140. ) {
  53141. properties.widths[index] = charString.width;
  53142. }
  53143. }
  53144. }
  53145. return program;
  53146. }
  53147. extractFontHeader(properties) {
  53148. let token;
  53149. while ((token = this.getToken()) !== null) {
  53150. if (token !== "/") {
  53151. continue;
  53152. }
  53153. token = this.getToken();
  53154. switch (token) {
  53155. case "FontMatrix":
  53156. const matrix = this.readNumberArray();
  53157. properties.fontMatrix = matrix;
  53158. break;
  53159. case "Encoding":
  53160. const encodingArg = this.getToken();
  53161. let encoding;
  53162. if (!/^\d+$/.test(encodingArg)) {
  53163. encoding = (0, _encodings.getEncoding)(encodingArg);
  53164. } else {
  53165. encoding = [];
  53166. const size = parseInt(encodingArg, 10) | 0;
  53167. this.getToken();
  53168. for (let j = 0; j < size; j++) {
  53169. token = this.getToken();
  53170. while (token !== "dup" && token !== "def") {
  53171. token = this.getToken();
  53172. if (token === null) {
  53173. return;
  53174. }
  53175. }
  53176. if (token === "def") {
  53177. break;
  53178. }
  53179. const index = this.readInt();
  53180. this.getToken();
  53181. const glyph = this.getToken();
  53182. encoding[index] = glyph;
  53183. this.getToken();
  53184. }
  53185. }
  53186. properties.builtInEncoding = encoding;
  53187. break;
  53188. case "FontBBox":
  53189. const fontBBox = this.readNumberArray();
  53190. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  53191. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  53192. properties.ascentScaled = true;
  53193. break;
  53194. }
  53195. }
  53196. }
  53197. }
  53198. exports.Type1Parser = Type1Parser;
  53199. /***/
  53200. },
  53201. /* 50 */
  53202. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  53203. Object.defineProperty(exports, "__esModule", {
  53204. value: true,
  53205. });
  53206. exports.Pattern = void 0;
  53207. exports.getTilingPatternIR = getTilingPatternIR;
  53208. var _util = __w_pdfjs_require__(2);
  53209. var _base_stream = __w_pdfjs_require__(7);
  53210. var _colorspace = __w_pdfjs_require__(14);
  53211. var _core_utils = __w_pdfjs_require__(6);
  53212. const ShadingType = {
  53213. FUNCTION_BASED: 1,
  53214. AXIAL: 2,
  53215. RADIAL: 3,
  53216. FREE_FORM_MESH: 4,
  53217. LATTICE_FORM_MESH: 5,
  53218. COONS_PATCH_MESH: 6,
  53219. TENSOR_PATCH_MESH: 7,
  53220. };
  53221. class Pattern {
  53222. constructor() {
  53223. (0, _util.unreachable)("Cannot initialize Pattern.");
  53224. }
  53225. static parseShading(
  53226. shading,
  53227. xref,
  53228. res,
  53229. handler,
  53230. pdfFunctionFactory,
  53231. localColorSpaceCache
  53232. ) {
  53233. const dict =
  53234. shading instanceof _base_stream.BaseStream
  53235. ? shading.dict
  53236. : shading;
  53237. const type = dict.get("ShadingType");
  53238. try {
  53239. switch (type) {
  53240. case ShadingType.AXIAL:
  53241. case ShadingType.RADIAL:
  53242. return new RadialAxialShading(
  53243. dict,
  53244. xref,
  53245. res,
  53246. pdfFunctionFactory,
  53247. localColorSpaceCache
  53248. );
  53249. case ShadingType.FREE_FORM_MESH:
  53250. case ShadingType.LATTICE_FORM_MESH:
  53251. case ShadingType.COONS_PATCH_MESH:
  53252. case ShadingType.TENSOR_PATCH_MESH:
  53253. return new MeshShading(
  53254. shading,
  53255. xref,
  53256. res,
  53257. pdfFunctionFactory,
  53258. localColorSpaceCache
  53259. );
  53260. default:
  53261. throw new _util.FormatError(
  53262. "Unsupported ShadingType: " + type
  53263. );
  53264. }
  53265. } catch (ex) {
  53266. if (ex instanceof _core_utils.MissingDataException) {
  53267. throw ex;
  53268. }
  53269. handler.send("UnsupportedFeature", {
  53270. featureId: _util.UNSUPPORTED_FEATURES.shadingPattern,
  53271. });
  53272. (0, _util.warn)(ex);
  53273. return new DummyShading();
  53274. }
  53275. }
  53276. }
  53277. exports.Pattern = Pattern;
  53278. class BaseShading {
  53279. static get SMALL_NUMBER() {
  53280. return (0, _util.shadow)(this, "SMALL_NUMBER", 1e-6);
  53281. }
  53282. constructor() {
  53283. if (this.constructor === BaseShading) {
  53284. (0, _util.unreachable)("Cannot initialize BaseShading.");
  53285. }
  53286. }
  53287. getIR() {
  53288. (0, _util.unreachable)("Abstract method `getIR` called.");
  53289. }
  53290. }
  53291. class RadialAxialShading extends BaseShading {
  53292. constructor(
  53293. dict,
  53294. xref,
  53295. resources,
  53296. pdfFunctionFactory,
  53297. localColorSpaceCache
  53298. ) {
  53299. super();
  53300. this.coordsArr = dict.getArray("Coords");
  53301. this.shadingType = dict.get("ShadingType");
  53302. const cs = _colorspace.ColorSpace.parse({
  53303. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  53304. xref,
  53305. resources,
  53306. pdfFunctionFactory,
  53307. localColorSpaceCache,
  53308. });
  53309. const bbox = dict.getArray("BBox");
  53310. if (Array.isArray(bbox) && bbox.length === 4) {
  53311. this.bbox = _util.Util.normalizeRect(bbox);
  53312. } else {
  53313. this.bbox = null;
  53314. }
  53315. let t0 = 0.0,
  53316. t1 = 1.0;
  53317. if (dict.has("Domain")) {
  53318. const domainArr = dict.getArray("Domain");
  53319. t0 = domainArr[0];
  53320. t1 = domainArr[1];
  53321. }
  53322. let extendStart = false,
  53323. extendEnd = false;
  53324. if (dict.has("Extend")) {
  53325. const extendArr = dict.getArray("Extend");
  53326. extendStart = extendArr[0];
  53327. extendEnd = extendArr[1];
  53328. }
  53329. if (
  53330. this.shadingType === ShadingType.RADIAL &&
  53331. (!extendStart || !extendEnd)
  53332. ) {
  53333. const [x1, y1, r1, x2, y2, r2] = this.coordsArr;
  53334. const distance = Math.hypot(x1 - x2, y1 - y2);
  53335. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  53336. (0, _util.warn)("Unsupported radial gradient.");
  53337. }
  53338. }
  53339. this.extendStart = extendStart;
  53340. this.extendEnd = extendEnd;
  53341. const fnObj = dict.getRaw("Function");
  53342. const fn = pdfFunctionFactory.createFromArray(fnObj);
  53343. const NUMBER_OF_SAMPLES = 10;
  53344. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  53345. const colorStops = (this.colorStops = []);
  53346. if (t0 >= t1 || step <= 0) {
  53347. (0, _util.info)("Bad shading domain.");
  53348. return;
  53349. }
  53350. const color = new Float32Array(cs.numComps),
  53351. ratio = new Float32Array(1);
  53352. let rgbColor;
  53353. for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
  53354. ratio[0] = t0 + i * step;
  53355. fn(ratio, 0, color, 0);
  53356. rgbColor = cs.getRgb(color, 0);
  53357. const cssColor = _util.Util.makeHexColor(
  53358. rgbColor[0],
  53359. rgbColor[1],
  53360. rgbColor[2]
  53361. );
  53362. colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
  53363. }
  53364. let background = "transparent";
  53365. if (dict.has("Background")) {
  53366. rgbColor = cs.getRgb(dict.get("Background"), 0);
  53367. background = _util.Util.makeHexColor(
  53368. rgbColor[0],
  53369. rgbColor[1],
  53370. rgbColor[2]
  53371. );
  53372. }
  53373. if (!extendStart) {
  53374. colorStops.unshift([0, background]);
  53375. colorStops[1][0] += BaseShading.SMALL_NUMBER;
  53376. }
  53377. if (!extendEnd) {
  53378. colorStops.at(-1)[0] -= BaseShading.SMALL_NUMBER;
  53379. colorStops.push([1, background]);
  53380. }
  53381. this.colorStops = colorStops;
  53382. }
  53383. getIR() {
  53384. const coordsArr = this.coordsArr;
  53385. const shadingType = this.shadingType;
  53386. let type, p0, p1, r0, r1;
  53387. if (shadingType === ShadingType.AXIAL) {
  53388. p0 = [coordsArr[0], coordsArr[1]];
  53389. p1 = [coordsArr[2], coordsArr[3]];
  53390. r0 = null;
  53391. r1 = null;
  53392. type = "axial";
  53393. } else if (shadingType === ShadingType.RADIAL) {
  53394. p0 = [coordsArr[0], coordsArr[1]];
  53395. p1 = [coordsArr[3], coordsArr[4]];
  53396. r0 = coordsArr[2];
  53397. r1 = coordsArr[5];
  53398. type = "radial";
  53399. } else {
  53400. (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
  53401. }
  53402. return [
  53403. "RadialAxial",
  53404. type,
  53405. this.bbox,
  53406. this.colorStops,
  53407. p0,
  53408. p1,
  53409. r0,
  53410. r1,
  53411. ];
  53412. }
  53413. }
  53414. class MeshStreamReader {
  53415. constructor(stream, context) {
  53416. this.stream = stream;
  53417. this.context = context;
  53418. this.buffer = 0;
  53419. this.bufferLength = 0;
  53420. const numComps = context.numComps;
  53421. this.tmpCompsBuf = new Float32Array(numComps);
  53422. const csNumComps = context.colorSpace.numComps;
  53423. this.tmpCsCompsBuf = context.colorFn
  53424. ? new Float32Array(csNumComps)
  53425. : this.tmpCompsBuf;
  53426. }
  53427. get hasData() {
  53428. if (this.stream.end) {
  53429. return this.stream.pos < this.stream.end;
  53430. }
  53431. if (this.bufferLength > 0) {
  53432. return true;
  53433. }
  53434. const nextByte = this.stream.getByte();
  53435. if (nextByte < 0) {
  53436. return false;
  53437. }
  53438. this.buffer = nextByte;
  53439. this.bufferLength = 8;
  53440. return true;
  53441. }
  53442. readBits(n) {
  53443. let buffer = this.buffer;
  53444. let bufferLength = this.bufferLength;
  53445. if (n === 32) {
  53446. if (bufferLength === 0) {
  53447. return (
  53448. ((this.stream.getByte() << 24) |
  53449. (this.stream.getByte() << 16) |
  53450. (this.stream.getByte() << 8) |
  53451. this.stream.getByte()) >>>
  53452. 0
  53453. );
  53454. }
  53455. buffer =
  53456. (buffer << 24) |
  53457. (this.stream.getByte() << 16) |
  53458. (this.stream.getByte() << 8) |
  53459. this.stream.getByte();
  53460. const nextByte = this.stream.getByte();
  53461. this.buffer = nextByte & ((1 << bufferLength) - 1);
  53462. return (
  53463. ((buffer << (8 - bufferLength)) |
  53464. ((nextByte & 0xff) >> bufferLength)) >>>
  53465. 0
  53466. );
  53467. }
  53468. if (n === 8 && bufferLength === 0) {
  53469. return this.stream.getByte();
  53470. }
  53471. while (bufferLength < n) {
  53472. buffer = (buffer << 8) | this.stream.getByte();
  53473. bufferLength += 8;
  53474. }
  53475. bufferLength -= n;
  53476. this.bufferLength = bufferLength;
  53477. this.buffer = buffer & ((1 << bufferLength) - 1);
  53478. return buffer >> bufferLength;
  53479. }
  53480. align() {
  53481. this.buffer = 0;
  53482. this.bufferLength = 0;
  53483. }
  53484. readFlag() {
  53485. return this.readBits(this.context.bitsPerFlag);
  53486. }
  53487. readCoordinate() {
  53488. const bitsPerCoordinate = this.context.bitsPerCoordinate;
  53489. const xi = this.readBits(bitsPerCoordinate);
  53490. const yi = this.readBits(bitsPerCoordinate);
  53491. const decode = this.context.decode;
  53492. const scale =
  53493. bitsPerCoordinate < 32
  53494. ? 1 / ((1 << bitsPerCoordinate) - 1)
  53495. : 2.3283064365386963e-10;
  53496. return [
  53497. xi * scale * (decode[1] - decode[0]) + decode[0],
  53498. yi * scale * (decode[3] - decode[2]) + decode[2],
  53499. ];
  53500. }
  53501. readComponents() {
  53502. const numComps = this.context.numComps;
  53503. const bitsPerComponent = this.context.bitsPerComponent;
  53504. const scale =
  53505. bitsPerComponent < 32
  53506. ? 1 / ((1 << bitsPerComponent) - 1)
  53507. : 2.3283064365386963e-10;
  53508. const decode = this.context.decode;
  53509. const components = this.tmpCompsBuf;
  53510. for (let i = 0, j = 4; i < numComps; i++, j += 2) {
  53511. const ci = this.readBits(bitsPerComponent);
  53512. components[i] =
  53513. ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  53514. }
  53515. const color = this.tmpCsCompsBuf;
  53516. if (this.context.colorFn) {
  53517. this.context.colorFn(components, 0, color, 0);
  53518. }
  53519. return this.context.colorSpace.getRgb(color, 0);
  53520. }
  53521. }
  53522. const getB = (function getBClosure() {
  53523. function buildB(count) {
  53524. const lut = [];
  53525. for (let i = 0; i <= count; i++) {
  53526. const t = i / count,
  53527. t_ = 1 - t;
  53528. lut.push(
  53529. new Float32Array([
  53530. t_ * t_ * t_,
  53531. 3 * t * t_ * t_,
  53532. 3 * t * t * t_,
  53533. t * t * t,
  53534. ])
  53535. );
  53536. }
  53537. return lut;
  53538. }
  53539. const cache = [];
  53540. return function (count) {
  53541. if (!cache[count]) {
  53542. cache[count] = buildB(count);
  53543. }
  53544. return cache[count];
  53545. };
  53546. })();
  53547. class MeshShading extends BaseShading {
  53548. static get MIN_SPLIT_PATCH_CHUNKS_AMOUNT() {
  53549. return (0, _util.shadow)(this, "MIN_SPLIT_PATCH_CHUNKS_AMOUNT", 3);
  53550. }
  53551. static get MAX_SPLIT_PATCH_CHUNKS_AMOUNT() {
  53552. return (0, _util.shadow)(this, "MAX_SPLIT_PATCH_CHUNKS_AMOUNT", 20);
  53553. }
  53554. static get TRIANGLE_DENSITY() {
  53555. return (0, _util.shadow)(this, "TRIANGLE_DENSITY", 20);
  53556. }
  53557. constructor(
  53558. stream,
  53559. xref,
  53560. resources,
  53561. pdfFunctionFactory,
  53562. localColorSpaceCache
  53563. ) {
  53564. super();
  53565. if (!(stream instanceof _base_stream.BaseStream)) {
  53566. throw new _util.FormatError("Mesh data is not a stream");
  53567. }
  53568. const dict = stream.dict;
  53569. this.shadingType = dict.get("ShadingType");
  53570. const bbox = dict.getArray("BBox");
  53571. if (Array.isArray(bbox) && bbox.length === 4) {
  53572. this.bbox = _util.Util.normalizeRect(bbox);
  53573. } else {
  53574. this.bbox = null;
  53575. }
  53576. const cs = _colorspace.ColorSpace.parse({
  53577. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  53578. xref,
  53579. resources,
  53580. pdfFunctionFactory,
  53581. localColorSpaceCache,
  53582. });
  53583. this.background = dict.has("Background")
  53584. ? cs.getRgb(dict.get("Background"), 0)
  53585. : null;
  53586. const fnObj = dict.getRaw("Function");
  53587. const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  53588. this.coords = [];
  53589. this.colors = [];
  53590. this.figures = [];
  53591. const decodeContext = {
  53592. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  53593. bitsPerComponent: dict.get("BitsPerComponent"),
  53594. bitsPerFlag: dict.get("BitsPerFlag"),
  53595. decode: dict.getArray("Decode"),
  53596. colorFn: fn,
  53597. colorSpace: cs,
  53598. numComps: fn ? 1 : cs.numComps,
  53599. };
  53600. const reader = new MeshStreamReader(stream, decodeContext);
  53601. let patchMesh = false;
  53602. switch (this.shadingType) {
  53603. case ShadingType.FREE_FORM_MESH:
  53604. this._decodeType4Shading(reader);
  53605. break;
  53606. case ShadingType.LATTICE_FORM_MESH:
  53607. const verticesPerRow = dict.get("VerticesPerRow") | 0;
  53608. if (verticesPerRow < 2) {
  53609. throw new _util.FormatError("Invalid VerticesPerRow");
  53610. }
  53611. this._decodeType5Shading(reader, verticesPerRow);
  53612. break;
  53613. case ShadingType.COONS_PATCH_MESH:
  53614. this._decodeType6Shading(reader);
  53615. patchMesh = true;
  53616. break;
  53617. case ShadingType.TENSOR_PATCH_MESH:
  53618. this._decodeType7Shading(reader);
  53619. patchMesh = true;
  53620. break;
  53621. default:
  53622. (0, _util.unreachable)("Unsupported mesh type.");
  53623. break;
  53624. }
  53625. if (patchMesh) {
  53626. this._updateBounds();
  53627. for (let i = 0, ii = this.figures.length; i < ii; i++) {
  53628. this._buildFigureFromPatch(i);
  53629. }
  53630. }
  53631. this._updateBounds();
  53632. this._packData();
  53633. }
  53634. _decodeType4Shading(reader) {
  53635. const coords = this.coords;
  53636. const colors = this.colors;
  53637. const operators = [];
  53638. const ps = [];
  53639. let verticesLeft = 0;
  53640. while (reader.hasData) {
  53641. const f = reader.readFlag();
  53642. const coord = reader.readCoordinate();
  53643. const color = reader.readComponents();
  53644. if (verticesLeft === 0) {
  53645. if (!(0 <= f && f <= 2)) {
  53646. throw new _util.FormatError("Unknown type4 flag");
  53647. }
  53648. switch (f) {
  53649. case 0:
  53650. verticesLeft = 3;
  53651. break;
  53652. case 1:
  53653. ps.push(ps.at(-2), ps.at(-1));
  53654. verticesLeft = 1;
  53655. break;
  53656. case 2:
  53657. ps.push(ps.at(-3), ps.at(-1));
  53658. verticesLeft = 1;
  53659. break;
  53660. }
  53661. operators.push(f);
  53662. }
  53663. ps.push(coords.length);
  53664. coords.push(coord);
  53665. colors.push(color);
  53666. verticesLeft--;
  53667. reader.align();
  53668. }
  53669. this.figures.push({
  53670. type: "triangles",
  53671. coords: new Int32Array(ps),
  53672. colors: new Int32Array(ps),
  53673. });
  53674. }
  53675. _decodeType5Shading(reader, verticesPerRow) {
  53676. const coords = this.coords;
  53677. const colors = this.colors;
  53678. const ps = [];
  53679. while (reader.hasData) {
  53680. const coord = reader.readCoordinate();
  53681. const color = reader.readComponents();
  53682. ps.push(coords.length);
  53683. coords.push(coord);
  53684. colors.push(color);
  53685. }
  53686. this.figures.push({
  53687. type: "lattice",
  53688. coords: new Int32Array(ps),
  53689. colors: new Int32Array(ps),
  53690. verticesPerRow,
  53691. });
  53692. }
  53693. _decodeType6Shading(reader) {
  53694. const coords = this.coords;
  53695. const colors = this.colors;
  53696. const ps = new Int32Array(16);
  53697. const cs = new Int32Array(4);
  53698. while (reader.hasData) {
  53699. const f = reader.readFlag();
  53700. if (!(0 <= f && f <= 3)) {
  53701. throw new _util.FormatError("Unknown type6 flag");
  53702. }
  53703. const pi = coords.length;
  53704. for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  53705. coords.push(reader.readCoordinate());
  53706. }
  53707. const ci = colors.length;
  53708. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  53709. colors.push(reader.readComponents());
  53710. }
  53711. let tmp1, tmp2, tmp3, tmp4;
  53712. switch (f) {
  53713. case 0:
  53714. ps[12] = pi + 3;
  53715. ps[13] = pi + 4;
  53716. ps[14] = pi + 5;
  53717. ps[15] = pi + 6;
  53718. ps[8] = pi + 2;
  53719. ps[11] = pi + 7;
  53720. ps[4] = pi + 1;
  53721. ps[7] = pi + 8;
  53722. ps[0] = pi;
  53723. ps[1] = pi + 11;
  53724. ps[2] = pi + 10;
  53725. ps[3] = pi + 9;
  53726. cs[2] = ci + 1;
  53727. cs[3] = ci + 2;
  53728. cs[0] = ci;
  53729. cs[1] = ci + 3;
  53730. break;
  53731. case 1:
  53732. tmp1 = ps[12];
  53733. tmp2 = ps[13];
  53734. tmp3 = ps[14];
  53735. tmp4 = ps[15];
  53736. ps[12] = tmp4;
  53737. ps[13] = pi + 0;
  53738. ps[14] = pi + 1;
  53739. ps[15] = pi + 2;
  53740. ps[8] = tmp3;
  53741. ps[11] = pi + 3;
  53742. ps[4] = tmp2;
  53743. ps[7] = pi + 4;
  53744. ps[0] = tmp1;
  53745. ps[1] = pi + 7;
  53746. ps[2] = pi + 6;
  53747. ps[3] = pi + 5;
  53748. tmp1 = cs[2];
  53749. tmp2 = cs[3];
  53750. cs[2] = tmp2;
  53751. cs[3] = ci;
  53752. cs[0] = tmp1;
  53753. cs[1] = ci + 1;
  53754. break;
  53755. case 2:
  53756. tmp1 = ps[15];
  53757. tmp2 = ps[11];
  53758. ps[12] = ps[3];
  53759. ps[13] = pi + 0;
  53760. ps[14] = pi + 1;
  53761. ps[15] = pi + 2;
  53762. ps[8] = ps[7];
  53763. ps[11] = pi + 3;
  53764. ps[4] = tmp2;
  53765. ps[7] = pi + 4;
  53766. ps[0] = tmp1;
  53767. ps[1] = pi + 7;
  53768. ps[2] = pi + 6;
  53769. ps[3] = pi + 5;
  53770. tmp1 = cs[3];
  53771. cs[2] = cs[1];
  53772. cs[3] = ci;
  53773. cs[0] = tmp1;
  53774. cs[1] = ci + 1;
  53775. break;
  53776. case 3:
  53777. ps[12] = ps[0];
  53778. ps[13] = pi + 0;
  53779. ps[14] = pi + 1;
  53780. ps[15] = pi + 2;
  53781. ps[8] = ps[1];
  53782. ps[11] = pi + 3;
  53783. ps[4] = ps[2];
  53784. ps[7] = pi + 4;
  53785. ps[0] = ps[3];
  53786. ps[1] = pi + 7;
  53787. ps[2] = pi + 6;
  53788. ps[3] = pi + 5;
  53789. cs[2] = cs[0];
  53790. cs[3] = ci;
  53791. cs[0] = cs[1];
  53792. cs[1] = ci + 1;
  53793. break;
  53794. }
  53795. ps[5] = coords.length;
  53796. coords.push([
  53797. (-4 * coords[ps[0]][0] -
  53798. coords[ps[15]][0] +
  53799. 6 * (coords[ps[4]][0] + coords[ps[1]][0]) -
  53800. 2 * (coords[ps[12]][0] + coords[ps[3]][0]) +
  53801. 3 * (coords[ps[13]][0] + coords[ps[7]][0])) /
  53802. 9,
  53803. (-4 * coords[ps[0]][1] -
  53804. coords[ps[15]][1] +
  53805. 6 * (coords[ps[4]][1] + coords[ps[1]][1]) -
  53806. 2 * (coords[ps[12]][1] + coords[ps[3]][1]) +
  53807. 3 * (coords[ps[13]][1] + coords[ps[7]][1])) /
  53808. 9,
  53809. ]);
  53810. ps[6] = coords.length;
  53811. coords.push([
  53812. (-4 * coords[ps[3]][0] -
  53813. coords[ps[12]][0] +
  53814. 6 * (coords[ps[2]][0] + coords[ps[7]][0]) -
  53815. 2 * (coords[ps[0]][0] + coords[ps[15]][0]) +
  53816. 3 * (coords[ps[4]][0] + coords[ps[14]][0])) /
  53817. 9,
  53818. (-4 * coords[ps[3]][1] -
  53819. coords[ps[12]][1] +
  53820. 6 * (coords[ps[2]][1] + coords[ps[7]][1]) -
  53821. 2 * (coords[ps[0]][1] + coords[ps[15]][1]) +
  53822. 3 * (coords[ps[4]][1] + coords[ps[14]][1])) /
  53823. 9,
  53824. ]);
  53825. ps[9] = coords.length;
  53826. coords.push([
  53827. (-4 * coords[ps[12]][0] -
  53828. coords[ps[3]][0] +
  53829. 6 * (coords[ps[8]][0] + coords[ps[13]][0]) -
  53830. 2 * (coords[ps[0]][0] + coords[ps[15]][0]) +
  53831. 3 * (coords[ps[11]][0] + coords[ps[1]][0])) /
  53832. 9,
  53833. (-4 * coords[ps[12]][1] -
  53834. coords[ps[3]][1] +
  53835. 6 * (coords[ps[8]][1] + coords[ps[13]][1]) -
  53836. 2 * (coords[ps[0]][1] + coords[ps[15]][1]) +
  53837. 3 * (coords[ps[11]][1] + coords[ps[1]][1])) /
  53838. 9,
  53839. ]);
  53840. ps[10] = coords.length;
  53841. coords.push([
  53842. (-4 * coords[ps[15]][0] -
  53843. coords[ps[0]][0] +
  53844. 6 * (coords[ps[11]][0] + coords[ps[14]][0]) -
  53845. 2 * (coords[ps[12]][0] + coords[ps[3]][0]) +
  53846. 3 * (coords[ps[2]][0] + coords[ps[8]][0])) /
  53847. 9,
  53848. (-4 * coords[ps[15]][1] -
  53849. coords[ps[0]][1] +
  53850. 6 * (coords[ps[11]][1] + coords[ps[14]][1]) -
  53851. 2 * (coords[ps[12]][1] + coords[ps[3]][1]) +
  53852. 3 * (coords[ps[2]][1] + coords[ps[8]][1])) /
  53853. 9,
  53854. ]);
  53855. this.figures.push({
  53856. type: "patch",
  53857. coords: new Int32Array(ps),
  53858. colors: new Int32Array(cs),
  53859. });
  53860. }
  53861. }
  53862. _decodeType7Shading(reader) {
  53863. const coords = this.coords;
  53864. const colors = this.colors;
  53865. const ps = new Int32Array(16);
  53866. const cs = new Int32Array(4);
  53867. while (reader.hasData) {
  53868. const f = reader.readFlag();
  53869. if (!(0 <= f && f <= 3)) {
  53870. throw new _util.FormatError("Unknown type7 flag");
  53871. }
  53872. const pi = coords.length;
  53873. for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  53874. coords.push(reader.readCoordinate());
  53875. }
  53876. const ci = colors.length;
  53877. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  53878. colors.push(reader.readComponents());
  53879. }
  53880. let tmp1, tmp2, tmp3, tmp4;
  53881. switch (f) {
  53882. case 0:
  53883. ps[12] = pi + 3;
  53884. ps[13] = pi + 4;
  53885. ps[14] = pi + 5;
  53886. ps[15] = pi + 6;
  53887. ps[8] = pi + 2;
  53888. ps[9] = pi + 13;
  53889. ps[10] = pi + 14;
  53890. ps[11] = pi + 7;
  53891. ps[4] = pi + 1;
  53892. ps[5] = pi + 12;
  53893. ps[6] = pi + 15;
  53894. ps[7] = pi + 8;
  53895. ps[0] = pi;
  53896. ps[1] = pi + 11;
  53897. ps[2] = pi + 10;
  53898. ps[3] = pi + 9;
  53899. cs[2] = ci + 1;
  53900. cs[3] = ci + 2;
  53901. cs[0] = ci;
  53902. cs[1] = ci + 3;
  53903. break;
  53904. case 1:
  53905. tmp1 = ps[12];
  53906. tmp2 = ps[13];
  53907. tmp3 = ps[14];
  53908. tmp4 = ps[15];
  53909. ps[12] = tmp4;
  53910. ps[13] = pi + 0;
  53911. ps[14] = pi + 1;
  53912. ps[15] = pi + 2;
  53913. ps[8] = tmp3;
  53914. ps[9] = pi + 9;
  53915. ps[10] = pi + 10;
  53916. ps[11] = pi + 3;
  53917. ps[4] = tmp2;
  53918. ps[5] = pi + 8;
  53919. ps[6] = pi + 11;
  53920. ps[7] = pi + 4;
  53921. ps[0] = tmp1;
  53922. ps[1] = pi + 7;
  53923. ps[2] = pi + 6;
  53924. ps[3] = pi + 5;
  53925. tmp1 = cs[2];
  53926. tmp2 = cs[3];
  53927. cs[2] = tmp2;
  53928. cs[3] = ci;
  53929. cs[0] = tmp1;
  53930. cs[1] = ci + 1;
  53931. break;
  53932. case 2:
  53933. tmp1 = ps[15];
  53934. tmp2 = ps[11];
  53935. ps[12] = ps[3];
  53936. ps[13] = pi + 0;
  53937. ps[14] = pi + 1;
  53938. ps[15] = pi + 2;
  53939. ps[8] = ps[7];
  53940. ps[9] = pi + 9;
  53941. ps[10] = pi + 10;
  53942. ps[11] = pi + 3;
  53943. ps[4] = tmp2;
  53944. ps[5] = pi + 8;
  53945. ps[6] = pi + 11;
  53946. ps[7] = pi + 4;
  53947. ps[0] = tmp1;
  53948. ps[1] = pi + 7;
  53949. ps[2] = pi + 6;
  53950. ps[3] = pi + 5;
  53951. tmp1 = cs[3];
  53952. cs[2] = cs[1];
  53953. cs[3] = ci;
  53954. cs[0] = tmp1;
  53955. cs[1] = ci + 1;
  53956. break;
  53957. case 3:
  53958. ps[12] = ps[0];
  53959. ps[13] = pi + 0;
  53960. ps[14] = pi + 1;
  53961. ps[15] = pi + 2;
  53962. ps[8] = ps[1];
  53963. ps[9] = pi + 9;
  53964. ps[10] = pi + 10;
  53965. ps[11] = pi + 3;
  53966. ps[4] = ps[2];
  53967. ps[5] = pi + 8;
  53968. ps[6] = pi + 11;
  53969. ps[7] = pi + 4;
  53970. ps[0] = ps[3];
  53971. ps[1] = pi + 7;
  53972. ps[2] = pi + 6;
  53973. ps[3] = pi + 5;
  53974. cs[2] = cs[0];
  53975. cs[3] = ci;
  53976. cs[0] = cs[1];
  53977. cs[1] = ci + 1;
  53978. break;
  53979. }
  53980. this.figures.push({
  53981. type: "patch",
  53982. coords: new Int32Array(ps),
  53983. colors: new Int32Array(cs),
  53984. });
  53985. }
  53986. }
  53987. _buildFigureFromPatch(index) {
  53988. const figure = this.figures[index];
  53989. (0, _util.assert)(
  53990. figure.type === "patch",
  53991. "Unexpected patch mesh figure"
  53992. );
  53993. const coords = this.coords,
  53994. colors = this.colors;
  53995. const pi = figure.coords;
  53996. const ci = figure.colors;
  53997. const figureMinX = Math.min(
  53998. coords[pi[0]][0],
  53999. coords[pi[3]][0],
  54000. coords[pi[12]][0],
  54001. coords[pi[15]][0]
  54002. );
  54003. const figureMinY = Math.min(
  54004. coords[pi[0]][1],
  54005. coords[pi[3]][1],
  54006. coords[pi[12]][1],
  54007. coords[pi[15]][1]
  54008. );
  54009. const figureMaxX = Math.max(
  54010. coords[pi[0]][0],
  54011. coords[pi[3]][0],
  54012. coords[pi[12]][0],
  54013. coords[pi[15]][0]
  54014. );
  54015. const figureMaxY = Math.max(
  54016. coords[pi[0]][1],
  54017. coords[pi[3]][1],
  54018. coords[pi[12]][1],
  54019. coords[pi[15]][1]
  54020. );
  54021. let splitXBy = Math.ceil(
  54022. ((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY) /
  54023. (this.bounds[2] - this.bounds[0])
  54024. );
  54025. splitXBy = Math.max(
  54026. MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT,
  54027. Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy)
  54028. );
  54029. let splitYBy = Math.ceil(
  54030. ((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY) /
  54031. (this.bounds[3] - this.bounds[1])
  54032. );
  54033. splitYBy = Math.max(
  54034. MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT,
  54035. Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy)
  54036. );
  54037. const verticesPerRow = splitXBy + 1;
  54038. const figureCoords = new Int32Array(
  54039. (splitYBy + 1) * verticesPerRow
  54040. );
  54041. const figureColors = new Int32Array(
  54042. (splitYBy + 1) * verticesPerRow
  54043. );
  54044. let k = 0;
  54045. const cl = new Uint8Array(3),
  54046. cr = new Uint8Array(3);
  54047. const c0 = colors[ci[0]],
  54048. c1 = colors[ci[1]],
  54049. c2 = colors[ci[2]],
  54050. c3 = colors[ci[3]];
  54051. const bRow = getB(splitYBy),
  54052. bCol = getB(splitXBy);
  54053. for (let row = 0; row <= splitYBy; row++) {
  54054. cl[0] = ((c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy) | 0;
  54055. cl[1] = ((c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy) | 0;
  54056. cl[2] = ((c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy) | 0;
  54057. cr[0] = ((c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy) | 0;
  54058. cr[1] = ((c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy) | 0;
  54059. cr[2] = ((c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy) | 0;
  54060. for (let col = 0; col <= splitXBy; col++, k++) {
  54061. if (
  54062. (row === 0 || row === splitYBy) &&
  54063. (col === 0 || col === splitXBy)
  54064. ) {
  54065. continue;
  54066. }
  54067. let x = 0,
  54068. y = 0;
  54069. let q = 0;
  54070. for (let i = 0; i <= 3; i++) {
  54071. for (let j = 0; j <= 3; j++, q++) {
  54072. const m = bRow[row][i] * bCol[col][j];
  54073. x += coords[pi[q]][0] * m;
  54074. y += coords[pi[q]][1] * m;
  54075. }
  54076. }
  54077. figureCoords[k] = coords.length;
  54078. coords.push([x, y]);
  54079. figureColors[k] = colors.length;
  54080. const newColor = new Uint8Array(3);
  54081. newColor[0] =
  54082. ((cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy) | 0;
  54083. newColor[1] =
  54084. ((cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy) | 0;
  54085. newColor[2] =
  54086. ((cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy) | 0;
  54087. colors.push(newColor);
  54088. }
  54089. }
  54090. figureCoords[0] = pi[0];
  54091. figureColors[0] = ci[0];
  54092. figureCoords[splitXBy] = pi[3];
  54093. figureColors[splitXBy] = ci[1];
  54094. figureCoords[verticesPerRow * splitYBy] = pi[12];
  54095. figureColors[verticesPerRow * splitYBy] = ci[2];
  54096. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  54097. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  54098. this.figures[index] = {
  54099. type: "lattice",
  54100. coords: figureCoords,
  54101. colors: figureColors,
  54102. verticesPerRow,
  54103. };
  54104. }
  54105. _updateBounds() {
  54106. let minX = this.coords[0][0],
  54107. minY = this.coords[0][1],
  54108. maxX = minX,
  54109. maxY = minY;
  54110. for (let i = 1, ii = this.coords.length; i < ii; i++) {
  54111. const x = this.coords[i][0],
  54112. y = this.coords[i][1];
  54113. minX = minX > x ? x : minX;
  54114. minY = minY > y ? y : minY;
  54115. maxX = maxX < x ? x : maxX;
  54116. maxY = maxY < y ? y : maxY;
  54117. }
  54118. this.bounds = [minX, minY, maxX, maxY];
  54119. }
  54120. _packData() {
  54121. let i, ii, j, jj;
  54122. const coords = this.coords;
  54123. const coordsPacked = new Float32Array(coords.length * 2);
  54124. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  54125. const xy = coords[i];
  54126. coordsPacked[j++] = xy[0];
  54127. coordsPacked[j++] = xy[1];
  54128. }
  54129. this.coords = coordsPacked;
  54130. const colors = this.colors;
  54131. const colorsPacked = new Uint8Array(colors.length * 3);
  54132. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  54133. const c = colors[i];
  54134. colorsPacked[j++] = c[0];
  54135. colorsPacked[j++] = c[1];
  54136. colorsPacked[j++] = c[2];
  54137. }
  54138. this.colors = colorsPacked;
  54139. const figures = this.figures;
  54140. for (i = 0, ii = figures.length; i < ii; i++) {
  54141. const figure = figures[i],
  54142. ps = figure.coords,
  54143. cs = figure.colors;
  54144. for (j = 0, jj = ps.length; j < jj; j++) {
  54145. ps[j] *= 2;
  54146. cs[j] *= 3;
  54147. }
  54148. }
  54149. }
  54150. getIR() {
  54151. return [
  54152. "Mesh",
  54153. this.shadingType,
  54154. this.coords,
  54155. this.colors,
  54156. this.figures,
  54157. this.bounds,
  54158. this.bbox,
  54159. this.background,
  54160. ];
  54161. }
  54162. }
  54163. class DummyShading extends BaseShading {
  54164. getIR() {
  54165. return ["Dummy"];
  54166. }
  54167. }
  54168. function getTilingPatternIR(operatorList, dict, color) {
  54169. const matrix = dict.getArray("Matrix");
  54170. const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
  54171. const xstep = dict.get("XStep");
  54172. const ystep = dict.get("YStep");
  54173. const paintType = dict.get("PaintType");
  54174. const tilingType = dict.get("TilingType");
  54175. if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  54176. throw new _util.FormatError(
  54177. `Invalid getTilingPatternIR /BBox array: [${bbox}].`
  54178. );
  54179. }
  54180. return [
  54181. "TilingPattern",
  54182. color,
  54183. operatorList,
  54184. matrix,
  54185. bbox,
  54186. xstep,
  54187. ystep,
  54188. paintType,
  54189. tilingType,
  54190. ];
  54191. }
  54192. /***/
  54193. },
  54194. /* 51 */
  54195. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54196. Object.defineProperty(exports, "__esModule", {
  54197. value: true,
  54198. });
  54199. exports.getXfaFontDict = getXfaFontDict;
  54200. exports.getXfaFontName = getXfaFontName;
  54201. var _calibri_factors = __w_pdfjs_require__(52);
  54202. var _primitives = __w_pdfjs_require__(5);
  54203. var _helvetica_factors = __w_pdfjs_require__(53);
  54204. var _liberationsans_widths = __w_pdfjs_require__(54);
  54205. var _myriadpro_factors = __w_pdfjs_require__(55);
  54206. var _segoeui_factors = __w_pdfjs_require__(56);
  54207. var _core_utils = __w_pdfjs_require__(6);
  54208. var _fonts_utils = __w_pdfjs_require__(38);
  54209. const getXFAFontMap = (0, _core_utils.getLookupTableFactory)(function (
  54210. t
  54211. ) {
  54212. t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = {
  54213. name: "LiberationSans-Regular",
  54214. factors: _myriadpro_factors.MyriadProRegularFactors,
  54215. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  54216. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  54217. metrics: _myriadpro_factors.MyriadProRegularMetrics,
  54218. };
  54219. t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = {
  54220. name: "LiberationSans-Bold",
  54221. factors: _myriadpro_factors.MyriadProBoldFactors,
  54222. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  54223. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  54224. metrics: _myriadpro_factors.MyriadProBoldMetrics,
  54225. };
  54226. t["MyriadPro-It"] =
  54227. t["MyriadPro-Italic"] =
  54228. t["PdfJS-Fallback-Italic"] =
  54229. {
  54230. name: "LiberationSans-Italic",
  54231. factors: _myriadpro_factors.MyriadProItalicFactors,
  54232. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  54233. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  54234. metrics: _myriadpro_factors.MyriadProItalicMetrics,
  54235. };
  54236. t["MyriadPro-BoldIt"] =
  54237. t["MyriadPro-BoldItalic"] =
  54238. t["PdfJS-Fallback-BoldItalic"] =
  54239. {
  54240. name: "LiberationSans-BoldItalic",
  54241. factors: _myriadpro_factors.MyriadProBoldItalicFactors,
  54242. baseWidths:
  54243. _liberationsans_widths.LiberationSansBoldItalicWidths,
  54244. baseMapping:
  54245. _liberationsans_widths.LiberationSansBoldItalicMapping,
  54246. metrics: _myriadpro_factors.MyriadProBoldItalicMetrics,
  54247. };
  54248. t.ArialMT =
  54249. t.Arial =
  54250. t["Arial-Regular"] =
  54251. {
  54252. name: "LiberationSans-Regular",
  54253. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  54254. baseMapping:
  54255. _liberationsans_widths.LiberationSansRegularMapping,
  54256. };
  54257. t["Arial-BoldMT"] = t["Arial-Bold"] = {
  54258. name: "LiberationSans-Bold",
  54259. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  54260. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  54261. };
  54262. t["Arial-ItalicMT"] = t["Arial-Italic"] = {
  54263. name: "LiberationSans-Italic",
  54264. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  54265. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  54266. };
  54267. t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = {
  54268. name: "LiberationSans-BoldItalic",
  54269. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  54270. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  54271. };
  54272. t["Calibri-Regular"] = {
  54273. name: "LiberationSans-Regular",
  54274. factors: _calibri_factors.CalibriRegularFactors,
  54275. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  54276. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  54277. metrics: _calibri_factors.CalibriRegularMetrics,
  54278. };
  54279. t["Calibri-Bold"] = {
  54280. name: "LiberationSans-Bold",
  54281. factors: _calibri_factors.CalibriBoldFactors,
  54282. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  54283. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  54284. metrics: _calibri_factors.CalibriBoldMetrics,
  54285. };
  54286. t["Calibri-Italic"] = {
  54287. name: "LiberationSans-Italic",
  54288. factors: _calibri_factors.CalibriItalicFactors,
  54289. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  54290. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  54291. metrics: _calibri_factors.CalibriItalicMetrics,
  54292. };
  54293. t["Calibri-BoldItalic"] = {
  54294. name: "LiberationSans-BoldItalic",
  54295. factors: _calibri_factors.CalibriBoldItalicFactors,
  54296. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  54297. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  54298. metrics: _calibri_factors.CalibriBoldItalicMetrics,
  54299. };
  54300. t["Segoeui-Regular"] = {
  54301. name: "LiberationSans-Regular",
  54302. factors: _segoeui_factors.SegoeuiRegularFactors,
  54303. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  54304. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  54305. metrics: _segoeui_factors.SegoeuiRegularMetrics,
  54306. };
  54307. t["Segoeui-Bold"] = {
  54308. name: "LiberationSans-Bold",
  54309. factors: _segoeui_factors.SegoeuiBoldFactors,
  54310. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  54311. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  54312. metrics: _segoeui_factors.SegoeuiBoldMetrics,
  54313. };
  54314. t["Segoeui-Italic"] = {
  54315. name: "LiberationSans-Italic",
  54316. factors: _segoeui_factors.SegoeuiItalicFactors,
  54317. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  54318. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  54319. metrics: _segoeui_factors.SegoeuiItalicMetrics,
  54320. };
  54321. t["Segoeui-BoldItalic"] = {
  54322. name: "LiberationSans-BoldItalic",
  54323. factors: _segoeui_factors.SegoeuiBoldItalicFactors,
  54324. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  54325. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  54326. metrics: _segoeui_factors.SegoeuiBoldItalicMetrics,
  54327. };
  54328. t["Helvetica-Regular"] = t.Helvetica = {
  54329. name: "LiberationSans-Regular",
  54330. factors: _helvetica_factors.HelveticaRegularFactors,
  54331. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  54332. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  54333. metrics: _helvetica_factors.HelveticaRegularMetrics,
  54334. };
  54335. t["Helvetica-Bold"] = {
  54336. name: "LiberationSans-Bold",
  54337. factors: _helvetica_factors.HelveticaBoldFactors,
  54338. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  54339. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  54340. metrics: _helvetica_factors.HelveticaBoldMetrics,
  54341. };
  54342. t["Helvetica-Italic"] = {
  54343. name: "LiberationSans-Italic",
  54344. factors: _helvetica_factors.HelveticaItalicFactors,
  54345. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  54346. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  54347. metrics: _helvetica_factors.HelveticaItalicMetrics,
  54348. };
  54349. t["Helvetica-BoldItalic"] = {
  54350. name: "LiberationSans-BoldItalic",
  54351. factors: _helvetica_factors.HelveticaBoldItalicFactors,
  54352. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  54353. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  54354. metrics: _helvetica_factors.HelveticaBoldItalicMetrics,
  54355. };
  54356. });
  54357. function getXfaFontName(name) {
  54358. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  54359. const fontMap = getXFAFontMap();
  54360. return fontMap[fontName];
  54361. }
  54362. function getXfaFontWidths(name) {
  54363. const info = getXfaFontName(name);
  54364. if (!info) {
  54365. return null;
  54366. }
  54367. const { baseWidths, baseMapping, factors } = info;
  54368. let rescaledBaseWidths;
  54369. if (!factors) {
  54370. rescaledBaseWidths = baseWidths;
  54371. } else {
  54372. rescaledBaseWidths = baseWidths.map((w, i) => w * factors[i]);
  54373. }
  54374. let currentCode = -2;
  54375. let currentArray;
  54376. const newWidths = [];
  54377. for (const [unicode, glyphIndex] of baseMapping
  54378. .map((charUnicode, index) => [charUnicode, index])
  54379. .sort(([unicode1], [unicode2]) => unicode1 - unicode2)) {
  54380. if (unicode === -1) {
  54381. continue;
  54382. }
  54383. if (unicode === currentCode + 1) {
  54384. currentArray.push(rescaledBaseWidths[glyphIndex]);
  54385. currentCode += 1;
  54386. } else {
  54387. currentCode = unicode;
  54388. currentArray = [rescaledBaseWidths[glyphIndex]];
  54389. newWidths.push(unicode, currentArray);
  54390. }
  54391. }
  54392. return newWidths;
  54393. }
  54394. function getXfaFontDict(name) {
  54395. const widths = getXfaFontWidths(name);
  54396. const dict = new _primitives.Dict(null);
  54397. dict.set("BaseFont", _primitives.Name.get(name));
  54398. dict.set("Type", _primitives.Name.get("Font"));
  54399. dict.set("Subtype", _primitives.Name.get("CIDFontType2"));
  54400. dict.set("Encoding", _primitives.Name.get("Identity-H"));
  54401. dict.set("CIDToGIDMap", _primitives.Name.get("Identity"));
  54402. dict.set("W", widths);
  54403. dict.set("FirstChar", widths[0]);
  54404. dict.set("LastChar", widths.at(-2) + widths.at(-1).length - 1);
  54405. const descriptor = new _primitives.Dict(null);
  54406. dict.set("FontDescriptor", descriptor);
  54407. const systemInfo = new _primitives.Dict(null);
  54408. systemInfo.set("Ordering", "Identity");
  54409. systemInfo.set("Registry", "Adobe");
  54410. systemInfo.set("Supplement", 0);
  54411. dict.set("CIDSystemInfo", systemInfo);
  54412. return dict;
  54413. }
  54414. /***/
  54415. },
  54416. /* 52 */
  54417. /***/ (__unused_webpack_module, exports) => {
  54418. Object.defineProperty(exports, "__esModule", {
  54419. value: true,
  54420. });
  54421. exports.CalibriRegularMetrics =
  54422. exports.CalibriRegularFactors =
  54423. exports.CalibriItalicMetrics =
  54424. exports.CalibriItalicFactors =
  54425. exports.CalibriBoldMetrics =
  54426. exports.CalibriBoldItalicMetrics =
  54427. exports.CalibriBoldItalicFactors =
  54428. exports.CalibriBoldFactors =
  54429. void 0;
  54430. const CalibriBoldFactors = [
  54431. 1.3877, 1, 1, 1, 0.97801, 0.92482, 0.89552, 0.91133, 0.81988, 0.97566,
  54432. 0.98152, 0.93548, 0.93548, 1.2798, 0.85284, 0.92794, 1, 0.96134,
  54433. 1.54657, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133,
  54434. 0.91133, 0.91133, 0.91133, 0.91133, 0.82845, 0.82845, 0.85284,
  54435. 0.85284, 0.85284, 0.75859, 0.92138, 0.83908, 0.7762, 0.73293, 0.87289,
  54436. 0.73133, 0.7514, 0.81921, 0.87356, 0.95958, 0.59526, 0.75727, 0.69225,
  54437. 1.04924, 0.9121, 0.86943, 0.79795, 0.88198, 0.77958, 0.70864, 0.81055,
  54438. 0.90399, 0.88653, 0.96017, 0.82577, 0.77892, 0.78257, 0.97507,
  54439. 1.54657, 0.97507, 0.85284, 0.89552, 0.90176, 0.88762, 0.8785, 0.75241,
  54440. 0.8785, 0.90518, 0.95015, 0.77618, 0.8785, 0.88401, 0.91916, 0.86304,
  54441. 0.88401, 0.91488, 0.8785, 0.8801, 0.8785, 0.8785, 0.91343, 0.7173,
  54442. 1.04106, 0.8785, 0.85075, 0.95794, 0.82616, 0.85162, 0.79492, 0.88331,
  54443. 1.69808, 0.88331, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552,
  54444. 0.91133, 1.7801, 0.89552, 1.24487, 1.13254, 1.12401, 0.96839, 0.85284,
  54445. 0.68787, 0.70645, 0.85592, 0.90747, 1.01466, 1.0088, 0.90323, 1,
  54446. 1.07463, 1, 0.91056, 0.75806, 1.19118, 0.96839, 0.78864, 0.82845,
  54447. 0.84133, 0.75859, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908,
  54448. 0.83908, 0.77539, 0.73293, 0.73133, 0.73133, 0.73133, 0.73133,
  54449. 0.95958, 0.95958, 0.95958, 0.95958, 0.88506, 0.9121, 0.86943, 0.86943,
  54450. 0.86943, 0.86943, 0.86943, 0.85284, 0.87508, 0.90399, 0.90399,
  54451. 0.90399, 0.90399, 0.77892, 0.79795, 0.90807, 0.88762, 0.88762,
  54452. 0.88762, 0.88762, 0.88762, 0.88762, 0.8715, 0.75241, 0.90518, 0.90518,
  54453. 0.90518, 0.90518, 0.88401, 0.88401, 0.88401, 0.88401, 0.8785, 0.8785,
  54454. 0.8801, 0.8801, 0.8801, 0.8801, 0.8801, 0.90747, 0.89049, 0.8785,
  54455. 0.8785, 0.8785, 0.8785, 0.85162, 0.8785, 0.85162, 0.83908, 0.88762,
  54456. 0.83908, 0.88762, 0.83908, 0.88762, 0.73293, 0.75241, 0.73293,
  54457. 0.75241, 0.73293, 0.75241, 0.73293, 0.75241, 0.87289, 0.83016,
  54458. 0.88506, 0.93125, 0.73133, 0.90518, 0.73133, 0.90518, 0.73133,
  54459. 0.90518, 0.73133, 0.90518, 0.73133, 0.90518, 0.81921, 0.77618,
  54460. 0.81921, 0.77618, 0.81921, 0.77618, 1, 1, 0.87356, 0.8785, 0.91075,
  54461. 0.89608, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401,
  54462. 0.95958, 0.88401, 0.95958, 0.88401, 0.76229, 0.90167, 0.59526,
  54463. 0.91916, 1, 1, 0.86304, 0.69225, 0.88401, 1, 1, 0.70424, 0.79468,
  54464. 0.91926, 0.88175, 0.70823, 0.94903, 0.9121, 0.8785, 1, 1, 0.9121,
  54465. 0.8785, 0.87802, 0.88656, 0.8785, 0.86943, 0.8801, 0.86943, 0.8801,
  54466. 0.86943, 0.8801, 0.87402, 0.89291, 0.77958, 0.91343, 1, 1, 0.77958,
  54467. 0.91343, 0.70864, 0.7173, 0.70864, 0.7173, 0.70864, 0.7173, 0.70864,
  54468. 0.7173, 1, 1, 0.81055, 0.75841, 0.81055, 1.06452, 0.90399, 0.8785,
  54469. 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785,
  54470. 0.90399, 0.8785, 0.96017, 0.95794, 0.77892, 0.85162, 0.77892, 0.78257,
  54471. 0.79492, 0.78257, 0.79492, 0.78257, 0.79492, 0.9297, 0.56892, 0.83908,
  54472. 0.88762, 0.77539, 0.8715, 0.87508, 0.89049, 1, 1, 0.81055, 1.04106,
  54473. 1.20528, 1.20528, 1, 1.15543, 0.70674, 0.98387, 0.94721, 1.33431,
  54474. 1.45894, 0.95161, 1.06303, 0.83908, 0.80352, 0.57184, 0.6965, 0.56289,
  54475. 0.82001, 0.56029, 0.81235, 1.02988, 0.83908, 0.7762, 0.68156, 0.80367,
  54476. 0.73133, 0.78257, 0.87356, 0.86943, 0.95958, 0.75727, 0.89019,
  54477. 1.04924, 0.9121, 0.7648, 0.86943, 0.87356, 0.79795, 0.78275, 0.81055,
  54478. 0.77892, 0.9762, 0.82577, 0.99819, 0.84896, 0.95958, 0.77892, 0.96108,
  54479. 1.01407, 0.89049, 1.02988, 0.94211, 0.96108, 0.8936, 0.84021, 0.87842,
  54480. 0.96399, 0.79109, 0.89049, 1.00813, 1.02988, 0.86077, 0.87445,
  54481. 0.92099, 0.84723, 0.86513, 0.8801, 0.75638, 0.85714, 0.78216, 0.79586,
  54482. 0.87965, 0.94211, 0.97747, 0.78287, 0.97926, 0.84971, 1.02988,
  54483. 0.94211, 0.8801, 0.94211, 0.84971, 0.73133, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54484. 1, 1, 1, 0.90264, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54485. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54486. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54487. 1, 1, 1, 0.90518, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90548, 1, 1,
  54488. 1, 1, 1, 1, 0.96017, 0.95794, 0.96017, 0.95794, 0.96017, 0.95794,
  54489. 0.77892, 0.85162, 1, 1, 0.89552, 0.90527, 1, 0.90363, 0.92794,
  54490. 0.92794, 0.92794, 0.92794, 0.87012, 0.87012, 0.87012, 0.89552,
  54491. 0.89552, 1.42259, 0.71143, 1.06152, 1, 1, 1.03372, 1.03372, 0.97171,
  54492. 1.4956, 2.2807, 0.93835, 0.83406, 0.91133, 0.84107, 0.91133, 1, 1, 1,
  54493. 0.72021, 1, 1.23108, 0.83489, 0.88525, 0.88525, 0.81499, 0.90527,
  54494. 1.81055, 0.90527, 1.81055, 1.31006, 1.53711, 0.94434, 1.08696, 1,
  54495. 0.95018, 0.77192, 0.85284, 0.90747, 1.17534, 0.69825, 0.9716, 1.37077,
  54496. 0.90747, 0.90747, 0.85356, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941,
  54497. 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1,
  54498. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54499. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862,
  54500. 1, 1, 1, 1, 1, 1.08004, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1,
  54501. 1, 1, 1, 1, 1, 1, 0.90727, 0.90727, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54502. 1, 1, 1, 1, 1, 1, 1,
  54503. ];
  54504. exports.CalibriBoldFactors = CalibriBoldFactors;
  54505. const CalibriBoldMetrics = {
  54506. lineHeight: 1.2207,
  54507. lineGap: 0.2207,
  54508. };
  54509. exports.CalibriBoldMetrics = CalibriBoldMetrics;
  54510. const CalibriBoldItalicFactors = [
  54511. 1.3877, 1, 1, 1, 0.97801, 0.92482, 0.89552, 0.91133, 0.81988, 0.97566,
  54512. 0.98152, 0.93548, 0.93548, 1.2798, 0.85284, 0.92794, 1, 0.96134,
  54513. 1.56239, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133,
  54514. 0.91133, 0.91133, 0.91133, 0.91133, 0.82845, 0.82845, 0.85284,
  54515. 0.85284, 0.85284, 0.75859, 0.92138, 0.83908, 0.7762, 0.71805, 0.87289,
  54516. 0.73133, 0.7514, 0.81921, 0.87356, 0.95958, 0.59526, 0.75727, 0.69225,
  54517. 1.04924, 0.90872, 0.85938, 0.79795, 0.87068, 0.77958, 0.69766,
  54518. 0.81055, 0.90399, 0.88653, 0.96068, 0.82577, 0.77892, 0.78257,
  54519. 0.97507, 1.529, 0.97507, 0.85284, 0.89552, 0.90176, 0.94908, 0.86411,
  54520. 0.74012, 0.86411, 0.88323, 0.95015, 0.86411, 0.86331, 0.88401,
  54521. 0.91916, 0.86304, 0.88401, 0.9039, 0.86331, 0.86331, 0.86411, 0.86411,
  54522. 0.90464, 0.70852, 1.04106, 0.86331, 0.84372, 0.95794, 0.82616,
  54523. 0.84548, 0.79492, 0.88331, 1.69808, 0.88331, 0.85284, 0.97801,
  54524. 0.89552, 0.91133, 0.89552, 0.91133, 1.7801, 0.89552, 1.24487, 1.13254,
  54525. 1.19129, 0.96839, 0.85284, 0.68787, 0.70645, 0.85592, 0.90747,
  54526. 1.01466, 1.0088, 0.90323, 1, 1.07463, 1, 0.91056, 0.75806, 1.19118,
  54527. 0.96839, 0.78864, 0.82845, 0.84133, 0.75859, 0.83908, 0.83908,
  54528. 0.83908, 0.83908, 0.83908, 0.83908, 0.77539, 0.71805, 0.73133,
  54529. 0.73133, 0.73133, 0.73133, 0.95958, 0.95958, 0.95958, 0.95958,
  54530. 0.88506, 0.90872, 0.85938, 0.85938, 0.85938, 0.85938, 0.85938,
  54531. 0.85284, 0.87068, 0.90399, 0.90399, 0.90399, 0.90399, 0.77892,
  54532. 0.79795, 0.90807, 0.94908, 0.94908, 0.94908, 0.94908, 0.94908,
  54533. 0.94908, 0.85887, 0.74012, 0.88323, 0.88323, 0.88323, 0.88323,
  54534. 0.88401, 0.88401, 0.88401, 0.88401, 0.8785, 0.86331, 0.86331, 0.86331,
  54535. 0.86331, 0.86331, 0.86331, 0.90747, 0.89049, 0.86331, 0.86331,
  54536. 0.86331, 0.86331, 0.84548, 0.86411, 0.84548, 0.83908, 0.94908,
  54537. 0.83908, 0.94908, 0.83908, 0.94908, 0.71805, 0.74012, 0.71805,
  54538. 0.74012, 0.71805, 0.74012, 0.71805, 0.74012, 0.87289, 0.79538,
  54539. 0.88506, 0.92726, 0.73133, 0.88323, 0.73133, 0.88323, 0.73133,
  54540. 0.88323, 0.73133, 0.88323, 0.73133, 0.88323, 0.81921, 0.86411,
  54541. 0.81921, 0.86411, 0.81921, 0.86411, 1, 1, 0.87356, 0.86331, 0.91075,
  54542. 0.8777, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958,
  54543. 0.88401, 0.95958, 0.88401, 0.76467, 0.90167, 0.59526, 0.91916, 1, 1,
  54544. 0.86304, 0.69225, 0.88401, 1, 1, 0.70424, 0.77312, 0.91926, 0.88175,
  54545. 0.70823, 0.94903, 0.90872, 0.86331, 1, 1, 0.90872, 0.86331, 0.86906,
  54546. 0.88116, 0.86331, 0.85938, 0.86331, 0.85938, 0.86331, 0.85938,
  54547. 0.86331, 0.87402, 0.86549, 0.77958, 0.90464, 1, 1, 0.77958, 0.90464,
  54548. 0.69766, 0.70852, 0.69766, 0.70852, 0.69766, 0.70852, 0.69766,
  54549. 0.70852, 1, 1, 0.81055, 0.75841, 0.81055, 1.06452, 0.90399, 0.86331,
  54550. 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399,
  54551. 0.86331, 0.90399, 0.86331, 0.96068, 0.95794, 0.77892, 0.84548,
  54552. 0.77892, 0.78257, 0.79492, 0.78257, 0.79492, 0.78257, 0.79492, 0.9297,
  54553. 0.56892, 0.83908, 0.94908, 0.77539, 0.85887, 0.87068, 0.89049, 1, 1,
  54554. 0.81055, 1.04106, 1.20528, 1.20528, 1, 1.15543, 0.70088, 0.98387,
  54555. 0.94721, 1.33431, 1.45894, 0.95161, 1.48387, 0.83908, 0.80352,
  54556. 0.57118, 0.6965, 0.56347, 0.79179, 0.55853, 0.80346, 1.02988, 0.83908,
  54557. 0.7762, 0.67174, 0.86036, 0.73133, 0.78257, 0.87356, 0.86441, 0.95958,
  54558. 0.75727, 0.89019, 1.04924, 0.90872, 0.74889, 0.85938, 0.87891,
  54559. 0.79795, 0.7957, 0.81055, 0.77892, 0.97447, 0.82577, 0.97466, 0.87179,
  54560. 0.95958, 0.77892, 0.94252, 0.95612, 0.8753, 1.02988, 0.92733, 0.94252,
  54561. 0.87411, 0.84021, 0.8728, 0.95612, 0.74081, 0.8753, 1.02189, 1.02988,
  54562. 0.84814, 0.87445, 0.91822, 0.84723, 0.85668, 0.86331, 0.81344,
  54563. 0.87581, 0.76422, 0.82046, 0.96057, 0.92733, 0.99375, 0.78022,
  54564. 0.95452, 0.86015, 1.02988, 0.92733, 0.86331, 0.92733, 0.86015,
  54565. 0.73133, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90631, 1, 1, 1, 1, 1,
  54566. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54567. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54568. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.88323, 1, 1, 1, 1, 1,
  54569. 1, 1, 1, 1, 1, 1, 1, 0.85174, 1, 1, 1, 1, 1, 1, 0.96068, 0.95794,
  54570. 0.96068, 0.95794, 0.96068, 0.95794, 0.77892, 0.84548, 1, 1, 0.89552,
  54571. 0.90527, 1, 0.90363, 0.92794, 0.92794, 0.92794, 0.89807, 0.87012,
  54572. 0.87012, 0.87012, 0.89552, 0.89552, 1.42259, 0.71094, 1.06152, 1, 1,
  54573. 1.03372, 1.03372, 0.97171, 1.4956, 2.2807, 0.92972, 0.83406, 0.91133,
  54574. 0.83326, 0.91133, 1, 1, 1, 0.72021, 1, 1.23108, 0.83489, 0.88525,
  54575. 0.88525, 0.81499, 0.90616, 1.81055, 0.90527, 1.81055, 1.3107, 1.53711,
  54576. 0.94434, 1.08696, 1, 0.95018, 0.77192, 0.85284, 0.90747, 1.17534,
  54577. 0.69825, 0.9716, 1.37077, 0.90747, 0.90747, 0.85356, 0.90747, 0.90747,
  54578. 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572,
  54579. 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54580. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54581. 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.08004, 0.91027, 1, 1,
  54582. 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90727, 0.90727, 1,
  54583. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54584. ];
  54585. exports.CalibriBoldItalicFactors = CalibriBoldItalicFactors;
  54586. const CalibriBoldItalicMetrics = {
  54587. lineHeight: 1.2207,
  54588. lineGap: 0.2207,
  54589. };
  54590. exports.CalibriBoldItalicMetrics = CalibriBoldItalicMetrics;
  54591. const CalibriItalicFactors = [
  54592. 1.3877, 1, 1, 1, 1.17223, 1.1293, 0.89552, 0.91133, 0.80395, 1.02269,
  54593. 1.15601, 0.91056, 0.91056, 1.2798, 0.85284, 0.89807, 1, 0.90861,
  54594. 1.39543, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133,
  54595. 0.91133, 0.91133, 0.91133, 0.91133, 0.96309, 0.96309, 0.85284,
  54596. 0.85284, 0.85284, 0.83319, 0.88071, 0.8675, 0.81552, 0.72346, 0.85193,
  54597. 0.73206, 0.7522, 0.81105, 0.86275, 0.90685, 0.6377, 0.77892, 0.75593,
  54598. 1.02638, 0.89249, 0.84118, 0.77452, 0.85374, 0.75186, 0.67789,
  54599. 0.79776, 0.88844, 0.85066, 0.94309, 0.77818, 0.7306, 0.76659, 1.10369,
  54600. 1.38313, 1.10369, 1.06139, 0.89552, 0.8739, 0.9245, 0.9245, 0.83203,
  54601. 0.9245, 0.85865, 1.09842, 0.9245, 0.9245, 1.03297, 1.07692, 0.90918,
  54602. 1.03297, 0.94959, 0.9245, 0.92274, 0.9245, 0.9245, 1.02933, 0.77832,
  54603. 1.20562, 0.9245, 0.8916, 0.98986, 0.86621, 0.89453, 0.79004, 0.94152,
  54604. 1.77256, 0.94152, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552,
  54605. 0.91133, 1.91729, 0.89552, 1.17889, 1.13254, 1.16359, 0.92098,
  54606. 0.85284, 0.68787, 0.71353, 0.84737, 0.90747, 1.0088, 1.0044, 0.87683,
  54607. 1, 1.09091, 1, 0.92229, 0.739, 1.15642, 0.92098, 0.76288, 0.80504,
  54608. 0.80972, 0.75859, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675,
  54609. 0.76318, 0.72346, 0.73206, 0.73206, 0.73206, 0.73206, 0.90685,
  54610. 0.90685, 0.90685, 0.90685, 0.86477, 0.89249, 0.84118, 0.84118,
  54611. 0.84118, 0.84118, 0.84118, 0.85284, 0.84557, 0.88844, 0.88844,
  54612. 0.88844, 0.88844, 0.7306, 0.77452, 0.86331, 0.9245, 0.9245, 0.9245,
  54613. 0.9245, 0.9245, 0.9245, 0.84843, 0.83203, 0.85865, 0.85865, 0.85865,
  54614. 0.85865, 0.82601, 0.82601, 0.82601, 0.82601, 0.94469, 0.9245, 0.92274,
  54615. 0.92274, 0.92274, 0.92274, 0.92274, 0.90747, 0.86651, 0.9245, 0.9245,
  54616. 0.9245, 0.9245, 0.89453, 0.9245, 0.89453, 0.8675, 0.9245, 0.8675,
  54617. 0.9245, 0.8675, 0.9245, 0.72346, 0.83203, 0.72346, 0.83203, 0.72346,
  54618. 0.83203, 0.72346, 0.83203, 0.85193, 0.8875, 0.86477, 0.99034, 0.73206,
  54619. 0.85865, 0.73206, 0.85865, 0.73206, 0.85865, 0.73206, 0.85865,
  54620. 0.73206, 0.85865, 0.81105, 0.9245, 0.81105, 0.9245, 0.81105, 0.9245,
  54621. 1, 1, 0.86275, 0.9245, 0.90872, 0.93591, 0.90685, 0.82601, 0.90685,
  54622. 0.82601, 0.90685, 0.82601, 0.90685, 1.03297, 0.90685, 0.82601,
  54623. 0.77896, 1.05611, 0.6377, 1.07692, 1, 1, 0.90918, 0.75593, 1.03297, 1,
  54624. 1, 0.76032, 0.9375, 0.98156, 0.93407, 0.77261, 1.11429, 0.89249,
  54625. 0.9245, 1, 1, 0.89249, 0.9245, 0.92534, 0.86698, 0.9245, 0.84118,
  54626. 0.92274, 0.84118, 0.92274, 0.84118, 0.92274, 0.8667, 0.86291, 0.75186,
  54627. 1.02933, 1, 1, 0.75186, 1.02933, 0.67789, 0.77832, 0.67789, 0.77832,
  54628. 0.67789, 0.77832, 0.67789, 0.77832, 1, 1, 0.79776, 0.97655, 0.79776,
  54629. 1.23023, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844,
  54630. 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.94309, 0.98986, 0.7306,
  54631. 0.89453, 0.7306, 0.76659, 0.79004, 0.76659, 0.79004, 0.76659, 0.79004,
  54632. 1.09231, 0.54873, 0.8675, 0.9245, 0.76318, 0.84843, 0.84557, 0.86651,
  54633. 1, 1, 0.79776, 1.20562, 1.18622, 1.18622, 1, 1.1437, 0.67009, 0.96334,
  54634. 0.93695, 1.35191, 1.40909, 0.95161, 1.48387, 0.8675, 0.90861, 0.6192,
  54635. 0.7363, 0.64824, 0.82411, 0.56321, 0.85696, 1.23516, 0.8675, 0.81552,
  54636. 0.7286, 0.84134, 0.73206, 0.76659, 0.86275, 0.84369, 0.90685, 0.77892,
  54637. 0.85871, 1.02638, 0.89249, 0.75828, 0.84118, 0.85984, 0.77452,
  54638. 0.76466, 0.79776, 0.7306, 0.90782, 0.77818, 0.903, 0.87291, 0.90685,
  54639. 0.7306, 0.99058, 1.03667, 0.94635, 1.23516, 0.9849, 0.99058, 0.92393,
  54640. 0.8916, 0.942, 1.03667, 0.75026, 0.94635, 1.0297, 1.23516, 0.90918,
  54641. 0.94048, 0.98217, 0.89746, 0.84153, 0.92274, 0.82507, 0.88832,
  54642. 0.84438, 0.88178, 1.03525, 0.9849, 1.00225, 0.78086, 0.97248, 0.89404,
  54643. 1.23516, 0.9849, 0.92274, 0.9849, 0.89404, 0.73206, 1, 1, 1, 1, 1, 1,
  54644. 1, 1, 1, 1, 1, 1, 0.89693, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54645. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54646. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54647. 1, 1, 1, 1, 1, 1, 0.85865, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54648. 0.90933, 1, 1, 1, 1, 1, 1, 0.94309, 0.98986, 0.94309, 0.98986,
  54649. 0.94309, 0.98986, 0.7306, 0.89453, 1, 1, 0.89552, 0.90527, 1, 0.90186,
  54650. 1.12308, 1.12308, 1.12308, 1.12308, 1.2566, 1.2566, 1.2566, 0.89552,
  54651. 0.89552, 1.42259, 0.68994, 1.03809, 1, 1, 1.0176, 1.0176, 1.11523,
  54652. 1.4956, 2.01462, 0.97858, 0.82616, 0.91133, 0.83437, 0.91133, 1, 1, 1,
  54653. 0.70508, 1, 1.23108, 0.79801, 0.84426, 0.84426, 0.774, 0.90572,
  54654. 1.81055, 0.90749, 1.81055, 1.28809, 1.55469, 0.94434, 1.07806, 1,
  54655. 0.97094, 0.7589, 0.85284, 0.90747, 1.19658, 0.69825, 0.97622, 1.33512,
  54656. 0.90747, 0.90747, 0.85284, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941,
  54657. 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1,
  54658. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54659. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862,
  54660. 1, 1, 1, 1, 1, 1.0336, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1,
  54661. 1, 1, 1, 1, 1, 1.05859, 1.05859, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54662. 1, 1, 1, 1, 1, 1,
  54663. ];
  54664. exports.CalibriItalicFactors = CalibriItalicFactors;
  54665. const CalibriItalicMetrics = {
  54666. lineHeight: 1.2207,
  54667. lineGap: 0.2207,
  54668. };
  54669. exports.CalibriItalicMetrics = CalibriItalicMetrics;
  54670. const CalibriRegularFactors = [
  54671. 1.3877, 1, 1, 1, 1.17223, 1.1293, 0.89552, 0.91133, 0.80395, 1.02269,
  54672. 1.15601, 0.91056, 0.91056, 1.2798, 0.85284, 0.89807, 1, 0.90861,
  54673. 1.39016, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133,
  54674. 0.91133, 0.91133, 0.91133, 0.91133, 0.96309, 0.96309, 0.85284,
  54675. 0.85284, 0.85284, 0.83319, 0.88071, 0.8675, 0.81552, 0.73834, 0.85193,
  54676. 0.73206, 0.7522, 0.81105, 0.86275, 0.90685, 0.6377, 0.77892, 0.75593,
  54677. 1.02638, 0.89385, 0.85122, 0.77452, 0.86503, 0.75186, 0.68887,
  54678. 0.79776, 0.88844, 0.85066, 0.94258, 0.77818, 0.7306, 0.76659, 1.10369,
  54679. 1.39016, 1.10369, 1.06139, 0.89552, 0.8739, 0.86128, 0.94469, 0.8457,
  54680. 0.94469, 0.89464, 1.09842, 0.84636, 0.94469, 1.03297, 1.07692,
  54681. 0.90918, 1.03297, 0.95897, 0.94469, 0.9482, 0.94469, 0.94469, 1.04692,
  54682. 0.78223, 1.20562, 0.94469, 0.90332, 0.98986, 0.86621, 0.90527,
  54683. 0.79004, 0.94152, 1.77256, 0.94152, 0.85284, 0.97801, 0.89552,
  54684. 0.91133, 0.89552, 0.91133, 1.91729, 0.89552, 1.17889, 1.13254,
  54685. 1.08707, 0.92098, 0.85284, 0.68787, 0.71353, 0.84737, 0.90747, 1.0088,
  54686. 1.0044, 0.87683, 1, 1.09091, 1, 0.92229, 0.739, 1.15642, 0.92098,
  54687. 0.76288, 0.80504, 0.80972, 0.75859, 0.8675, 0.8675, 0.8675, 0.8675,
  54688. 0.8675, 0.8675, 0.76318, 0.73834, 0.73206, 0.73206, 0.73206, 0.73206,
  54689. 0.90685, 0.90685, 0.90685, 0.90685, 0.86477, 0.89385, 0.85122,
  54690. 0.85122, 0.85122, 0.85122, 0.85122, 0.85284, 0.85311, 0.88844,
  54691. 0.88844, 0.88844, 0.88844, 0.7306, 0.77452, 0.86331, 0.86128, 0.86128,
  54692. 0.86128, 0.86128, 0.86128, 0.86128, 0.8693, 0.8457, 0.89464, 0.89464,
  54693. 0.89464, 0.89464, 0.82601, 0.82601, 0.82601, 0.82601, 0.94469,
  54694. 0.94469, 0.9482, 0.9482, 0.9482, 0.9482, 0.9482, 0.90747, 0.86651,
  54695. 0.94469, 0.94469, 0.94469, 0.94469, 0.90527, 0.94469, 0.90527, 0.8675,
  54696. 0.86128, 0.8675, 0.86128, 0.8675, 0.86128, 0.73834, 0.8457, 0.73834,
  54697. 0.8457, 0.73834, 0.8457, 0.73834, 0.8457, 0.85193, 0.92454, 0.86477,
  54698. 0.9921, 0.73206, 0.89464, 0.73206, 0.89464, 0.73206, 0.89464, 0.73206,
  54699. 0.89464, 0.73206, 0.89464, 0.81105, 0.84636, 0.81105, 0.84636,
  54700. 0.81105, 0.84636, 1, 1, 0.86275, 0.94469, 0.90872, 0.95786, 0.90685,
  54701. 0.82601, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 1.03297,
  54702. 0.90685, 0.82601, 0.77741, 1.05611, 0.6377, 1.07692, 1, 1, 0.90918,
  54703. 0.75593, 1.03297, 1, 1, 0.76032, 0.90452, 0.98156, 1.11842, 0.77261,
  54704. 1.11429, 0.89385, 0.94469, 1, 1, 0.89385, 0.94469, 0.95877, 0.86901,
  54705. 0.94469, 0.85122, 0.9482, 0.85122, 0.9482, 0.85122, 0.9482, 0.8667,
  54706. 0.90016, 0.75186, 1.04692, 1, 1, 0.75186, 1.04692, 0.68887, 0.78223,
  54707. 0.68887, 0.78223, 0.68887, 0.78223, 0.68887, 0.78223, 1, 1, 0.79776,
  54708. 0.92188, 0.79776, 1.23023, 0.88844, 0.94469, 0.88844, 0.94469,
  54709. 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844,
  54710. 0.94469, 0.94258, 0.98986, 0.7306, 0.90527, 0.7306, 0.76659, 0.79004,
  54711. 0.76659, 0.79004, 0.76659, 0.79004, 1.09231, 0.54873, 0.8675, 0.86128,
  54712. 0.76318, 0.8693, 0.85311, 0.86651, 1, 1, 0.79776, 1.20562, 1.18622,
  54713. 1.18622, 1, 1.1437, 0.67742, 0.96334, 0.93695, 1.35191, 1.40909,
  54714. 0.95161, 1.48387, 0.86686, 0.90861, 0.62267, 0.74359, 0.65649,
  54715. 0.85498, 0.56963, 0.88254, 1.23516, 0.8675, 0.81552, 0.75443, 0.84503,
  54716. 0.73206, 0.76659, 0.86275, 0.85122, 0.90685, 0.77892, 0.85746,
  54717. 1.02638, 0.89385, 0.75657, 0.85122, 0.86275, 0.77452, 0.74171,
  54718. 0.79776, 0.7306, 0.95165, 0.77818, 0.89772, 0.88831, 0.90685, 0.7306,
  54719. 0.98142, 1.02191, 0.96576, 1.23516, 0.99018, 0.98142, 0.9236, 0.89258,
  54720. 0.94035, 1.02191, 0.78848, 0.96576, 0.9561, 1.23516, 0.90918, 0.92578,
  54721. 0.95424, 0.89746, 0.83969, 0.9482, 0.80113, 0.89442, 0.85208, 0.86155,
  54722. 0.98022, 0.99018, 1.00452, 0.81209, 0.99247, 0.89181, 1.23516,
  54723. 0.99018, 0.9482, 0.99018, 0.89181, 0.73206, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54724. 1, 1, 1, 0.88844, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54725. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54726. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54727. 1, 1, 1, 0.89464, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.96766, 1, 1,
  54728. 1, 1, 1, 1, 0.94258, 0.98986, 0.94258, 0.98986, 0.94258, 0.98986,
  54729. 0.7306, 0.90527, 1, 1, 0.89552, 0.90527, 1, 0.90186, 1.12308, 1.12308,
  54730. 1.12308, 1.12308, 1.2566, 1.2566, 1.2566, 0.89552, 0.89552, 1.42259,
  54731. 0.69043, 1.03809, 1, 1, 1.0176, 1.0176, 1.11523, 1.4956, 2.01462,
  54732. 0.99331, 0.82616, 0.91133, 0.84286, 0.91133, 1, 1, 1, 0.70508, 1,
  54733. 1.23108, 0.79801, 0.84426, 0.84426, 0.774, 0.90527, 1.81055, 0.90527,
  54734. 1.81055, 1.28809, 1.55469, 0.94434, 1.07806, 1, 0.97094, 0.7589,
  54735. 0.85284, 0.90747, 1.19658, 0.69825, 0.97622, 1.33512, 0.90747,
  54736. 0.90747, 0.85356, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941,
  54737. 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1,
  54738. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54739. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1,
  54740. 1, 1, 1.0336, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54741. 1, 1, 1.05859, 1.05859, 1, 1, 1, 1.07185, 0.99413, 0.96334, 1.08065,
  54742. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54743. ];
  54744. exports.CalibriRegularFactors = CalibriRegularFactors;
  54745. const CalibriRegularMetrics = {
  54746. lineHeight: 1.2207,
  54747. lineGap: 0.2207,
  54748. };
  54749. exports.CalibriRegularMetrics = CalibriRegularMetrics;
  54750. /***/
  54751. },
  54752. /* 53 */
  54753. /***/ (__unused_webpack_module, exports) => {
  54754. Object.defineProperty(exports, "__esModule", {
  54755. value: true,
  54756. });
  54757. exports.HelveticaRegularMetrics =
  54758. exports.HelveticaRegularFactors =
  54759. exports.HelveticaItalicMetrics =
  54760. exports.HelveticaItalicFactors =
  54761. exports.HelveticaBoldMetrics =
  54762. exports.HelveticaBoldItalicMetrics =
  54763. exports.HelveticaBoldItalicFactors =
  54764. exports.HelveticaBoldFactors =
  54765. void 0;
  54766. const HelveticaBoldFactors = [
  54767. 0.76116, 1, 1, 1.0006, 0.99998, 0.99974, 0.99973, 0.99973, 0.99982,
  54768. 0.99977, 1.00087, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998,
  54769. 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973,
  54770. 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.00003, 1.00003,
  54771. 1.00003, 1.00026, 0.9999, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001,
  54772. 1.00026, 1.00022, 0.99977, 1.0006, 0.99973, 0.99977, 1.00026, 0.99999,
  54773. 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026,
  54774. 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 0.99998, 1.0006,
  54775. 0.99998, 1.00003, 0.99973, 0.99998, 0.99973, 1.00026, 0.99973,
  54776. 1.00026, 0.99973, 0.99998, 1.00026, 1.00026, 1.0006, 1.0006, 0.99973,
  54777. 1.0006, 0.99982, 1.00026, 1.00026, 1.00026, 1.00026, 0.99959, 0.99973,
  54778. 0.99998, 1.00026, 0.99973, 1.00022, 0.99973, 0.99973, 1, 0.99959,
  54779. 1.00077, 0.99959, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973,
  54780. 0.99973, 1.00077, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973,
  54781. 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1,
  54782. 0.99973, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002,
  54783. 1.00002, 1.00026, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977,
  54784. 0.99977, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006,
  54785. 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022,
  54786. 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977,
  54787. 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973,
  54788. 0.99973, 0.99973, 0.99973, 0.99982, 0.99973, 0.99973, 0.99973,
  54789. 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.00026, 1.00026,
  54790. 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.06409, 1.00026,
  54791. 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 1.00026, 0.99973,
  54792. 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977,
  54793. 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973,
  54794. 0.99977, 1.03374, 0.99977, 1.00026, 1.00001, 0.99973, 1.00001,
  54795. 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973,
  54796. 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022,
  54797. 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.0006, 1.0006, 1.0006,
  54798. 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.00042,
  54799. 0.99973, 0.99973, 1.0006, 0.99977, 0.99973, 0.99973, 1.00026, 1.0006,
  54800. 1.00026, 1.0006, 1.00026, 1.03828, 1.00026, 0.99999, 1.00026, 1.0006,
  54801. 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.9993, 0.9998,
  54802. 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1,
  54803. 1.00016, 0.99977, 0.99959, 0.99977, 0.99959, 0.99977, 0.99959,
  54804. 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001,
  54805. 0.99973, 1.00026, 0.99998, 1.00026, 0.8121, 1.00026, 0.99998, 0.99977,
  54806. 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026,
  54807. 0.99977, 1.00026, 0.99977, 1.00026, 1.00016, 1.00022, 1.00001,
  54808. 0.99973, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 1.0006, 0.99973,
  54809. 0.99977, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 0.99973,
  54810. 1.00026, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998,
  54811. 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 1.00034, 0.99977, 1,
  54812. 0.99997, 1.00026, 1.00078, 1.00036, 0.99973, 1.00013, 1.0006, 0.99977,
  54813. 0.99977, 0.99988, 0.85148, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006,
  54814. 0.99977, 1.00001, 0.99999, 0.99977, 1.00069, 1.00022, 0.99977,
  54815. 1.00001, 0.99984, 1.00026, 1.00001, 1.00024, 1.00001, 0.9999, 1,
  54816. 1.0006, 1.00001, 1.00041, 0.99962, 1.00026, 1.0006, 0.99995, 1.00041,
  54817. 0.99942, 0.99973, 0.99927, 1.00082, 0.99902, 1.00026, 1.00087, 1.0006,
  54818. 1.00069, 0.99973, 0.99867, 0.99973, 0.9993, 1.00026, 1.00049, 1.00056,
  54819. 1, 0.99988, 0.99935, 0.99995, 0.99954, 1.00055, 0.99945, 1.00032,
  54820. 1.0006, 0.99995, 1.00026, 0.99995, 1.00032, 1.00001, 1.00008, 0.99971,
  54821. 1.00019, 0.9994, 1.00001, 1.0006, 1.00044, 0.99973, 1.00023, 1.00047,
  54822. 1, 0.99942, 0.99561, 0.99989, 1.00035, 0.99977, 1.00035, 0.99977,
  54823. 1.00019, 0.99944, 1.00001, 1.00021, 0.99926, 1.00035, 1.00035,
  54824. 0.99942, 1.00048, 0.99999, 0.99977, 1.00022, 1.00035, 1.00001,
  54825. 0.99977, 1.00026, 0.99989, 1.00057, 1.00001, 0.99936, 1.00052,
  54826. 1.00012, 0.99996, 1.00043, 1, 1.00035, 0.9994, 0.99976, 1.00035,
  54827. 0.99973, 1.00052, 1.00041, 1.00119, 1.00037, 0.99973, 1.00002,
  54828. 0.99986, 1.00041, 1.00041, 0.99902, 0.9996, 1.00034, 0.99999, 1.00026,
  54829. 0.99999, 1.00026, 0.99973, 1.00052, 0.99973, 1, 0.99973, 1.00041,
  54830. 1.00075, 0.9994, 1.0003, 0.99999, 1, 1.00041, 0.99955, 1, 0.99915,
  54831. 0.99973, 0.99973, 1.00026, 1.00119, 0.99955, 0.99973, 1.0006, 0.99911,
  54832. 1.0006, 1.00026, 0.99972, 1.00026, 0.99902, 1.00041, 0.99973, 0.99999,
  54833. 1, 1, 1.00038, 1.0005, 1.00016, 1.00022, 1.00016, 1.00022, 1.00016,
  54834. 1.00022, 1.00001, 0.99973, 1, 1, 0.99973, 1, 1, 0.99955, 1.0006,
  54835. 1.0006, 1.0006, 1.0006, 1, 1, 1, 0.99973, 0.99973, 0.99972, 1, 1,
  54836. 1.00106, 0.99999, 0.99998, 0.99998, 0.99999, 0.99998, 1.66475, 1,
  54837. 0.99973, 0.99973, 1.00023, 0.99973, 0.99971, 1.00047, 1.00023, 1,
  54838. 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1, 1, 1, 1, 1,
  54839. 1, 1, 0.99972, 1, 1.20985, 1.39713, 1.00003, 1.00031, 1.00015, 1,
  54840. 0.99561, 1.00027, 1.00031, 1.00031, 0.99915, 1.00031, 1.00031,
  54841. 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144,
  54842. 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144,
  54843. 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144,
  54844. 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144,
  54845. 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144,
  54846. 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144,
  54847. 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579,
  54848. 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026,
  54849. 1.00026, 1.00026, 0.99972, 0.99999, 0.99999, 0.99999, 0.99999,
  54850. 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995,
  54851. 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 0.99998, 0.99998, 0.99998, 1, 1, 1,
  54852. 1, 1, 1, 1, 1, 1, 1, 1,
  54853. ];
  54854. exports.HelveticaBoldFactors = HelveticaBoldFactors;
  54855. const HelveticaBoldMetrics = {
  54856. lineHeight: 1.2,
  54857. lineGap: 0.2,
  54858. };
  54859. exports.HelveticaBoldMetrics = HelveticaBoldMetrics;
  54860. const HelveticaBoldItalicFactors = [
  54861. 0.76116, 1, 1, 1.0006, 0.99998, 0.99974, 0.99973, 0.99973, 0.99982,
  54862. 0.99977, 1.00087, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998,
  54863. 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973,
  54864. 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.00003, 1.00003,
  54865. 1.00003, 1.00026, 0.9999, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001,
  54866. 1.00026, 1.00022, 0.99977, 1.0006, 0.99973, 0.99977, 1.00026, 0.99999,
  54867. 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026,
  54868. 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 0.99998, 1.0006,
  54869. 0.99998, 1.00003, 0.99973, 0.99998, 0.99973, 1.00026, 0.99973,
  54870. 1.00026, 0.99973, 0.99998, 1.00026, 1.00026, 1.0006, 1.0006, 0.99973,
  54871. 1.0006, 0.99982, 1.00026, 1.00026, 1.00026, 1.00026, 0.99959, 0.99973,
  54872. 0.99998, 1.00026, 0.99973, 1.00022, 0.99973, 0.99973, 1, 0.99959,
  54873. 1.00077, 0.99959, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973,
  54874. 0.99973, 1.00077, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973,
  54875. 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1,
  54876. 0.99973, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002,
  54877. 1.00002, 1.00026, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977,
  54878. 0.99977, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006,
  54879. 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022,
  54880. 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977,
  54881. 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973,
  54882. 0.99973, 0.99973, 0.99973, 0.99982, 0.99973, 0.99973, 0.99973,
  54883. 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.00026, 1.00026,
  54884. 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.06409, 1.00026,
  54885. 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 1.00026, 0.99973,
  54886. 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977,
  54887. 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973,
  54888. 0.99977, 1.0044, 0.99977, 1.00026, 1.00001, 0.99973, 1.00001, 0.99973,
  54889. 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022,
  54890. 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026,
  54891. 0.99977, 1.00026, 0.99977, 1.00026, 1.0006, 1.0006, 1.0006, 1.0006,
  54892. 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99971, 0.99973,
  54893. 0.99973, 1.0006, 0.99977, 0.99973, 0.99973, 1.00026, 1.0006, 1.00026,
  54894. 1.0006, 1.00026, 1.01011, 1.00026, 0.99999, 1.00026, 1.0006, 0.99977,
  54895. 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.9993, 0.9998, 1.00026,
  54896. 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1, 1.00016,
  54897. 0.99977, 0.99959, 0.99977, 0.99959, 0.99977, 0.99959, 1.00001,
  54898. 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973,
  54899. 1.00026, 0.99998, 1.00026, 0.8121, 1.00026, 0.99998, 0.99977, 1.00026,
  54900. 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977,
  54901. 1.00026, 0.99977, 1.00026, 1.00016, 1.00022, 1.00001, 0.99973,
  54902. 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 1.0006, 0.99973, 0.99977,
  54903. 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 0.99973, 1.00026,
  54904. 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998,
  54905. 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99977, 1, 1, 1.00026,
  54906. 0.99969, 0.99972, 0.99981, 0.9998, 1.0006, 0.99977, 0.99977, 1.00022,
  54907. 0.91155, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 0.99977, 1.00001,
  54908. 0.99999, 0.99977, 0.99966, 1.00022, 1.00032, 1.00001, 0.99944,
  54909. 1.00026, 1.00001, 0.99968, 1.00001, 1.00047, 1, 1.0006, 1.00001,
  54910. 0.99981, 1.00101, 1.00026, 1.0006, 0.99948, 0.99981, 1.00064, 0.99973,
  54911. 0.99942, 1.00101, 1.00061, 1.00026, 1.00069, 1.0006, 1.00014, 0.99973,
  54912. 1.01322, 0.99973, 1.00065, 1.00026, 1.00012, 0.99923, 1, 1.00064,
  54913. 1.00076, 0.99948, 1.00055, 1.00063, 1.00007, 0.99943, 1.0006, 0.99948,
  54914. 1.00026, 0.99948, 0.99943, 1.00001, 1.00001, 1.00029, 1.00038,
  54915. 1.00035, 1.00001, 1.0006, 1.0006, 0.99973, 0.99978, 1.00001, 1.00057,
  54916. 0.99989, 0.99967, 0.99964, 0.99967, 0.99977, 0.99999, 0.99977,
  54917. 1.00038, 0.99977, 1.00001, 0.99973, 1.00066, 0.99967, 0.99967,
  54918. 1.00041, 0.99998, 0.99999, 0.99977, 1.00022, 0.99967, 1.00001,
  54919. 0.99977, 1.00026, 0.99964, 1.00031, 1.00001, 0.99999, 0.99999, 1,
  54920. 1.00023, 1, 1, 0.99999, 1.00035, 1.00001, 0.99999, 0.99973, 0.99977,
  54921. 0.99999, 1.00058, 0.99973, 0.99973, 0.99955, 0.9995, 1.00026, 1.00026,
  54922. 1.00032, 0.99989, 1.00034, 0.99999, 1.00026, 1.00026, 1.00026,
  54923. 0.99973, 0.45998, 0.99973, 1.00026, 0.99973, 1.00001, 0.99999,
  54924. 0.99982, 0.99994, 0.99996, 1, 1.00042, 1.00044, 1.00029, 1.00023,
  54925. 0.99973, 0.99973, 1.00026, 0.99949, 1.00002, 0.99973, 1.0006, 1.0006,
  54926. 1.0006, 0.99975, 1.00026, 1.00026, 1.00032, 0.98685, 0.99973, 1.00026,
  54927. 1, 1, 0.99966, 1.00044, 1.00016, 1.00022, 1.00016, 1.00022, 1.00016,
  54928. 1.00022, 1.00001, 0.99973, 1, 1, 0.99973, 1, 1, 0.99955, 1.0006,
  54929. 1.0006, 1.0006, 1.0006, 1, 1, 1, 0.99973, 0.99973, 0.99972, 1, 1,
  54930. 1.00106, 0.99999, 0.99998, 0.99998, 0.99999, 0.99998, 1.66475, 1,
  54931. 0.99973, 0.99973, 1, 0.99973, 0.99971, 0.99978, 1, 1, 0.99991,
  54932. 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1.00098, 1, 1, 1,
  54933. 1.00049, 1, 1, 0.99972, 1, 1.20985, 1.39713, 1.00003, 1.00031,
  54934. 1.00015, 1, 0.99561, 1.00027, 1.00031, 1.00031, 0.99915, 1.00031,
  54935. 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144,
  54936. 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144,
  54937. 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144,
  54938. 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144,
  54939. 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144,
  54940. 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144,
  54941. 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144,
  54942. 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026,
  54943. 1.00026, 1.00026, 1.00026, 0.99972, 0.99999, 0.99999, 0.99999,
  54944. 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962,
  54945. 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 0.99998, 0.99998,
  54946. 0.99998, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  54947. ];
  54948. exports.HelveticaBoldItalicFactors = HelveticaBoldItalicFactors;
  54949. const HelveticaBoldItalicMetrics = {
  54950. lineHeight: 1.35,
  54951. lineGap: 0.2,
  54952. };
  54953. exports.HelveticaBoldItalicMetrics = HelveticaBoldItalicMetrics;
  54954. const HelveticaItalicFactors = [
  54955. 0.76116, 1, 1, 1.0006, 1.0006, 1.00006, 0.99973, 0.99973, 0.99982,
  54956. 1.00001, 1.00043, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998,
  54957. 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973,
  54958. 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1, 1.00003, 1.00003,
  54959. 1.00003, 0.99973, 0.99987, 1.00001, 1.00001, 0.99977, 0.99977,
  54960. 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 1, 1.00001, 0.99973,
  54961. 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001,
  54962. 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 1.0006,
  54963. 1.0006, 1.0006, 0.99949, 0.99973, 0.99998, 0.99973, 0.99973, 1,
  54964. 0.99973, 0.99973, 1.0006, 0.99973, 0.99973, 0.99924, 0.99924, 1,
  54965. 0.99924, 0.99999, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1,
  54966. 1.0006, 0.99973, 1, 0.99977, 1, 1, 1, 1.00005, 1.0009, 1.00005,
  54967. 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.0009, 0.99973,
  54968. 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299,
  54969. 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.9998, 1.0006, 0.99998, 1,
  54970. 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 1.00001,
  54971. 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1, 0.99977, 1.00001,
  54972. 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977,
  54973. 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003,
  54974. 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001,
  54975. 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973,
  54976. 0.99982, 1, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006,
  54977. 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973,
  54978. 0.99973, 1.06409, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 1,
  54979. 0.99973, 1, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973,
  54980. 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1.0288,
  54981. 0.99977, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001,
  54982. 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 0.99973,
  54983. 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 0.99977,
  54984. 0.99973, 0.99977, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006,
  54985. 1.0006, 1.0006, 0.99924, 1.0006, 1.0006, 0.99946, 1.00034, 1, 0.99924,
  54986. 1.00001, 1, 1, 0.99973, 0.99924, 0.99973, 0.99924, 0.99973, 1.06311,
  54987. 0.99973, 1.00024, 0.99973, 0.99924, 0.99977, 0.99973, 0.99977,
  54988. 0.99973, 0.99977, 0.99973, 1.00041, 0.9998, 0.99973, 1.00022, 0.99973,
  54989. 1.00022, 0.99973, 1.00022, 0.99973, 1, 1.00016, 0.99977, 0.99998,
  54990. 0.99977, 0.99998, 0.99977, 0.99998, 1.00001, 1, 1.00001, 1, 1.00001,
  54991. 1, 1.00001, 1, 1.00026, 1.0006, 1.00026, 0.89547, 1.00026, 1.0006,
  54992. 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977,
  54993. 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.00016, 0.99977,
  54994. 1.00001, 1, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 0.99924,
  54995. 0.99973, 1.00001, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 1,
  54996. 1.00026, 1.0006, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998,
  54997. 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 1.00001, 1, 1.00054,
  54998. 0.99977, 1.00084, 1.00007, 0.99973, 1.00013, 0.99924, 1.00001,
  54999. 1.00001, 0.99945, 0.91221, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006,
  55000. 1.00001, 1.00001, 0.99999, 0.99977, 0.99933, 1.00022, 1.00054,
  55001. 1.00001, 1.00065, 1.00026, 1.00001, 1.0001, 1.00001, 1.00052, 1,
  55002. 1.0006, 1.00001, 0.99945, 0.99897, 0.99968, 0.99924, 1.00036, 0.99945,
  55003. 0.99949, 1, 1.0006, 0.99897, 0.99918, 0.99968, 0.99911, 0.99924, 1,
  55004. 0.99962, 1.01487, 1, 1.0005, 0.99973, 1.00012, 1.00043, 1, 0.99995,
  55005. 0.99994, 1.00036, 0.99947, 1.00019, 1.00063, 1.00025, 0.99924,
  55006. 1.00036, 0.99973, 1.00036, 1.00025, 1.00001, 1.00001, 1.00027, 1.0001,
  55007. 1.00068, 1.00001, 1.0006, 1.0006, 1, 1.00008, 0.99957, 0.99972,
  55008. 0.9994, 0.99954, 0.99975, 1.00051, 1.00001, 1.00019, 1.00001, 1.0001,
  55009. 0.99986, 1.00001, 1.00001, 1.00038, 0.99954, 0.99954, 0.9994, 1.00066,
  55010. 0.99999, 0.99977, 1.00022, 1.00054, 1.00001, 0.99977, 1.00026,
  55011. 0.99975, 1.0001, 1.00001, 0.99993, 0.9995, 0.99955, 1.00016, 0.99978,
  55012. 0.99974, 1.00019, 1.00022, 0.99955, 1.00053, 0.99973, 1.00089,
  55013. 1.00005, 0.99967, 1.00048, 0.99973, 1.00002, 1.00034, 0.99973,
  55014. 0.99973, 0.99964, 1.00006, 1.00066, 0.99947, 0.99973, 0.98894,
  55015. 0.99973, 1, 0.44898, 1, 0.99946, 1, 1.00039, 1.00082, 0.99991,
  55016. 0.99991, 0.99985, 1.00022, 1.00023, 1.00061, 1.00006, 0.99966,
  55017. 0.99973, 0.99973, 0.99973, 1.00019, 1.0008, 1, 0.99924, 0.99924,
  55018. 0.99924, 0.99983, 1.00044, 0.99973, 0.99964, 0.98332, 1, 0.99973, 1,
  55019. 1, 0.99962, 0.99895, 1.00016, 0.99977, 1.00016, 0.99977, 1.00016,
  55020. 0.99977, 1.00001, 1, 1, 1, 0.99973, 1, 1, 0.99955, 0.99924, 0.99924,
  55021. 0.99924, 0.99924, 0.99998, 0.99998, 0.99998, 0.99973, 0.99973,
  55022. 0.99972, 1, 1, 1.00267, 0.99999, 0.99998, 0.99998, 1, 0.99998,
  55023. 1.66475, 1, 0.99973, 0.99973, 1.00023, 0.99973, 1.00423, 0.99925,
  55024. 0.99999, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002,
  55025. 1.00049, 1, 1.00245, 1, 1, 1, 1, 0.96329, 1, 1.20985, 1.39713,
  55026. 1.00003, 0.8254, 1.00015, 1, 1.00035, 1.00027, 1.00031, 1.00031,
  55027. 1.00003, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999,
  55028. 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144,
  55029. 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144,
  55030. 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144,
  55031. 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144,
  55032. 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144,
  55033. 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144,
  55034. 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861,
  55035. 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.95317, 0.99999,
  55036. 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1,
  55037. 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998,
  55038. 0.99998, 0.99998, 0.99998, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55039. ];
  55040. exports.HelveticaItalicFactors = HelveticaItalicFactors;
  55041. const HelveticaItalicMetrics = {
  55042. lineHeight: 1.35,
  55043. lineGap: 0.2,
  55044. };
  55045. exports.HelveticaItalicMetrics = HelveticaItalicMetrics;
  55046. const HelveticaRegularFactors = [
  55047. 0.76116, 1, 1, 1.0006, 1.0006, 1.00006, 0.99973, 0.99973, 0.99982,
  55048. 1.00001, 1.00043, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998,
  55049. 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973,
  55050. 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1, 1.00003, 1.00003,
  55051. 1.00003, 0.99973, 0.99987, 1.00001, 1.00001, 0.99977, 0.99977,
  55052. 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 1, 1.00001, 0.99973,
  55053. 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001,
  55054. 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 1.0006,
  55055. 1.0006, 1.0006, 0.99949, 0.99973, 0.99998, 0.99973, 0.99973, 1,
  55056. 0.99973, 0.99973, 1.0006, 0.99973, 0.99973, 0.99924, 0.99924, 1,
  55057. 0.99924, 0.99999, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1,
  55058. 1.0006, 0.99973, 1, 0.99977, 1, 1, 1, 1.00005, 1.0009, 1.00005,
  55059. 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.0009, 0.99973,
  55060. 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299,
  55061. 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.9998, 1.0006, 0.99998, 1,
  55062. 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 1.00001,
  55063. 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1, 0.99977, 1.00001,
  55064. 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977,
  55065. 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003,
  55066. 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001,
  55067. 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973,
  55068. 0.99982, 1, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006,
  55069. 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973,
  55070. 0.99973, 1.06409, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 1,
  55071. 0.99973, 1, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973,
  55072. 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1.04596,
  55073. 0.99977, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001,
  55074. 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 0.99973,
  55075. 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 0.99977,
  55076. 0.99973, 0.99977, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006,
  55077. 1.0006, 1.0006, 0.99924, 1.0006, 1.0006, 1.00019, 1.00034, 1, 0.99924,
  55078. 1.00001, 1, 1, 0.99973, 0.99924, 0.99973, 0.99924, 0.99973, 1.02572,
  55079. 0.99973, 1.00005, 0.99973, 0.99924, 0.99977, 0.99973, 0.99977,
  55080. 0.99973, 0.99977, 0.99973, 0.99999, 0.9998, 0.99973, 1.00022, 0.99973,
  55081. 1.00022, 0.99973, 1.00022, 0.99973, 1, 1.00016, 0.99977, 0.99998,
  55082. 0.99977, 0.99998, 0.99977, 0.99998, 1.00001, 1, 1.00001, 1, 1.00001,
  55083. 1, 1.00001, 1, 1.00026, 1.0006, 1.00026, 0.84533, 1.00026, 1.0006,
  55084. 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977,
  55085. 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.00016, 0.99977,
  55086. 1.00001, 1, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 0.99924,
  55087. 0.99973, 1.00001, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 1,
  55088. 1.00026, 1.0006, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998,
  55089. 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99928, 1, 0.99977,
  55090. 1.00013, 1.00055, 0.99947, 0.99945, 0.99941, 0.99924, 1.00001,
  55091. 1.00001, 1.0004, 0.91621, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006,
  55092. 1.00001, 1.00005, 0.99999, 0.99977, 1.00015, 1.00022, 0.99977,
  55093. 1.00001, 0.99973, 1.00026, 1.00001, 1.00019, 1.00001, 0.99946, 1,
  55094. 1.0006, 1.00001, 0.99978, 1.00045, 0.99973, 0.99924, 1.00023, 0.99978,
  55095. 0.99966, 1, 1.00065, 1.00045, 1.00019, 0.99973, 0.99973, 0.99924, 1,
  55096. 1, 0.96499, 1, 1.00055, 0.99973, 1.00008, 1.00027, 1, 0.9997, 0.99995,
  55097. 1.00023, 0.99933, 1.00019, 1.00015, 1.00031, 0.99924, 1.00023,
  55098. 0.99973, 1.00023, 1.00031, 1.00001, 0.99928, 1.00029, 1.00092,
  55099. 1.00035, 1.00001, 1.0006, 1.0006, 1, 0.99988, 0.99975, 1, 1.00082,
  55100. 0.99561, 0.9996, 1.00035, 1.00001, 0.99962, 1.00001, 1.00092, 0.99964,
  55101. 1.00001, 0.99963, 0.99999, 1.00035, 1.00035, 1.00082, 0.99962,
  55102. 0.99999, 0.99977, 1.00022, 1.00035, 1.00001, 0.99977, 1.00026, 0.9996,
  55103. 0.99967, 1.00001, 1.00034, 1.00074, 1.00054, 1.00053, 1.00063,
  55104. 0.99971, 0.99962, 1.00035, 0.99975, 0.99977, 0.99973, 1.00043,
  55105. 0.99953, 1.0007, 0.99915, 0.99973, 1.00008, 0.99892, 1.00073, 1.00073,
  55106. 1.00114, 0.99915, 1.00073, 0.99955, 0.99973, 1.00092, 0.99973, 1,
  55107. 0.99998, 1, 1.0003, 1, 1.00043, 1.00001, 0.99969, 1.0003, 1, 1.00035,
  55108. 1.00001, 0.9995, 1, 1.00092, 0.99973, 0.99973, 0.99973, 1.0007,
  55109. 0.9995, 1, 0.99924, 1.0006, 0.99924, 0.99972, 1.00062, 0.99973,
  55110. 1.00114, 1.00073, 1, 0.99955, 1, 1, 1.00047, 0.99968, 1.00016,
  55111. 0.99977, 1.00016, 0.99977, 1.00016, 0.99977, 1.00001, 1, 1, 1,
  55112. 0.99973, 1, 1, 0.99955, 0.99924, 0.99924, 0.99924, 0.99924, 0.99998,
  55113. 0.99998, 0.99998, 0.99973, 0.99973, 0.99972, 1, 1, 1.00267, 0.99999,
  55114. 0.99998, 0.99998, 1, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1.00023,
  55115. 0.99973, 0.99971, 0.99925, 1.00023, 1, 0.99991, 0.99984, 1.00002,
  55116. 1.00002, 1.00002, 1.00002, 1, 1, 1, 1, 1, 1, 1, 0.96329, 1, 1.20985,
  55117. 1.39713, 1.00003, 0.8254, 1.00015, 1, 1.00035, 1.00027, 1.00031,
  55118. 1.00031, 0.99915, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999,
  55119. 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144,
  55120. 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144,
  55121. 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144,
  55122. 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144,
  55123. 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144,
  55124. 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144,
  55125. 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1,
  55126. 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.95317,
  55127. 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1,
  55128. 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55129. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55130. ];
  55131. exports.HelveticaRegularFactors = HelveticaRegularFactors;
  55132. const HelveticaRegularMetrics = {
  55133. lineHeight: 1.2,
  55134. lineGap: 0.2,
  55135. };
  55136. exports.HelveticaRegularMetrics = HelveticaRegularMetrics;
  55137. /***/
  55138. },
  55139. /* 54 */
  55140. /***/ (__unused_webpack_module, exports) => {
  55141. Object.defineProperty(exports, "__esModule", {
  55142. value: true,
  55143. });
  55144. exports.LiberationSansRegularWidths =
  55145. exports.LiberationSansRegularMapping =
  55146. exports.LiberationSansItalicWidths =
  55147. exports.LiberationSansItalicMapping =
  55148. exports.LiberationSansBoldWidths =
  55149. exports.LiberationSansBoldMapping =
  55150. exports.LiberationSansBoldItalicWidths =
  55151. exports.LiberationSansBoldItalicMapping =
  55152. void 0;
  55153. const LiberationSansBoldWidths = [
  55154. 365, 0, 333, 278, 333, 474, 556, 556, 889, 722, 238, 333, 333, 389,
  55155. 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556,
  55156. 556, 333, 333, 584, 584, 584, 611, 975, 722, 722, 722, 722, 667, 611,
  55157. 778, 722, 278, 556, 722, 611, 833, 722, 778, 667, 778, 722, 667, 611,
  55158. 722, 667, 944, 667, 667, 611, 333, 278, 333, 584, 556, 333, 556, 611,
  55159. 556, 611, 556, 333, 611, 611, 278, 278, 556, 278, 889, 611, 611, 611,
  55160. 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389, 584,
  55161. 333, 556, 556, 556, 556, 280, 556, 333, 737, 370, 556, 584, 737, 552,
  55162. 400, 549, 333, 333, 333, 576, 556, 278, 333, 333, 365, 556, 834, 834,
  55163. 834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667,
  55164. 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722,
  55165. 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 556,
  55166. 556, 556, 556, 556, 278, 278, 278, 278, 611, 611, 611, 611, 611, 611,
  55167. 611, 549, 611, 611, 611, 611, 611, 556, 611, 556, 722, 556, 722, 556,
  55168. 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 719, 722, 611,
  55169. 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 611, 778, 611,
  55170. 778, 611, 778, 611, 722, 611, 722, 611, 278, 278, 278, 278, 278, 278,
  55171. 278, 278, 278, 278, 785, 556, 556, 278, 722, 556, 556, 611, 278, 611,
  55172. 278, 611, 385, 611, 479, 611, 278, 722, 611, 722, 611, 722, 611, 708,
  55173. 723, 611, 778, 611, 778, 611, 778, 611, 1000, 944, 722, 389, 722, 389,
  55174. 722, 389, 667, 556, 667, 556, 667, 556, 667, 556, 611, 333, 611, 479,
  55175. 611, 333, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611,
  55176. 944, 778, 667, 556, 667, 611, 500, 611, 500, 611, 500, 278, 556, 722,
  55177. 556, 1000, 889, 778, 611, 667, 556, 611, 333, 333, 333, 333, 333, 333,
  55178. 333, 333, 333, 333, 333, 465, 722, 333, 853, 906, 474, 825, 927, 838,
  55179. 278, 722, 722, 601, 719, 667, 611, 722, 778, 278, 722, 667, 833, 722,
  55180. 644, 778, 722, 667, 600, 611, 667, 821, 667, 809, 802, 278, 667, 615,
  55181. 451, 611, 278, 582, 615, 610, 556, 606, 475, 460, 611, 541, 278, 558,
  55182. 556, 612, 556, 445, 611, 766, 619, 520, 684, 446, 582, 715, 576, 753,
  55183. 845, 278, 582, 611, 582, 845, 667, 669, 885, 567, 711, 667, 278, 276,
  55184. 556, 1094, 1062, 875, 610, 722, 622, 719, 722, 719, 722, 567, 712,
  55185. 667, 904, 626, 719, 719, 610, 702, 833, 722, 778, 719, 667, 722, 611,
  55186. 622, 854, 667, 730, 703, 1005, 1019, 870, 979, 719, 711, 1031, 719,
  55187. 556, 618, 615, 417, 635, 556, 709, 497, 615, 615, 500, 635, 740, 604,
  55188. 611, 604, 611, 556, 490, 556, 875, 556, 615, 581, 833, 844, 729, 854,
  55189. 615, 552, 854, 583, 556, 556, 611, 417, 552, 556, 278, 281, 278, 969,
  55190. 906, 611, 500, 615, 556, 604, 778, 611, 487, 447, 944, 778, 944, 778,
  55191. 944, 778, 667, 556, 333, 333, 556, 1000, 1000, 552, 278, 278, 278,
  55192. 278, 500, 500, 500, 556, 556, 350, 1000, 1000, 240, 479, 333, 333,
  55193. 604, 333, 167, 396, 556, 556, 1094, 556, 885, 489, 1115, 1000, 768,
  55194. 600, 834, 834, 834, 834, 1000, 500, 1000, 500, 1000, 500, 500, 494,
  55195. 612, 823, 713, 584, 549, 713, 979, 722, 274, 549, 549, 583, 549, 549,
  55196. 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708,
  55197. 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708,
  55198. 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708,
  55199. 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354,
  55200. 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052,
  55201. 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 611, 611, 333, 333,
  55202. 333, 333, 333, 333, 333, 333, 222, 222, 333, 333, 333, 333, 333, 333,
  55203. 333, 333,
  55204. ];
  55205. exports.LiberationSansBoldWidths = LiberationSansBoldWidths;
  55206. const LiberationSansBoldMapping = [
  55207. -1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
  55208. 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
  55209. 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
  55210. 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
  55211. 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
  55212. 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
  55213. 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172,
  55214. 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
  55215. 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201,
  55216. 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215,
  55217. 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
  55218. 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243,
  55219. 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257,
  55220. 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271,
  55221. 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
  55222. 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299,
  55223. 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313,
  55224. 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327,
  55225. 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341,
  55226. 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355,
  55227. 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369,
  55228. 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383,
  55229. 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713,
  55230. 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908,
  55231. 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923,
  55232. 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938,
  55233. 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952,
  55234. 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966,
  55235. 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028,
  55236. 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039,
  55237. 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050,
  55238. 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061,
  55239. 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072,
  55240. 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083,
  55241. 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094,
  55242. 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105,
  55243. 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116,
  55244. 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811,
  55245. 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216,
  55246. 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240,
  55247. 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359,
  55248. 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542,
  55249. 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721,
  55250. 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805,
  55251. 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500,
  55252. 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558,
  55253. 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569,
  55254. 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580,
  55255. 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642,
  55256. 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689,
  55257. 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834,
  55258. 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  55259. -1, -1, -1, -1, -1, -1, -1, -1,
  55260. ];
  55261. exports.LiberationSansBoldMapping = LiberationSansBoldMapping;
  55262. const LiberationSansBoldItalicWidths = [
  55263. 365, 0, 333, 278, 333, 474, 556, 556, 889, 722, 238, 333, 333, 389,
  55264. 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556,
  55265. 556, 333, 333, 584, 584, 584, 611, 975, 722, 722, 722, 722, 667, 611,
  55266. 778, 722, 278, 556, 722, 611, 833, 722, 778, 667, 778, 722, 667, 611,
  55267. 722, 667, 944, 667, 667, 611, 333, 278, 333, 584, 556, 333, 556, 611,
  55268. 556, 611, 556, 333, 611, 611, 278, 278, 556, 278, 889, 611, 611, 611,
  55269. 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389, 584,
  55270. 333, 556, 556, 556, 556, 280, 556, 333, 737, 370, 556, 584, 737, 552,
  55271. 400, 549, 333, 333, 333, 576, 556, 278, 333, 333, 365, 556, 834, 834,
  55272. 834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667,
  55273. 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722,
  55274. 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 556,
  55275. 556, 556, 556, 556, 278, 278, 278, 278, 611, 611, 611, 611, 611, 611,
  55276. 611, 549, 611, 611, 611, 611, 611, 556, 611, 556, 722, 556, 722, 556,
  55277. 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 740, 722, 611,
  55278. 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 611, 778, 611,
  55279. 778, 611, 778, 611, 722, 611, 722, 611, 278, 278, 278, 278, 278, 278,
  55280. 278, 278, 278, 278, 782, 556, 556, 278, 722, 556, 556, 611, 278, 611,
  55281. 278, 611, 396, 611, 479, 611, 278, 722, 611, 722, 611, 722, 611, 708,
  55282. 723, 611, 778, 611, 778, 611, 778, 611, 1000, 944, 722, 389, 722, 389,
  55283. 722, 389, 667, 556, 667, 556, 667, 556, 667, 556, 611, 333, 611, 479,
  55284. 611, 333, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611,
  55285. 944, 778, 667, 556, 667, 611, 500, 611, 500, 611, 500, 278, 556, 722,
  55286. 556, 1000, 889, 778, 611, 667, 556, 611, 333, 333, 333, 333, 333, 333,
  55287. 333, 333, 333, 333, 333, 333, 722, 333, 854, 906, 473, 844, 930, 847,
  55288. 278, 722, 722, 610, 671, 667, 611, 722, 778, 278, 722, 667, 833, 722,
  55289. 657, 778, 718, 667, 590, 611, 667, 822, 667, 829, 781, 278, 667, 620,
  55290. 479, 611, 278, 591, 620, 621, 556, 610, 479, 492, 611, 558, 278, 566,
  55291. 556, 603, 556, 450, 611, 712, 605, 532, 664, 409, 591, 704, 578, 773,
  55292. 834, 278, 591, 611, 591, 834, 667, 667, 886, 614, 719, 667, 278, 278,
  55293. 556, 1094, 1042, 854, 622, 719, 677, 719, 722, 708, 722, 614, 722,
  55294. 667, 927, 643, 719, 719, 615, 687, 833, 722, 778, 719, 667, 722, 611,
  55295. 677, 781, 667, 729, 708, 979, 989, 854, 1000, 708, 719, 1042, 729,
  55296. 556, 619, 604, 534, 618, 556, 736, 510, 611, 611, 507, 622, 740, 604,
  55297. 611, 611, 611, 556, 889, 556, 885, 556, 646, 583, 889, 935, 707, 854,
  55298. 594, 552, 865, 589, 556, 556, 611, 469, 563, 556, 278, 278, 278, 969,
  55299. 906, 611, 507, 619, 556, 611, 778, 611, 575, 467, 944, 778, 944, 778,
  55300. 944, 778, 667, 556, 333, 333, 556, 1000, 1000, 552, 278, 278, 278,
  55301. 278, 500, 500, 500, 556, 556, 350, 1000, 1000, 240, 479, 333, 333,
  55302. 604, 333, 167, 396, 556, 556, 1104, 556, 885, 516, 1146, 1000, 768,
  55303. 600, 834, 834, 834, 834, 999, 500, 1000, 500, 1000, 500, 500, 494,
  55304. 612, 823, 713, 584, 549, 713, 979, 722, 274, 549, 549, 583, 549, 549,
  55305. 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708,
  55306. 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708,
  55307. 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708,
  55308. 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354,
  55309. 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052,
  55310. 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 611, 611, 333, 333,
  55311. 333, 333, 333, 333, 333, 333, 222, 222, 333, 333, 333, 333, 333, 333,
  55312. 333, 333,
  55313. ];
  55314. exports.LiberationSansBoldItalicWidths = LiberationSansBoldItalicWidths;
  55315. const LiberationSansBoldItalicMapping = [
  55316. -1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
  55317. 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
  55318. 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
  55319. 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
  55320. 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
  55321. 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
  55322. 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172,
  55323. 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
  55324. 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201,
  55325. 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215,
  55326. 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
  55327. 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243,
  55328. 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257,
  55329. 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271,
  55330. 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
  55331. 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299,
  55332. 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313,
  55333. 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327,
  55334. 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341,
  55335. 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355,
  55336. 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369,
  55337. 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383,
  55338. 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713,
  55339. 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908,
  55340. 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923,
  55341. 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938,
  55342. 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952,
  55343. 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966,
  55344. 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028,
  55345. 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039,
  55346. 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050,
  55347. 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061,
  55348. 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072,
  55349. 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083,
  55350. 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094,
  55351. 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105,
  55352. 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116,
  55353. 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811,
  55354. 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216,
  55355. 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240,
  55356. 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359,
  55357. 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542,
  55358. 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721,
  55359. 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805,
  55360. 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500,
  55361. 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558,
  55362. 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569,
  55363. 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580,
  55364. 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642,
  55365. 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689,
  55366. 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834,
  55367. 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  55368. -1, -1, -1, -1, -1, -1, -1, -1,
  55369. ];
  55370. exports.LiberationSansBoldItalicMapping =
  55371. LiberationSansBoldItalicMapping;
  55372. const LiberationSansItalicWidths = [
  55373. 365, 0, 333, 278, 278, 355, 556, 556, 889, 667, 191, 333, 333, 389,
  55374. 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556,
  55375. 556, 278, 278, 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, 611,
  55376. 778, 722, 278, 500, 667, 556, 833, 722, 778, 667, 778, 722, 667, 611,
  55377. 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, 333, 556, 556,
  55378. 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, 556, 556, 556,
  55379. 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334, 584,
  55380. 333, 556, 556, 556, 556, 260, 556, 333, 737, 370, 556, 584, 737, 552,
  55381. 400, 549, 333, 333, 333, 576, 537, 278, 333, 333, 365, 556, 834, 834,
  55382. 834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, 667, 667, 667, 667,
  55383. 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722,
  55384. 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 500,
  55385. 556, 556, 556, 556, 278, 278, 278, 278, 556, 556, 556, 556, 556, 556,
  55386. 556, 549, 611, 556, 556, 556, 556, 500, 556, 500, 667, 556, 667, 556,
  55387. 667, 556, 722, 500, 722, 500, 722, 500, 722, 500, 722, 625, 722, 556,
  55388. 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 556, 778, 556,
  55389. 778, 556, 778, 556, 722, 556, 722, 556, 278, 278, 278, 278, 278, 278,
  55390. 278, 222, 278, 278, 733, 444, 500, 222, 667, 500, 500, 556, 222, 556,
  55391. 222, 556, 281, 556, 400, 556, 222, 722, 556, 722, 556, 722, 556, 615,
  55392. 723, 556, 778, 556, 778, 556, 778, 556, 1000, 944, 722, 333, 722, 333,
  55393. 722, 333, 667, 500, 667, 500, 667, 500, 667, 500, 611, 278, 611, 354,
  55394. 611, 278, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556,
  55395. 944, 722, 667, 500, 667, 611, 500, 611, 500, 611, 500, 222, 556, 667,
  55396. 556, 1000, 889, 778, 611, 667, 500, 611, 278, 333, 333, 333, 333, 333,
  55397. 333, 333, 333, 333, 333, 333, 667, 278, 789, 846, 389, 794, 865, 775,
  55398. 222, 667, 667, 570, 671, 667, 611, 722, 778, 278, 667, 667, 833, 722,
  55399. 648, 778, 725, 667, 600, 611, 667, 837, 667, 831, 761, 278, 667, 570,
  55400. 439, 555, 222, 550, 570, 571, 500, 556, 439, 463, 555, 542, 222, 500,
  55401. 492, 548, 500, 447, 556, 670, 573, 486, 603, 374, 550, 652, 546, 728,
  55402. 779, 222, 550, 556, 550, 779, 667, 667, 843, 544, 708, 667, 278, 278,
  55403. 500, 1066, 982, 844, 589, 715, 639, 724, 667, 651, 667, 544, 704, 667,
  55404. 917, 614, 715, 715, 589, 686, 833, 722, 778, 725, 667, 722, 611, 639,
  55405. 795, 667, 727, 673, 920, 923, 805, 886, 651, 694, 1022, 682, 556, 562,
  55406. 522, 493, 553, 556, 688, 465, 556, 556, 472, 564, 686, 550, 556, 556,
  55407. 556, 500, 833, 500, 835, 500, 572, 518, 830, 851, 621, 736, 526, 492,
  55408. 752, 534, 556, 556, 556, 378, 496, 500, 222, 222, 222, 910, 828, 556,
  55409. 472, 565, 500, 556, 778, 556, 492, 339, 944, 722, 944, 722, 944, 722,
  55410. 667, 500, 333, 333, 556, 1000, 1000, 552, 222, 222, 222, 222, 333,
  55411. 333, 333, 556, 556, 350, 1000, 1000, 188, 354, 333, 333, 500, 333,
  55412. 167, 365, 556, 556, 1094, 556, 885, 323, 1083, 1000, 768, 600, 834,
  55413. 834, 834, 834, 1000, 500, 998, 500, 1000, 500, 500, 494, 612, 823,
  55414. 713, 584, 549, 713, 979, 719, 274, 549, 549, 584, 549, 549, 604, 584,
  55415. 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708,
  55416. 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708,
  55417. 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708,
  55418. 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990,
  55419. 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750,
  55420. 750, 531, 656, 594, 510, 500, 750, 750, 500, 500, 333, 333, 333, 333,
  55421. 333, 333, 333, 333, 222, 222, 294, 294, 324, 324, 316, 328, 398, 285,
  55422. ];
  55423. exports.LiberationSansItalicWidths = LiberationSansItalicWidths;
  55424. const LiberationSansItalicMapping = [
  55425. -1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
  55426. 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
  55427. 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
  55428. 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
  55429. 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
  55430. 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
  55431. 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172,
  55432. 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
  55433. 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201,
  55434. 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215,
  55435. 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
  55436. 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243,
  55437. 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257,
  55438. 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271,
  55439. 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
  55440. 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299,
  55441. 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313,
  55442. 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327,
  55443. 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341,
  55444. 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355,
  55445. 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369,
  55446. 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383,
  55447. 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713,
  55448. 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908,
  55449. 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923,
  55450. 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938,
  55451. 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952,
  55452. 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966,
  55453. 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028,
  55454. 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039,
  55455. 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050,
  55456. 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061,
  55457. 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072,
  55458. 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083,
  55459. 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094,
  55460. 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105,
  55461. 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116,
  55462. 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811,
  55463. 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216,
  55464. 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240,
  55465. 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359,
  55466. 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542,
  55467. 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721,
  55468. 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805,
  55469. 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500,
  55470. 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558,
  55471. 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569,
  55472. 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580,
  55473. 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642,
  55474. 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689,
  55475. 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834,
  55476. 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  55477. -1, -1, -1, -1, -1, -1, -1, -1,
  55478. ];
  55479. exports.LiberationSansItalicMapping = LiberationSansItalicMapping;
  55480. const LiberationSansRegularWidths = [
  55481. 365, 0, 333, 278, 278, 355, 556, 556, 889, 667, 191, 333, 333, 389,
  55482. 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556,
  55483. 556, 278, 278, 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, 611,
  55484. 778, 722, 278, 500, 667, 556, 833, 722, 778, 667, 778, 722, 667, 611,
  55485. 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, 333, 556, 556,
  55486. 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, 556, 556, 556,
  55487. 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334, 584,
  55488. 333, 556, 556, 556, 556, 260, 556, 333, 737, 370, 556, 584, 737, 552,
  55489. 400, 549, 333, 333, 333, 576, 537, 278, 333, 333, 365, 556, 834, 834,
  55490. 834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, 667, 667, 667, 667,
  55491. 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722,
  55492. 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 500,
  55493. 556, 556, 556, 556, 278, 278, 278, 278, 556, 556, 556, 556, 556, 556,
  55494. 556, 549, 611, 556, 556, 556, 556, 500, 556, 500, 667, 556, 667, 556,
  55495. 667, 556, 722, 500, 722, 500, 722, 500, 722, 500, 722, 615, 722, 556,
  55496. 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 556, 778, 556,
  55497. 778, 556, 778, 556, 722, 556, 722, 556, 278, 278, 278, 278, 278, 278,
  55498. 278, 222, 278, 278, 735, 444, 500, 222, 667, 500, 500, 556, 222, 556,
  55499. 222, 556, 292, 556, 334, 556, 222, 722, 556, 722, 556, 722, 556, 604,
  55500. 723, 556, 778, 556, 778, 556, 778, 556, 1000, 944, 722, 333, 722, 333,
  55501. 722, 333, 667, 500, 667, 500, 667, 500, 667, 500, 611, 278, 611, 375,
  55502. 611, 278, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556,
  55503. 944, 722, 667, 500, 667, 611, 500, 611, 500, 611, 500, 222, 556, 667,
  55504. 556, 1000, 889, 778, 611, 667, 500, 611, 278, 333, 333, 333, 333, 333,
  55505. 333, 333, 333, 333, 333, 333, 667, 278, 784, 838, 384, 774, 855, 752,
  55506. 222, 667, 667, 551, 668, 667, 611, 722, 778, 278, 667, 668, 833, 722,
  55507. 650, 778, 722, 667, 618, 611, 667, 798, 667, 835, 748, 278, 667, 578,
  55508. 446, 556, 222, 547, 578, 575, 500, 557, 446, 441, 556, 556, 222, 500,
  55509. 500, 576, 500, 448, 556, 690, 569, 482, 617, 395, 547, 648, 525, 713,
  55510. 781, 222, 547, 556, 547, 781, 667, 667, 865, 542, 719, 667, 278, 278,
  55511. 500, 1057, 1010, 854, 583, 722, 635, 719, 667, 656, 667, 542, 677,
  55512. 667, 923, 604, 719, 719, 583, 656, 833, 722, 778, 719, 667, 722, 611,
  55513. 635, 760, 667, 740, 667, 917, 938, 792, 885, 656, 719, 1010, 722, 556,
  55514. 573, 531, 365, 583, 556, 669, 458, 559, 559, 438, 583, 688, 552, 556,
  55515. 542, 556, 500, 458, 500, 823, 500, 573, 521, 802, 823, 625, 719, 521,
  55516. 510, 750, 542, 556, 556, 556, 365, 510, 500, 222, 278, 222, 906, 812,
  55517. 556, 438, 559, 500, 552, 778, 556, 489, 411, 944, 722, 944, 722, 944,
  55518. 722, 667, 500, 333, 333, 556, 1000, 1000, 552, 222, 222, 222, 222,
  55519. 333, 333, 333, 556, 556, 350, 1000, 1000, 188, 354, 333, 333, 500,
  55520. 333, 167, 365, 556, 556, 1094, 556, 885, 323, 1073, 1000, 768, 600,
  55521. 834, 834, 834, 834, 1000, 500, 1000, 500, 1000, 500, 500, 494, 612,
  55522. 823, 713, 584, 549, 713, 979, 719, 274, 549, 549, 583, 549, 549, 604,
  55523. 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708,
  55524. 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708,
  55525. 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708,
  55526. 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000,
  55527. 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917,
  55528. 750, 750, 531, 656, 594, 510, 500, 750, 750, 500, 500, 333, 333, 333,
  55529. 333, 333, 333, 333, 333, 222, 222, 294, 294, 324, 324, 316, 328, 398,
  55530. 285,
  55531. ];
  55532. exports.LiberationSansRegularWidths = LiberationSansRegularWidths;
  55533. const LiberationSansRegularMapping = [
  55534. -1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
  55535. 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
  55536. 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
  55537. 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
  55538. 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
  55539. 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
  55540. 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172,
  55541. 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
  55542. 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201,
  55543. 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215,
  55544. 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
  55545. 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243,
  55546. 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257,
  55547. 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271,
  55548. 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
  55549. 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299,
  55550. 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313,
  55551. 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327,
  55552. 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341,
  55553. 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355,
  55554. 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369,
  55555. 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383,
  55556. 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713,
  55557. 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908,
  55558. 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923,
  55559. 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938,
  55560. 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952,
  55561. 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966,
  55562. 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028,
  55563. 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039,
  55564. 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050,
  55565. 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061,
  55566. 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072,
  55567. 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083,
  55568. 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094,
  55569. 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105,
  55570. 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116,
  55571. 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811,
  55572. 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216,
  55573. 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240,
  55574. 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359,
  55575. 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542,
  55576. 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721,
  55577. 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805,
  55578. 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500,
  55579. 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558,
  55580. 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569,
  55581. 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580,
  55582. 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642,
  55583. 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689,
  55584. 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834,
  55585. 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  55586. -1, -1, -1, -1, -1, -1, -1, -1,
  55587. ];
  55588. exports.LiberationSansRegularMapping = LiberationSansRegularMapping;
  55589. /***/
  55590. },
  55591. /* 55 */
  55592. /***/ (__unused_webpack_module, exports) => {
  55593. Object.defineProperty(exports, "__esModule", {
  55594. value: true,
  55595. });
  55596. exports.MyriadProRegularMetrics =
  55597. exports.MyriadProRegularFactors =
  55598. exports.MyriadProItalicMetrics =
  55599. exports.MyriadProItalicFactors =
  55600. exports.MyriadProBoldMetrics =
  55601. exports.MyriadProBoldItalicMetrics =
  55602. exports.MyriadProBoldItalicFactors =
  55603. exports.MyriadProBoldFactors =
  55604. void 0;
  55605. const MyriadProBoldFactors = [
  55606. 1.36898, 1, 1, 0.72706, 0.80479, 0.83734, 0.98894, 0.99793, 0.9897,
  55607. 0.93884, 0.86209, 0.94292, 0.94292, 1.16661, 1.02058, 0.93582,
  55608. 0.96694, 0.93582, 1.19137, 0.99793, 0.99793, 0.99793, 0.99793,
  55609. 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.78076,
  55610. 0.78076, 1.02058, 1.02058, 1.02058, 0.72851, 0.78966, 0.90838,
  55611. 0.83637, 0.82391, 0.96376, 0.80061, 0.86275, 0.8768, 0.95407, 1.0258,
  55612. 0.73901, 0.85022, 0.83655, 1.0156, 0.95546, 0.92179, 0.87107, 0.92179,
  55613. 0.82114, 0.8096, 0.89713, 0.94438, 0.95353, 0.94083, 0.91905, 0.90406,
  55614. 0.9446, 0.94292, 1.18777, 0.94292, 1.02058, 0.89903, 0.90088, 0.94938,
  55615. 0.97898, 0.81093, 0.97571, 0.94938, 1.024, 0.9577, 0.95933, 0.98621,
  55616. 1.0474, 0.97455, 0.98981, 0.9672, 0.95933, 0.9446, 0.97898, 0.97407,
  55617. 0.97646, 0.78036, 1.10208, 0.95442, 0.95298, 0.97579, 0.9332, 0.94039,
  55618. 0.938, 0.80687, 1.01149, 0.80687, 1.02058, 0.80479, 0.99793, 0.99793,
  55619. 0.99793, 0.99793, 1.01149, 1.00872, 0.90088, 0.91882, 1.0213, 0.8361,
  55620. 1.02058, 0.62295, 0.54324, 0.89022, 1.08595, 1, 1, 0.90088, 1,
  55621. 0.97455, 0.93582, 0.90088, 1, 1.05686, 0.8361, 0.99642, 0.99642,
  55622. 0.99642, 0.72851, 0.90838, 0.90838, 0.90838, 0.90838, 0.90838,
  55623. 0.90838, 0.868, 0.82391, 0.80061, 0.80061, 0.80061, 0.80061, 1.0258,
  55624. 1.0258, 1.0258, 1.0258, 0.97484, 0.95546, 0.92179, 0.92179, 0.92179,
  55625. 0.92179, 0.92179, 1.02058, 0.92179, 0.94438, 0.94438, 0.94438,
  55626. 0.94438, 0.90406, 0.86958, 0.98225, 0.94938, 0.94938, 0.94938,
  55627. 0.94938, 0.94938, 0.94938, 0.9031, 0.81093, 0.94938, 0.94938, 0.94938,
  55628. 0.94938, 0.98621, 0.98621, 0.98621, 0.98621, 0.93969, 0.95933, 0.9446,
  55629. 0.9446, 0.9446, 0.9446, 0.9446, 1.08595, 0.9446, 0.95442, 0.95442,
  55630. 0.95442, 0.95442, 0.94039, 0.97898, 0.94039, 0.90838, 0.94938,
  55631. 0.90838, 0.94938, 0.90838, 0.94938, 0.82391, 0.81093, 0.82391,
  55632. 0.81093, 0.82391, 0.81093, 0.82391, 0.81093, 0.96376, 0.84313,
  55633. 0.97484, 0.97571, 0.80061, 0.94938, 0.80061, 0.94938, 0.80061,
  55634. 0.94938, 0.80061, 0.94938, 0.80061, 0.94938, 0.8768, 0.9577, 0.8768,
  55635. 0.9577, 0.8768, 0.9577, 1, 1, 0.95407, 0.95933, 0.97069, 0.95933,
  55636. 1.0258, 0.98621, 1.0258, 0.98621, 1.0258, 0.98621, 1.0258, 0.98621,
  55637. 1.0258, 0.98621, 0.887, 1.01591, 0.73901, 1.0474, 1, 1, 0.97455,
  55638. 0.83655, 0.98981, 1, 1, 0.83655, 0.73977, 0.83655, 0.73903, 0.84638,
  55639. 1.033, 0.95546, 0.95933, 1, 1, 0.95546, 0.95933, 0.8271, 0.95417,
  55640. 0.95933, 0.92179, 0.9446, 0.92179, 0.9446, 0.92179, 0.9446, 0.936,
  55641. 0.91964, 0.82114, 0.97646, 1, 1, 0.82114, 0.97646, 0.8096, 0.78036,
  55642. 0.8096, 0.78036, 1, 1, 0.8096, 0.78036, 1, 1, 0.89713, 0.77452,
  55643. 0.89713, 1.10208, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438,
  55644. 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442,
  55645. 0.94083, 0.97579, 0.90406, 0.94039, 0.90406, 0.9446, 0.938, 0.9446,
  55646. 0.938, 0.9446, 0.938, 1, 0.99793, 0.90838, 0.94938, 0.868, 0.9031,
  55647. 0.92179, 0.9446, 1, 1, 0.89713, 1.10208, 0.90088, 0.90088, 0.90088,
  55648. 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90989, 0.9358,
  55649. 0.91945, 0.83181, 0.75261, 0.87992, 0.82976, 0.96034, 0.83689,
  55650. 0.97268, 1.0078, 0.90838, 0.83637, 0.8019, 0.90157, 0.80061, 0.9446,
  55651. 0.95407, 0.92436, 1.0258, 0.85022, 0.97153, 1.0156, 0.95546, 0.89192,
  55652. 0.92179, 0.92361, 0.87107, 0.96318, 0.89713, 0.93704, 0.95638,
  55653. 0.91905, 0.91709, 0.92796, 1.0258, 0.93704, 0.94836, 1.0373, 0.95933,
  55654. 1.0078, 0.95871, 0.94836, 0.96174, 0.92601, 0.9498, 0.98607, 0.95776,
  55655. 0.95933, 1.05453, 1.0078, 0.98275, 0.9314, 0.95617, 0.91701, 1.05993,
  55656. 0.9446, 0.78367, 0.9553, 1, 0.86832, 1.0128, 0.95871, 0.99394,
  55657. 0.87548, 0.96361, 0.86774, 1.0078, 0.95871, 0.9446, 0.95871, 0.86774,
  55658. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55659. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55660. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55661. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55662. 1, 1, 1, 1, 1, 1, 1, 1, 0.94083, 0.97579, 0.94083, 0.97579, 0.94083,
  55663. 0.97579, 0.90406, 0.94039, 0.96694, 1, 0.89903, 1, 1, 1, 0.93582,
  55664. 0.93582, 0.93582, 1, 0.908, 0.908, 0.918, 0.94219, 0.94219, 0.96544,
  55665. 1, 1.285, 1, 1, 0.81079, 0.81079, 1, 1, 0.74854, 1, 1, 1, 1, 0.99793,
  55666. 1, 1, 1, 0.65, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.17173,
  55667. 1, 0.80535, 0.76169, 1.02058, 1.0732, 1.05486, 1, 1, 1.30692, 1.08595,
  55668. 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55669. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55670. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55671. 1, 1, 1.16161, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55672. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55673. ];
  55674. exports.MyriadProBoldFactors = MyriadProBoldFactors;
  55675. const MyriadProBoldMetrics = {
  55676. lineHeight: 1.2,
  55677. lineGap: 0.2,
  55678. };
  55679. exports.MyriadProBoldMetrics = MyriadProBoldMetrics;
  55680. const MyriadProBoldItalicFactors = [
  55681. 1.36898, 1, 1, 0.66227, 0.80779, 0.81625, 0.97276, 0.97276, 0.97733,
  55682. 0.92222, 0.83266, 0.94292, 0.94292, 1.16148, 1.02058, 0.93582,
  55683. 0.96694, 0.93582, 1.17337, 0.97276, 0.97276, 0.97276, 0.97276,
  55684. 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.78076,
  55685. 0.78076, 1.02058, 1.02058, 1.02058, 0.71541, 0.76813, 0.85576,
  55686. 0.80591, 0.80729, 0.94299, 0.77512, 0.83655, 0.86523, 0.92222,
  55687. 0.98621, 0.71743, 0.81698, 0.79726, 0.98558, 0.92222, 0.90637,
  55688. 0.83809, 0.90637, 0.80729, 0.76463, 0.86275, 0.90699, 0.91605, 0.9154,
  55689. 0.85308, 0.85458, 0.90531, 0.94292, 1.21296, 0.94292, 1.02058,
  55690. 0.89903, 1.18616, 0.99613, 0.91677, 0.78216, 0.91677, 0.90083,
  55691. 0.98796, 0.9135, 0.92168, 0.95381, 0.98981, 0.95298, 0.95381, 0.93459,
  55692. 0.92168, 0.91513, 0.92004, 0.91677, 0.95077, 0.748, 1.04502, 0.91677,
  55693. 0.92061, 0.94236, 0.89544, 0.89364, 0.9, 0.80687, 0.8578, 0.80687,
  55694. 1.02058, 0.80779, 0.97276, 0.97276, 0.97276, 0.97276, 0.8578, 0.99973,
  55695. 1.18616, 0.91339, 1.08074, 0.82891, 1.02058, 0.55509, 0.71526,
  55696. 0.89022, 1.08595, 1, 1, 1.18616, 1, 0.96736, 0.93582, 1.18616, 1,
  55697. 1.04864, 0.82711, 0.99043, 0.99043, 0.99043, 0.71541, 0.85576,
  55698. 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.845, 0.80729, 0.77512,
  55699. 0.77512, 0.77512, 0.77512, 0.98621, 0.98621, 0.98621, 0.98621,
  55700. 0.95961, 0.92222, 0.90637, 0.90637, 0.90637, 0.90637, 0.90637,
  55701. 1.02058, 0.90251, 0.90699, 0.90699, 0.90699, 0.90699, 0.85458,
  55702. 0.83659, 0.94951, 0.99613, 0.99613, 0.99613, 0.99613, 0.99613,
  55703. 0.99613, 0.85811, 0.78216, 0.90083, 0.90083, 0.90083, 0.90083,
  55704. 0.95381, 0.95381, 0.95381, 0.95381, 0.9135, 0.92168, 0.91513, 0.91513,
  55705. 0.91513, 0.91513, 0.91513, 1.08595, 0.91677, 0.91677, 0.91677,
  55706. 0.91677, 0.91677, 0.89364, 0.92332, 0.89364, 0.85576, 0.99613,
  55707. 0.85576, 0.99613, 0.85576, 0.99613, 0.80729, 0.78216, 0.80729,
  55708. 0.78216, 0.80729, 0.78216, 0.80729, 0.78216, 0.94299, 0.76783,
  55709. 0.95961, 0.91677, 0.77512, 0.90083, 0.77512, 0.90083, 0.77512,
  55710. 0.90083, 0.77512, 0.90083, 0.77512, 0.90083, 0.86523, 0.9135, 0.86523,
  55711. 0.9135, 0.86523, 0.9135, 1, 1, 0.92222, 0.92168, 0.92222, 0.92168,
  55712. 0.98621, 0.95381, 0.98621, 0.95381, 0.98621, 0.95381, 0.98621,
  55713. 0.95381, 0.98621, 0.95381, 0.86036, 0.97096, 0.71743, 0.98981, 1, 1,
  55714. 0.95298, 0.79726, 0.95381, 1, 1, 0.79726, 0.6894, 0.79726, 0.74321,
  55715. 0.81691, 1.0006, 0.92222, 0.92168, 1, 1, 0.92222, 0.92168, 0.79464,
  55716. 0.92098, 0.92168, 0.90637, 0.91513, 0.90637, 0.91513, 0.90637,
  55717. 0.91513, 0.909, 0.87514, 0.80729, 0.95077, 1, 1, 0.80729, 0.95077,
  55718. 0.76463, 0.748, 0.76463, 0.748, 1, 1, 0.76463, 0.748, 1, 1, 0.86275,
  55719. 0.72651, 0.86275, 1.04502, 0.90699, 0.91677, 0.90699, 0.91677,
  55720. 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699,
  55721. 0.91677, 0.9154, 0.94236, 0.85458, 0.89364, 0.85458, 0.90531, 0.9,
  55722. 0.90531, 0.9, 0.90531, 0.9, 1, 0.97276, 0.85576, 0.99613, 0.845,
  55723. 0.85811, 0.90251, 0.91677, 1, 1, 0.86275, 1.04502, 1.18616, 1.18616,
  55724. 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616,
  55725. 1.00899, 1.30628, 0.85576, 0.80178, 0.66862, 0.7927, 0.69323, 0.88127,
  55726. 0.72459, 0.89711, 0.95381, 0.85576, 0.80591, 0.7805, 0.94729, 0.77512,
  55727. 0.90531, 0.92222, 0.90637, 0.98621, 0.81698, 0.92655, 0.98558,
  55728. 0.92222, 0.85359, 0.90637, 0.90976, 0.83809, 0.94523, 0.86275,
  55729. 0.83509, 0.93157, 0.85308, 0.83392, 0.92346, 0.98621, 0.83509,
  55730. 0.92886, 0.91324, 0.92168, 0.95381, 0.90646, 0.92886, 0.90557,
  55731. 0.86847, 0.90276, 0.91324, 0.86842, 0.92168, 0.99531, 0.95381, 0.9224,
  55732. 0.85408, 0.92699, 0.86847, 1.0051, 0.91513, 0.80487, 0.93481, 1,
  55733. 0.88159, 1.05214, 0.90646, 0.97355, 0.81539, 0.89398, 0.85923,
  55734. 0.95381, 0.90646, 0.91513, 0.90646, 0.85923, 1, 1, 1, 1, 1, 1, 1, 1,
  55735. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55736. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55737. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55738. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55739. 0.9154, 0.94236, 0.9154, 0.94236, 0.9154, 0.94236, 0.85458, 0.89364,
  55740. 0.96694, 1, 0.89903, 1, 1, 1, 0.91782, 0.91782, 0.91782, 1, 0.896,
  55741. 0.896, 0.896, 0.9332, 0.9332, 0.95973, 1, 1.26, 1, 1, 0.80479,
  55742. 0.80178, 1, 1, 0.85633, 1, 1, 1, 1, 0.97276, 1, 1, 1, 0.698, 1,
  55743. 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.14542, 1, 0.79199,
  55744. 0.78694, 1.02058, 1.03493, 1.05486, 1, 1, 1.23026, 1.08595, 1.08595,
  55745. 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55746. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55747. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55748. 1.20006, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55749. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55750. ];
  55751. exports.MyriadProBoldItalicFactors = MyriadProBoldItalicFactors;
  55752. const MyriadProBoldItalicMetrics = {
  55753. lineHeight: 1.2,
  55754. lineGap: 0.2,
  55755. };
  55756. exports.MyriadProBoldItalicMetrics = MyriadProBoldItalicMetrics;
  55757. const MyriadProItalicFactors = [
  55758. 1.36898, 1, 1, 0.65507, 0.84943, 0.85639, 0.88465, 0.88465, 0.86936,
  55759. 0.88307, 0.86948, 0.85283, 0.85283, 1.06383, 1.02058, 0.75945, 0.9219,
  55760. 0.75945, 1.17337, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465,
  55761. 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.75945, 0.75945,
  55762. 1.02058, 1.02058, 1.02058, 0.69046, 0.70926, 0.85158, 0.77812,
  55763. 0.76852, 0.89591, 0.70466, 0.76125, 0.80094, 0.86822, 0.83864, 0.728,
  55764. 0.77212, 0.79475, 0.93637, 0.87514, 0.8588, 0.76013, 0.8588, 0.72421,
  55765. 0.69866, 0.77598, 0.85991, 0.80811, 0.87832, 0.78112, 0.77512, 0.8562,
  55766. 1.0222, 1.18417, 1.0222, 1.27014, 0.89903, 1.15012, 0.93859, 0.94399,
  55767. 0.846, 0.94399, 0.81453, 1.0186, 0.94219, 0.96017, 1.03075, 1.02175,
  55768. 0.912, 1.03075, 0.96998, 0.96017, 0.93859, 0.94399, 0.94399, 0.95493,
  55769. 0.746, 1.12658, 0.94578, 0.91, 0.979, 0.882, 0.882, 0.83, 0.85034,
  55770. 0.83537, 0.85034, 1.02058, 0.70869, 0.88465, 0.88465, 0.88465,
  55771. 0.88465, 0.83537, 0.90083, 1.15012, 0.9161, 0.94565, 0.73541, 1.02058,
  55772. 0.53609, 0.69353, 0.79519, 1.08595, 1, 1, 1.15012, 1, 0.91974,
  55773. 0.75945, 1.15012, 1, 0.9446, 0.73361, 0.9005, 0.9005, 0.9005, 0.62864,
  55774. 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.773, 0.76852,
  55775. 0.70466, 0.70466, 0.70466, 0.70466, 0.83864, 0.83864, 0.83864,
  55776. 0.83864, 0.90561, 0.87514, 0.8588, 0.8588, 0.8588, 0.8588, 0.8588,
  55777. 1.02058, 0.85751, 0.85991, 0.85991, 0.85991, 0.85991, 0.77512,
  55778. 0.76013, 0.88075, 0.93859, 0.93859, 0.93859, 0.93859, 0.93859,
  55779. 0.93859, 0.8075, 0.846, 0.81453, 0.81453, 0.81453, 0.81453, 0.82424,
  55780. 0.82424, 0.82424, 0.82424, 0.9278, 0.96017, 0.93859, 0.93859, 0.93859,
  55781. 0.93859, 0.93859, 1.08595, 0.8562, 0.94578, 0.94578, 0.94578, 0.94578,
  55782. 0.882, 0.94578, 0.882, 0.85158, 0.93859, 0.85158, 0.93859, 0.85158,
  55783. 0.93859, 0.76852, 0.846, 0.76852, 0.846, 0.76852, 0.846, 0.76852,
  55784. 0.846, 0.89591, 0.8544, 0.90561, 0.94399, 0.70466, 0.81453, 0.70466,
  55785. 0.81453, 0.70466, 0.81453, 0.70466, 0.81453, 0.70466, 0.81453,
  55786. 0.80094, 0.94219, 0.80094, 0.94219, 0.80094, 0.94219, 1, 1, 0.86822,
  55787. 0.96017, 0.86822, 0.96017, 0.83864, 0.82424, 0.83864, 0.82424,
  55788. 0.83864, 0.82424, 0.83864, 1.03075, 0.83864, 0.82424, 0.81402,
  55789. 1.02738, 0.728, 1.02175, 1, 1, 0.912, 0.79475, 1.03075, 1, 1, 0.79475,
  55790. 0.83911, 0.79475, 0.66266, 0.80553, 1.06676, 0.87514, 0.96017, 1, 1,
  55791. 0.87514, 0.96017, 0.86865, 0.87396, 0.96017, 0.8588, 0.93859, 0.8588,
  55792. 0.93859, 0.8588, 0.93859, 0.867, 0.84759, 0.72421, 0.95493, 1, 1,
  55793. 0.72421, 0.95493, 0.69866, 0.746, 0.69866, 0.746, 1, 1, 0.69866,
  55794. 0.746, 1, 1, 0.77598, 0.88417, 0.77598, 1.12658, 0.85991, 0.94578,
  55795. 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991,
  55796. 0.94578, 0.85991, 0.94578, 0.87832, 0.979, 0.77512, 0.882, 0.77512,
  55797. 0.8562, 0.83, 0.8562, 0.83, 0.8562, 0.83, 1, 0.88465, 0.85158,
  55798. 0.93859, 0.773, 0.8075, 0.85751, 0.8562, 1, 1, 0.77598, 1.12658,
  55799. 1.15012, 1.15012, 1.15012, 1.15012, 1.15012, 1.15313, 1.15012,
  55800. 1.15012, 1.15012, 1.08106, 1.03901, 0.85158, 0.77025, 0.62264, 0.7646,
  55801. 0.65351, 0.86026, 0.69461, 0.89947, 1.03075, 0.85158, 0.77812,
  55802. 0.76449, 0.88836, 0.70466, 0.8562, 0.86822, 0.8588, 0.83864, 0.77212,
  55803. 0.85308, 0.93637, 0.87514, 0.82352, 0.8588, 0.85701, 0.76013, 0.89058,
  55804. 0.77598, 0.8156, 0.82565, 0.78112, 0.77899, 0.89386, 0.83864, 0.8156,
  55805. 0.9486, 0.92388, 0.96186, 1.03075, 0.91123, 0.9486, 0.93298, 0.878,
  55806. 0.93942, 0.92388, 0.84596, 0.96186, 0.95119, 1.03075, 0.922, 0.88787,
  55807. 0.95829, 0.88, 0.93559, 0.93859, 0.78815, 0.93758, 1, 0.89217,
  55808. 1.03737, 0.91123, 0.93969, 0.77487, 0.85769, 0.86799, 1.03075,
  55809. 0.91123, 0.93859, 0.91123, 0.86799, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55810. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55811. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55812. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55813. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.87832,
  55814. 0.979, 0.87832, 0.979, 0.87832, 0.979, 0.77512, 0.882, 0.9219, 1,
  55815. 0.89903, 1, 1, 1, 0.87321, 0.87321, 0.87321, 1, 1.027, 1.027, 1.027,
  55816. 0.86847, 0.86847, 0.79121, 1, 1.124, 1, 1, 0.73572, 0.73572, 1, 1,
  55817. 0.85034, 1, 1, 1, 1, 0.88465, 1, 1, 1, 0.669, 1, 1.36145, 1, 1, 1, 1,
  55818. 1, 1, 1, 1, 1, 1, 1, 1.04828, 1, 0.74948, 0.75187, 1.02058, 0.98391,
  55819. 1.02119, 1, 1, 1.06233, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1,
  55820. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55821. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55822. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05233, 1, 1, 1, 1, 1, 1, 1,
  55823. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55824. 1, 1, 1, 1, 1, 1, 1,
  55825. ];
  55826. exports.MyriadProItalicFactors = MyriadProItalicFactors;
  55827. const MyriadProItalicMetrics = {
  55828. lineHeight: 1.2,
  55829. lineGap: 0.2,
  55830. };
  55831. exports.MyriadProItalicMetrics = MyriadProItalicMetrics;
  55832. const MyriadProRegularFactors = [
  55833. 1.36898, 1, 1, 0.76305, 0.82784, 0.94935, 0.89364, 0.92241, 0.89073,
  55834. 0.90706, 0.98472, 0.85283, 0.85283, 1.0664, 1.02058, 0.74505, 0.9219,
  55835. 0.74505, 1.23456, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241,
  55836. 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.74505, 0.74505,
  55837. 1.02058, 1.02058, 1.02058, 0.73002, 0.72601, 0.91755, 0.8126, 0.80314,
  55838. 0.92222, 0.73764, 0.79726, 0.83051, 0.90284, 0.86023, 0.74, 0.8126,
  55839. 0.84869, 0.96518, 0.91115, 0.8858, 0.79761, 0.8858, 0.74498, 0.73914,
  55840. 0.81363, 0.89591, 0.83659, 0.89633, 0.85608, 0.8111, 0.90531, 1.0222,
  55841. 1.22736, 1.0222, 1.27014, 0.89903, 0.90088, 0.86667, 1.0231, 0.896,
  55842. 1.01411, 0.90083, 1.05099, 1.00512, 0.99793, 1.05326, 1.09377, 0.938,
  55843. 1.06226, 1.00119, 0.99793, 0.98714, 1.0231, 1.01231, 0.98196, 0.792,
  55844. 1.19137, 0.99074, 0.962, 1.01915, 0.926, 0.942, 0.856, 0.85034,
  55845. 0.92006, 0.85034, 1.02058, 0.69067, 0.92241, 0.92241, 0.92241,
  55846. 0.92241, 0.92006, 0.9332, 0.90088, 0.91882, 0.93484, 0.75339, 1.02058,
  55847. 0.56866, 0.54324, 0.79519, 1.08595, 1, 1, 0.90088, 1, 0.95325,
  55848. 0.74505, 0.90088, 1, 0.97198, 0.75339, 0.91009, 0.91009, 0.91009,
  55849. 0.66466, 0.91755, 0.91755, 0.91755, 0.91755, 0.91755, 0.91755, 0.788,
  55850. 0.80314, 0.73764, 0.73764, 0.73764, 0.73764, 0.86023, 0.86023,
  55851. 0.86023, 0.86023, 0.92915, 0.91115, 0.8858, 0.8858, 0.8858, 0.8858,
  55852. 0.8858, 1.02058, 0.8858, 0.89591, 0.89591, 0.89591, 0.89591, 0.8111,
  55853. 0.79611, 0.89713, 0.86667, 0.86667, 0.86667, 0.86667, 0.86667,
  55854. 0.86667, 0.86936, 0.896, 0.90083, 0.90083, 0.90083, 0.90083, 0.84224,
  55855. 0.84224, 0.84224, 0.84224, 0.97276, 0.99793, 0.98714, 0.98714,
  55856. 0.98714, 0.98714, 0.98714, 1.08595, 0.89876, 0.99074, 0.99074,
  55857. 0.99074, 0.99074, 0.942, 1.0231, 0.942, 0.91755, 0.86667, 0.91755,
  55858. 0.86667, 0.91755, 0.86667, 0.80314, 0.896, 0.80314, 0.896, 0.80314,
  55859. 0.896, 0.80314, 0.896, 0.92222, 0.93372, 0.92915, 1.01411, 0.73764,
  55860. 0.90083, 0.73764, 0.90083, 0.73764, 0.90083, 0.73764, 0.90083,
  55861. 0.73764, 0.90083, 0.83051, 1.00512, 0.83051, 1.00512, 0.83051,
  55862. 1.00512, 1, 1, 0.90284, 0.99793, 0.90976, 0.99793, 0.86023, 0.84224,
  55863. 0.86023, 0.84224, 0.86023, 0.84224, 0.86023, 1.05326, 0.86023,
  55864. 0.84224, 0.82873, 1.07469, 0.74, 1.09377, 1, 1, 0.938, 0.84869,
  55865. 1.06226, 1, 1, 0.84869, 0.83704, 0.84869, 0.81441, 0.85588, 1.08927,
  55866. 0.91115, 0.99793, 1, 1, 0.91115, 0.99793, 0.91887, 0.90991, 0.99793,
  55867. 0.8858, 0.98714, 0.8858, 0.98714, 0.8858, 0.98714, 0.894, 0.91434,
  55868. 0.74498, 0.98196, 1, 1, 0.74498, 0.98196, 0.73914, 0.792, 0.73914,
  55869. 0.792, 1, 1, 0.73914, 0.792, 1, 1, 0.81363, 0.904, 0.81363, 1.19137,
  55870. 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591,
  55871. 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89633, 1.01915, 0.8111,
  55872. 0.942, 0.8111, 0.90531, 0.856, 0.90531, 0.856, 0.90531, 0.856, 1,
  55873. 0.92241, 0.91755, 0.86667, 0.788, 0.86936, 0.8858, 0.89876, 1, 1,
  55874. 0.81363, 1.19137, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088,
  55875. 0.90088, 0.90088, 0.90088, 0.90088, 0.90388, 1.03901, 0.92138,
  55876. 0.78105, 0.7154, 0.86169, 0.80513, 0.94007, 0.82528, 0.98612, 1.06226,
  55877. 0.91755, 0.8126, 0.81884, 0.92819, 0.73764, 0.90531, 0.90284, 0.8858,
  55878. 0.86023, 0.8126, 0.91172, 0.96518, 0.91115, 0.83089, 0.8858, 0.87791,
  55879. 0.79761, 0.89297, 0.81363, 0.88157, 0.89992, 0.85608, 0.81992,
  55880. 0.94307, 0.86023, 0.88157, 0.95308, 0.98699, 0.99793, 1.06226,
  55881. 0.95817, 0.95308, 0.97358, 0.928, 0.98088, 0.98699, 0.92761, 0.99793,
  55882. 0.96017, 1.06226, 0.986, 0.944, 0.95978, 0.938, 0.96705, 0.98714,
  55883. 0.80442, 0.98972, 1, 0.89762, 1.04552, 0.95817, 0.99007, 0.87064,
  55884. 0.91879, 0.88888, 1.06226, 0.95817, 0.98714, 0.95817, 0.88888, 1, 1,
  55885. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55886. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55887. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55888. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55889. 1, 1, 1, 1, 1, 1, 0.89633, 1.01915, 0.89633, 1.01915, 0.89633,
  55890. 1.01915, 0.8111, 0.942, 0.9219, 1, 0.89903, 1, 1, 1, 0.93173, 0.93173,
  55891. 0.93173, 1, 1.06304, 1.06304, 1.06904, 0.89903, 0.89903, 0.80549, 1,
  55892. 1.156, 1, 1, 0.76575, 0.76575, 1, 1, 0.72458, 1, 1, 1, 1, 0.92241, 1,
  55893. 1, 1, 0.619, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.07257, 1,
  55894. 0.74705, 0.71119, 1.02058, 1.024, 1.02119, 1, 1, 1.1536, 1.08595,
  55895. 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55896. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55897. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55898. 1, 1, 1.05638, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55899. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55900. ];
  55901. exports.MyriadProRegularFactors = MyriadProRegularFactors;
  55902. const MyriadProRegularMetrics = {
  55903. lineHeight: 1.2,
  55904. lineGap: 0.2,
  55905. };
  55906. exports.MyriadProRegularMetrics = MyriadProRegularMetrics;
  55907. /***/
  55908. },
  55909. /* 56 */
  55910. /***/ (__unused_webpack_module, exports) => {
  55911. Object.defineProperty(exports, "__esModule", {
  55912. value: true,
  55913. });
  55914. exports.SegoeuiRegularMetrics =
  55915. exports.SegoeuiRegularFactors =
  55916. exports.SegoeuiItalicMetrics =
  55917. exports.SegoeuiItalicFactors =
  55918. exports.SegoeuiBoldMetrics =
  55919. exports.SegoeuiBoldItalicMetrics =
  55920. exports.SegoeuiBoldItalicFactors =
  55921. exports.SegoeuiBoldFactors =
  55922. void 0;
  55923. const SegoeuiBoldFactors = [
  55924. 1.76738, 1, 1, 0.99297, 0.9824, 1.04016, 1.06497, 1.03424, 0.97529,
  55925. 1.17647, 1.23203, 1.1085, 1.1085, 1.16939, 1.2107, 0.9754, 1.21408,
  55926. 0.9754, 1.59578, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424,
  55927. 1.03424, 1.03424, 1.03424, 1.03424, 0.81378, 0.81378, 1.2107, 1.2107,
  55928. 1.2107, 0.71703, 0.97847, 0.97363, 0.88776, 0.8641, 1.02096, 0.79795,
  55929. 0.85132, 0.914, 1.06085, 1.1406, 0.8007, 0.89858, 0.83693, 1.14889,
  55930. 1.09398, 0.97489, 0.92094, 0.97489, 0.90399, 0.84041, 0.95923,
  55931. 1.00135, 1, 1.06467, 0.98243, 0.90996, 0.99361, 1.1085, 1.56942,
  55932. 1.1085, 1.2107, 0.74627, 0.94282, 0.96752, 1.01519, 0.86304, 1.01359,
  55933. 0.97278, 1.15103, 1.01359, 0.98561, 1.02285, 1.02285, 1.00527,
  55934. 1.02285, 1.0302, 0.99041, 1.0008, 1.01519, 1.01359, 1.02258, 0.79104,
  55935. 1.16862, 0.99041, 0.97454, 1.02511, 0.99298, 0.96752, 0.95801,
  55936. 0.94856, 1.16579, 0.94856, 1.2107, 0.9824, 1.03424, 1.03424, 1,
  55937. 1.03424, 1.16579, 0.8727, 1.3871, 1.18622, 1.10818, 1.04478, 1.2107,
  55938. 1.18622, 0.75155, 0.94994, 1.28826, 1.21408, 1.21408, 0.91056, 1,
  55939. 0.91572, 0.9754, 0.64663, 1.18328, 1.24866, 1.04478, 1.14169, 1.15749,
  55940. 1.17389, 0.71703, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363,
  55941. 0.97363, 0.93506, 0.8641, 0.79795, 0.79795, 0.79795, 0.79795, 1.1406,
  55942. 1.1406, 1.1406, 1.1406, 1.02096, 1.09398, 0.97426, 0.97426, 0.97426,
  55943. 0.97426, 0.97426, 1.2107, 0.97489, 1.00135, 1.00135, 1.00135, 1.00135,
  55944. 0.90996, 0.92094, 1.02798, 0.96752, 0.96752, 0.96752, 0.96752,
  55945. 0.96752, 0.96752, 0.93136, 0.86304, 0.97278, 0.97278, 0.97278,
  55946. 0.97278, 1.02285, 1.02285, 1.02285, 1.02285, 0.97122, 0.99041, 1, 1,
  55947. 1, 1, 1, 1.28826, 1.0008, 0.99041, 0.99041, 0.99041, 0.99041, 0.96752,
  55948. 1.01519, 0.96752, 0.97363, 0.96752, 0.97363, 0.96752, 0.97363,
  55949. 0.96752, 0.8641, 0.86304, 0.8641, 0.86304, 0.8641, 0.86304, 0.8641,
  55950. 0.86304, 1.02096, 1.03057, 1.02096, 1.03517, 0.79795, 0.97278,
  55951. 0.79795, 0.97278, 0.79795, 0.97278, 0.79795, 0.97278, 0.79795,
  55952. 0.97278, 0.914, 1.01359, 0.914, 1.01359, 0.914, 1.01359, 1, 1,
  55953. 1.06085, 0.98561, 1.06085, 1.00879, 1.1406, 1.02285, 1.1406, 1.02285,
  55954. 1.1406, 1.02285, 1.1406, 1.02285, 1.1406, 1.02285, 0.97138, 1.08692,
  55955. 0.8007, 1.02285, 1, 1, 1.00527, 0.83693, 1.02285, 1, 1, 0.83693,
  55956. 0.9455, 0.83693, 0.90418, 0.83693, 1.13005, 1.09398, 0.99041, 1, 1,
  55957. 1.09398, 0.99041, 0.96692, 1.09251, 0.99041, 0.97489, 1.0008, 0.97489,
  55958. 1.0008, 0.97489, 1.0008, 0.93994, 0.97931, 0.90399, 1.02258, 1, 1,
  55959. 0.90399, 1.02258, 0.84041, 0.79104, 0.84041, 0.79104, 0.84041,
  55960. 0.79104, 0.84041, 0.79104, 1, 1, 0.95923, 1.07034, 0.95923, 1.16862,
  55961. 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135,
  55962. 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.06467, 1.02511,
  55963. 0.90996, 0.96752, 0.90996, 0.99361, 0.95801, 0.99361, 0.95801,
  55964. 0.99361, 0.95801, 1.07733, 1.03424, 0.97363, 0.96752, 0.93506,
  55965. 0.93136, 0.97489, 1.0008, 1, 1, 0.95923, 1.16862, 1.15103, 1.15103,
  55966. 1.01173, 1.03959, 0.75953, 0.81378, 0.79912, 1.15103, 1.21994,
  55967. 0.95161, 0.87815, 1.01149, 0.81525, 0.7676, 0.98167, 1.01134, 1.02546,
  55968. 0.84097, 1.03089, 1.18102, 0.97363, 0.88776, 0.85134, 0.97826,
  55969. 0.79795, 0.99361, 1.06085, 0.97489, 1.1406, 0.89858, 1.0388, 1.14889,
  55970. 1.09398, 0.86039, 0.97489, 1.0595, 0.92094, 0.94793, 0.95923, 0.90996,
  55971. 0.99346, 0.98243, 1.02112, 0.95493, 1.1406, 0.90996, 1.03574, 1.02597,
  55972. 1.0008, 1.18102, 1.06628, 1.03574, 1.0192, 1.01932, 1.00886, 0.97531,
  55973. 1.0106, 1.0008, 1.13189, 1.18102, 1.02277, 0.98683, 1.0016, 0.99561,
  55974. 1.07237, 1.0008, 0.90434, 0.99921, 0.93803, 0.8965, 1.23085, 1.06628,
  55975. 1.04983, 0.96268, 1.0499, 0.98439, 1.18102, 1.06628, 1.0008, 1.06628,
  55976. 0.98439, 0.79795, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.09466, 1, 1,
  55977. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55978. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55979. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.97278, 1, 1,
  55980. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.02065, 1, 1, 1, 1, 1, 1, 1.06467,
  55981. 1.02511, 1.06467, 1.02511, 1.06467, 1.02511, 0.90996, 0.96752, 1,
  55982. 1.21408, 0.89903, 1, 1, 0.75155, 1.04394, 1.04394, 1.04394, 1.04394,
  55983. 0.98633, 0.98633, 0.98633, 0.73047, 0.73047, 1.20642, 0.91211,
  55984. 1.25635, 1.222, 1.02956, 1.03372, 1.03372, 0.96039, 1.24633, 1,
  55985. 1.12454, 0.93503, 1.03424, 1.19687, 1.03424, 1, 1, 1, 0.771, 1, 1,
  55986. 1.15749, 1.15749, 1.15749, 1.10948, 0.86279, 0.94434, 0.86279,
  55987. 0.94434, 0.86182, 1, 1, 1.16897, 1, 0.96085, 0.90137, 1.2107, 1.18416,
  55988. 1.13973, 0.69825, 0.9716, 2.10339, 1.29004, 1.29004, 1.21172, 1.29004,
  55989. 1.29004, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55990. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55991. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025,
  55992. 0.87025, 0.87025, 0.87025, 1.18874, 1.42603, 1, 1.42603, 1.42603,
  55993. 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1,
  55994. 1.09193, 1.09193, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  55995. 1,
  55996. ];
  55997. exports.SegoeuiBoldFactors = SegoeuiBoldFactors;
  55998. const SegoeuiBoldMetrics = {
  55999. lineHeight: 1.33008,
  56000. lineGap: 0,
  56001. };
  56002. exports.SegoeuiBoldMetrics = SegoeuiBoldMetrics;
  56003. const SegoeuiBoldItalicFactors = [
  56004. 1.76738, 1, 1, 0.98946, 1.03959, 1.04016, 1.02809, 1.036, 0.97639,
  56005. 1.10953, 1.23203, 1.11144, 1.11144, 1.16939, 1.21237, 0.9754, 1.21261,
  56006. 0.9754, 1.59754, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036,
  56007. 1.036, 1.036, 1.036, 0.81378, 0.81378, 1.21237, 1.21237, 1.21237,
  56008. 0.73541, 0.97847, 0.97363, 0.89723, 0.87897, 1.0426, 0.79429, 0.85292,
  56009. 0.91149, 1.05815, 1.1406, 0.79631, 0.90128, 0.83853, 1.04396, 1.10615,
  56010. 0.97552, 0.94436, 0.97552, 0.88641, 0.80527, 0.96083, 1.00135, 1,
  56011. 1.06777, 0.9817, 0.91142, 0.99361, 1.11144, 1.57293, 1.11144, 1.21237,
  56012. 0.74627, 1.31818, 1.06585, 0.97042, 0.83055, 0.97042, 0.93503, 1.1261,
  56013. 0.97042, 0.97922, 1.14236, 0.94552, 1.01054, 1.14236, 1.02471,
  56014. 0.97922, 0.94165, 0.97042, 0.97042, 1.0276, 0.78929, 1.1261, 0.97922,
  56015. 0.95874, 1.02197, 0.98507, 0.96752, 0.97168, 0.95107, 1.16579,
  56016. 0.95107, 1.21237, 1.03959, 1.036, 1.036, 1, 1.036, 1.16579, 0.87357,
  56017. 1.31818, 1.18754, 1.26781, 1.05356, 1.21237, 1.18622, 0.79487,
  56018. 0.94994, 1.29004, 1.24047, 1.24047, 1.31818, 1, 0.91484, 0.9754,
  56019. 1.31818, 1.1349, 1.24866, 1.05356, 1.13934, 1.15574, 1.17389, 0.73541,
  56020. 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.94385,
  56021. 0.87897, 0.79429, 0.79429, 0.79429, 0.79429, 1.1406, 1.1406, 1.1406,
  56022. 1.1406, 1.0426, 1.10615, 0.97552, 0.97552, 0.97552, 0.97552, 0.97552,
  56023. 1.21237, 0.97552, 1.00135, 1.00135, 1.00135, 1.00135, 0.91142,
  56024. 0.94436, 0.98721, 1.06585, 1.06585, 1.06585, 1.06585, 1.06585,
  56025. 1.06585, 0.96705, 0.83055, 0.93503, 0.93503, 0.93503, 0.93503,
  56026. 1.14236, 1.14236, 1.14236, 1.14236, 0.93125, 0.97922, 0.94165,
  56027. 0.94165, 0.94165, 0.94165, 0.94165, 1.29004, 0.94165, 0.97922,
  56028. 0.97922, 0.97922, 0.97922, 0.96752, 0.97042, 0.96752, 0.97363,
  56029. 1.06585, 0.97363, 1.06585, 0.97363, 1.06585, 0.87897, 0.83055,
  56030. 0.87897, 0.83055, 0.87897, 0.83055, 0.87897, 0.83055, 1.0426, 1.0033,
  56031. 1.0426, 0.97042, 0.79429, 0.93503, 0.79429, 0.93503, 0.79429, 0.93503,
  56032. 0.79429, 0.93503, 0.79429, 0.93503, 0.91149, 0.97042, 0.91149,
  56033. 0.97042, 0.91149, 0.97042, 1, 1, 1.05815, 0.97922, 1.05815, 0.97922,
  56034. 1.1406, 1.14236, 1.1406, 1.14236, 1.1406, 1.14236, 1.1406, 1.14236,
  56035. 1.1406, 1.14236, 0.97441, 1.04302, 0.79631, 1.01582, 1, 1, 1.01054,
  56036. 0.83853, 1.14236, 1, 1, 0.83853, 1.09125, 0.83853, 0.90418, 0.83853,
  56037. 1.19508, 1.10615, 0.97922, 1, 1, 1.10615, 0.97922, 1.01034, 1.10466,
  56038. 0.97922, 0.97552, 0.94165, 0.97552, 0.94165, 0.97552, 0.94165,
  56039. 0.91602, 0.91981, 0.88641, 1.0276, 1, 1, 0.88641, 1.0276, 0.80527,
  56040. 0.78929, 0.80527, 0.78929, 0.80527, 0.78929, 0.80527, 0.78929, 1, 1,
  56041. 0.96083, 1.05403, 0.95923, 1.16862, 1.00135, 0.97922, 1.00135,
  56042. 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922,
  56043. 1.00135, 0.97922, 1.06777, 1.02197, 0.91142, 0.96752, 0.91142,
  56044. 0.99361, 0.97168, 0.99361, 0.97168, 0.99361, 0.97168, 1.23199, 1.036,
  56045. 0.97363, 1.06585, 0.94385, 0.96705, 0.97552, 0.94165, 1, 1, 0.96083,
  56046. 1.1261, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818,
  56047. 1.31818, 1.31818, 0.95161, 1.27126, 1.00811, 0.83284, 0.77702,
  56048. 0.99137, 0.95253, 1.0347, 0.86142, 1.07205, 1.14236, 0.97363, 0.89723,
  56049. 0.86869, 1.09818, 0.79429, 0.99361, 1.05815, 0.97552, 1.1406, 0.90128,
  56050. 1.06662, 1.04396, 1.10615, 0.84918, 0.97552, 1.04694, 0.94436,
  56051. 0.98015, 0.96083, 0.91142, 1.00356, 0.9817, 1.01945, 0.98999, 1.1406,
  56052. 0.91142, 1.04961, 0.9898, 1.00639, 1.14236, 1.07514, 1.04961, 0.99607,
  56053. 1.02897, 1.008, 0.9898, 0.95134, 1.00639, 1.11121, 1.14236, 1.00518,
  56054. 0.97981, 1.02186, 1, 1.08578, 0.94165, 0.99314, 0.98387, 0.93028,
  56055. 0.93377, 1.35125, 1.07514, 1.10687, 0.93491, 1.04232, 1.00351,
  56056. 1.14236, 1.07514, 0.94165, 1.07514, 1.00351, 0.79429, 1, 1, 1, 1, 1,
  56057. 1, 1, 1, 1, 1, 1, 1, 1.09097, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  56058. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  56059. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  56060. 1, 1, 1, 1, 1, 1, 1, 0.93503, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  56061. 0.96609, 1, 1, 1, 1, 1, 1, 1.06777, 1.02197, 1.06777, 1.02197,
  56062. 1.06777, 1.02197, 0.91142, 0.96752, 1, 1.21261, 0.89903, 1, 1,
  56063. 0.75155, 1.04745, 1.04745, 1.04745, 1.04394, 0.98633, 0.98633,
  56064. 0.98633, 0.72959, 0.72959, 1.20502, 0.91406, 1.26514, 1.222, 1.02956,
  56065. 1.03372, 1.03372, 0.96039, 1.24633, 1, 1.09125, 0.93327, 1.03336,
  56066. 1.16541, 1.036, 1, 1, 1, 0.771, 1, 1, 1.15574, 1.15574, 1.15574,
  56067. 1.15574, 0.86364, 0.94434, 0.86279, 0.94434, 0.86224, 1, 1, 1.16798,
  56068. 1, 0.96085, 0.90068, 1.21237, 1.18416, 1.13904, 0.69825, 0.9716,
  56069. 2.10339, 1.29004, 1.29004, 1.21339, 1.29004, 1.29004, 1, 1, 1, 1, 1,
  56070. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  56071. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  56072. 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025,
  56073. 0.87025, 1.18775, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1,
  56074. 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.13269, 1.13269, 1, 1,
  56075. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  56076. ];
  56077. exports.SegoeuiBoldItalicFactors = SegoeuiBoldItalicFactors;
  56078. const SegoeuiBoldItalicMetrics = {
  56079. lineHeight: 1.33008,
  56080. lineGap: 0,
  56081. };
  56082. exports.SegoeuiBoldItalicMetrics = SegoeuiBoldItalicMetrics;
  56083. const SegoeuiItalicFactors = [
  56084. 1.76738, 1, 1, 0.98946, 1.14763, 1.05365, 1.06234, 0.96927, 0.92586,
  56085. 1.15373, 1.18414, 0.91349, 0.91349, 1.07403, 1.17308, 0.78383,
  56086. 1.20088, 0.78383, 1.42531, 0.96927, 0.96927, 0.96927, 0.96927,
  56087. 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.78383,
  56088. 0.78383, 1.17308, 1.17308, 1.17308, 0.77349, 0.94565, 0.94729,
  56089. 0.85944, 0.88506, 0.9858, 0.74817, 0.80016, 0.88449, 0.98039, 0.95782,
  56090. 0.69238, 0.89898, 0.83231, 0.98183, 1.03989, 0.96924, 0.86237,
  56091. 0.96924, 0.80595, 0.74524, 0.86091, 0.95402, 0.94143, 0.98448, 0.8858,
  56092. 0.83089, 0.93285, 1.0949, 1.39016, 1.0949, 1.45994, 0.74627, 1.04839,
  56093. 0.97454, 0.97454, 0.87207, 0.97454, 0.87533, 1.06151, 0.97454,
  56094. 1.00176, 1.16484, 1.08132, 0.98047, 1.16484, 1.02989, 1.01054,
  56095. 0.96225, 0.97454, 0.97454, 1.06598, 0.79004, 1.16344, 1.00351,
  56096. 0.94629, 0.9973, 0.91016, 0.96777, 0.9043, 0.91082, 0.92481, 0.91082,
  56097. 1.17308, 0.95748, 0.96927, 0.96927, 1, 0.96927, 0.92481, 0.80597,
  56098. 1.04839, 1.23393, 1.1781, 0.9245, 1.17308, 1.20808, 0.63218, 0.94261,
  56099. 1.24822, 1.09971, 1.09971, 1.04839, 1, 0.85273, 0.78032, 1.04839,
  56100. 1.09971, 1.22326, 0.9245, 1.09836, 1.13525, 1.15222, 0.70424, 0.94729,
  56101. 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.85498, 0.88506,
  56102. 0.74817, 0.74817, 0.74817, 0.74817, 0.95782, 0.95782, 0.95782,
  56103. 0.95782, 0.9858, 1.03989, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924,
  56104. 1.17308, 0.96924, 0.95402, 0.95402, 0.95402, 0.95402, 0.83089,
  56105. 0.86237, 0.88409, 0.97454, 0.97454, 0.97454, 0.97454, 0.97454,
  56106. 0.97454, 0.92916, 0.87207, 0.87533, 0.87533, 0.87533, 0.87533,
  56107. 0.93146, 0.93146, 0.93146, 0.93146, 0.93854, 1.01054, 0.96225,
  56108. 0.96225, 0.96225, 0.96225, 0.96225, 1.24822, 0.8761, 1.00351, 1.00351,
  56109. 1.00351, 1.00351, 0.96777, 0.97454, 0.96777, 0.94729, 0.97454,
  56110. 0.94729, 0.97454, 0.94729, 0.97454, 0.88506, 0.87207, 0.88506,
  56111. 0.87207, 0.88506, 0.87207, 0.88506, 0.87207, 0.9858, 0.95391, 0.9858,
  56112. 0.97454, 0.74817, 0.87533, 0.74817, 0.87533, 0.74817, 0.87533,
  56113. 0.74817, 0.87533, 0.74817, 0.87533, 0.88449, 0.97454, 0.88449,
  56114. 0.97454, 0.88449, 0.97454, 1, 1, 0.98039, 1.00176, 0.98039, 1.00176,
  56115. 0.95782, 0.93146, 0.95782, 0.93146, 0.95782, 0.93146, 0.95782,
  56116. 1.16484, 0.95782, 0.93146, 0.84421, 1.12761, 0.69238, 1.08132, 1, 1,
  56117. 0.98047, 0.83231, 1.16484, 1, 1, 0.84723, 1.04861, 0.84723, 0.78755,
  56118. 0.83231, 1.23736, 1.03989, 1.01054, 1, 1, 1.03989, 1.01054, 0.9857,
  56119. 1.03849, 1.01054, 0.96924, 0.96225, 0.96924, 0.96225, 0.96924,
  56120. 0.96225, 0.92383, 0.90171, 0.80595, 1.06598, 1, 1, 0.80595, 1.06598,
  56121. 0.74524, 0.79004, 0.74524, 0.79004, 0.74524, 0.79004, 0.74524,
  56122. 0.79004, 1, 1, 0.86091, 1.02759, 0.85771, 1.16344, 0.95402, 1.00351,
  56123. 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402,
  56124. 1.00351, 0.95402, 1.00351, 0.98448, 0.9973, 0.83089, 0.96777, 0.83089,
  56125. 0.93285, 0.9043, 0.93285, 0.9043, 0.93285, 0.9043, 1.31868, 0.96927,
  56126. 0.94729, 0.97454, 0.85498, 0.92916, 0.96924, 0.8761, 1, 1, 0.86091,
  56127. 1.16344, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839,
  56128. 1.04839, 1.04839, 1.04839, 0.81965, 0.81965, 0.94729, 0.78032,
  56129. 0.71022, 0.90883, 0.84171, 0.99877, 0.77596, 1.05734, 1.2, 0.94729,
  56130. 0.85944, 0.82791, 0.9607, 0.74817, 0.93285, 0.98039, 0.96924, 0.95782,
  56131. 0.89898, 0.98316, 0.98183, 1.03989, 0.78614, 0.96924, 0.97642,
  56132. 0.86237, 0.86075, 0.86091, 0.83089, 0.90082, 0.8858, 0.97296, 1.01284,
  56133. 0.95782, 0.83089, 1.0976, 1.04, 1.03342, 1.2, 1.0675, 1.0976, 0.98205,
  56134. 1.03809, 1.05097, 1.04, 0.95364, 1.03342, 1.05401, 1.2, 1.02148,
  56135. 1.0119, 1.04724, 1.0127, 1.02732, 0.96225, 0.8965, 0.97783, 0.93574,
  56136. 0.94818, 1.30679, 1.0675, 1.11826, 0.99821, 1.0557, 1.0326, 1.2,
  56137. 1.0675, 0.96225, 1.0675, 1.0326, 0.74817, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  56138. 1, 1, 1, 1.03754, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  56139. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  56140. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  56141. 1, 1, 1, 0.87533, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.98705, 1, 1,
  56142. 1, 1, 1, 1, 0.98448, 0.9973, 0.98448, 0.9973, 0.98448, 0.9973,
  56143. 0.83089, 0.96777, 1, 1.20088, 0.89903, 1, 1, 0.75155, 0.94945,
  56144. 0.94945, 0.94945, 0.94945, 1.12317, 1.12317, 1.12317, 0.67603,
  56145. 0.67603, 1.15621, 0.73584, 1.21191, 1.22135, 1.06483, 0.94868,
  56146. 0.94868, 0.95996, 1.24633, 1, 1.07497, 0.87709, 0.96927, 1.01473,
  56147. 0.96927, 1, 1, 1, 0.77295, 1, 1, 1.09836, 1.09836, 1.09836, 1.01522,
  56148. 0.86321, 0.94434, 0.8649, 0.94434, 0.86182, 1, 1, 1.083, 1, 0.91578,
  56149. 0.86438, 1.17308, 1.18416, 1.14589, 0.69825, 0.97622, 1.96791,
  56150. 1.24822, 1.24822, 1.17308, 1.24822, 1.24822, 1, 1, 1, 1, 1, 1, 1, 1,
  56151. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  56152. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  56153. 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025,
  56154. 1.17984, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886,
  56155. 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.10742, 1.10742, 1, 1, 1, 1, 1,
  56156. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  56157. ];
  56158. exports.SegoeuiItalicFactors = SegoeuiItalicFactors;
  56159. const SegoeuiItalicMetrics = {
  56160. lineHeight: 1.33008,
  56161. lineGap: 0,
  56162. };
  56163. exports.SegoeuiItalicMetrics = SegoeuiItalicMetrics;
  56164. const SegoeuiRegularFactors = [
  56165. 1.76738, 1, 1, 0.98594, 1.02285, 1.10454, 1.06234, 0.96927, 0.92037,
  56166. 1.19985, 1.2046, 0.90616, 0.90616, 1.07152, 1.1714, 0.78032, 1.20088,
  56167. 0.78032, 1.40246, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927,
  56168. 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.78032, 0.78032, 1.1714,
  56169. 1.1714, 1.1714, 0.80597, 0.94084, 0.96706, 0.85944, 0.85734, 0.97093,
  56170. 0.75842, 0.79936, 0.88198, 0.9831, 0.95782, 0.71387, 0.86969, 0.84636,
  56171. 1.07796, 1.03584, 0.96924, 0.83968, 0.96924, 0.82826, 0.79649,
  56172. 0.85771, 0.95132, 0.93119, 0.98965, 0.88433, 0.8287, 0.93365, 1.08612,
  56173. 1.3638, 1.08612, 1.45786, 0.74627, 0.80499, 0.91484, 1.05707, 0.92383,
  56174. 1.05882, 0.9403, 1.12654, 1.05882, 1.01756, 1.09011, 1.09011, 0.99414,
  56175. 1.09011, 1.034, 1.01756, 1.05356, 1.05707, 1.05882, 1.04399, 0.84863,
  56176. 1.21968, 1.01756, 0.95801, 1.00068, 0.91797, 0.96777, 0.9043, 0.90351,
  56177. 0.92105, 0.90351, 1.1714, 0.85337, 0.96927, 0.96927, 0.99912, 0.96927,
  56178. 0.92105, 0.80597, 1.2434, 1.20808, 1.05937, 0.90957, 1.1714, 1.20808,
  56179. 0.75155, 0.94261, 1.24644, 1.09971, 1.09971, 0.84751, 1, 0.85273,
  56180. 0.78032, 0.61584, 1.05425, 1.17914, 0.90957, 1.08665, 1.11593,
  56181. 1.14169, 0.73381, 0.96706, 0.96706, 0.96706, 0.96706, 0.96706,
  56182. 0.96706, 0.86035, 0.85734, 0.75842, 0.75842, 0.75842, 0.75842,
  56183. 0.95782, 0.95782, 0.95782, 0.95782, 0.97093, 1.03584, 0.96924,
  56184. 0.96924, 0.96924, 0.96924, 0.96924, 1.1714, 0.96924, 0.95132, 0.95132,
  56185. 0.95132, 0.95132, 0.8287, 0.83968, 0.89049, 0.91484, 0.91484, 0.91484,
  56186. 0.91484, 0.91484, 0.91484, 0.93575, 0.92383, 0.9403, 0.9403, 0.9403,
  56187. 0.9403, 0.8717, 0.8717, 0.8717, 0.8717, 1.00527, 1.01756, 1.05356,
  56188. 1.05356, 1.05356, 1.05356, 1.05356, 1.24644, 0.95923, 1.01756,
  56189. 1.01756, 1.01756, 1.01756, 0.96777, 1.05707, 0.96777, 0.96706,
  56190. 0.91484, 0.96706, 0.91484, 0.96706, 0.91484, 0.85734, 0.92383,
  56191. 0.85734, 0.92383, 0.85734, 0.92383, 0.85734, 0.92383, 0.97093, 1.0969,
  56192. 0.97093, 1.05882, 0.75842, 0.9403, 0.75842, 0.9403, 0.75842, 0.9403,
  56193. 0.75842, 0.9403, 0.75842, 0.9403, 0.88198, 1.05882, 0.88198, 1.05882,
  56194. 0.88198, 1.05882, 1, 1, 0.9831, 1.01756, 0.9831, 1.01756, 0.95782,
  56195. 0.8717, 0.95782, 0.8717, 0.95782, 0.8717, 0.95782, 1.09011, 0.95782,
  56196. 0.8717, 0.84784, 1.11551, 0.71387, 1.09011, 1, 1, 0.99414, 0.84636,
  56197. 1.09011, 1, 1, 0.84636, 1.0536, 0.84636, 0.94298, 0.84636, 1.23297,
  56198. 1.03584, 1.01756, 1, 1, 1.03584, 1.01756, 1.00323, 1.03444, 1.01756,
  56199. 0.96924, 1.05356, 0.96924, 1.05356, 0.96924, 1.05356, 0.93066,
  56200. 0.98293, 0.82826, 1.04399, 1, 1, 0.82826, 1.04399, 0.79649, 0.84863,
  56201. 0.79649, 0.84863, 0.79649, 0.84863, 0.79649, 0.84863, 1, 1, 0.85771,
  56202. 1.17318, 0.85771, 1.21968, 0.95132, 1.01756, 0.95132, 1.01756,
  56203. 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132,
  56204. 1.01756, 0.98965, 1.00068, 0.8287, 0.96777, 0.8287, 0.93365, 0.9043,
  56205. 0.93365, 0.9043, 0.93365, 0.9043, 1.08571, 0.96927, 0.96706, 0.91484,
  56206. 0.86035, 0.93575, 0.96924, 0.95923, 1, 1, 0.85771, 1.21968, 1.11437,
  56207. 1.11437, 0.93109, 0.91202, 0.60411, 0.84164, 0.55572, 1.01173,
  56208. 0.97361, 0.81818, 0.81818, 0.96635, 0.78032, 0.72727, 0.92366,
  56209. 0.98601, 1.03405, 0.77968, 1.09799, 1.2, 0.96706, 0.85944, 0.85638,
  56210. 0.96491, 0.75842, 0.93365, 0.9831, 0.96924, 0.95782, 0.86969, 0.94152,
  56211. 1.07796, 1.03584, 0.78437, 0.96924, 0.98715, 0.83968, 0.83491,
  56212. 0.85771, 0.8287, 0.94492, 0.88433, 0.9287, 1.0098, 0.95782, 0.8287,
  56213. 1.0625, 0.98248, 1.03424, 1.2, 1.01071, 1.0625, 0.95246, 1.03809,
  56214. 1.04912, 0.98248, 1.00221, 1.03424, 1.05443, 1.2, 1.04785, 0.99609,
  56215. 1.00169, 1.05176, 0.99346, 1.05356, 0.9087, 1.03004, 0.95542, 0.93117,
  56216. 1.23362, 1.01071, 1.07831, 1.02512, 1.05205, 1.03502, 1.2, 1.01071,
  56217. 1.05356, 1.01071, 1.03502, 0.75842, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  56218. 1, 1.03719, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  56219. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  56220. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  56221. 1, 0.9403, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.04021, 1, 1, 1, 1, 1,
  56222. 1, 0.98965, 1.00068, 0.98965, 1.00068, 0.98965, 1.00068, 0.8287,
  56223. 0.96777, 1, 1.20088, 0.89903, 1, 1, 0.75155, 1.03077, 1.03077,
  56224. 1.03077, 1.03077, 1.13196, 1.13196, 1.13196, 0.67428, 0.67428,
  56225. 1.16039, 0.73291, 1.20996, 1.22135, 1.06483, 0.94868, 0.94868,
  56226. 0.95996, 1.24633, 1, 1.07497, 0.87796, 0.96927, 1.01518, 0.96927, 1,
  56227. 1, 1, 0.77295, 1, 1, 1.10539, 1.10539, 1.11358, 1.06967, 0.86279,
  56228. 0.94434, 0.86279, 0.94434, 0.86182, 1, 1, 1.083, 1, 0.91578, 0.86507,
  56229. 1.1714, 1.18416, 1.14589, 0.69825, 0.97622, 1.9697, 1.24822, 1.24822,
  56230. 1.17238, 1.24822, 1.24822, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  56231. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  56232. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862,
  56233. 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.18083, 1.42603, 1,
  56234. 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296,
  56235. 1.34163, 1, 1, 1, 1.10938, 1.10938, 1, 1, 1, 1.05425, 1.09971,
  56236. 1.09971, 1.09971, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  56237. ];
  56238. exports.SegoeuiRegularFactors = SegoeuiRegularFactors;
  56239. const SegoeuiRegularMetrics = {
  56240. lineHeight: 1.33008,
  56241. lineGap: 0,
  56242. };
  56243. exports.SegoeuiRegularMetrics = SegoeuiRegularMetrics;
  56244. /***/
  56245. },
  56246. /* 57 */
  56247. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56248. Object.defineProperty(exports, "__esModule", {
  56249. value: true,
  56250. });
  56251. exports.PostScriptEvaluator =
  56252. exports.PostScriptCompiler =
  56253. exports.PDFFunctionFactory =
  56254. void 0;
  56255. exports.isPDFFunction = isPDFFunction;
  56256. var _primitives = __w_pdfjs_require__(5);
  56257. var _util = __w_pdfjs_require__(2);
  56258. var _ps_parser = __w_pdfjs_require__(58);
  56259. var _base_stream = __w_pdfjs_require__(7);
  56260. var _image_utils = __w_pdfjs_require__(59);
  56261. class PDFFunctionFactory {
  56262. constructor({ xref, isEvalSupported = true }) {
  56263. this.xref = xref;
  56264. this.isEvalSupported = isEvalSupported !== false;
  56265. }
  56266. create(fn) {
  56267. const cachedFunction = this.getCached(fn);
  56268. if (cachedFunction) {
  56269. return cachedFunction;
  56270. }
  56271. const parsedFunction = PDFFunction.parse({
  56272. xref: this.xref,
  56273. isEvalSupported: this.isEvalSupported,
  56274. fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn,
  56275. });
  56276. this._cache(fn, parsedFunction);
  56277. return parsedFunction;
  56278. }
  56279. createFromArray(fnObj) {
  56280. const cachedFunction = this.getCached(fnObj);
  56281. if (cachedFunction) {
  56282. return cachedFunction;
  56283. }
  56284. const parsedFunction = PDFFunction.parseArray({
  56285. xref: this.xref,
  56286. isEvalSupported: this.isEvalSupported,
  56287. fnObj:
  56288. fnObj instanceof _primitives.Ref
  56289. ? this.xref.fetch(fnObj)
  56290. : fnObj,
  56291. });
  56292. this._cache(fnObj, parsedFunction);
  56293. return parsedFunction;
  56294. }
  56295. getCached(cacheKey) {
  56296. let fnRef;
  56297. if (cacheKey instanceof _primitives.Ref) {
  56298. fnRef = cacheKey;
  56299. } else if (cacheKey instanceof _primitives.Dict) {
  56300. fnRef = cacheKey.objId;
  56301. } else if (cacheKey instanceof _base_stream.BaseStream) {
  56302. fnRef = cacheKey.dict && cacheKey.dict.objId;
  56303. }
  56304. if (fnRef) {
  56305. const localFunction = this._localFunctionCache.getByRef(fnRef);
  56306. if (localFunction) {
  56307. return localFunction;
  56308. }
  56309. }
  56310. return null;
  56311. }
  56312. _cache(cacheKey, parsedFunction) {
  56313. if (!parsedFunction) {
  56314. throw new Error(
  56315. 'PDFFunctionFactory._cache - expected "parsedFunction" argument.'
  56316. );
  56317. }
  56318. let fnRef;
  56319. if (cacheKey instanceof _primitives.Ref) {
  56320. fnRef = cacheKey;
  56321. } else if (cacheKey instanceof _primitives.Dict) {
  56322. fnRef = cacheKey.objId;
  56323. } else if (cacheKey instanceof _base_stream.BaseStream) {
  56324. fnRef = cacheKey.dict && cacheKey.dict.objId;
  56325. }
  56326. if (fnRef) {
  56327. this._localFunctionCache.set(null, fnRef, parsedFunction);
  56328. }
  56329. }
  56330. get _localFunctionCache() {
  56331. return (0, _util.shadow)(
  56332. this,
  56333. "_localFunctionCache",
  56334. new _image_utils.LocalFunctionCache()
  56335. );
  56336. }
  56337. }
  56338. exports.PDFFunctionFactory = PDFFunctionFactory;
  56339. function toNumberArray(arr) {
  56340. if (!Array.isArray(arr)) {
  56341. return null;
  56342. }
  56343. const length = arr.length;
  56344. for (let i = 0; i < length; i++) {
  56345. if (typeof arr[i] !== "number") {
  56346. const result = new Array(length);
  56347. for (let j = 0; j < length; j++) {
  56348. result[j] = +arr[j];
  56349. }
  56350. return result;
  56351. }
  56352. }
  56353. return arr;
  56354. }
  56355. class PDFFunction {
  56356. static getSampleArray(size, outputSize, bps, stream) {
  56357. let i, ii;
  56358. let length = 1;
  56359. for (i = 0, ii = size.length; i < ii; i++) {
  56360. length *= size[i];
  56361. }
  56362. length *= outputSize;
  56363. const array = new Array(length);
  56364. let codeSize = 0;
  56365. let codeBuf = 0;
  56366. const sampleMul = 1.0 / (2.0 ** bps - 1);
  56367. const strBytes = stream.getBytes((length * bps + 7) / 8);
  56368. let strIdx = 0;
  56369. for (i = 0; i < length; i++) {
  56370. while (codeSize < bps) {
  56371. codeBuf <<= 8;
  56372. codeBuf |= strBytes[strIdx++];
  56373. codeSize += 8;
  56374. }
  56375. codeSize -= bps;
  56376. array[i] = (codeBuf >> codeSize) * sampleMul;
  56377. codeBuf &= (1 << codeSize) - 1;
  56378. }
  56379. return array;
  56380. }
  56381. static parse({ xref, isEvalSupported, fn }) {
  56382. const dict = fn.dict || fn;
  56383. const typeNum = dict.get("FunctionType");
  56384. switch (typeNum) {
  56385. case 0:
  56386. return this.constructSampled({
  56387. xref,
  56388. isEvalSupported,
  56389. fn,
  56390. dict,
  56391. });
  56392. case 1:
  56393. break;
  56394. case 2:
  56395. return this.constructInterpolated({
  56396. xref,
  56397. isEvalSupported,
  56398. dict,
  56399. });
  56400. case 3:
  56401. return this.constructStiched({
  56402. xref,
  56403. isEvalSupported,
  56404. dict,
  56405. });
  56406. case 4:
  56407. return this.constructPostScript({
  56408. xref,
  56409. isEvalSupported,
  56410. fn,
  56411. dict,
  56412. });
  56413. }
  56414. throw new _util.FormatError("Unknown type of function");
  56415. }
  56416. static parseArray({ xref, isEvalSupported, fnObj }) {
  56417. if (!Array.isArray(fnObj)) {
  56418. return this.parse({
  56419. xref,
  56420. isEvalSupported,
  56421. fn: fnObj,
  56422. });
  56423. }
  56424. const fnArray = [];
  56425. for (let j = 0, jj = fnObj.length; j < jj; j++) {
  56426. fnArray.push(
  56427. this.parse({
  56428. xref,
  56429. isEvalSupported,
  56430. fn: xref.fetchIfRef(fnObj[j]),
  56431. })
  56432. );
  56433. }
  56434. return function (src, srcOffset, dest, destOffset) {
  56435. for (let i = 0, ii = fnArray.length; i < ii; i++) {
  56436. fnArray[i](src, srcOffset, dest, destOffset + i);
  56437. }
  56438. };
  56439. }
  56440. static constructSampled({ xref, isEvalSupported, fn, dict }) {
  56441. function toMultiArray(arr) {
  56442. const inputLength = arr.length;
  56443. const out = [];
  56444. let index = 0;
  56445. for (let i = 0; i < inputLength; i += 2) {
  56446. out[index++] = [arr[i], arr[i + 1]];
  56447. }
  56448. return out;
  56449. }
  56450. function interpolate(x, xmin, xmax, ymin, ymax) {
  56451. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  56452. }
  56453. let domain = toNumberArray(dict.getArray("Domain"));
  56454. let range = toNumberArray(dict.getArray("Range"));
  56455. if (!domain || !range) {
  56456. throw new _util.FormatError("No domain or range");
  56457. }
  56458. const inputSize = domain.length / 2;
  56459. const outputSize = range.length / 2;
  56460. domain = toMultiArray(domain);
  56461. range = toMultiArray(range);
  56462. const size = toNumberArray(dict.getArray("Size"));
  56463. const bps = dict.get("BitsPerSample");
  56464. const order = dict.get("Order") || 1;
  56465. if (order !== 1) {
  56466. (0, _util.info)(
  56467. "No support for cubic spline interpolation: " + order
  56468. );
  56469. }
  56470. let encode = toNumberArray(dict.getArray("Encode"));
  56471. if (!encode) {
  56472. encode = [];
  56473. for (let i = 0; i < inputSize; ++i) {
  56474. encode.push([0, size[i] - 1]);
  56475. }
  56476. } else {
  56477. encode = toMultiArray(encode);
  56478. }
  56479. let decode = toNumberArray(dict.getArray("Decode"));
  56480. if (!decode) {
  56481. decode = range;
  56482. } else {
  56483. decode = toMultiArray(decode);
  56484. }
  56485. const samples = this.getSampleArray(size, outputSize, bps, fn);
  56486. return function constructSampledFn(
  56487. src,
  56488. srcOffset,
  56489. dest,
  56490. destOffset
  56491. ) {
  56492. const cubeVertices = 1 << inputSize;
  56493. const cubeN = new Float64Array(cubeVertices);
  56494. const cubeVertex = new Uint32Array(cubeVertices);
  56495. let i, j;
  56496. for (j = 0; j < cubeVertices; j++) {
  56497. cubeN[j] = 1;
  56498. }
  56499. let k = outputSize,
  56500. pos = 1;
  56501. for (i = 0; i < inputSize; ++i) {
  56502. const domain_2i = domain[i][0];
  56503. const domain_2i_1 = domain[i][1];
  56504. const xi = Math.min(
  56505. Math.max(src[srcOffset + i], domain_2i),
  56506. domain_2i_1
  56507. );
  56508. let e = interpolate(
  56509. xi,
  56510. domain_2i,
  56511. domain_2i_1,
  56512. encode[i][0],
  56513. encode[i][1]
  56514. );
  56515. const size_i = size[i];
  56516. e = Math.min(Math.max(e, 0), size_i - 1);
  56517. const e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  56518. const n0 = e0 + 1 - e;
  56519. const n1 = e - e0;
  56520. const offset0 = e0 * k;
  56521. const offset1 = offset0 + k;
  56522. for (j = 0; j < cubeVertices; j++) {
  56523. if (j & pos) {
  56524. cubeN[j] *= n1;
  56525. cubeVertex[j] += offset1;
  56526. } else {
  56527. cubeN[j] *= n0;
  56528. cubeVertex[j] += offset0;
  56529. }
  56530. }
  56531. k *= size_i;
  56532. pos <<= 1;
  56533. }
  56534. for (j = 0; j < outputSize; ++j) {
  56535. let rj = 0;
  56536. for (i = 0; i < cubeVertices; i++) {
  56537. rj += samples[cubeVertex[i] + j] * cubeN[i];
  56538. }
  56539. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  56540. dest[destOffset + j] = Math.min(
  56541. Math.max(rj, range[j][0]),
  56542. range[j][1]
  56543. );
  56544. }
  56545. };
  56546. }
  56547. static constructInterpolated({ xref, isEvalSupported, dict }) {
  56548. const c0 = toNumberArray(dict.getArray("C0")) || [0];
  56549. const c1 = toNumberArray(dict.getArray("C1")) || [1];
  56550. const n = dict.get("N");
  56551. const diff = [];
  56552. for (let i = 0, ii = c0.length; i < ii; ++i) {
  56553. diff.push(c1[i] - c0[i]);
  56554. }
  56555. const length = diff.length;
  56556. return function constructInterpolatedFn(
  56557. src,
  56558. srcOffset,
  56559. dest,
  56560. destOffset
  56561. ) {
  56562. const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  56563. for (let j = 0; j < length; ++j) {
  56564. dest[destOffset + j] = c0[j] + x * diff[j];
  56565. }
  56566. };
  56567. }
  56568. static constructStiched({ xref, isEvalSupported, dict }) {
  56569. const domain = toNumberArray(dict.getArray("Domain"));
  56570. if (!domain) {
  56571. throw new _util.FormatError("No domain");
  56572. }
  56573. const inputSize = domain.length / 2;
  56574. if (inputSize !== 1) {
  56575. throw new _util.FormatError("Bad domain for stiched function");
  56576. }
  56577. const fnRefs = dict.get("Functions");
  56578. const fns = [];
  56579. for (let i = 0, ii = fnRefs.length; i < ii; ++i) {
  56580. fns.push(
  56581. this.parse({
  56582. xref,
  56583. isEvalSupported,
  56584. fn: xref.fetchIfRef(fnRefs[i]),
  56585. })
  56586. );
  56587. }
  56588. const bounds = toNumberArray(dict.getArray("Bounds"));
  56589. const encode = toNumberArray(dict.getArray("Encode"));
  56590. const tmpBuf = new Float32Array(1);
  56591. return function constructStichedFn(
  56592. src,
  56593. srcOffset,
  56594. dest,
  56595. destOffset
  56596. ) {
  56597. const clip = function constructStichedFromIRClip(v, min, max) {
  56598. if (v > max) {
  56599. v = max;
  56600. } else if (v < min) {
  56601. v = min;
  56602. }
  56603. return v;
  56604. };
  56605. const v = clip(src[srcOffset], domain[0], domain[1]);
  56606. const length = bounds.length;
  56607. let i;
  56608. for (i = 0; i < length; ++i) {
  56609. if (v < bounds[i]) {
  56610. break;
  56611. }
  56612. }
  56613. let dmin = domain[0];
  56614. if (i > 0) {
  56615. dmin = bounds[i - 1];
  56616. }
  56617. let dmax = domain[1];
  56618. if (i < bounds.length) {
  56619. dmax = bounds[i];
  56620. }
  56621. const rmin = encode[2 * i];
  56622. const rmax = encode[2 * i + 1];
  56623. tmpBuf[0] =
  56624. dmin === dmax
  56625. ? rmin
  56626. : rmin + ((v - dmin) * (rmax - rmin)) / (dmax - dmin);
  56627. fns[i](tmpBuf, 0, dest, destOffset);
  56628. };
  56629. }
  56630. static constructPostScript({ xref, isEvalSupported, fn, dict }) {
  56631. const domain = toNumberArray(dict.getArray("Domain"));
  56632. const range = toNumberArray(dict.getArray("Range"));
  56633. if (!domain) {
  56634. throw new _util.FormatError("No domain.");
  56635. }
  56636. if (!range) {
  56637. throw new _util.FormatError("No range.");
  56638. }
  56639. const lexer = new _ps_parser.PostScriptLexer(fn);
  56640. const parser = new _ps_parser.PostScriptParser(lexer);
  56641. const code = parser.parse();
  56642. if (isEvalSupported && _util.FeatureTest.isEvalSupported) {
  56643. const compiled = new PostScriptCompiler().compile(
  56644. code,
  56645. domain,
  56646. range
  56647. );
  56648. if (compiled) {
  56649. return new Function(
  56650. "src",
  56651. "srcOffset",
  56652. "dest",
  56653. "destOffset",
  56654. compiled
  56655. );
  56656. }
  56657. }
  56658. (0, _util.info)("Unable to compile PS function");
  56659. const numOutputs = range.length >> 1;
  56660. const numInputs = domain.length >> 1;
  56661. const evaluator = new PostScriptEvaluator(code);
  56662. const cache = Object.create(null);
  56663. const MAX_CACHE_SIZE = 2048 * 4;
  56664. let cache_available = MAX_CACHE_SIZE;
  56665. const tmpBuf = new Float32Array(numInputs);
  56666. return function constructPostScriptFn(
  56667. src,
  56668. srcOffset,
  56669. dest,
  56670. destOffset
  56671. ) {
  56672. let i, value;
  56673. let key = "";
  56674. const input = tmpBuf;
  56675. for (i = 0; i < numInputs; i++) {
  56676. value = src[srcOffset + i];
  56677. input[i] = value;
  56678. key += value + "_";
  56679. }
  56680. const cachedValue = cache[key];
  56681. if (cachedValue !== undefined) {
  56682. dest.set(cachedValue, destOffset);
  56683. return;
  56684. }
  56685. const output = new Float32Array(numOutputs);
  56686. const stack = evaluator.execute(input);
  56687. const stackIndex = stack.length - numOutputs;
  56688. for (i = 0; i < numOutputs; i++) {
  56689. value = stack[stackIndex + i];
  56690. let bound = range[i * 2];
  56691. if (value < bound) {
  56692. value = bound;
  56693. } else {
  56694. bound = range[i * 2 + 1];
  56695. if (value > bound) {
  56696. value = bound;
  56697. }
  56698. }
  56699. output[i] = value;
  56700. }
  56701. if (cache_available > 0) {
  56702. cache_available--;
  56703. cache[key] = output;
  56704. }
  56705. dest.set(output, destOffset);
  56706. };
  56707. }
  56708. }
  56709. function isPDFFunction(v) {
  56710. let fnDict;
  56711. if (typeof v !== "object") {
  56712. return false;
  56713. } else if (v instanceof _primitives.Dict) {
  56714. fnDict = v;
  56715. } else if (v instanceof _base_stream.BaseStream) {
  56716. fnDict = v.dict;
  56717. } else {
  56718. return false;
  56719. }
  56720. return fnDict.has("FunctionType");
  56721. }
  56722. class PostScriptStack {
  56723. static get MAX_STACK_SIZE() {
  56724. return (0, _util.shadow)(this, "MAX_STACK_SIZE", 100);
  56725. }
  56726. constructor(initialStack) {
  56727. this.stack = !initialStack
  56728. ? []
  56729. : Array.prototype.slice.call(initialStack, 0);
  56730. }
  56731. push(value) {
  56732. if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) {
  56733. throw new Error("PostScript function stack overflow.");
  56734. }
  56735. this.stack.push(value);
  56736. }
  56737. pop() {
  56738. if (this.stack.length <= 0) {
  56739. throw new Error("PostScript function stack underflow.");
  56740. }
  56741. return this.stack.pop();
  56742. }
  56743. copy(n) {
  56744. if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) {
  56745. throw new Error("PostScript function stack overflow.");
  56746. }
  56747. const stack = this.stack;
  56748. for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  56749. stack.push(stack[i]);
  56750. }
  56751. }
  56752. index(n) {
  56753. this.push(this.stack[this.stack.length - n - 1]);
  56754. }
  56755. roll(n, p) {
  56756. const stack = this.stack;
  56757. const l = stack.length - n;
  56758. const r = stack.length - 1;
  56759. const c = l + (p - Math.floor(p / n) * n);
  56760. for (let i = l, j = r; i < j; i++, j--) {
  56761. const t = stack[i];
  56762. stack[i] = stack[j];
  56763. stack[j] = t;
  56764. }
  56765. for (let i = l, j = c - 1; i < j; i++, j--) {
  56766. const t = stack[i];
  56767. stack[i] = stack[j];
  56768. stack[j] = t;
  56769. }
  56770. for (let i = c, j = r; i < j; i++, j--) {
  56771. const t = stack[i];
  56772. stack[i] = stack[j];
  56773. stack[j] = t;
  56774. }
  56775. }
  56776. }
  56777. class PostScriptEvaluator {
  56778. constructor(operators) {
  56779. this.operators = operators;
  56780. }
  56781. execute(initialStack) {
  56782. const stack = new PostScriptStack(initialStack);
  56783. let counter = 0;
  56784. const operators = this.operators;
  56785. const length = operators.length;
  56786. let operator, a, b;
  56787. while (counter < length) {
  56788. operator = operators[counter++];
  56789. if (typeof operator === "number") {
  56790. stack.push(operator);
  56791. continue;
  56792. }
  56793. switch (operator) {
  56794. case "jz":
  56795. b = stack.pop();
  56796. a = stack.pop();
  56797. if (!a) {
  56798. counter = b;
  56799. }
  56800. break;
  56801. case "j":
  56802. a = stack.pop();
  56803. counter = a;
  56804. break;
  56805. case "abs":
  56806. a = stack.pop();
  56807. stack.push(Math.abs(a));
  56808. break;
  56809. case "add":
  56810. b = stack.pop();
  56811. a = stack.pop();
  56812. stack.push(a + b);
  56813. break;
  56814. case "and":
  56815. b = stack.pop();
  56816. a = stack.pop();
  56817. if (typeof a === "boolean" && typeof b === "boolean") {
  56818. stack.push(a && b);
  56819. } else {
  56820. stack.push(a & b);
  56821. }
  56822. break;
  56823. case "atan":
  56824. a = stack.pop();
  56825. stack.push(Math.atan(a));
  56826. break;
  56827. case "bitshift":
  56828. b = stack.pop();
  56829. a = stack.pop();
  56830. if (a > 0) {
  56831. stack.push(a << b);
  56832. } else {
  56833. stack.push(a >> b);
  56834. }
  56835. break;
  56836. case "ceiling":
  56837. a = stack.pop();
  56838. stack.push(Math.ceil(a));
  56839. break;
  56840. case "copy":
  56841. a = stack.pop();
  56842. stack.copy(a);
  56843. break;
  56844. case "cos":
  56845. a = stack.pop();
  56846. stack.push(Math.cos(a));
  56847. break;
  56848. case "cvi":
  56849. a = stack.pop() | 0;
  56850. stack.push(a);
  56851. break;
  56852. case "cvr":
  56853. break;
  56854. case "div":
  56855. b = stack.pop();
  56856. a = stack.pop();
  56857. stack.push(a / b);
  56858. break;
  56859. case "dup":
  56860. stack.copy(1);
  56861. break;
  56862. case "eq":
  56863. b = stack.pop();
  56864. a = stack.pop();
  56865. stack.push(a === b);
  56866. break;
  56867. case "exch":
  56868. stack.roll(2, 1);
  56869. break;
  56870. case "exp":
  56871. b = stack.pop();
  56872. a = stack.pop();
  56873. stack.push(a ** b);
  56874. break;
  56875. case "false":
  56876. stack.push(false);
  56877. break;
  56878. case "floor":
  56879. a = stack.pop();
  56880. stack.push(Math.floor(a));
  56881. break;
  56882. case "ge":
  56883. b = stack.pop();
  56884. a = stack.pop();
  56885. stack.push(a >= b);
  56886. break;
  56887. case "gt":
  56888. b = stack.pop();
  56889. a = stack.pop();
  56890. stack.push(a > b);
  56891. break;
  56892. case "idiv":
  56893. b = stack.pop();
  56894. a = stack.pop();
  56895. stack.push((a / b) | 0);
  56896. break;
  56897. case "index":
  56898. a = stack.pop();
  56899. stack.index(a);
  56900. break;
  56901. case "le":
  56902. b = stack.pop();
  56903. a = stack.pop();
  56904. stack.push(a <= b);
  56905. break;
  56906. case "ln":
  56907. a = stack.pop();
  56908. stack.push(Math.log(a));
  56909. break;
  56910. case "log":
  56911. a = stack.pop();
  56912. stack.push(Math.log(a) / Math.LN10);
  56913. break;
  56914. case "lt":
  56915. b = stack.pop();
  56916. a = stack.pop();
  56917. stack.push(a < b);
  56918. break;
  56919. case "mod":
  56920. b = stack.pop();
  56921. a = stack.pop();
  56922. stack.push(a % b);
  56923. break;
  56924. case "mul":
  56925. b = stack.pop();
  56926. a = stack.pop();
  56927. stack.push(a * b);
  56928. break;
  56929. case "ne":
  56930. b = stack.pop();
  56931. a = stack.pop();
  56932. stack.push(a !== b);
  56933. break;
  56934. case "neg":
  56935. a = stack.pop();
  56936. stack.push(-a);
  56937. break;
  56938. case "not":
  56939. a = stack.pop();
  56940. if (typeof a === "boolean") {
  56941. stack.push(!a);
  56942. } else {
  56943. stack.push(~a);
  56944. }
  56945. break;
  56946. case "or":
  56947. b = stack.pop();
  56948. a = stack.pop();
  56949. if (typeof a === "boolean" && typeof b === "boolean") {
  56950. stack.push(a || b);
  56951. } else {
  56952. stack.push(a | b);
  56953. }
  56954. break;
  56955. case "pop":
  56956. stack.pop();
  56957. break;
  56958. case "roll":
  56959. b = stack.pop();
  56960. a = stack.pop();
  56961. stack.roll(a, b);
  56962. break;
  56963. case "round":
  56964. a = stack.pop();
  56965. stack.push(Math.round(a));
  56966. break;
  56967. case "sin":
  56968. a = stack.pop();
  56969. stack.push(Math.sin(a));
  56970. break;
  56971. case "sqrt":
  56972. a = stack.pop();
  56973. stack.push(Math.sqrt(a));
  56974. break;
  56975. case "sub":
  56976. b = stack.pop();
  56977. a = stack.pop();
  56978. stack.push(a - b);
  56979. break;
  56980. case "true":
  56981. stack.push(true);
  56982. break;
  56983. case "truncate":
  56984. a = stack.pop();
  56985. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  56986. stack.push(a);
  56987. break;
  56988. case "xor":
  56989. b = stack.pop();
  56990. a = stack.pop();
  56991. if (typeof a === "boolean" && typeof b === "boolean") {
  56992. stack.push(a !== b);
  56993. } else {
  56994. stack.push(a ^ b);
  56995. }
  56996. break;
  56997. default:
  56998. throw new _util.FormatError(`Unknown operator ${operator}`);
  56999. }
  57000. }
  57001. return stack.stack;
  57002. }
  57003. }
  57004. exports.PostScriptEvaluator = PostScriptEvaluator;
  57005. class AstNode {
  57006. constructor(type) {
  57007. this.type = type;
  57008. }
  57009. visit(visitor) {
  57010. (0, _util.unreachable)("abstract method");
  57011. }
  57012. }
  57013. class AstArgument extends AstNode {
  57014. constructor(index, min, max) {
  57015. super("args");
  57016. this.index = index;
  57017. this.min = min;
  57018. this.max = max;
  57019. }
  57020. visit(visitor) {
  57021. visitor.visitArgument(this);
  57022. }
  57023. }
  57024. class AstLiteral extends AstNode {
  57025. constructor(number) {
  57026. super("literal");
  57027. this.number = number;
  57028. this.min = number;
  57029. this.max = number;
  57030. }
  57031. visit(visitor) {
  57032. visitor.visitLiteral(this);
  57033. }
  57034. }
  57035. class AstBinaryOperation extends AstNode {
  57036. constructor(op, arg1, arg2, min, max) {
  57037. super("binary");
  57038. this.op = op;
  57039. this.arg1 = arg1;
  57040. this.arg2 = arg2;
  57041. this.min = min;
  57042. this.max = max;
  57043. }
  57044. visit(visitor) {
  57045. visitor.visitBinaryOperation(this);
  57046. }
  57047. }
  57048. class AstMin extends AstNode {
  57049. constructor(arg, max) {
  57050. super("max");
  57051. this.arg = arg;
  57052. this.min = arg.min;
  57053. this.max = max;
  57054. }
  57055. visit(visitor) {
  57056. visitor.visitMin(this);
  57057. }
  57058. }
  57059. class AstVariable extends AstNode {
  57060. constructor(index, min, max) {
  57061. super("var");
  57062. this.index = index;
  57063. this.min = min;
  57064. this.max = max;
  57065. }
  57066. visit(visitor) {
  57067. visitor.visitVariable(this);
  57068. }
  57069. }
  57070. class AstVariableDefinition extends AstNode {
  57071. constructor(variable, arg) {
  57072. super("definition");
  57073. this.variable = variable;
  57074. this.arg = arg;
  57075. }
  57076. visit(visitor) {
  57077. visitor.visitVariableDefinition(this);
  57078. }
  57079. }
  57080. class ExpressionBuilderVisitor {
  57081. constructor() {
  57082. this.parts = [];
  57083. }
  57084. visitArgument(arg) {
  57085. this.parts.push(
  57086. "Math.max(",
  57087. arg.min,
  57088. ", Math.min(",
  57089. arg.max,
  57090. ", src[srcOffset + ",
  57091. arg.index,
  57092. "]))"
  57093. );
  57094. }
  57095. visitVariable(variable) {
  57096. this.parts.push("v", variable.index);
  57097. }
  57098. visitLiteral(literal) {
  57099. this.parts.push(literal.number);
  57100. }
  57101. visitBinaryOperation(operation) {
  57102. this.parts.push("(");
  57103. operation.arg1.visit(this);
  57104. this.parts.push(" ", operation.op, " ");
  57105. operation.arg2.visit(this);
  57106. this.parts.push(")");
  57107. }
  57108. visitVariableDefinition(definition) {
  57109. this.parts.push("var ");
  57110. definition.variable.visit(this);
  57111. this.parts.push(" = ");
  57112. definition.arg.visit(this);
  57113. this.parts.push(";");
  57114. }
  57115. visitMin(max) {
  57116. this.parts.push("Math.min(");
  57117. max.arg.visit(this);
  57118. this.parts.push(", ", max.max, ")");
  57119. }
  57120. toString() {
  57121. return this.parts.join("");
  57122. }
  57123. }
  57124. function buildAddOperation(num1, num2) {
  57125. if (num2.type === "literal" && num2.number === 0) {
  57126. return num1;
  57127. }
  57128. if (num1.type === "literal" && num1.number === 0) {
  57129. return num2;
  57130. }
  57131. if (num2.type === "literal" && num1.type === "literal") {
  57132. return new AstLiteral(num1.number + num2.number);
  57133. }
  57134. return new AstBinaryOperation(
  57135. "+",
  57136. num1,
  57137. num2,
  57138. num1.min + num2.min,
  57139. num1.max + num2.max
  57140. );
  57141. }
  57142. function buildMulOperation(num1, num2) {
  57143. if (num2.type === "literal") {
  57144. if (num2.number === 0) {
  57145. return new AstLiteral(0);
  57146. } else if (num2.number === 1) {
  57147. return num1;
  57148. } else if (num1.type === "literal") {
  57149. return new AstLiteral(num1.number * num2.number);
  57150. }
  57151. }
  57152. if (num1.type === "literal") {
  57153. if (num1.number === 0) {
  57154. return new AstLiteral(0);
  57155. } else if (num1.number === 1) {
  57156. return num2;
  57157. }
  57158. }
  57159. const min = Math.min(
  57160. num1.min * num2.min,
  57161. num1.min * num2.max,
  57162. num1.max * num2.min,
  57163. num1.max * num2.max
  57164. );
  57165. const max = Math.max(
  57166. num1.min * num2.min,
  57167. num1.min * num2.max,
  57168. num1.max * num2.min,
  57169. num1.max * num2.max
  57170. );
  57171. return new AstBinaryOperation("*", num1, num2, min, max);
  57172. }
  57173. function buildSubOperation(num1, num2) {
  57174. if (num2.type === "literal") {
  57175. if (num2.number === 0) {
  57176. return num1;
  57177. } else if (num1.type === "literal") {
  57178. return new AstLiteral(num1.number - num2.number);
  57179. }
  57180. }
  57181. if (
  57182. num2.type === "binary" &&
  57183. num2.op === "-" &&
  57184. num1.type === "literal" &&
  57185. num1.number === 1 &&
  57186. num2.arg1.type === "literal" &&
  57187. num2.arg1.number === 1
  57188. ) {
  57189. return num2.arg2;
  57190. }
  57191. return new AstBinaryOperation(
  57192. "-",
  57193. num1,
  57194. num2,
  57195. num1.min - num2.max,
  57196. num1.max - num2.min
  57197. );
  57198. }
  57199. function buildMinOperation(num1, max) {
  57200. if (num1.min >= max) {
  57201. return new AstLiteral(max);
  57202. } else if (num1.max <= max) {
  57203. return num1;
  57204. }
  57205. return new AstMin(num1, max);
  57206. }
  57207. class PostScriptCompiler {
  57208. compile(code, domain, range) {
  57209. const stack = [];
  57210. const instructions = [];
  57211. const inputSize = domain.length >> 1,
  57212. outputSize = range.length >> 1;
  57213. let lastRegister = 0;
  57214. let n, j;
  57215. let num1, num2, ast1, ast2, tmpVar, item;
  57216. for (let i = 0; i < inputSize; i++) {
  57217. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  57218. }
  57219. for (let i = 0, ii = code.length; i < ii; i++) {
  57220. item = code[i];
  57221. if (typeof item === "number") {
  57222. stack.push(new AstLiteral(item));
  57223. continue;
  57224. }
  57225. switch (item) {
  57226. case "add":
  57227. if (stack.length < 2) {
  57228. return null;
  57229. }
  57230. num2 = stack.pop();
  57231. num1 = stack.pop();
  57232. stack.push(buildAddOperation(num1, num2));
  57233. break;
  57234. case "cvr":
  57235. if (stack.length < 1) {
  57236. return null;
  57237. }
  57238. break;
  57239. case "mul":
  57240. if (stack.length < 2) {
  57241. return null;
  57242. }
  57243. num2 = stack.pop();
  57244. num1 = stack.pop();
  57245. stack.push(buildMulOperation(num1, num2));
  57246. break;
  57247. case "sub":
  57248. if (stack.length < 2) {
  57249. return null;
  57250. }
  57251. num2 = stack.pop();
  57252. num1 = stack.pop();
  57253. stack.push(buildSubOperation(num1, num2));
  57254. break;
  57255. case "exch":
  57256. if (stack.length < 2) {
  57257. return null;
  57258. }
  57259. ast1 = stack.pop();
  57260. ast2 = stack.pop();
  57261. stack.push(ast1, ast2);
  57262. break;
  57263. case "pop":
  57264. if (stack.length < 1) {
  57265. return null;
  57266. }
  57267. stack.pop();
  57268. break;
  57269. case "index":
  57270. if (stack.length < 1) {
  57271. return null;
  57272. }
  57273. num1 = stack.pop();
  57274. if (num1.type !== "literal") {
  57275. return null;
  57276. }
  57277. n = num1.number;
  57278. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  57279. return null;
  57280. }
  57281. ast1 = stack[stack.length - n - 1];
  57282. if (ast1.type === "literal" || ast1.type === "var") {
  57283. stack.push(ast1);
  57284. break;
  57285. }
  57286. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  57287. stack[stack.length - n - 1] = tmpVar;
  57288. stack.push(tmpVar);
  57289. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  57290. break;
  57291. case "dup":
  57292. if (stack.length < 1) {
  57293. return null;
  57294. }
  57295. if (
  57296. typeof code[i + 1] === "number" &&
  57297. code[i + 2] === "gt" &&
  57298. code[i + 3] === i + 7 &&
  57299. code[i + 4] === "jz" &&
  57300. code[i + 5] === "pop" &&
  57301. code[i + 6] === code[i + 1]
  57302. ) {
  57303. num1 = stack.pop();
  57304. stack.push(buildMinOperation(num1, code[i + 1]));
  57305. i += 6;
  57306. break;
  57307. }
  57308. ast1 = stack.at(-1);
  57309. if (ast1.type === "literal" || ast1.type === "var") {
  57310. stack.push(ast1);
  57311. break;
  57312. }
  57313. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  57314. stack[stack.length - 1] = tmpVar;
  57315. stack.push(tmpVar);
  57316. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  57317. break;
  57318. case "roll":
  57319. if (stack.length < 2) {
  57320. return null;
  57321. }
  57322. num2 = stack.pop();
  57323. num1 = stack.pop();
  57324. if (num2.type !== "literal" || num1.type !== "literal") {
  57325. return null;
  57326. }
  57327. j = num2.number;
  57328. n = num1.number;
  57329. if (
  57330. n <= 0 ||
  57331. !Number.isInteger(n) ||
  57332. !Number.isInteger(j) ||
  57333. stack.length < n
  57334. ) {
  57335. return null;
  57336. }
  57337. j = ((j % n) + n) % n;
  57338. if (j === 0) {
  57339. break;
  57340. }
  57341. Array.prototype.push.apply(
  57342. stack,
  57343. stack.splice(stack.length - n, n - j)
  57344. );
  57345. break;
  57346. default:
  57347. return null;
  57348. }
  57349. }
  57350. if (stack.length !== outputSize) {
  57351. return null;
  57352. }
  57353. const result = [];
  57354. for (const instruction of instructions) {
  57355. const statementBuilder = new ExpressionBuilderVisitor();
  57356. instruction.visit(statementBuilder);
  57357. result.push(statementBuilder.toString());
  57358. }
  57359. for (let i = 0, ii = stack.length; i < ii; i++) {
  57360. const expr = stack[i],
  57361. statementBuilder = new ExpressionBuilderVisitor();
  57362. expr.visit(statementBuilder);
  57363. const min = range[i * 2],
  57364. max = range[i * 2 + 1];
  57365. const out = [statementBuilder.toString()];
  57366. if (min > expr.min) {
  57367. out.unshift("Math.max(", min, ", ");
  57368. out.push(")");
  57369. }
  57370. if (max < expr.max) {
  57371. out.unshift("Math.min(", max, ", ");
  57372. out.push(")");
  57373. }
  57374. out.unshift("dest[destOffset + ", i, "] = ");
  57375. out.push(";");
  57376. result.push(out.join(""));
  57377. }
  57378. return result.join("\n");
  57379. }
  57380. }
  57381. exports.PostScriptCompiler = PostScriptCompiler;
  57382. /***/
  57383. },
  57384. /* 58 */
  57385. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57386. Object.defineProperty(exports, "__esModule", {
  57387. value: true,
  57388. });
  57389. exports.PostScriptParser = exports.PostScriptLexer = void 0;
  57390. var _util = __w_pdfjs_require__(2);
  57391. var _primitives = __w_pdfjs_require__(5);
  57392. var _core_utils = __w_pdfjs_require__(6);
  57393. class PostScriptParser {
  57394. constructor(lexer) {
  57395. this.lexer = lexer;
  57396. this.operators = [];
  57397. this.token = null;
  57398. this.prev = null;
  57399. }
  57400. nextToken() {
  57401. this.prev = this.token;
  57402. this.token = this.lexer.getToken();
  57403. }
  57404. accept(type) {
  57405. if (this.token.type === type) {
  57406. this.nextToken();
  57407. return true;
  57408. }
  57409. return false;
  57410. }
  57411. expect(type) {
  57412. if (this.accept(type)) {
  57413. return true;
  57414. }
  57415. throw new _util.FormatError(
  57416. `Unexpected symbol: found ${this.token.type} expected ${type}.`
  57417. );
  57418. }
  57419. parse() {
  57420. this.nextToken();
  57421. this.expect(PostScriptTokenTypes.LBRACE);
  57422. this.parseBlock();
  57423. this.expect(PostScriptTokenTypes.RBRACE);
  57424. return this.operators;
  57425. }
  57426. parseBlock() {
  57427. while (true) {
  57428. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  57429. this.operators.push(this.prev.value);
  57430. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  57431. this.operators.push(this.prev.value);
  57432. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  57433. this.parseCondition();
  57434. } else {
  57435. return;
  57436. }
  57437. }
  57438. }
  57439. parseCondition() {
  57440. const conditionLocation = this.operators.length;
  57441. this.operators.push(null, null);
  57442. this.parseBlock();
  57443. this.expect(PostScriptTokenTypes.RBRACE);
  57444. if (this.accept(PostScriptTokenTypes.IF)) {
  57445. this.operators[conditionLocation] = this.operators.length;
  57446. this.operators[conditionLocation + 1] = "jz";
  57447. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  57448. const jumpLocation = this.operators.length;
  57449. this.operators.push(null, null);
  57450. const endOfTrue = this.operators.length;
  57451. this.parseBlock();
  57452. this.expect(PostScriptTokenTypes.RBRACE);
  57453. this.expect(PostScriptTokenTypes.IFELSE);
  57454. this.operators[jumpLocation] = this.operators.length;
  57455. this.operators[jumpLocation + 1] = "j";
  57456. this.operators[conditionLocation] = endOfTrue;
  57457. this.operators[conditionLocation + 1] = "jz";
  57458. } else {
  57459. throw new _util.FormatError(
  57460. "PS Function: error parsing conditional."
  57461. );
  57462. }
  57463. }
  57464. }
  57465. exports.PostScriptParser = PostScriptParser;
  57466. const PostScriptTokenTypes = {
  57467. LBRACE: 0,
  57468. RBRACE: 1,
  57469. NUMBER: 2,
  57470. OPERATOR: 3,
  57471. IF: 4,
  57472. IFELSE: 5,
  57473. };
  57474. class PostScriptToken {
  57475. static get opCache() {
  57476. return (0, _util.shadow)(this, "opCache", Object.create(null));
  57477. }
  57478. constructor(type, value) {
  57479. this.type = type;
  57480. this.value = value;
  57481. }
  57482. static getOperator(op) {
  57483. const opValue = PostScriptToken.opCache[op];
  57484. if (opValue) {
  57485. return opValue;
  57486. }
  57487. return (PostScriptToken.opCache[op] = new PostScriptToken(
  57488. PostScriptTokenTypes.OPERATOR,
  57489. op
  57490. ));
  57491. }
  57492. static get LBRACE() {
  57493. return (0, _util.shadow)(
  57494. this,
  57495. "LBRACE",
  57496. new PostScriptToken(PostScriptTokenTypes.LBRACE, "{")
  57497. );
  57498. }
  57499. static get RBRACE() {
  57500. return (0, _util.shadow)(
  57501. this,
  57502. "RBRACE",
  57503. new PostScriptToken(PostScriptTokenTypes.RBRACE, "}")
  57504. );
  57505. }
  57506. static get IF() {
  57507. return (0, _util.shadow)(
  57508. this,
  57509. "IF",
  57510. new PostScriptToken(PostScriptTokenTypes.IF, "IF")
  57511. );
  57512. }
  57513. static get IFELSE() {
  57514. return (0, _util.shadow)(
  57515. this,
  57516. "IFELSE",
  57517. new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE")
  57518. );
  57519. }
  57520. }
  57521. class PostScriptLexer {
  57522. constructor(stream) {
  57523. this.stream = stream;
  57524. this.nextChar();
  57525. this.strBuf = [];
  57526. }
  57527. nextChar() {
  57528. return (this.currentChar = this.stream.getByte());
  57529. }
  57530. getToken() {
  57531. let comment = false;
  57532. let ch = this.currentChar;
  57533. while (true) {
  57534. if (ch < 0) {
  57535. return _primitives.EOF;
  57536. }
  57537. if (comment) {
  57538. if (ch === 0x0a || ch === 0x0d) {
  57539. comment = false;
  57540. }
  57541. } else if (ch === 0x25) {
  57542. comment = true;
  57543. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  57544. break;
  57545. }
  57546. ch = this.nextChar();
  57547. }
  57548. switch (ch | 0) {
  57549. case 0x30:
  57550. case 0x31:
  57551. case 0x32:
  57552. case 0x33:
  57553. case 0x34:
  57554. case 0x35:
  57555. case 0x36:
  57556. case 0x37:
  57557. case 0x38:
  57558. case 0x39:
  57559. case 0x2b:
  57560. case 0x2d:
  57561. case 0x2e:
  57562. return new PostScriptToken(
  57563. PostScriptTokenTypes.NUMBER,
  57564. this.getNumber()
  57565. );
  57566. case 0x7b:
  57567. this.nextChar();
  57568. return PostScriptToken.LBRACE;
  57569. case 0x7d:
  57570. this.nextChar();
  57571. return PostScriptToken.RBRACE;
  57572. }
  57573. const strBuf = this.strBuf;
  57574. strBuf.length = 0;
  57575. strBuf[0] = String.fromCharCode(ch);
  57576. while (
  57577. (ch = this.nextChar()) >= 0 &&
  57578. ((ch >= 0x41 && ch <= 0x5a) || (ch >= 0x61 && ch <= 0x7a))
  57579. ) {
  57580. strBuf.push(String.fromCharCode(ch));
  57581. }
  57582. const str = strBuf.join("");
  57583. switch (str.toLowerCase()) {
  57584. case "if":
  57585. return PostScriptToken.IF;
  57586. case "ifelse":
  57587. return PostScriptToken.IFELSE;
  57588. default:
  57589. return PostScriptToken.getOperator(str);
  57590. }
  57591. }
  57592. getNumber() {
  57593. let ch = this.currentChar;
  57594. const strBuf = this.strBuf;
  57595. strBuf.length = 0;
  57596. strBuf[0] = String.fromCharCode(ch);
  57597. while ((ch = this.nextChar()) >= 0) {
  57598. if ((ch >= 0x30 && ch <= 0x39) || ch === 0x2d || ch === 0x2e) {
  57599. strBuf.push(String.fromCharCode(ch));
  57600. } else {
  57601. break;
  57602. }
  57603. }
  57604. const value = parseFloat(strBuf.join(""));
  57605. if (isNaN(value)) {
  57606. throw new _util.FormatError(
  57607. `Invalid floating point number: ${value}`
  57608. );
  57609. }
  57610. return value;
  57611. }
  57612. }
  57613. exports.PostScriptLexer = PostScriptLexer;
  57614. /***/
  57615. },
  57616. /* 59 */
  57617. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57618. Object.defineProperty(exports, "__esModule", {
  57619. value: true,
  57620. });
  57621. exports.LocalTilingPatternCache =
  57622. exports.LocalImageCache =
  57623. exports.LocalGStateCache =
  57624. exports.LocalFunctionCache =
  57625. exports.LocalColorSpaceCache =
  57626. exports.GlobalImageCache =
  57627. void 0;
  57628. var _util = __w_pdfjs_require__(2);
  57629. var _primitives = __w_pdfjs_require__(5);
  57630. class BaseLocalCache {
  57631. constructor(options) {
  57632. if (this.constructor === BaseLocalCache) {
  57633. (0, _util.unreachable)("Cannot initialize BaseLocalCache.");
  57634. }
  57635. this._onlyRefs = (options && options.onlyRefs) === true;
  57636. if (!this._onlyRefs) {
  57637. this._nameRefMap = new Map();
  57638. this._imageMap = new Map();
  57639. }
  57640. this._imageCache = new _primitives.RefSetCache();
  57641. }
  57642. getByName(name) {
  57643. if (this._onlyRefs) {
  57644. (0, _util.unreachable)("Should not call `getByName` method.");
  57645. }
  57646. const ref = this._nameRefMap.get(name);
  57647. if (ref) {
  57648. return this.getByRef(ref);
  57649. }
  57650. return this._imageMap.get(name) || null;
  57651. }
  57652. getByRef(ref) {
  57653. return this._imageCache.get(ref) || null;
  57654. }
  57655. set(name, ref, data) {
  57656. (0, _util.unreachable)("Abstract method `set` called.");
  57657. }
  57658. }
  57659. class LocalImageCache extends BaseLocalCache {
  57660. set(name, ref = null, data) {
  57661. if (typeof name !== "string") {
  57662. throw new Error(
  57663. 'LocalImageCache.set - expected "name" argument.'
  57664. );
  57665. }
  57666. if (ref) {
  57667. if (this._imageCache.has(ref)) {
  57668. return;
  57669. }
  57670. this._nameRefMap.set(name, ref);
  57671. this._imageCache.put(ref, data);
  57672. return;
  57673. }
  57674. if (this._imageMap.has(name)) {
  57675. return;
  57676. }
  57677. this._imageMap.set(name, data);
  57678. }
  57679. }
  57680. exports.LocalImageCache = LocalImageCache;
  57681. class LocalColorSpaceCache extends BaseLocalCache {
  57682. set(name = null, ref = null, data) {
  57683. if (typeof name !== "string" && !ref) {
  57684. throw new Error(
  57685. 'LocalColorSpaceCache.set - expected "name" and/or "ref" argument.'
  57686. );
  57687. }
  57688. if (ref) {
  57689. if (this._imageCache.has(ref)) {
  57690. return;
  57691. }
  57692. if (name !== null) {
  57693. this._nameRefMap.set(name, ref);
  57694. }
  57695. this._imageCache.put(ref, data);
  57696. return;
  57697. }
  57698. if (this._imageMap.has(name)) {
  57699. return;
  57700. }
  57701. this._imageMap.set(name, data);
  57702. }
  57703. }
  57704. exports.LocalColorSpaceCache = LocalColorSpaceCache;
  57705. class LocalFunctionCache extends BaseLocalCache {
  57706. constructor(options) {
  57707. super({
  57708. onlyRefs: true,
  57709. });
  57710. }
  57711. set(name = null, ref, data) {
  57712. if (!ref) {
  57713. throw new Error(
  57714. 'LocalFunctionCache.set - expected "ref" argument.'
  57715. );
  57716. }
  57717. if (this._imageCache.has(ref)) {
  57718. return;
  57719. }
  57720. this._imageCache.put(ref, data);
  57721. }
  57722. }
  57723. exports.LocalFunctionCache = LocalFunctionCache;
  57724. class LocalGStateCache extends BaseLocalCache {
  57725. set(name, ref = null, data) {
  57726. if (typeof name !== "string") {
  57727. throw new Error(
  57728. 'LocalGStateCache.set - expected "name" argument.'
  57729. );
  57730. }
  57731. if (ref) {
  57732. if (this._imageCache.has(ref)) {
  57733. return;
  57734. }
  57735. this._nameRefMap.set(name, ref);
  57736. this._imageCache.put(ref, data);
  57737. return;
  57738. }
  57739. if (this._imageMap.has(name)) {
  57740. return;
  57741. }
  57742. this._imageMap.set(name, data);
  57743. }
  57744. }
  57745. exports.LocalGStateCache = LocalGStateCache;
  57746. class LocalTilingPatternCache extends BaseLocalCache {
  57747. constructor(options) {
  57748. super({
  57749. onlyRefs: true,
  57750. });
  57751. }
  57752. set(name = null, ref, data) {
  57753. if (!ref) {
  57754. throw new Error(
  57755. 'LocalTilingPatternCache.set - expected "ref" argument.'
  57756. );
  57757. }
  57758. if (this._imageCache.has(ref)) {
  57759. return;
  57760. }
  57761. this._imageCache.put(ref, data);
  57762. }
  57763. }
  57764. exports.LocalTilingPatternCache = LocalTilingPatternCache;
  57765. class GlobalImageCache {
  57766. static get NUM_PAGES_THRESHOLD() {
  57767. return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
  57768. }
  57769. static get MIN_IMAGES_TO_CACHE() {
  57770. return (0, _util.shadow)(this, "MIN_IMAGES_TO_CACHE", 10);
  57771. }
  57772. static get MAX_BYTE_SIZE() {
  57773. return (0, _util.shadow)(this, "MAX_BYTE_SIZE", 40e6);
  57774. }
  57775. constructor() {
  57776. this._refCache = new _primitives.RefSetCache();
  57777. this._imageCache = new _primitives.RefSetCache();
  57778. }
  57779. get _byteSize() {
  57780. let byteSize = 0;
  57781. for (const imageData of this._imageCache) {
  57782. byteSize += imageData.byteSize;
  57783. }
  57784. return byteSize;
  57785. }
  57786. get _cacheLimitReached() {
  57787. if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) {
  57788. return false;
  57789. }
  57790. if (this._byteSize < GlobalImageCache.MAX_BYTE_SIZE) {
  57791. return false;
  57792. }
  57793. return true;
  57794. }
  57795. shouldCache(ref, pageIndex) {
  57796. const pageIndexSet = this._refCache.get(ref);
  57797. const numPages = pageIndexSet
  57798. ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1)
  57799. : 1;
  57800. if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  57801. return false;
  57802. }
  57803. if (!this._imageCache.has(ref) && this._cacheLimitReached) {
  57804. return false;
  57805. }
  57806. return true;
  57807. }
  57808. addPageIndex(ref, pageIndex) {
  57809. let pageIndexSet = this._refCache.get(ref);
  57810. if (!pageIndexSet) {
  57811. pageIndexSet = new Set();
  57812. this._refCache.put(ref, pageIndexSet);
  57813. }
  57814. pageIndexSet.add(pageIndex);
  57815. }
  57816. addByteSize(ref, byteSize) {
  57817. const imageData = this._imageCache.get(ref);
  57818. if (!imageData) {
  57819. return;
  57820. }
  57821. if (imageData.byteSize) {
  57822. return;
  57823. }
  57824. imageData.byteSize = byteSize;
  57825. }
  57826. getData(ref, pageIndex) {
  57827. const pageIndexSet = this._refCache.get(ref);
  57828. if (!pageIndexSet) {
  57829. return null;
  57830. }
  57831. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  57832. return null;
  57833. }
  57834. const imageData = this._imageCache.get(ref);
  57835. if (!imageData) {
  57836. return null;
  57837. }
  57838. pageIndexSet.add(pageIndex);
  57839. return imageData;
  57840. }
  57841. setData(ref, data) {
  57842. if (!this._refCache.has(ref)) {
  57843. throw new Error(
  57844. 'GlobalImageCache.setData - expected "addPageIndex" to have been called.'
  57845. );
  57846. }
  57847. if (this._imageCache.has(ref)) {
  57848. return;
  57849. }
  57850. if (this._cacheLimitReached) {
  57851. (0, _util.warn)(
  57852. "GlobalImageCache.setData - cache limit reached."
  57853. );
  57854. return;
  57855. }
  57856. this._imageCache.put(ref, data);
  57857. }
  57858. clear(onlyData = false) {
  57859. if (!onlyData) {
  57860. this._refCache.clear();
  57861. }
  57862. this._imageCache.clear();
  57863. }
  57864. }
  57865. exports.GlobalImageCache = GlobalImageCache;
  57866. /***/
  57867. },
  57868. /* 60 */
  57869. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57870. Object.defineProperty(exports, "__esModule", {
  57871. value: true,
  57872. });
  57873. exports.bidi = bidi;
  57874. var _util = __w_pdfjs_require__(2);
  57875. const baseTypes = [
  57876. "BN",
  57877. "BN",
  57878. "BN",
  57879. "BN",
  57880. "BN",
  57881. "BN",
  57882. "BN",
  57883. "BN",
  57884. "BN",
  57885. "S",
  57886. "B",
  57887. "S",
  57888. "WS",
  57889. "B",
  57890. "BN",
  57891. "BN",
  57892. "BN",
  57893. "BN",
  57894. "BN",
  57895. "BN",
  57896. "BN",
  57897. "BN",
  57898. "BN",
  57899. "BN",
  57900. "BN",
  57901. "BN",
  57902. "BN",
  57903. "BN",
  57904. "B",
  57905. "B",
  57906. "B",
  57907. "S",
  57908. "WS",
  57909. "ON",
  57910. "ON",
  57911. "ET",
  57912. "ET",
  57913. "ET",
  57914. "ON",
  57915. "ON",
  57916. "ON",
  57917. "ON",
  57918. "ON",
  57919. "ES",
  57920. "CS",
  57921. "ES",
  57922. "CS",
  57923. "CS",
  57924. "EN",
  57925. "EN",
  57926. "EN",
  57927. "EN",
  57928. "EN",
  57929. "EN",
  57930. "EN",
  57931. "EN",
  57932. "EN",
  57933. "EN",
  57934. "CS",
  57935. "ON",
  57936. "ON",
  57937. "ON",
  57938. "ON",
  57939. "ON",
  57940. "ON",
  57941. "L",
  57942. "L",
  57943. "L",
  57944. "L",
  57945. "L",
  57946. "L",
  57947. "L",
  57948. "L",
  57949. "L",
  57950. "L",
  57951. "L",
  57952. "L",
  57953. "L",
  57954. "L",
  57955. "L",
  57956. "L",
  57957. "L",
  57958. "L",
  57959. "L",
  57960. "L",
  57961. "L",
  57962. "L",
  57963. "L",
  57964. "L",
  57965. "L",
  57966. "L",
  57967. "ON",
  57968. "ON",
  57969. "ON",
  57970. "ON",
  57971. "ON",
  57972. "ON",
  57973. "L",
  57974. "L",
  57975. "L",
  57976. "L",
  57977. "L",
  57978. "L",
  57979. "L",
  57980. "L",
  57981. "L",
  57982. "L",
  57983. "L",
  57984. "L",
  57985. "L",
  57986. "L",
  57987. "L",
  57988. "L",
  57989. "L",
  57990. "L",
  57991. "L",
  57992. "L",
  57993. "L",
  57994. "L",
  57995. "L",
  57996. "L",
  57997. "L",
  57998. "L",
  57999. "ON",
  58000. "ON",
  58001. "ON",
  58002. "ON",
  58003. "BN",
  58004. "BN",
  58005. "BN",
  58006. "BN",
  58007. "BN",
  58008. "BN",
  58009. "B",
  58010. "BN",
  58011. "BN",
  58012. "BN",
  58013. "BN",
  58014. "BN",
  58015. "BN",
  58016. "BN",
  58017. "BN",
  58018. "BN",
  58019. "BN",
  58020. "BN",
  58021. "BN",
  58022. "BN",
  58023. "BN",
  58024. "BN",
  58025. "BN",
  58026. "BN",
  58027. "BN",
  58028. "BN",
  58029. "BN",
  58030. "BN",
  58031. "BN",
  58032. "BN",
  58033. "BN",
  58034. "BN",
  58035. "BN",
  58036. "CS",
  58037. "ON",
  58038. "ET",
  58039. "ET",
  58040. "ET",
  58041. "ET",
  58042. "ON",
  58043. "ON",
  58044. "ON",
  58045. "ON",
  58046. "L",
  58047. "ON",
  58048. "ON",
  58049. "BN",
  58050. "ON",
  58051. "ON",
  58052. "ET",
  58053. "ET",
  58054. "EN",
  58055. "EN",
  58056. "ON",
  58057. "L",
  58058. "ON",
  58059. "ON",
  58060. "ON",
  58061. "EN",
  58062. "L",
  58063. "ON",
  58064. "ON",
  58065. "ON",
  58066. "ON",
  58067. "ON",
  58068. "L",
  58069. "L",
  58070. "L",
  58071. "L",
  58072. "L",
  58073. "L",
  58074. "L",
  58075. "L",
  58076. "L",
  58077. "L",
  58078. "L",
  58079. "L",
  58080. "L",
  58081. "L",
  58082. "L",
  58083. "L",
  58084. "L",
  58085. "L",
  58086. "L",
  58087. "L",
  58088. "L",
  58089. "L",
  58090. "L",
  58091. "ON",
  58092. "L",
  58093. "L",
  58094. "L",
  58095. "L",
  58096. "L",
  58097. "L",
  58098. "L",
  58099. "L",
  58100. "L",
  58101. "L",
  58102. "L",
  58103. "L",
  58104. "L",
  58105. "L",
  58106. "L",
  58107. "L",
  58108. "L",
  58109. "L",
  58110. "L",
  58111. "L",
  58112. "L",
  58113. "L",
  58114. "L",
  58115. "L",
  58116. "L",
  58117. "L",
  58118. "L",
  58119. "L",
  58120. "L",
  58121. "L",
  58122. "L",
  58123. "ON",
  58124. "L",
  58125. "L",
  58126. "L",
  58127. "L",
  58128. "L",
  58129. "L",
  58130. "L",
  58131. "L",
  58132. ];
  58133. const arabicTypes = [
  58134. "AN",
  58135. "AN",
  58136. "AN",
  58137. "AN",
  58138. "AN",
  58139. "AN",
  58140. "ON",
  58141. "ON",
  58142. "AL",
  58143. "ET",
  58144. "ET",
  58145. "AL",
  58146. "CS",
  58147. "AL",
  58148. "ON",
  58149. "ON",
  58150. "NSM",
  58151. "NSM",
  58152. "NSM",
  58153. "NSM",
  58154. "NSM",
  58155. "NSM",
  58156. "NSM",
  58157. "NSM",
  58158. "NSM",
  58159. "NSM",
  58160. "NSM",
  58161. "AL",
  58162. "AL",
  58163. "",
  58164. "AL",
  58165. "AL",
  58166. "AL",
  58167. "AL",
  58168. "AL",
  58169. "AL",
  58170. "AL",
  58171. "AL",
  58172. "AL",
  58173. "AL",
  58174. "AL",
  58175. "AL",
  58176. "AL",
  58177. "AL",
  58178. "AL",
  58179. "AL",
  58180. "AL",
  58181. "AL",
  58182. "AL",
  58183. "AL",
  58184. "AL",
  58185. "AL",
  58186. "AL",
  58187. "AL",
  58188. "AL",
  58189. "AL",
  58190. "AL",
  58191. "AL",
  58192. "AL",
  58193. "AL",
  58194. "AL",
  58195. "AL",
  58196. "AL",
  58197. "AL",
  58198. "AL",
  58199. "AL",
  58200. "AL",
  58201. "AL",
  58202. "AL",
  58203. "AL",
  58204. "AL",
  58205. "AL",
  58206. "AL",
  58207. "AL",
  58208. "AL",
  58209. "NSM",
  58210. "NSM",
  58211. "NSM",
  58212. "NSM",
  58213. "NSM",
  58214. "NSM",
  58215. "NSM",
  58216. "NSM",
  58217. "NSM",
  58218. "NSM",
  58219. "NSM",
  58220. "NSM",
  58221. "NSM",
  58222. "NSM",
  58223. "NSM",
  58224. "NSM",
  58225. "NSM",
  58226. "NSM",
  58227. "NSM",
  58228. "NSM",
  58229. "NSM",
  58230. "AN",
  58231. "AN",
  58232. "AN",
  58233. "AN",
  58234. "AN",
  58235. "AN",
  58236. "AN",
  58237. "AN",
  58238. "AN",
  58239. "AN",
  58240. "ET",
  58241. "AN",
  58242. "AN",
  58243. "AL",
  58244. "AL",
  58245. "AL",
  58246. "NSM",
  58247. "AL",
  58248. "AL",
  58249. "AL",
  58250. "AL",
  58251. "AL",
  58252. "AL",
  58253. "AL",
  58254. "AL",
  58255. "AL",
  58256. "AL",
  58257. "AL",
  58258. "AL",
  58259. "AL",
  58260. "AL",
  58261. "AL",
  58262. "AL",
  58263. "AL",
  58264. "AL",
  58265. "AL",
  58266. "AL",
  58267. "AL",
  58268. "AL",
  58269. "AL",
  58270. "AL",
  58271. "AL",
  58272. "AL",
  58273. "AL",
  58274. "AL",
  58275. "AL",
  58276. "AL",
  58277. "AL",
  58278. "AL",
  58279. "AL",
  58280. "AL",
  58281. "AL",
  58282. "AL",
  58283. "AL",
  58284. "AL",
  58285. "AL",
  58286. "AL",
  58287. "AL",
  58288. "AL",
  58289. "AL",
  58290. "AL",
  58291. "AL",
  58292. "AL",
  58293. "AL",
  58294. "AL",
  58295. "AL",
  58296. "AL",
  58297. "AL",
  58298. "AL",
  58299. "AL",
  58300. "AL",
  58301. "AL",
  58302. "AL",
  58303. "AL",
  58304. "AL",
  58305. "AL",
  58306. "AL",
  58307. "AL",
  58308. "AL",
  58309. "AL",
  58310. "AL",
  58311. "AL",
  58312. "AL",
  58313. "AL",
  58314. "AL",
  58315. "AL",
  58316. "AL",
  58317. "AL",
  58318. "AL",
  58319. "AL",
  58320. "AL",
  58321. "AL",
  58322. "AL",
  58323. "AL",
  58324. "AL",
  58325. "AL",
  58326. "AL",
  58327. "AL",
  58328. "AL",
  58329. "AL",
  58330. "AL",
  58331. "AL",
  58332. "AL",
  58333. "AL",
  58334. "AL",
  58335. "AL",
  58336. "AL",
  58337. "AL",
  58338. "AL",
  58339. "AL",
  58340. "AL",
  58341. "AL",
  58342. "AL",
  58343. "AL",
  58344. "AL",
  58345. "AL",
  58346. "AL",
  58347. "AL",
  58348. "NSM",
  58349. "NSM",
  58350. "NSM",
  58351. "NSM",
  58352. "NSM",
  58353. "NSM",
  58354. "NSM",
  58355. "AN",
  58356. "ON",
  58357. "NSM",
  58358. "NSM",
  58359. "NSM",
  58360. "NSM",
  58361. "NSM",
  58362. "NSM",
  58363. "AL",
  58364. "AL",
  58365. "NSM",
  58366. "NSM",
  58367. "ON",
  58368. "NSM",
  58369. "NSM",
  58370. "NSM",
  58371. "NSM",
  58372. "AL",
  58373. "AL",
  58374. "EN",
  58375. "EN",
  58376. "EN",
  58377. "EN",
  58378. "EN",
  58379. "EN",
  58380. "EN",
  58381. "EN",
  58382. "EN",
  58383. "EN",
  58384. "AL",
  58385. "AL",
  58386. "AL",
  58387. "AL",
  58388. "AL",
  58389. "AL",
  58390. ];
  58391. function isOdd(i) {
  58392. return (i & 1) !== 0;
  58393. }
  58394. function isEven(i) {
  58395. return (i & 1) === 0;
  58396. }
  58397. function findUnequal(arr, start, value) {
  58398. let j, jj;
  58399. for (j = start, jj = arr.length; j < jj; ++j) {
  58400. if (arr[j] !== value) {
  58401. return j;
  58402. }
  58403. }
  58404. return j;
  58405. }
  58406. function setValues(arr, start, end, value) {
  58407. for (let j = start; j < end; ++j) {
  58408. arr[j] = value;
  58409. }
  58410. }
  58411. function reverseValues(arr, start, end) {
  58412. for (let i = start, j = end - 1; i < j; ++i, --j) {
  58413. const temp = arr[i];
  58414. arr[i] = arr[j];
  58415. arr[j] = temp;
  58416. }
  58417. }
  58418. function createBidiText(str, isLTR, vertical = false) {
  58419. let dir = "ltr";
  58420. if (vertical) {
  58421. dir = "ttb";
  58422. } else if (!isLTR) {
  58423. dir = "rtl";
  58424. }
  58425. return {
  58426. str,
  58427. dir,
  58428. };
  58429. }
  58430. const chars = [];
  58431. const types = [];
  58432. function bidi(str, startLevel = -1, vertical = false) {
  58433. let isLTR = true;
  58434. const strLength = str.length;
  58435. if (strLength === 0 || vertical) {
  58436. return createBidiText(str, isLTR, vertical);
  58437. }
  58438. chars.length = strLength;
  58439. types.length = strLength;
  58440. let numBidi = 0;
  58441. let i, ii;
  58442. for (i = 0; i < strLength; ++i) {
  58443. chars[i] = str.charAt(i);
  58444. const charCode = str.charCodeAt(i);
  58445. let charType = "L";
  58446. if (charCode <= 0x00ff) {
  58447. charType = baseTypes[charCode];
  58448. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  58449. charType = "R";
  58450. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  58451. charType = arabicTypes[charCode & 0xff];
  58452. if (!charType) {
  58453. (0, _util.warn)(
  58454. "Bidi: invalid Unicode character " + charCode.toString(16)
  58455. );
  58456. }
  58457. } else if (0x0700 <= charCode && charCode <= 0x08ac) {
  58458. charType = "AL";
  58459. }
  58460. if (charType === "R" || charType === "AL" || charType === "AN") {
  58461. numBidi++;
  58462. }
  58463. types[i] = charType;
  58464. }
  58465. if (numBidi === 0) {
  58466. isLTR = true;
  58467. return createBidiText(str, isLTR);
  58468. }
  58469. if (startLevel === -1) {
  58470. if (numBidi / strLength < 0.3 && strLength > 4) {
  58471. isLTR = true;
  58472. startLevel = 0;
  58473. } else {
  58474. isLTR = false;
  58475. startLevel = 1;
  58476. }
  58477. }
  58478. const levels = [];
  58479. for (i = 0; i < strLength; ++i) {
  58480. levels[i] = startLevel;
  58481. }
  58482. const e = isOdd(startLevel) ? "R" : "L";
  58483. const sor = e;
  58484. const eor = sor;
  58485. let lastType = sor;
  58486. for (i = 0; i < strLength; ++i) {
  58487. if (types[i] === "NSM") {
  58488. types[i] = lastType;
  58489. } else {
  58490. lastType = types[i];
  58491. }
  58492. }
  58493. lastType = sor;
  58494. let t;
  58495. for (i = 0; i < strLength; ++i) {
  58496. t = types[i];
  58497. if (t === "EN") {
  58498. types[i] = lastType === "AL" ? "AN" : "EN";
  58499. } else if (t === "R" || t === "L" || t === "AL") {
  58500. lastType = t;
  58501. }
  58502. }
  58503. for (i = 0; i < strLength; ++i) {
  58504. t = types[i];
  58505. if (t === "AL") {
  58506. types[i] = "R";
  58507. }
  58508. }
  58509. for (i = 1; i < strLength - 1; ++i) {
  58510. if (
  58511. types[i] === "ES" &&
  58512. types[i - 1] === "EN" &&
  58513. types[i + 1] === "EN"
  58514. ) {
  58515. types[i] = "EN";
  58516. }
  58517. if (
  58518. types[i] === "CS" &&
  58519. (types[i - 1] === "EN" || types[i - 1] === "AN") &&
  58520. types[i + 1] === types[i - 1]
  58521. ) {
  58522. types[i] = types[i - 1];
  58523. }
  58524. }
  58525. for (i = 0; i < strLength; ++i) {
  58526. if (types[i] === "EN") {
  58527. for (let j = i - 1; j >= 0; --j) {
  58528. if (types[j] !== "ET") {
  58529. break;
  58530. }
  58531. types[j] = "EN";
  58532. }
  58533. for (let j = i + 1; j < strLength; ++j) {
  58534. if (types[j] !== "ET") {
  58535. break;
  58536. }
  58537. types[j] = "EN";
  58538. }
  58539. }
  58540. }
  58541. for (i = 0; i < strLength; ++i) {
  58542. t = types[i];
  58543. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  58544. types[i] = "ON";
  58545. }
  58546. }
  58547. lastType = sor;
  58548. for (i = 0; i < strLength; ++i) {
  58549. t = types[i];
  58550. if (t === "EN") {
  58551. types[i] = lastType === "L" ? "L" : "EN";
  58552. } else if (t === "R" || t === "L") {
  58553. lastType = t;
  58554. }
  58555. }
  58556. for (i = 0; i < strLength; ++i) {
  58557. if (types[i] === "ON") {
  58558. const end = findUnequal(types, i + 1, "ON");
  58559. let before = sor;
  58560. if (i > 0) {
  58561. before = types[i - 1];
  58562. }
  58563. let after = eor;
  58564. if (end + 1 < strLength) {
  58565. after = types[end + 1];
  58566. }
  58567. if (before !== "L") {
  58568. before = "R";
  58569. }
  58570. if (after !== "L") {
  58571. after = "R";
  58572. }
  58573. if (before === after) {
  58574. setValues(types, i, end, before);
  58575. }
  58576. i = end - 1;
  58577. }
  58578. }
  58579. for (i = 0; i < strLength; ++i) {
  58580. if (types[i] === "ON") {
  58581. types[i] = e;
  58582. }
  58583. }
  58584. for (i = 0; i < strLength; ++i) {
  58585. t = types[i];
  58586. if (isEven(levels[i])) {
  58587. if (t === "R") {
  58588. levels[i] += 1;
  58589. } else if (t === "AN" || t === "EN") {
  58590. levels[i] += 2;
  58591. }
  58592. } else {
  58593. if (t === "L" || t === "AN" || t === "EN") {
  58594. levels[i] += 1;
  58595. }
  58596. }
  58597. }
  58598. let highestLevel = -1;
  58599. let lowestOddLevel = 99;
  58600. let level;
  58601. for (i = 0, ii = levels.length; i < ii; ++i) {
  58602. level = levels[i];
  58603. if (highestLevel < level) {
  58604. highestLevel = level;
  58605. }
  58606. if (lowestOddLevel > level && isOdd(level)) {
  58607. lowestOddLevel = level;
  58608. }
  58609. }
  58610. for (level = highestLevel; level >= lowestOddLevel; --level) {
  58611. let start = -1;
  58612. for (i = 0, ii = levels.length; i < ii; ++i) {
  58613. if (levels[i] < level) {
  58614. if (start >= 0) {
  58615. reverseValues(chars, start, i);
  58616. start = -1;
  58617. }
  58618. } else if (start < 0) {
  58619. start = i;
  58620. }
  58621. }
  58622. if (start >= 0) {
  58623. reverseValues(chars, start, levels.length);
  58624. }
  58625. }
  58626. for (i = 0, ii = chars.length; i < ii; ++i) {
  58627. const ch = chars[i];
  58628. if (ch === "<" || ch === ">") {
  58629. chars[i] = "";
  58630. }
  58631. }
  58632. return createBidiText(chars.join(""), isLTR);
  58633. }
  58634. /***/
  58635. },
  58636. /* 61 */
  58637. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58638. Object.defineProperty(exports, "__esModule", {
  58639. value: true,
  58640. });
  58641. exports.MurmurHash3_64 = void 0;
  58642. var _util = __w_pdfjs_require__(2);
  58643. const SEED = 0xc3d2e1f0;
  58644. const MASK_HIGH = 0xffff0000;
  58645. const MASK_LOW = 0xffff;
  58646. class MurmurHash3_64 {
  58647. constructor(seed) {
  58648. this.h1 = seed ? seed & 0xffffffff : SEED;
  58649. this.h2 = seed ? seed & 0xffffffff : SEED;
  58650. }
  58651. update(input) {
  58652. let data, length;
  58653. if (typeof input === "string") {
  58654. data = new Uint8Array(input.length * 2);
  58655. length = 0;
  58656. for (let i = 0, ii = input.length; i < ii; i++) {
  58657. const code = input.charCodeAt(i);
  58658. if (code <= 0xff) {
  58659. data[length++] = code;
  58660. } else {
  58661. data[length++] = code >>> 8;
  58662. data[length++] = code & 0xff;
  58663. }
  58664. }
  58665. } else if ((0, _util.isArrayBuffer)(input)) {
  58666. data = input.slice();
  58667. length = data.byteLength;
  58668. } else {
  58669. throw new Error(
  58670. "Wrong data format in MurmurHash3_64_update. " +
  58671. "Input must be a string or array."
  58672. );
  58673. }
  58674. const blockCounts = length >> 2;
  58675. const tailLength = length - blockCounts * 4;
  58676. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  58677. let k1 = 0,
  58678. k2 = 0;
  58679. let h1 = this.h1,
  58680. h2 = this.h2;
  58681. const C1 = 0xcc9e2d51,
  58682. C2 = 0x1b873593;
  58683. const C1_LOW = C1 & MASK_LOW,
  58684. C2_LOW = C2 & MASK_LOW;
  58685. for (let i = 0; i < blockCounts; i++) {
  58686. if (i & 1) {
  58687. k1 = dataUint32[i];
  58688. k1 = ((k1 * C1) & MASK_HIGH) | ((k1 * C1_LOW) & MASK_LOW);
  58689. k1 = (k1 << 15) | (k1 >>> 17);
  58690. k1 = ((k1 * C2) & MASK_HIGH) | ((k1 * C2_LOW) & MASK_LOW);
  58691. h1 ^= k1;
  58692. h1 = (h1 << 13) | (h1 >>> 19);
  58693. h1 = h1 * 5 + 0xe6546b64;
  58694. } else {
  58695. k2 = dataUint32[i];
  58696. k2 = ((k2 * C1) & MASK_HIGH) | ((k2 * C1_LOW) & MASK_LOW);
  58697. k2 = (k2 << 15) | (k2 >>> 17);
  58698. k2 = ((k2 * C2) & MASK_HIGH) | ((k2 * C2_LOW) & MASK_LOW);
  58699. h2 ^= k2;
  58700. h2 = (h2 << 13) | (h2 >>> 19);
  58701. h2 = h2 * 5 + 0xe6546b64;
  58702. }
  58703. }
  58704. k1 = 0;
  58705. switch (tailLength) {
  58706. case 3:
  58707. k1 ^= data[blockCounts * 4 + 2] << 16;
  58708. case 2:
  58709. k1 ^= data[blockCounts * 4 + 1] << 8;
  58710. case 1:
  58711. k1 ^= data[blockCounts * 4];
  58712. k1 = ((k1 * C1) & MASK_HIGH) | ((k1 * C1_LOW) & MASK_LOW);
  58713. k1 = (k1 << 15) | (k1 >>> 17);
  58714. k1 = ((k1 * C2) & MASK_HIGH) | ((k1 * C2_LOW) & MASK_LOW);
  58715. if (blockCounts & 1) {
  58716. h1 ^= k1;
  58717. } else {
  58718. h2 ^= k1;
  58719. }
  58720. }
  58721. this.h1 = h1;
  58722. this.h2 = h2;
  58723. }
  58724. hexdigest() {
  58725. let h1 = this.h1,
  58726. h2 = this.h2;
  58727. h1 ^= h2 >>> 1;
  58728. h1 = ((h1 * 0xed558ccd) & MASK_HIGH) | ((h1 * 0x8ccd) & MASK_LOW);
  58729. h2 =
  58730. ((h2 * 0xff51afd7) & MASK_HIGH) |
  58731. (((((h2 << 16) | (h1 >>> 16)) * 0xafd7ed55) & MASK_HIGH) >>> 16);
  58732. h1 ^= h2 >>> 1;
  58733. h1 = ((h1 * 0x1a85ec53) & MASK_HIGH) | ((h1 * 0xec53) & MASK_LOW);
  58734. h2 =
  58735. ((h2 * 0xc4ceb9fe) & MASK_HIGH) |
  58736. (((((h2 << 16) | (h1 >>> 16)) * 0xb9fe1a85) & MASK_HIGH) >>> 16);
  58737. h1 ^= h2 >>> 1;
  58738. const hex1 = (h1 >>> 0).toString(16),
  58739. hex2 = (h2 >>> 0).toString(16);
  58740. return hex1.padStart(8, "0") + hex2.padStart(8, "0");
  58741. }
  58742. }
  58743. exports.MurmurHash3_64 = MurmurHash3_64;
  58744. /***/
  58745. },
  58746. /* 62 */
  58747. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58748. Object.defineProperty(exports, "__esModule", {
  58749. value: true,
  58750. });
  58751. exports.OperatorList = void 0;
  58752. var _util = __w_pdfjs_require__(2);
  58753. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  58754. let state = parentState;
  58755. for (let i = 0, ii = pattern.length - 1; i < ii; i++) {
  58756. const item = pattern[i];
  58757. state = state[item] || (state[item] = []);
  58758. }
  58759. state[pattern.at(-1)] = {
  58760. checkFn,
  58761. iterateFn,
  58762. processFn,
  58763. };
  58764. }
  58765. const InitialState = [];
  58766. addState(
  58767. InitialState,
  58768. [
  58769. _util.OPS.save,
  58770. _util.OPS.transform,
  58771. _util.OPS.paintInlineImageXObject,
  58772. _util.OPS.restore,
  58773. ],
  58774. null,
  58775. function iterateInlineImageGroup(context, i) {
  58776. const fnArray = context.fnArray;
  58777. const iFirstSave = context.iCurr - 3;
  58778. const pos = (i - iFirstSave) % 4;
  58779. switch (pos) {
  58780. case 0:
  58781. return fnArray[i] === _util.OPS.save;
  58782. case 1:
  58783. return fnArray[i] === _util.OPS.transform;
  58784. case 2:
  58785. return fnArray[i] === _util.OPS.paintInlineImageXObject;
  58786. case 3:
  58787. return fnArray[i] === _util.OPS.restore;
  58788. }
  58789. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  58790. },
  58791. function foundInlineImageGroup(context, i) {
  58792. const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  58793. const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  58794. const MAX_WIDTH = 1000;
  58795. const IMAGE_PADDING = 1;
  58796. const fnArray = context.fnArray,
  58797. argsArray = context.argsArray;
  58798. const curr = context.iCurr;
  58799. const iFirstSave = curr - 3;
  58800. const iFirstTransform = curr - 2;
  58801. const iFirstPIIXO = curr - 1;
  58802. const count = Math.min(
  58803. Math.floor((i - iFirstSave) / 4),
  58804. MAX_IMAGES_IN_INLINE_IMAGES_BLOCK
  58805. );
  58806. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  58807. return i - ((i - iFirstSave) % 4);
  58808. }
  58809. let maxX = 0;
  58810. const map = [];
  58811. let maxLineHeight = 0;
  58812. let currentX = IMAGE_PADDING,
  58813. currentY = IMAGE_PADDING;
  58814. for (let q = 0; q < count; q++) {
  58815. const transform = argsArray[iFirstTransform + (q << 2)];
  58816. const img = argsArray[iFirstPIIXO + (q << 2)][0];
  58817. if (currentX + img.width > MAX_WIDTH) {
  58818. maxX = Math.max(maxX, currentX);
  58819. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  58820. currentX = 0;
  58821. maxLineHeight = 0;
  58822. }
  58823. map.push({
  58824. transform,
  58825. x: currentX,
  58826. y: currentY,
  58827. w: img.width,
  58828. h: img.height,
  58829. });
  58830. currentX += img.width + 2 * IMAGE_PADDING;
  58831. maxLineHeight = Math.max(maxLineHeight, img.height);
  58832. }
  58833. const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  58834. const imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  58835. const imgData = new Uint8Array(imgWidth * imgHeight * 4);
  58836. const imgRowSize = imgWidth << 2;
  58837. for (let q = 0; q < count; q++) {
  58838. const data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  58839. const rowSize = map[q].w << 2;
  58840. let dataOffset = 0;
  58841. let offset = (map[q].x + map[q].y * imgWidth) << 2;
  58842. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  58843. for (let k = 0, kk = map[q].h; k < kk; k++) {
  58844. imgData.set(
  58845. data.subarray(dataOffset, dataOffset + rowSize),
  58846. offset
  58847. );
  58848. dataOffset += rowSize;
  58849. offset += imgRowSize;
  58850. }
  58851. imgData.set(
  58852. data.subarray(dataOffset - rowSize, dataOffset),
  58853. offset
  58854. );
  58855. while (offset >= 0) {
  58856. data[offset - 4] = data[offset];
  58857. data[offset - 3] = data[offset + 1];
  58858. data[offset - 2] = data[offset + 2];
  58859. data[offset - 1] = data[offset + 3];
  58860. data[offset + rowSize] = data[offset + rowSize - 4];
  58861. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  58862. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  58863. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  58864. offset -= imgRowSize;
  58865. }
  58866. }
  58867. fnArray.splice(
  58868. iFirstSave,
  58869. count * 4,
  58870. _util.OPS.paintInlineImageXObjectGroup
  58871. );
  58872. argsArray.splice(iFirstSave, count * 4, [
  58873. {
  58874. width: imgWidth,
  58875. height: imgHeight,
  58876. kind: _util.ImageKind.RGBA_32BPP,
  58877. data: imgData,
  58878. },
  58879. map,
  58880. ]);
  58881. return iFirstSave + 1;
  58882. }
  58883. );
  58884. addState(
  58885. InitialState,
  58886. [
  58887. _util.OPS.save,
  58888. _util.OPS.transform,
  58889. _util.OPS.paintImageMaskXObject,
  58890. _util.OPS.restore,
  58891. ],
  58892. null,
  58893. function iterateImageMaskGroup(context, i) {
  58894. const fnArray = context.fnArray;
  58895. const iFirstSave = context.iCurr - 3;
  58896. const pos = (i - iFirstSave) % 4;
  58897. switch (pos) {
  58898. case 0:
  58899. return fnArray[i] === _util.OPS.save;
  58900. case 1:
  58901. return fnArray[i] === _util.OPS.transform;
  58902. case 2:
  58903. return fnArray[i] === _util.OPS.paintImageMaskXObject;
  58904. case 3:
  58905. return fnArray[i] === _util.OPS.restore;
  58906. }
  58907. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  58908. },
  58909. function foundImageMaskGroup(context, i) {
  58910. const MIN_IMAGES_IN_MASKS_BLOCK = 10;
  58911. const MAX_IMAGES_IN_MASKS_BLOCK = 100;
  58912. const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  58913. const fnArray = context.fnArray,
  58914. argsArray = context.argsArray;
  58915. const curr = context.iCurr;
  58916. const iFirstSave = curr - 3;
  58917. const iFirstTransform = curr - 2;
  58918. const iFirstPIMXO = curr - 1;
  58919. let count = Math.floor((i - iFirstSave) / 4);
  58920. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  58921. return i - ((i - iFirstSave) % 4);
  58922. }
  58923. let isSameImage = false;
  58924. let iTransform, transformArgs;
  58925. const firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  58926. const firstTransformArg0 = argsArray[iFirstTransform][0],
  58927. firstTransformArg1 = argsArray[iFirstTransform][1],
  58928. firstTransformArg2 = argsArray[iFirstTransform][2],
  58929. firstTransformArg3 = argsArray[iFirstTransform][3];
  58930. if (firstTransformArg1 === firstTransformArg2) {
  58931. isSameImage = true;
  58932. iTransform = iFirstTransform + 4;
  58933. let iPIMXO = iFirstPIMXO + 4;
  58934. for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  58935. transformArgs = argsArray[iTransform];
  58936. if (
  58937. argsArray[iPIMXO][0] !== firstPIMXOArg0 ||
  58938. transformArgs[0] !== firstTransformArg0 ||
  58939. transformArgs[1] !== firstTransformArg1 ||
  58940. transformArgs[2] !== firstTransformArg2 ||
  58941. transformArgs[3] !== firstTransformArg3
  58942. ) {
  58943. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  58944. isSameImage = false;
  58945. } else {
  58946. count = q;
  58947. }
  58948. break;
  58949. }
  58950. }
  58951. }
  58952. if (isSameImage) {
  58953. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  58954. const positions = new Float32Array(count * 2);
  58955. iTransform = iFirstTransform;
  58956. for (let q = 0; q < count; q++, iTransform += 4) {
  58957. transformArgs = argsArray[iTransform];
  58958. positions[q << 1] = transformArgs[4];
  58959. positions[(q << 1) + 1] = transformArgs[5];
  58960. }
  58961. fnArray.splice(
  58962. iFirstSave,
  58963. count * 4,
  58964. _util.OPS.paintImageMaskXObjectRepeat
  58965. );
  58966. argsArray.splice(iFirstSave, count * 4, [
  58967. firstPIMXOArg0,
  58968. firstTransformArg0,
  58969. firstTransformArg1,
  58970. firstTransformArg2,
  58971. firstTransformArg3,
  58972. positions,
  58973. ]);
  58974. } else {
  58975. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  58976. const images = [];
  58977. for (let q = 0; q < count; q++) {
  58978. transformArgs = argsArray[iFirstTransform + (q << 2)];
  58979. const maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  58980. images.push({
  58981. data: maskParams.data,
  58982. width: maskParams.width,
  58983. height: maskParams.height,
  58984. interpolate: maskParams.interpolate,
  58985. count: maskParams.count,
  58986. transform: transformArgs,
  58987. });
  58988. }
  58989. fnArray.splice(
  58990. iFirstSave,
  58991. count * 4,
  58992. _util.OPS.paintImageMaskXObjectGroup
  58993. );
  58994. argsArray.splice(iFirstSave, count * 4, [images]);
  58995. }
  58996. return iFirstSave + 1;
  58997. }
  58998. );
  58999. addState(
  59000. InitialState,
  59001. [
  59002. _util.OPS.save,
  59003. _util.OPS.transform,
  59004. _util.OPS.paintImageXObject,
  59005. _util.OPS.restore,
  59006. ],
  59007. function (context) {
  59008. const argsArray = context.argsArray;
  59009. const iFirstTransform = context.iCurr - 2;
  59010. return (
  59011. argsArray[iFirstTransform][1] === 0 &&
  59012. argsArray[iFirstTransform][2] === 0
  59013. );
  59014. },
  59015. function iterateImageGroup(context, i) {
  59016. const fnArray = context.fnArray,
  59017. argsArray = context.argsArray;
  59018. const iFirstSave = context.iCurr - 3;
  59019. const pos = (i - iFirstSave) % 4;
  59020. switch (pos) {
  59021. case 0:
  59022. return fnArray[i] === _util.OPS.save;
  59023. case 1:
  59024. if (fnArray[i] !== _util.OPS.transform) {
  59025. return false;
  59026. }
  59027. const iFirstTransform = context.iCurr - 2;
  59028. const firstTransformArg0 = argsArray[iFirstTransform][0];
  59029. const firstTransformArg3 = argsArray[iFirstTransform][3];
  59030. if (
  59031. argsArray[i][0] !== firstTransformArg0 ||
  59032. argsArray[i][1] !== 0 ||
  59033. argsArray[i][2] !== 0 ||
  59034. argsArray[i][3] !== firstTransformArg3
  59035. ) {
  59036. return false;
  59037. }
  59038. return true;
  59039. case 2:
  59040. if (fnArray[i] !== _util.OPS.paintImageXObject) {
  59041. return false;
  59042. }
  59043. const iFirstPIXO = context.iCurr - 1;
  59044. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  59045. if (argsArray[i][0] !== firstPIXOArg0) {
  59046. return false;
  59047. }
  59048. return true;
  59049. case 3:
  59050. return fnArray[i] === _util.OPS.restore;
  59051. }
  59052. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  59053. },
  59054. function (context, i) {
  59055. const MIN_IMAGES_IN_BLOCK = 3;
  59056. const MAX_IMAGES_IN_BLOCK = 1000;
  59057. const fnArray = context.fnArray,
  59058. argsArray = context.argsArray;
  59059. const curr = context.iCurr;
  59060. const iFirstSave = curr - 3;
  59061. const iFirstTransform = curr - 2;
  59062. const iFirstPIXO = curr - 1;
  59063. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  59064. const firstTransformArg0 = argsArray[iFirstTransform][0];
  59065. const firstTransformArg3 = argsArray[iFirstTransform][3];
  59066. const count = Math.min(
  59067. Math.floor((i - iFirstSave) / 4),
  59068. MAX_IMAGES_IN_BLOCK
  59069. );
  59070. if (count < MIN_IMAGES_IN_BLOCK) {
  59071. return i - ((i - iFirstSave) % 4);
  59072. }
  59073. const positions = new Float32Array(count * 2);
  59074. let iTransform = iFirstTransform;
  59075. for (let q = 0; q < count; q++, iTransform += 4) {
  59076. const transformArgs = argsArray[iTransform];
  59077. positions[q << 1] = transformArgs[4];
  59078. positions[(q << 1) + 1] = transformArgs[5];
  59079. }
  59080. const args = [
  59081. firstPIXOArg0,
  59082. firstTransformArg0,
  59083. firstTransformArg3,
  59084. positions,
  59085. ];
  59086. fnArray.splice(
  59087. iFirstSave,
  59088. count * 4,
  59089. _util.OPS.paintImageXObjectRepeat
  59090. );
  59091. argsArray.splice(iFirstSave, count * 4, args);
  59092. return iFirstSave + 1;
  59093. }
  59094. );
  59095. addState(
  59096. InitialState,
  59097. [
  59098. _util.OPS.beginText,
  59099. _util.OPS.setFont,
  59100. _util.OPS.setTextMatrix,
  59101. _util.OPS.showText,
  59102. _util.OPS.endText,
  59103. ],
  59104. null,
  59105. function iterateShowTextGroup(context, i) {
  59106. const fnArray = context.fnArray,
  59107. argsArray = context.argsArray;
  59108. const iFirstSave = context.iCurr - 4;
  59109. const pos = (i - iFirstSave) % 5;
  59110. switch (pos) {
  59111. case 0:
  59112. return fnArray[i] === _util.OPS.beginText;
  59113. case 1:
  59114. return fnArray[i] === _util.OPS.setFont;
  59115. case 2:
  59116. return fnArray[i] === _util.OPS.setTextMatrix;
  59117. case 3:
  59118. if (fnArray[i] !== _util.OPS.showText) {
  59119. return false;
  59120. }
  59121. const iFirstSetFont = context.iCurr - 3;
  59122. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  59123. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  59124. if (
  59125. argsArray[i][0] !== firstSetFontArg0 ||
  59126. argsArray[i][1] !== firstSetFontArg1
  59127. ) {
  59128. return false;
  59129. }
  59130. return true;
  59131. case 4:
  59132. return fnArray[i] === _util.OPS.endText;
  59133. }
  59134. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  59135. },
  59136. function (context, i) {
  59137. const MIN_CHARS_IN_BLOCK = 3;
  59138. const MAX_CHARS_IN_BLOCK = 1000;
  59139. const fnArray = context.fnArray,
  59140. argsArray = context.argsArray;
  59141. const curr = context.iCurr;
  59142. const iFirstBeginText = curr - 4;
  59143. const iFirstSetFont = curr - 3;
  59144. const iFirstSetTextMatrix = curr - 2;
  59145. const iFirstShowText = curr - 1;
  59146. const iFirstEndText = curr;
  59147. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  59148. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  59149. let count = Math.min(
  59150. Math.floor((i - iFirstBeginText) / 5),
  59151. MAX_CHARS_IN_BLOCK
  59152. );
  59153. if (count < MIN_CHARS_IN_BLOCK) {
  59154. return i - ((i - iFirstBeginText) % 5);
  59155. }
  59156. let iFirst = iFirstBeginText;
  59157. if (
  59158. iFirstBeginText >= 4 &&
  59159. fnArray[iFirstBeginText - 4] === fnArray[iFirstSetFont] &&
  59160. fnArray[iFirstBeginText - 3] === fnArray[iFirstSetTextMatrix] &&
  59161. fnArray[iFirstBeginText - 2] === fnArray[iFirstShowText] &&
  59162. fnArray[iFirstBeginText - 1] === fnArray[iFirstEndText] &&
  59163. argsArray[iFirstBeginText - 4][0] === firstSetFontArg0 &&
  59164. argsArray[iFirstBeginText - 4][1] === firstSetFontArg1
  59165. ) {
  59166. count++;
  59167. iFirst -= 5;
  59168. }
  59169. let iEndText = iFirst + 4;
  59170. for (let q = 1; q < count; q++) {
  59171. fnArray.splice(iEndText, 3);
  59172. argsArray.splice(iEndText, 3);
  59173. iEndText += 2;
  59174. }
  59175. return iEndText + 1;
  59176. }
  59177. );
  59178. class NullOptimizer {
  59179. constructor(queue) {
  59180. this.queue = queue;
  59181. }
  59182. _optimize() {}
  59183. push(fn, args) {
  59184. this.queue.fnArray.push(fn);
  59185. this.queue.argsArray.push(args);
  59186. this._optimize();
  59187. }
  59188. flush() {}
  59189. reset() {}
  59190. }
  59191. class QueueOptimizer extends NullOptimizer {
  59192. constructor(queue) {
  59193. super(queue);
  59194. this.state = null;
  59195. this.context = {
  59196. iCurr: 0,
  59197. fnArray: queue.fnArray,
  59198. argsArray: queue.argsArray,
  59199. };
  59200. this.match = null;
  59201. this.lastProcessed = 0;
  59202. }
  59203. _optimize() {
  59204. const fnArray = this.queue.fnArray;
  59205. let i = this.lastProcessed,
  59206. ii = fnArray.length;
  59207. let state = this.state;
  59208. let match = this.match;
  59209. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  59210. this.lastProcessed = ii;
  59211. return;
  59212. }
  59213. const context = this.context;
  59214. while (i < ii) {
  59215. if (match) {
  59216. const iterate = (0, match.iterateFn)(context, i);
  59217. if (iterate) {
  59218. i++;
  59219. continue;
  59220. }
  59221. i = (0, match.processFn)(context, i + 1);
  59222. ii = fnArray.length;
  59223. match = null;
  59224. state = null;
  59225. if (i >= ii) {
  59226. break;
  59227. }
  59228. }
  59229. state = (state || InitialState)[fnArray[i]];
  59230. if (!state || Array.isArray(state)) {
  59231. i++;
  59232. continue;
  59233. }
  59234. context.iCurr = i;
  59235. i++;
  59236. if (state.checkFn && !(0, state.checkFn)(context)) {
  59237. state = null;
  59238. continue;
  59239. }
  59240. match = state;
  59241. state = null;
  59242. }
  59243. this.state = state;
  59244. this.match = match;
  59245. this.lastProcessed = i;
  59246. }
  59247. flush() {
  59248. while (this.match) {
  59249. const length = this.queue.fnArray.length;
  59250. this.lastProcessed = (0, this.match.processFn)(
  59251. this.context,
  59252. length
  59253. );
  59254. this.match = null;
  59255. this.state = null;
  59256. this._optimize();
  59257. }
  59258. }
  59259. reset() {
  59260. this.state = null;
  59261. this.match = null;
  59262. this.lastProcessed = 0;
  59263. }
  59264. }
  59265. class OperatorList {
  59266. static get CHUNK_SIZE() {
  59267. return (0, _util.shadow)(this, "CHUNK_SIZE", 1000);
  59268. }
  59269. static get CHUNK_SIZE_ABOUT() {
  59270. return (0, _util.shadow)(
  59271. this,
  59272. "CHUNK_SIZE_ABOUT",
  59273. this.CHUNK_SIZE - 5
  59274. );
  59275. }
  59276. constructor(intent = 0, streamSink) {
  59277. this._streamSink = streamSink;
  59278. this.fnArray = [];
  59279. this.argsArray = [];
  59280. if (streamSink && !(intent & _util.RenderingIntentFlag.OPLIST)) {
  59281. this.optimizer = new QueueOptimizer(this);
  59282. } else {
  59283. this.optimizer = new NullOptimizer(this);
  59284. }
  59285. this.dependencies = new Set();
  59286. this._totalLength = 0;
  59287. this.weight = 0;
  59288. this._resolved = streamSink ? null : Promise.resolve();
  59289. }
  59290. get length() {
  59291. return this.argsArray.length;
  59292. }
  59293. get ready() {
  59294. return this._resolved || this._streamSink.ready;
  59295. }
  59296. get totalLength() {
  59297. return this._totalLength + this.length;
  59298. }
  59299. addOp(fn, args) {
  59300. this.optimizer.push(fn, args);
  59301. this.weight++;
  59302. if (this._streamSink) {
  59303. if (this.weight >= OperatorList.CHUNK_SIZE) {
  59304. this.flush();
  59305. } else if (
  59306. this.weight >= OperatorList.CHUNK_SIZE_ABOUT &&
  59307. (fn === _util.OPS.restore || fn === _util.OPS.endText)
  59308. ) {
  59309. this.flush();
  59310. }
  59311. }
  59312. }
  59313. addImageOps(fn, args, optionalContent) {
  59314. if (optionalContent !== undefined) {
  59315. this.addOp(_util.OPS.beginMarkedContentProps, [
  59316. "OC",
  59317. optionalContent,
  59318. ]);
  59319. }
  59320. this.addOp(fn, args);
  59321. if (optionalContent !== undefined) {
  59322. this.addOp(_util.OPS.endMarkedContent, []);
  59323. }
  59324. }
  59325. addDependency(dependency) {
  59326. if (this.dependencies.has(dependency)) {
  59327. return;
  59328. }
  59329. this.dependencies.add(dependency);
  59330. this.addOp(_util.OPS.dependency, [dependency]);
  59331. }
  59332. addDependencies(dependencies) {
  59333. for (const dependency of dependencies) {
  59334. this.addDependency(dependency);
  59335. }
  59336. }
  59337. addOpList(opList) {
  59338. if (!(opList instanceof OperatorList)) {
  59339. (0, _util.warn)(
  59340. 'addOpList - ignoring invalid "opList" parameter.'
  59341. );
  59342. return;
  59343. }
  59344. for (const dependency of opList.dependencies) {
  59345. this.dependencies.add(dependency);
  59346. }
  59347. for (let i = 0, ii = opList.length; i < ii; i++) {
  59348. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  59349. }
  59350. }
  59351. getIR() {
  59352. return {
  59353. fnArray: this.fnArray,
  59354. argsArray: this.argsArray,
  59355. length: this.length,
  59356. };
  59357. }
  59358. get _transfers() {
  59359. const transfers = [];
  59360. const { fnArray, argsArray, length } = this;
  59361. for (let i = 0; i < length; i++) {
  59362. switch (fnArray[i]) {
  59363. case _util.OPS.paintInlineImageXObject:
  59364. case _util.OPS.paintInlineImageXObjectGroup:
  59365. case _util.OPS.paintImageMaskXObject:
  59366. const arg = argsArray[i][0];
  59367. if (
  59368. !arg.cached &&
  59369. arg.data &&
  59370. arg.data.buffer instanceof ArrayBuffer
  59371. ) {
  59372. transfers.push(arg.data.buffer);
  59373. }
  59374. break;
  59375. }
  59376. }
  59377. return transfers;
  59378. }
  59379. flush(lastChunk = false, separateAnnots = null) {
  59380. this.optimizer.flush();
  59381. const length = this.length;
  59382. this._totalLength += length;
  59383. this._streamSink.enqueue(
  59384. {
  59385. fnArray: this.fnArray,
  59386. argsArray: this.argsArray,
  59387. lastChunk,
  59388. separateAnnots,
  59389. length,
  59390. },
  59391. 1,
  59392. this._transfers
  59393. );
  59394. this.dependencies.clear();
  59395. this.fnArray.length = 0;
  59396. this.argsArray.length = 0;
  59397. this.weight = 0;
  59398. this.optimizer.reset();
  59399. }
  59400. }
  59401. exports.OperatorList = OperatorList;
  59402. /***/
  59403. },
  59404. /* 63 */
  59405. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59406. Object.defineProperty(exports, "__esModule", {
  59407. value: true,
  59408. });
  59409. exports.PDFImage = void 0;
  59410. var _util = __w_pdfjs_require__(2);
  59411. var _image_utils = __w_pdfjs_require__(64);
  59412. var _base_stream = __w_pdfjs_require__(7);
  59413. var _colorspace = __w_pdfjs_require__(14);
  59414. var _decode_stream = __w_pdfjs_require__(19);
  59415. var _jpeg_stream = __w_pdfjs_require__(27);
  59416. var _jpx = __w_pdfjs_require__(30);
  59417. var _primitives = __w_pdfjs_require__(5);
  59418. function decodeAndClamp(value, addend, coefficient, max) {
  59419. value = addend + value * coefficient;
  59420. if (value < 0) {
  59421. value = 0;
  59422. } else if (value > max) {
  59423. value = max;
  59424. }
  59425. return value;
  59426. }
  59427. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  59428. const length = w2 * h2;
  59429. let dest;
  59430. if (bpc <= 8) {
  59431. dest = new Uint8Array(length);
  59432. } else if (bpc <= 16) {
  59433. dest = new Uint16Array(length);
  59434. } else {
  59435. dest = new Uint32Array(length);
  59436. }
  59437. const xRatio = w1 / w2;
  59438. const yRatio = h1 / h2;
  59439. let i,
  59440. j,
  59441. py,
  59442. newIndex = 0,
  59443. oldIndex;
  59444. const xScaled = new Uint16Array(w2);
  59445. const w1Scanline = w1;
  59446. for (i = 0; i < w2; i++) {
  59447. xScaled[i] = Math.floor(i * xRatio);
  59448. }
  59449. for (i = 0; i < h2; i++) {
  59450. py = Math.floor(i * yRatio) * w1Scanline;
  59451. for (j = 0; j < w2; j++) {
  59452. oldIndex = py + xScaled[j];
  59453. dest[newIndex++] = src[oldIndex];
  59454. }
  59455. }
  59456. return dest;
  59457. }
  59458. class PDFImage {
  59459. constructor({
  59460. xref,
  59461. res,
  59462. image,
  59463. isInline = false,
  59464. smask = null,
  59465. mask = null,
  59466. isMask = false,
  59467. pdfFunctionFactory,
  59468. localColorSpaceCache,
  59469. }) {
  59470. this.image = image;
  59471. const dict = image.dict;
  59472. const filter = dict.get("F", "Filter");
  59473. let filterName;
  59474. if (filter instanceof _primitives.Name) {
  59475. filterName = filter.name;
  59476. } else if (Array.isArray(filter)) {
  59477. const filterZero = xref.fetchIfRef(filter[0]);
  59478. if (filterZero instanceof _primitives.Name) {
  59479. filterName = filterZero.name;
  59480. }
  59481. }
  59482. switch (filterName) {
  59483. case "JPXDecode":
  59484. const jpxImage = new _jpx.JpxImage();
  59485. jpxImage.parseImageProperties(image.stream);
  59486. image.stream.reset();
  59487. image.width = jpxImage.width;
  59488. image.height = jpxImage.height;
  59489. image.bitsPerComponent = jpxImage.bitsPerComponent;
  59490. image.numComps = jpxImage.componentsCount;
  59491. break;
  59492. case "JBIG2Decode":
  59493. image.bitsPerComponent = 1;
  59494. image.numComps = 1;
  59495. break;
  59496. }
  59497. let width = dict.get("W", "Width");
  59498. let height = dict.get("H", "Height");
  59499. if (
  59500. Number.isInteger(image.width) &&
  59501. image.width > 0 &&
  59502. Number.isInteger(image.height) &&
  59503. image.height > 0 &&
  59504. (image.width !== width || image.height !== height)
  59505. ) {
  59506. (0, _util.warn)(
  59507. "PDFImage - using the Width/Height of the image data, " +
  59508. "rather than the image dictionary."
  59509. );
  59510. width = image.width;
  59511. height = image.height;
  59512. }
  59513. if (width < 1 || height < 1) {
  59514. throw new _util.FormatError(
  59515. `Invalid image width: ${width} or height: ${height}`
  59516. );
  59517. }
  59518. this.width = width;
  59519. this.height = height;
  59520. this.interpolate = dict.get("I", "Interpolate");
  59521. this.imageMask = dict.get("IM", "ImageMask") || false;
  59522. this.matte = dict.get("Matte") || false;
  59523. let bitsPerComponent = image.bitsPerComponent;
  59524. if (!bitsPerComponent) {
  59525. bitsPerComponent = dict.get("BPC", "BitsPerComponent");
  59526. if (!bitsPerComponent) {
  59527. if (this.imageMask) {
  59528. bitsPerComponent = 1;
  59529. } else {
  59530. throw new _util.FormatError(
  59531. `Bits per component missing in image: ${this.imageMask}`
  59532. );
  59533. }
  59534. }
  59535. }
  59536. this.bpc = bitsPerComponent;
  59537. if (!this.imageMask) {
  59538. let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace");
  59539. if (!colorSpace) {
  59540. (0, _util.info)(
  59541. "JPX images (which do not require color spaces)"
  59542. );
  59543. switch (image.numComps) {
  59544. case 1:
  59545. colorSpace = _primitives.Name.get("DeviceGray");
  59546. break;
  59547. case 3:
  59548. colorSpace = _primitives.Name.get("DeviceRGB");
  59549. break;
  59550. case 4:
  59551. colorSpace = _primitives.Name.get("DeviceCMYK");
  59552. break;
  59553. default:
  59554. throw new Error(
  59555. `JPX images with ${image.numComps} color components not supported.`
  59556. );
  59557. }
  59558. }
  59559. this.colorSpace = _colorspace.ColorSpace.parse({
  59560. cs: colorSpace,
  59561. xref,
  59562. resources: isInline ? res : null,
  59563. pdfFunctionFactory,
  59564. localColorSpaceCache,
  59565. });
  59566. this.numComps = this.colorSpace.numComps;
  59567. }
  59568. this.decode = dict.getArray("D", "Decode");
  59569. this.needsDecode = false;
  59570. if (
  59571. this.decode &&
  59572. ((this.colorSpace &&
  59573. !this.colorSpace.isDefaultDecode(
  59574. this.decode,
  59575. bitsPerComponent
  59576. )) ||
  59577. (isMask &&
  59578. !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1)))
  59579. ) {
  59580. this.needsDecode = true;
  59581. const max = (1 << bitsPerComponent) - 1;
  59582. this.decodeCoefficients = [];
  59583. this.decodeAddends = [];
  59584. const isIndexed =
  59585. this.colorSpace && this.colorSpace.name === "Indexed";
  59586. for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  59587. const dmin = this.decode[i];
  59588. const dmax = this.decode[i + 1];
  59589. this.decodeCoefficients[j] = isIndexed
  59590. ? (dmax - dmin) / max
  59591. : dmax - dmin;
  59592. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  59593. }
  59594. }
  59595. if (smask) {
  59596. this.smask = new PDFImage({
  59597. xref,
  59598. res,
  59599. image: smask,
  59600. isInline,
  59601. pdfFunctionFactory,
  59602. localColorSpaceCache,
  59603. });
  59604. } else if (mask) {
  59605. if (mask instanceof _base_stream.BaseStream) {
  59606. const maskDict = mask.dict,
  59607. imageMask = maskDict.get("IM", "ImageMask");
  59608. if (!imageMask) {
  59609. (0, _util.warn)(
  59610. "Ignoring /Mask in image without /ImageMask."
  59611. );
  59612. } else {
  59613. this.mask = new PDFImage({
  59614. xref,
  59615. res,
  59616. image: mask,
  59617. isInline,
  59618. isMask: true,
  59619. pdfFunctionFactory,
  59620. localColorSpaceCache,
  59621. });
  59622. }
  59623. } else {
  59624. this.mask = mask;
  59625. }
  59626. }
  59627. }
  59628. static async buildImage({
  59629. xref,
  59630. res,
  59631. image,
  59632. isInline = false,
  59633. pdfFunctionFactory,
  59634. localColorSpaceCache,
  59635. }) {
  59636. const imageData = image;
  59637. let smaskData = null;
  59638. let maskData = null;
  59639. const smask = image.dict.get("SMask");
  59640. const mask = image.dict.get("Mask");
  59641. if (smask) {
  59642. if (smask instanceof _base_stream.BaseStream) {
  59643. smaskData = smask;
  59644. } else {
  59645. (0, _util.warn)("Unsupported /SMask format.");
  59646. }
  59647. } else if (mask) {
  59648. if (
  59649. mask instanceof _base_stream.BaseStream ||
  59650. Array.isArray(mask)
  59651. ) {
  59652. maskData = mask;
  59653. } else {
  59654. (0, _util.warn)("Unsupported /Mask format.");
  59655. }
  59656. }
  59657. return new PDFImage({
  59658. xref,
  59659. res,
  59660. image: imageData,
  59661. isInline,
  59662. smask: smaskData,
  59663. mask: maskData,
  59664. pdfFunctionFactory,
  59665. localColorSpaceCache,
  59666. });
  59667. }
  59668. static createRawMask({
  59669. imgArray,
  59670. width,
  59671. height,
  59672. imageIsFromDecodeStream,
  59673. inverseDecode,
  59674. interpolate,
  59675. }) {
  59676. const computedLength = ((width + 7) >> 3) * height;
  59677. const actualLength = imgArray.byteLength;
  59678. const haveFullData = computedLength === actualLength;
  59679. let data, i;
  59680. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  59681. data = imgArray;
  59682. } else if (!inverseDecode) {
  59683. data = new Uint8Array(imgArray);
  59684. } else {
  59685. data = new Uint8Array(computedLength);
  59686. data.set(imgArray);
  59687. data.fill(0xff, actualLength);
  59688. }
  59689. if (inverseDecode) {
  59690. for (i = 0; i < actualLength; i++) {
  59691. data[i] ^= 0xff;
  59692. }
  59693. }
  59694. return {
  59695. data,
  59696. width,
  59697. height,
  59698. interpolate,
  59699. };
  59700. }
  59701. static createMask({
  59702. imgArray,
  59703. width,
  59704. height,
  59705. imageIsFromDecodeStream,
  59706. inverseDecode,
  59707. interpolate,
  59708. }) {
  59709. const isSingleOpaquePixel =
  59710. width === 1 &&
  59711. height === 1 &&
  59712. inverseDecode ===
  59713. (imgArray.length === 0 || !!(imgArray[0] & 128));
  59714. if (isSingleOpaquePixel) {
  59715. return {
  59716. isSingleOpaquePixel,
  59717. };
  59718. }
  59719. if (_util.FeatureTest.isOffscreenCanvasSupported) {
  59720. const canvas = new OffscreenCanvas(width, height);
  59721. const ctx = canvas.getContext("2d");
  59722. const imgData = ctx.createImageData(width, height);
  59723. (0, _image_utils.applyMaskImageData)({
  59724. src: imgArray,
  59725. dest: imgData.data,
  59726. width,
  59727. height,
  59728. inverseDecode,
  59729. });
  59730. ctx.putImageData(imgData, 0, 0);
  59731. const bitmap = canvas.transferToImageBitmap();
  59732. return {
  59733. data: null,
  59734. width,
  59735. height,
  59736. interpolate,
  59737. bitmap,
  59738. };
  59739. }
  59740. return this.createRawMask({
  59741. imgArray,
  59742. width,
  59743. height,
  59744. inverseDecode,
  59745. imageIsFromDecodeStream,
  59746. interpolate,
  59747. });
  59748. }
  59749. get drawWidth() {
  59750. return Math.max(
  59751. this.width,
  59752. (this.smask && this.smask.width) || 0,
  59753. (this.mask && this.mask.width) || 0
  59754. );
  59755. }
  59756. get drawHeight() {
  59757. return Math.max(
  59758. this.height,
  59759. (this.smask && this.smask.height) || 0,
  59760. (this.mask && this.mask.height) || 0
  59761. );
  59762. }
  59763. decodeBuffer(buffer) {
  59764. const bpc = this.bpc;
  59765. const numComps = this.numComps;
  59766. const decodeAddends = this.decodeAddends;
  59767. const decodeCoefficients = this.decodeCoefficients;
  59768. const max = (1 << bpc) - 1;
  59769. let i, ii;
  59770. if (bpc === 1) {
  59771. for (i = 0, ii = buffer.length; i < ii; i++) {
  59772. buffer[i] = +!buffer[i];
  59773. }
  59774. return;
  59775. }
  59776. let index = 0;
  59777. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  59778. for (let j = 0; j < numComps; j++) {
  59779. buffer[index] = decodeAndClamp(
  59780. buffer[index],
  59781. decodeAddends[j],
  59782. decodeCoefficients[j],
  59783. max
  59784. );
  59785. index++;
  59786. }
  59787. }
  59788. }
  59789. getComponents(buffer) {
  59790. const bpc = this.bpc;
  59791. if (bpc === 8) {
  59792. return buffer;
  59793. }
  59794. const width = this.width;
  59795. const height = this.height;
  59796. const numComps = this.numComps;
  59797. const length = width * height * numComps;
  59798. let bufferPos = 0;
  59799. let output;
  59800. if (bpc <= 8) {
  59801. output = new Uint8Array(length);
  59802. } else if (bpc <= 16) {
  59803. output = new Uint16Array(length);
  59804. } else {
  59805. output = new Uint32Array(length);
  59806. }
  59807. const rowComps = width * numComps;
  59808. const max = (1 << bpc) - 1;
  59809. let i = 0,
  59810. ii,
  59811. buf;
  59812. if (bpc === 1) {
  59813. let mask, loop1End, loop2End;
  59814. for (let j = 0; j < height; j++) {
  59815. loop1End = i + (rowComps & ~7);
  59816. loop2End = i + rowComps;
  59817. while (i < loop1End) {
  59818. buf = buffer[bufferPos++];
  59819. output[i] = (buf >> 7) & 1;
  59820. output[i + 1] = (buf >> 6) & 1;
  59821. output[i + 2] = (buf >> 5) & 1;
  59822. output[i + 3] = (buf >> 4) & 1;
  59823. output[i + 4] = (buf >> 3) & 1;
  59824. output[i + 5] = (buf >> 2) & 1;
  59825. output[i + 6] = (buf >> 1) & 1;
  59826. output[i + 7] = buf & 1;
  59827. i += 8;
  59828. }
  59829. if (i < loop2End) {
  59830. buf = buffer[bufferPos++];
  59831. mask = 128;
  59832. while (i < loop2End) {
  59833. output[i++] = +!!(buf & mask);
  59834. mask >>= 1;
  59835. }
  59836. }
  59837. }
  59838. } else {
  59839. let bits = 0;
  59840. buf = 0;
  59841. for (i = 0, ii = length; i < ii; ++i) {
  59842. if (i % rowComps === 0) {
  59843. buf = 0;
  59844. bits = 0;
  59845. }
  59846. while (bits < bpc) {
  59847. buf = (buf << 8) | buffer[bufferPos++];
  59848. bits += 8;
  59849. }
  59850. const remainingBits = bits - bpc;
  59851. let value = buf >> remainingBits;
  59852. if (value < 0) {
  59853. value = 0;
  59854. } else if (value > max) {
  59855. value = max;
  59856. }
  59857. output[i] = value;
  59858. buf &= (1 << remainingBits) - 1;
  59859. bits = remainingBits;
  59860. }
  59861. }
  59862. return output;
  59863. }
  59864. fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  59865. const smask = this.smask;
  59866. const mask = this.mask;
  59867. let alphaBuf, sw, sh, i, ii, j;
  59868. if (smask) {
  59869. sw = smask.width;
  59870. sh = smask.height;
  59871. alphaBuf = new Uint8ClampedArray(sw * sh);
  59872. smask.fillGrayBuffer(alphaBuf);
  59873. if (sw !== width || sh !== height) {
  59874. alphaBuf = resizeImageMask(
  59875. alphaBuf,
  59876. smask.bpc,
  59877. sw,
  59878. sh,
  59879. width,
  59880. height
  59881. );
  59882. }
  59883. } else if (mask) {
  59884. if (mask instanceof PDFImage) {
  59885. sw = mask.width;
  59886. sh = mask.height;
  59887. alphaBuf = new Uint8ClampedArray(sw * sh);
  59888. mask.numComps = 1;
  59889. mask.fillGrayBuffer(alphaBuf);
  59890. for (i = 0, ii = sw * sh; i < ii; ++i) {
  59891. alphaBuf[i] = 255 - alphaBuf[i];
  59892. }
  59893. if (sw !== width || sh !== height) {
  59894. alphaBuf = resizeImageMask(
  59895. alphaBuf,
  59896. mask.bpc,
  59897. sw,
  59898. sh,
  59899. width,
  59900. height
  59901. );
  59902. }
  59903. } else if (Array.isArray(mask)) {
  59904. alphaBuf = new Uint8ClampedArray(width * height);
  59905. const numComps = this.numComps;
  59906. for (i = 0, ii = width * height; i < ii; ++i) {
  59907. let opacity = 0;
  59908. const imageOffset = i * numComps;
  59909. for (j = 0; j < numComps; ++j) {
  59910. const color = image[imageOffset + j];
  59911. const maskOffset = j * 2;
  59912. if (
  59913. color < mask[maskOffset] ||
  59914. color > mask[maskOffset + 1]
  59915. ) {
  59916. opacity = 255;
  59917. break;
  59918. }
  59919. }
  59920. alphaBuf[i] = opacity;
  59921. }
  59922. } else {
  59923. throw new _util.FormatError("Unknown mask format.");
  59924. }
  59925. }
  59926. if (alphaBuf) {
  59927. for (
  59928. i = 0, j = 3, ii = width * actualHeight;
  59929. i < ii;
  59930. ++i, j += 4
  59931. ) {
  59932. rgbaBuf[j] = alphaBuf[i];
  59933. }
  59934. } else {
  59935. for (
  59936. i = 0, j = 3, ii = width * actualHeight;
  59937. i < ii;
  59938. ++i, j += 4
  59939. ) {
  59940. rgbaBuf[j] = 255;
  59941. }
  59942. }
  59943. }
  59944. undoPreblend(buffer, width, height) {
  59945. const matte = this.smask && this.smask.matte;
  59946. if (!matte) {
  59947. return;
  59948. }
  59949. const matteRgb = this.colorSpace.getRgb(matte, 0);
  59950. const matteR = matteRgb[0];
  59951. const matteG = matteRgb[1];
  59952. const matteB = matteRgb[2];
  59953. const length = width * height * 4;
  59954. for (let i = 0; i < length; i += 4) {
  59955. const alpha = buffer[i + 3];
  59956. if (alpha === 0) {
  59957. buffer[i] = 255;
  59958. buffer[i + 1] = 255;
  59959. buffer[i + 2] = 255;
  59960. continue;
  59961. }
  59962. const k = 255 / alpha;
  59963. buffer[i] = (buffer[i] - matteR) * k + matteR;
  59964. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  59965. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  59966. }
  59967. }
  59968. createImageData(forceRGBA = false) {
  59969. const drawWidth = this.drawWidth;
  59970. const drawHeight = this.drawHeight;
  59971. const imgData = {
  59972. width: drawWidth,
  59973. height: drawHeight,
  59974. interpolate: this.interpolate,
  59975. kind: 0,
  59976. data: null,
  59977. };
  59978. const numComps = this.numComps;
  59979. const originalWidth = this.width;
  59980. const originalHeight = this.height;
  59981. const bpc = this.bpc;
  59982. const rowBytes = (originalWidth * numComps * bpc + 7) >> 3;
  59983. if (!forceRGBA) {
  59984. let kind;
  59985. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  59986. kind = _util.ImageKind.GRAYSCALE_1BPP;
  59987. } else if (
  59988. this.colorSpace.name === "DeviceRGB" &&
  59989. bpc === 8 &&
  59990. !this.needsDecode
  59991. ) {
  59992. kind = _util.ImageKind.RGB_24BPP;
  59993. }
  59994. if (
  59995. kind &&
  59996. !this.smask &&
  59997. !this.mask &&
  59998. drawWidth === originalWidth &&
  59999. drawHeight === originalHeight
  60000. ) {
  60001. imgData.kind = kind;
  60002. imgData.data = this.getImageBytes(
  60003. originalHeight * rowBytes,
  60004. {}
  60005. );
  60006. if (this.needsDecode) {
  60007. (0, _util.assert)(
  60008. kind === _util.ImageKind.GRAYSCALE_1BPP,
  60009. "PDFImage.createImageData: The image must be grayscale."
  60010. );
  60011. const buffer = imgData.data;
  60012. for (let i = 0, ii = buffer.length; i < ii; i++) {
  60013. buffer[i] ^= 0xff;
  60014. }
  60015. }
  60016. return imgData;
  60017. }
  60018. if (
  60019. this.image instanceof _jpeg_stream.JpegStream &&
  60020. !this.smask &&
  60021. !this.mask
  60022. ) {
  60023. let imageLength = originalHeight * rowBytes;
  60024. switch (this.colorSpace.name) {
  60025. case "DeviceGray":
  60026. imageLength *= 3;
  60027. case "DeviceRGB":
  60028. case "DeviceCMYK":
  60029. imgData.kind = _util.ImageKind.RGB_24BPP;
  60030. imgData.data = this.getImageBytes(imageLength, {
  60031. drawWidth,
  60032. drawHeight,
  60033. forceRGB: true,
  60034. });
  60035. return imgData;
  60036. }
  60037. }
  60038. }
  60039. const imgArray = this.getImageBytes(originalHeight * rowBytes, {
  60040. internal: true,
  60041. });
  60042. const actualHeight =
  60043. 0 |
  60044. (((imgArray.length / rowBytes) * drawHeight) / originalHeight);
  60045. const comps = this.getComponents(imgArray);
  60046. let alpha01, maybeUndoPreblend;
  60047. if (!forceRGBA && !this.smask && !this.mask) {
  60048. imgData.kind = _util.ImageKind.RGB_24BPP;
  60049. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  60050. alpha01 = 0;
  60051. maybeUndoPreblend = false;
  60052. } else {
  60053. imgData.kind = _util.ImageKind.RGBA_32BPP;
  60054. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  60055. alpha01 = 1;
  60056. maybeUndoPreblend = true;
  60057. this.fillOpacity(
  60058. imgData.data,
  60059. drawWidth,
  60060. drawHeight,
  60061. actualHeight,
  60062. comps
  60063. );
  60064. }
  60065. if (this.needsDecode) {
  60066. this.decodeBuffer(comps);
  60067. }
  60068. this.colorSpace.fillRgb(
  60069. imgData.data,
  60070. originalWidth,
  60071. originalHeight,
  60072. drawWidth,
  60073. drawHeight,
  60074. actualHeight,
  60075. bpc,
  60076. comps,
  60077. alpha01
  60078. );
  60079. if (maybeUndoPreblend) {
  60080. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  60081. }
  60082. return imgData;
  60083. }
  60084. fillGrayBuffer(buffer) {
  60085. const numComps = this.numComps;
  60086. if (numComps !== 1) {
  60087. throw new _util.FormatError(
  60088. `Reading gray scale from a color image: ${numComps}`
  60089. );
  60090. }
  60091. const width = this.width;
  60092. const height = this.height;
  60093. const bpc = this.bpc;
  60094. const rowBytes = (width * numComps * bpc + 7) >> 3;
  60095. const imgArray = this.getImageBytes(height * rowBytes, {
  60096. internal: true,
  60097. });
  60098. const comps = this.getComponents(imgArray);
  60099. let i, length;
  60100. if (bpc === 1) {
  60101. length = width * height;
  60102. if (this.needsDecode) {
  60103. for (i = 0; i < length; ++i) {
  60104. buffer[i] = (comps[i] - 1) & 255;
  60105. }
  60106. } else {
  60107. for (i = 0; i < length; ++i) {
  60108. buffer[i] = -comps[i] & 255;
  60109. }
  60110. }
  60111. return;
  60112. }
  60113. if (this.needsDecode) {
  60114. this.decodeBuffer(comps);
  60115. }
  60116. length = width * height;
  60117. const scale = 255 / ((1 << bpc) - 1);
  60118. for (i = 0; i < length; ++i) {
  60119. buffer[i] = scale * comps[i];
  60120. }
  60121. }
  60122. getImageBytes(
  60123. length,
  60124. { drawWidth, drawHeight, forceRGB = false, internal = false }
  60125. ) {
  60126. this.image.reset();
  60127. this.image.drawWidth = drawWidth || this.width;
  60128. this.image.drawHeight = drawHeight || this.height;
  60129. this.image.forceRGB = !!forceRGB;
  60130. const imageBytes = this.image.getBytes(length);
  60131. if (internal || this.image instanceof _decode_stream.DecodeStream) {
  60132. return imageBytes;
  60133. }
  60134. (0, _util.assert)(
  60135. imageBytes instanceof Uint8Array,
  60136. 'PDFImage.getImageBytes: Unsupported "imageBytes" type.'
  60137. );
  60138. return new Uint8Array(imageBytes);
  60139. }
  60140. }
  60141. exports.PDFImage = PDFImage;
  60142. /***/
  60143. },
  60144. /* 64 */
  60145. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60146. Object.defineProperty(exports, "__esModule", {
  60147. value: true,
  60148. });
  60149. exports.applyMaskImageData = applyMaskImageData;
  60150. var _util = __w_pdfjs_require__(2);
  60151. function applyMaskImageData({
  60152. src,
  60153. srcPos = 0,
  60154. dest,
  60155. destPos = 0,
  60156. width,
  60157. height,
  60158. inverseDecode = false,
  60159. }) {
  60160. const opaque = _util.FeatureTest.isLittleEndian
  60161. ? 0xff000000
  60162. : 0x000000ff;
  60163. const [zeroMapping, oneMapping] = !inverseDecode
  60164. ? [opaque, 0]
  60165. : [0, opaque];
  60166. const widthInSource = width >> 3;
  60167. const widthRemainder = width & 7;
  60168. const srcLength = src.length;
  60169. dest = new Uint32Array(dest.buffer);
  60170. for (let i = 0; i < height; i++) {
  60171. for (const max = srcPos + widthInSource; srcPos < max; srcPos++) {
  60172. const elem = srcPos < srcLength ? src[srcPos] : 255;
  60173. dest[destPos++] = elem & 0b10000000 ? oneMapping : zeroMapping;
  60174. dest[destPos++] = elem & 0b1000000 ? oneMapping : zeroMapping;
  60175. dest[destPos++] = elem & 0b100000 ? oneMapping : zeroMapping;
  60176. dest[destPos++] = elem & 0b10000 ? oneMapping : zeroMapping;
  60177. dest[destPos++] = elem & 0b1000 ? oneMapping : zeroMapping;
  60178. dest[destPos++] = elem & 0b100 ? oneMapping : zeroMapping;
  60179. dest[destPos++] = elem & 0b10 ? oneMapping : zeroMapping;
  60180. dest[destPos++] = elem & 0b1 ? oneMapping : zeroMapping;
  60181. }
  60182. if (widthRemainder === 0) {
  60183. continue;
  60184. }
  60185. const elem = srcPos < srcLength ? src[srcPos++] : 255;
  60186. for (let j = 0; j < widthRemainder; j++) {
  60187. dest[destPos++] =
  60188. elem & (1 << (7 - j)) ? oneMapping : zeroMapping;
  60189. }
  60190. }
  60191. return {
  60192. srcPos,
  60193. destPos,
  60194. };
  60195. }
  60196. /***/
  60197. },
  60198. /* 65 */
  60199. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60200. Object.defineProperty(exports, "__esModule", {
  60201. value: true,
  60202. });
  60203. exports.incrementalUpdate = incrementalUpdate;
  60204. exports.writeDict = writeDict;
  60205. exports.writeObject = writeObject;
  60206. var _util = __w_pdfjs_require__(2);
  60207. var _primitives = __w_pdfjs_require__(5);
  60208. var _core_utils = __w_pdfjs_require__(6);
  60209. var _xml_parser = __w_pdfjs_require__(66);
  60210. var _base_stream = __w_pdfjs_require__(7);
  60211. var _crypto = __w_pdfjs_require__(67);
  60212. function writeObject(ref, obj, buffer, transform) {
  60213. buffer.push(`${ref.num} ${ref.gen} obj\n`);
  60214. if (obj instanceof _primitives.Dict) {
  60215. writeDict(obj, buffer, transform);
  60216. } else if (obj instanceof _base_stream.BaseStream) {
  60217. writeStream(obj, buffer, transform);
  60218. }
  60219. buffer.push("\nendobj\n");
  60220. }
  60221. function writeDict(dict, buffer, transform) {
  60222. buffer.push("<<");
  60223. for (const key of dict.getKeys()) {
  60224. buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `);
  60225. writeValue(dict.getRaw(key), buffer, transform);
  60226. }
  60227. buffer.push(">>");
  60228. }
  60229. function writeStream(stream, buffer, transform) {
  60230. writeDict(stream.dict, buffer, transform);
  60231. buffer.push(" stream\n");
  60232. let string = stream.getString();
  60233. if (transform !== null) {
  60234. string = transform.encryptString(string);
  60235. }
  60236. buffer.push(string, "\nendstream\n");
  60237. }
  60238. function writeArray(array, buffer, transform) {
  60239. buffer.push("[");
  60240. let first = true;
  60241. for (const val of array) {
  60242. if (!first) {
  60243. buffer.push(" ");
  60244. } else {
  60245. first = false;
  60246. }
  60247. writeValue(val, buffer, transform);
  60248. }
  60249. buffer.push("]");
  60250. }
  60251. function writeValue(value, buffer, transform) {
  60252. if (value instanceof _primitives.Name) {
  60253. buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`);
  60254. } else if (value instanceof _primitives.Ref) {
  60255. buffer.push(`${value.num} ${value.gen} R`);
  60256. } else if (Array.isArray(value)) {
  60257. writeArray(value, buffer, transform);
  60258. } else if (typeof value === "string") {
  60259. if (transform !== null) {
  60260. value = transform.encryptString(value);
  60261. }
  60262. buffer.push(`(${(0, _util.escapeString)(value)})`);
  60263. } else if (typeof value === "number") {
  60264. buffer.push((0, _core_utils.numberToString)(value));
  60265. } else if (typeof value === "boolean") {
  60266. buffer.push(value.toString());
  60267. } else if (value instanceof _primitives.Dict) {
  60268. writeDict(value, buffer, transform);
  60269. } else if (value instanceof _base_stream.BaseStream) {
  60270. writeStream(value, buffer, transform);
  60271. } else if (value === null) {
  60272. buffer.push("null");
  60273. } else {
  60274. (0, _util.warn)(
  60275. `Unhandled value in writer: ${typeof value}, please file a bug.`
  60276. );
  60277. }
  60278. }
  60279. function writeInt(number, size, offset, buffer) {
  60280. for (let i = size + offset - 1; i > offset - 1; i--) {
  60281. buffer[i] = number & 0xff;
  60282. number >>= 8;
  60283. }
  60284. return offset + size;
  60285. }
  60286. function writeString(string, offset, buffer) {
  60287. for (let i = 0, len = string.length; i < len; i++) {
  60288. buffer[offset + i] = string.charCodeAt(i) & 0xff;
  60289. }
  60290. }
  60291. function computeMD5(filesize, xrefInfo) {
  60292. const time = Math.floor(Date.now() / 1000);
  60293. const filename = xrefInfo.filename || "";
  60294. const md5Buffer = [time.toString(), filename, filesize.toString()];
  60295. let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0);
  60296. for (const value of Object.values(xrefInfo.info)) {
  60297. md5Buffer.push(value);
  60298. md5BufferLen += value.length;
  60299. }
  60300. const array = new Uint8Array(md5BufferLen);
  60301. let offset = 0;
  60302. for (const str of md5Buffer) {
  60303. writeString(str, offset, array);
  60304. offset += str.length;
  60305. }
  60306. return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array));
  60307. }
  60308. function writeXFADataForAcroform(str, newRefs) {
  60309. const xml = new _xml_parser.SimpleXMLParser({
  60310. hasAttributes: true,
  60311. }).parseFromString(str);
  60312. for (const { xfa } of newRefs) {
  60313. if (!xfa) {
  60314. continue;
  60315. }
  60316. const { path, value } = xfa;
  60317. if (!path) {
  60318. continue;
  60319. }
  60320. const node = xml.documentElement.searchNode(
  60321. (0, _core_utils.parseXFAPath)(path),
  60322. 0
  60323. );
  60324. if (node) {
  60325. if (Array.isArray(value)) {
  60326. node.childNodes = value.map(
  60327. (val) => new _xml_parser.SimpleDOMNode("value", val)
  60328. );
  60329. } else {
  60330. node.childNodes = [
  60331. new _xml_parser.SimpleDOMNode("#text", value),
  60332. ];
  60333. }
  60334. } else {
  60335. (0, _util.warn)(`Node not found for path: ${path}`);
  60336. }
  60337. }
  60338. const buffer = [];
  60339. xml.documentElement.dump(buffer);
  60340. return buffer.join("");
  60341. }
  60342. function updateXFA({
  60343. xfaData,
  60344. xfaDatasetsRef,
  60345. hasXfaDatasetsEntry,
  60346. acroFormRef,
  60347. acroForm,
  60348. newRefs,
  60349. xref,
  60350. xrefInfo,
  60351. }) {
  60352. if (xref === null) {
  60353. return;
  60354. }
  60355. if (!hasXfaDatasetsEntry) {
  60356. if (!acroFormRef) {
  60357. (0, _util.warn)("XFA - Cannot save it");
  60358. return;
  60359. }
  60360. const oldXfa = acroForm.get("XFA");
  60361. const newXfa = oldXfa.slice();
  60362. newXfa.splice(2, 0, "datasets");
  60363. newXfa.splice(3, 0, xfaDatasetsRef);
  60364. acroForm.set("XFA", newXfa);
  60365. const encrypt = xref.encrypt;
  60366. let transform = null;
  60367. if (encrypt) {
  60368. transform = encrypt.createCipherTransform(
  60369. acroFormRef.num,
  60370. acroFormRef.gen
  60371. );
  60372. }
  60373. const buffer = [`${acroFormRef.num} ${acroFormRef.gen} obj\n`];
  60374. writeDict(acroForm, buffer, transform);
  60375. buffer.push("\n");
  60376. acroForm.set("XFA", oldXfa);
  60377. newRefs.push({
  60378. ref: acroFormRef,
  60379. data: buffer.join(""),
  60380. });
  60381. }
  60382. if (xfaData === null) {
  60383. const datasets = xref.fetchIfRef(xfaDatasetsRef);
  60384. xfaData = writeXFADataForAcroform(datasets.getString(), newRefs);
  60385. }
  60386. const encrypt = xref.encrypt;
  60387. if (encrypt) {
  60388. const transform = encrypt.createCipherTransform(
  60389. xfaDatasetsRef.num,
  60390. xfaDatasetsRef.gen
  60391. );
  60392. xfaData = transform.encryptString(xfaData);
  60393. }
  60394. const data =
  60395. `${xfaDatasetsRef.num} ${xfaDatasetsRef.gen} obj\n` +
  60396. `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` +
  60397. xfaData +
  60398. "\nendstream\nendobj\n";
  60399. newRefs.push({
  60400. ref: xfaDatasetsRef,
  60401. data,
  60402. });
  60403. }
  60404. function incrementalUpdate({
  60405. originalData,
  60406. xrefInfo,
  60407. newRefs,
  60408. xref = null,
  60409. hasXfa = false,
  60410. xfaDatasetsRef = null,
  60411. hasXfaDatasetsEntry = false,
  60412. acroFormRef = null,
  60413. acroForm = null,
  60414. xfaData = null,
  60415. }) {
  60416. if (hasXfa) {
  60417. updateXFA({
  60418. xfaData,
  60419. xfaDatasetsRef,
  60420. hasXfaDatasetsEntry,
  60421. acroFormRef,
  60422. acroForm,
  60423. newRefs,
  60424. xref,
  60425. xrefInfo,
  60426. });
  60427. }
  60428. const newXref = new _primitives.Dict(null);
  60429. const refForXrefTable = xrefInfo.newRef;
  60430. let buffer, baseOffset;
  60431. const lastByte = originalData.at(-1);
  60432. if (lastByte === 0x0a || lastByte === 0x0d) {
  60433. buffer = [];
  60434. baseOffset = originalData.length;
  60435. } else {
  60436. buffer = ["\n"];
  60437. baseOffset = originalData.length + 1;
  60438. }
  60439. newXref.set("Size", refForXrefTable.num + 1);
  60440. newXref.set("Prev", xrefInfo.startXRef);
  60441. newXref.set("Type", _primitives.Name.get("XRef"));
  60442. if (xrefInfo.rootRef !== null) {
  60443. newXref.set("Root", xrefInfo.rootRef);
  60444. }
  60445. if (xrefInfo.infoRef !== null) {
  60446. newXref.set("Info", xrefInfo.infoRef);
  60447. }
  60448. if (xrefInfo.encryptRef !== null) {
  60449. newXref.set("Encrypt", xrefInfo.encryptRef);
  60450. }
  60451. newRefs.push({
  60452. ref: refForXrefTable,
  60453. data: "",
  60454. });
  60455. newRefs = newRefs.sort((a, b) => {
  60456. return a.ref.num - b.ref.num;
  60457. });
  60458. const xrefTableData = [[0, 1, 0xffff]];
  60459. const indexes = [0, 1];
  60460. let maxOffset = 0;
  60461. for (const { ref, data } of newRefs) {
  60462. maxOffset = Math.max(maxOffset, baseOffset);
  60463. xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]);
  60464. baseOffset += data.length;
  60465. indexes.push(ref.num, 1);
  60466. buffer.push(data);
  60467. }
  60468. newXref.set("Index", indexes);
  60469. if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) {
  60470. const md5 = computeMD5(baseOffset, xrefInfo);
  60471. newXref.set("ID", [xrefInfo.fileIds[0], md5]);
  60472. }
  60473. const offsetSize = Math.ceil(Math.log2(maxOffset) / 8);
  60474. const sizes = [1, offsetSize, 2];
  60475. const structSize = sizes[0] + sizes[1] + sizes[2];
  60476. const tableLength = structSize * xrefTableData.length;
  60477. newXref.set("W", sizes);
  60478. newXref.set("Length", tableLength);
  60479. buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`);
  60480. writeDict(newXref, buffer, null);
  60481. buffer.push(" stream\n");
  60482. const bufferLen = buffer.reduce((a, str) => a + str.length, 0);
  60483. const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`;
  60484. const array = new Uint8Array(
  60485. originalData.length + bufferLen + tableLength + footer.length
  60486. );
  60487. array.set(originalData);
  60488. let offset = originalData.length;
  60489. for (const str of buffer) {
  60490. writeString(str, offset, array);
  60491. offset += str.length;
  60492. }
  60493. for (const [type, objOffset, gen] of xrefTableData) {
  60494. offset = writeInt(type, sizes[0], offset, array);
  60495. offset = writeInt(objOffset, sizes[1], offset, array);
  60496. offset = writeInt(gen, sizes[2], offset, array);
  60497. }
  60498. writeString(footer, offset, array);
  60499. return array;
  60500. }
  60501. /***/
  60502. },
  60503. /* 66 */
  60504. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60505. Object.defineProperty(exports, "__esModule", {
  60506. value: true,
  60507. });
  60508. exports.XMLParserErrorCode =
  60509. exports.XMLParserBase =
  60510. exports.SimpleXMLParser =
  60511. exports.SimpleDOMNode =
  60512. void 0;
  60513. var _core_utils = __w_pdfjs_require__(6);
  60514. const XMLParserErrorCode = {
  60515. NoError: 0,
  60516. EndOfDocument: -1,
  60517. UnterminatedCdat: -2,
  60518. UnterminatedXmlDeclaration: -3,
  60519. UnterminatedDoctypeDeclaration: -4,
  60520. UnterminatedComment: -5,
  60521. MalformedElement: -6,
  60522. OutOfMemory: -7,
  60523. UnterminatedAttributeValue: -8,
  60524. UnterminatedElement: -9,
  60525. ElementNeverBegun: -10,
  60526. };
  60527. exports.XMLParserErrorCode = XMLParserErrorCode;
  60528. function isWhitespace(s, index) {
  60529. const ch = s[index];
  60530. return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
  60531. }
  60532. function isWhitespaceString(s) {
  60533. for (let i = 0, ii = s.length; i < ii; i++) {
  60534. if (!isWhitespace(s, i)) {
  60535. return false;
  60536. }
  60537. }
  60538. return true;
  60539. }
  60540. class XMLParserBase {
  60541. _resolveEntities(s) {
  60542. return s.replace(/&([^;]+);/g, (all, entity) => {
  60543. if (entity.substring(0, 2) === "#x") {
  60544. return String.fromCodePoint(parseInt(entity.substring(2), 16));
  60545. } else if (entity.substring(0, 1) === "#") {
  60546. return String.fromCodePoint(parseInt(entity.substring(1), 10));
  60547. }
  60548. switch (entity) {
  60549. case "lt":
  60550. return "<";
  60551. case "gt":
  60552. return ">";
  60553. case "amp":
  60554. return "&";
  60555. case "quot":
  60556. return '"';
  60557. case "apos":
  60558. return "'";
  60559. }
  60560. return this.onResolveEntity(entity);
  60561. });
  60562. }
  60563. _parseContent(s, start) {
  60564. const attributes = [];
  60565. let pos = start;
  60566. function skipWs() {
  60567. while (pos < s.length && isWhitespace(s, pos)) {
  60568. ++pos;
  60569. }
  60570. }
  60571. while (
  60572. pos < s.length &&
  60573. !isWhitespace(s, pos) &&
  60574. s[pos] !== ">" &&
  60575. s[pos] !== "/"
  60576. ) {
  60577. ++pos;
  60578. }
  60579. const name = s.substring(start, pos);
  60580. skipWs();
  60581. while (
  60582. pos < s.length &&
  60583. s[pos] !== ">" &&
  60584. s[pos] !== "/" &&
  60585. s[pos] !== "?"
  60586. ) {
  60587. skipWs();
  60588. let attrName = "",
  60589. attrValue = "";
  60590. while (
  60591. pos < s.length &&
  60592. !isWhitespace(s, pos) &&
  60593. s[pos] !== "="
  60594. ) {
  60595. attrName += s[pos];
  60596. ++pos;
  60597. }
  60598. skipWs();
  60599. if (s[pos] !== "=") {
  60600. return null;
  60601. }
  60602. ++pos;
  60603. skipWs();
  60604. const attrEndChar = s[pos];
  60605. if (attrEndChar !== '"' && attrEndChar !== "'") {
  60606. return null;
  60607. }
  60608. const attrEndIndex = s.indexOf(attrEndChar, ++pos);
  60609. if (attrEndIndex < 0) {
  60610. return null;
  60611. }
  60612. attrValue = s.substring(pos, attrEndIndex);
  60613. attributes.push({
  60614. name: attrName,
  60615. value: this._resolveEntities(attrValue),
  60616. });
  60617. pos = attrEndIndex + 1;
  60618. skipWs();
  60619. }
  60620. return {
  60621. name,
  60622. attributes,
  60623. parsed: pos - start,
  60624. };
  60625. }
  60626. _parseProcessingInstruction(s, start) {
  60627. let pos = start;
  60628. function skipWs() {
  60629. while (pos < s.length && isWhitespace(s, pos)) {
  60630. ++pos;
  60631. }
  60632. }
  60633. while (
  60634. pos < s.length &&
  60635. !isWhitespace(s, pos) &&
  60636. s[pos] !== ">" &&
  60637. s[pos] !== "?" &&
  60638. s[pos] !== "/"
  60639. ) {
  60640. ++pos;
  60641. }
  60642. const name = s.substring(start, pos);
  60643. skipWs();
  60644. const attrStart = pos;
  60645. while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
  60646. ++pos;
  60647. }
  60648. const value = s.substring(attrStart, pos);
  60649. return {
  60650. name,
  60651. value,
  60652. parsed: pos - start,
  60653. };
  60654. }
  60655. parseXml(s) {
  60656. let i = 0;
  60657. while (i < s.length) {
  60658. const ch = s[i];
  60659. let j = i;
  60660. if (ch === "<") {
  60661. ++j;
  60662. const ch2 = s[j];
  60663. let q;
  60664. switch (ch2) {
  60665. case "/":
  60666. ++j;
  60667. q = s.indexOf(">", j);
  60668. if (q < 0) {
  60669. this.onError(XMLParserErrorCode.UnterminatedElement);
  60670. return;
  60671. }
  60672. this.onEndElement(s.substring(j, q));
  60673. j = q + 1;
  60674. break;
  60675. case "?":
  60676. ++j;
  60677. const pi = this._parseProcessingInstruction(s, j);
  60678. if (
  60679. s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>"
  60680. ) {
  60681. this.onError(
  60682. XMLParserErrorCode.UnterminatedXmlDeclaration
  60683. );
  60684. return;
  60685. }
  60686. this.onPi(pi.name, pi.value);
  60687. j += pi.parsed + 2;
  60688. break;
  60689. case "!":
  60690. if (s.substring(j + 1, j + 3) === "--") {
  60691. q = s.indexOf("-->", j + 3);
  60692. if (q < 0) {
  60693. this.onError(XMLParserErrorCode.UnterminatedComment);
  60694. return;
  60695. }
  60696. this.onComment(s.substring(j + 3, q));
  60697. j = q + 3;
  60698. } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
  60699. q = s.indexOf("]]>", j + 8);
  60700. if (q < 0) {
  60701. this.onError(XMLParserErrorCode.UnterminatedCdat);
  60702. return;
  60703. }
  60704. this.onCdata(s.substring(j + 8, q));
  60705. j = q + 3;
  60706. } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
  60707. const q2 = s.indexOf("[", j + 8);
  60708. let complexDoctype = false;
  60709. q = s.indexOf(">", j + 8);
  60710. if (q < 0) {
  60711. this.onError(
  60712. XMLParserErrorCode.UnterminatedDoctypeDeclaration
  60713. );
  60714. return;
  60715. }
  60716. if (q2 > 0 && q > q2) {
  60717. q = s.indexOf("]>", j + 8);
  60718. if (q < 0) {
  60719. this.onError(
  60720. XMLParserErrorCode.UnterminatedDoctypeDeclaration
  60721. );
  60722. return;
  60723. }
  60724. complexDoctype = true;
  60725. }
  60726. const doctypeContent = s.substring(
  60727. j + 8,
  60728. q + (complexDoctype ? 1 : 0)
  60729. );
  60730. this.onDoctype(doctypeContent);
  60731. j = q + (complexDoctype ? 2 : 1);
  60732. } else {
  60733. this.onError(XMLParserErrorCode.MalformedElement);
  60734. return;
  60735. }
  60736. break;
  60737. default:
  60738. const content = this._parseContent(s, j);
  60739. if (content === null) {
  60740. this.onError(XMLParserErrorCode.MalformedElement);
  60741. return;
  60742. }
  60743. let isClosed = false;
  60744. if (
  60745. s.substring(
  60746. j + content.parsed,
  60747. j + content.parsed + 2
  60748. ) === "/>"
  60749. ) {
  60750. isClosed = true;
  60751. } else if (
  60752. s.substring(
  60753. j + content.parsed,
  60754. j + content.parsed + 1
  60755. ) !== ">"
  60756. ) {
  60757. this.onError(XMLParserErrorCode.UnterminatedElement);
  60758. return;
  60759. }
  60760. this.onBeginElement(
  60761. content.name,
  60762. content.attributes,
  60763. isClosed
  60764. );
  60765. j += content.parsed + (isClosed ? 2 : 1);
  60766. break;
  60767. }
  60768. } else {
  60769. while (j < s.length && s[j] !== "<") {
  60770. j++;
  60771. }
  60772. const text = s.substring(i, j);
  60773. this.onText(this._resolveEntities(text));
  60774. }
  60775. i = j;
  60776. }
  60777. }
  60778. onResolveEntity(name) {
  60779. return `&${name};`;
  60780. }
  60781. onPi(name, value) {}
  60782. onComment(text) {}
  60783. onCdata(text) {}
  60784. onDoctype(doctypeContent) {}
  60785. onText(text) {}
  60786. onBeginElement(name, attributes, isEmpty) {}
  60787. onEndElement(name) {}
  60788. onError(code) {}
  60789. }
  60790. exports.XMLParserBase = XMLParserBase;
  60791. class SimpleDOMNode {
  60792. constructor(nodeName, nodeValue) {
  60793. this.nodeName = nodeName;
  60794. this.nodeValue = nodeValue;
  60795. Object.defineProperty(this, "parentNode", {
  60796. value: null,
  60797. writable: true,
  60798. });
  60799. }
  60800. get firstChild() {
  60801. return this.childNodes && this.childNodes[0];
  60802. }
  60803. get nextSibling() {
  60804. const childNodes = this.parentNode.childNodes;
  60805. if (!childNodes) {
  60806. return undefined;
  60807. }
  60808. const index = childNodes.indexOf(this);
  60809. if (index === -1) {
  60810. return undefined;
  60811. }
  60812. return childNodes[index + 1];
  60813. }
  60814. get textContent() {
  60815. if (!this.childNodes) {
  60816. return this.nodeValue || "";
  60817. }
  60818. return this.childNodes
  60819. .map(function (child) {
  60820. return child.textContent;
  60821. })
  60822. .join("");
  60823. }
  60824. get children() {
  60825. return this.childNodes || [];
  60826. }
  60827. hasChildNodes() {
  60828. return this.childNodes && this.childNodes.length > 0;
  60829. }
  60830. searchNode(paths, pos) {
  60831. if (pos >= paths.length) {
  60832. return this;
  60833. }
  60834. const component = paths[pos];
  60835. const stack = [];
  60836. let node = this;
  60837. while (true) {
  60838. if (component.name === node.nodeName) {
  60839. if (component.pos === 0) {
  60840. const res = node.searchNode(paths, pos + 1);
  60841. if (res !== null) {
  60842. return res;
  60843. }
  60844. } else if (stack.length === 0) {
  60845. return null;
  60846. } else {
  60847. const [parent] = stack.pop();
  60848. let siblingPos = 0;
  60849. for (const child of parent.childNodes) {
  60850. if (component.name === child.nodeName) {
  60851. if (siblingPos === component.pos) {
  60852. return child.searchNode(paths, pos + 1);
  60853. }
  60854. siblingPos++;
  60855. }
  60856. }
  60857. return node.searchNode(paths, pos + 1);
  60858. }
  60859. }
  60860. if (node.childNodes && node.childNodes.length !== 0) {
  60861. stack.push([node, 0]);
  60862. node = node.childNodes[0];
  60863. } else if (stack.length === 0) {
  60864. return null;
  60865. } else {
  60866. while (stack.length !== 0) {
  60867. const [parent, currentPos] = stack.pop();
  60868. const newPos = currentPos + 1;
  60869. if (newPos < parent.childNodes.length) {
  60870. stack.push([parent, newPos]);
  60871. node = parent.childNodes[newPos];
  60872. break;
  60873. }
  60874. }
  60875. if (stack.length === 0) {
  60876. return null;
  60877. }
  60878. }
  60879. }
  60880. }
  60881. dump(buffer) {
  60882. if (this.nodeName === "#text") {
  60883. buffer.push((0, _core_utils.encodeToXmlString)(this.nodeValue));
  60884. return;
  60885. }
  60886. buffer.push(`<${this.nodeName}`);
  60887. if (this.attributes) {
  60888. for (const attribute of this.attributes) {
  60889. buffer.push(
  60890. ` ${attribute.name}="${(0, _core_utils.encodeToXmlString)(
  60891. attribute.value
  60892. )}"`
  60893. );
  60894. }
  60895. }
  60896. if (this.hasChildNodes()) {
  60897. buffer.push(">");
  60898. for (const child of this.childNodes) {
  60899. child.dump(buffer);
  60900. }
  60901. buffer.push(`</${this.nodeName}>`);
  60902. } else if (this.nodeValue) {
  60903. buffer.push(
  60904. `>${(0, _core_utils.encodeToXmlString)(this.nodeValue)}</${
  60905. this.nodeName
  60906. }>`
  60907. );
  60908. } else {
  60909. buffer.push("/>");
  60910. }
  60911. }
  60912. }
  60913. exports.SimpleDOMNode = SimpleDOMNode;
  60914. class SimpleXMLParser extends XMLParserBase {
  60915. constructor({ hasAttributes = false, lowerCaseName = false }) {
  60916. super();
  60917. this._currentFragment = null;
  60918. this._stack = null;
  60919. this._errorCode = XMLParserErrorCode.NoError;
  60920. this._hasAttributes = hasAttributes;
  60921. this._lowerCaseName = lowerCaseName;
  60922. }
  60923. parseFromString(data) {
  60924. this._currentFragment = [];
  60925. this._stack = [];
  60926. this._errorCode = XMLParserErrorCode.NoError;
  60927. this.parseXml(data);
  60928. if (this._errorCode !== XMLParserErrorCode.NoError) {
  60929. return undefined;
  60930. }
  60931. const [documentElement] = this._currentFragment;
  60932. if (!documentElement) {
  60933. return undefined;
  60934. }
  60935. return {
  60936. documentElement,
  60937. };
  60938. }
  60939. onText(text) {
  60940. if (isWhitespaceString(text)) {
  60941. return;
  60942. }
  60943. const node = new SimpleDOMNode("#text", text);
  60944. this._currentFragment.push(node);
  60945. }
  60946. onCdata(text) {
  60947. const node = new SimpleDOMNode("#text", text);
  60948. this._currentFragment.push(node);
  60949. }
  60950. onBeginElement(name, attributes, isEmpty) {
  60951. if (this._lowerCaseName) {
  60952. name = name.toLowerCase();
  60953. }
  60954. const node = new SimpleDOMNode(name);
  60955. node.childNodes = [];
  60956. if (this._hasAttributes) {
  60957. node.attributes = attributes;
  60958. }
  60959. this._currentFragment.push(node);
  60960. if (isEmpty) {
  60961. return;
  60962. }
  60963. this._stack.push(this._currentFragment);
  60964. this._currentFragment = node.childNodes;
  60965. }
  60966. onEndElement(name) {
  60967. this._currentFragment = this._stack.pop() || [];
  60968. const lastElement = this._currentFragment.at(-1);
  60969. if (!lastElement) {
  60970. return null;
  60971. }
  60972. for (let i = 0, ii = lastElement.childNodes.length; i < ii; i++) {
  60973. lastElement.childNodes[i].parentNode = lastElement;
  60974. }
  60975. return lastElement;
  60976. }
  60977. onError(code) {
  60978. this._errorCode = code;
  60979. }
  60980. }
  60981. exports.SimpleXMLParser = SimpleXMLParser;
  60982. /***/
  60983. },
  60984. /* 67 */
  60985. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60986. Object.defineProperty(exports, "__esModule", {
  60987. value: true,
  60988. });
  60989. exports.calculateSHA256 =
  60990. exports.calculateMD5 =
  60991. exports.PDF20 =
  60992. exports.PDF17 =
  60993. exports.CipherTransformFactory =
  60994. exports.ARCFourCipher =
  60995. exports.AES256Cipher =
  60996. exports.AES128Cipher =
  60997. void 0;
  60998. exports.calculateSHA384 = calculateSHA384;
  60999. exports.calculateSHA512 = void 0;
  61000. var _util = __w_pdfjs_require__(2);
  61001. var _primitives = __w_pdfjs_require__(5);
  61002. var _decrypt_stream = __w_pdfjs_require__(68);
  61003. class ARCFourCipher {
  61004. constructor(key) {
  61005. this.a = 0;
  61006. this.b = 0;
  61007. const s = new Uint8Array(256);
  61008. const keyLength = key.length;
  61009. for (let i = 0; i < 256; ++i) {
  61010. s[i] = i;
  61011. }
  61012. for (let i = 0, j = 0; i < 256; ++i) {
  61013. const tmp = s[i];
  61014. j = (j + tmp + key[i % keyLength]) & 0xff;
  61015. s[i] = s[j];
  61016. s[j] = tmp;
  61017. }
  61018. this.s = s;
  61019. }
  61020. encryptBlock(data) {
  61021. let a = this.a,
  61022. b = this.b;
  61023. const s = this.s;
  61024. const n = data.length;
  61025. const output = new Uint8Array(n);
  61026. for (let i = 0; i < n; ++i) {
  61027. a = (a + 1) & 0xff;
  61028. const tmp = s[a];
  61029. b = (b + tmp) & 0xff;
  61030. const tmp2 = s[b];
  61031. s[a] = tmp2;
  61032. s[b] = tmp;
  61033. output[i] = data[i] ^ s[(tmp + tmp2) & 0xff];
  61034. }
  61035. this.a = a;
  61036. this.b = b;
  61037. return output;
  61038. }
  61039. decryptBlock(data) {
  61040. return this.encryptBlock(data);
  61041. }
  61042. encrypt(data) {
  61043. return this.encryptBlock(data);
  61044. }
  61045. }
  61046. exports.ARCFourCipher = ARCFourCipher;
  61047. const calculateMD5 = (function calculateMD5Closure() {
  61048. const r = new Uint8Array([
  61049. 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9,
  61050. 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4,
  61051. 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15,
  61052. 21, 6, 10, 15, 21, 6, 10, 15, 21,
  61053. ]);
  61054. const k = new Int32Array([
  61055. -680876936, -389564586, 606105819, -1044525330, -176418897,
  61056. 1200080426, -1473231341, -45705983, 1770035416, -1958414417, -42063,
  61057. -1990404162, 1804603682, -40341101, -1502002290, 1236535329,
  61058. -165796510, -1069501632, 643717713, -373897302, -701558691,
  61059. 38016083, -660478335, -405537848, 568446438, -1019803690,
  61060. -187363961, 1163531501, -1444681467, -51403784, 1735328473,
  61061. -1926607734, -378558, -2022574463, 1839030562, -35309556,
  61062. -1530992060, 1272893353, -155497632, -1094730640, 681279174,
  61063. -358537222, -722521979, 76029189, -640364487, -421815835, 530742520,
  61064. -995338651, -198630844, 1126891415, -1416354905, -57434055,
  61065. 1700485571, -1894986606, -1051523, -2054922799, 1873313359,
  61066. -30611744, -1560198380, 1309151649, -145523070, -1120210379,
  61067. 718787259, -343485551,
  61068. ]);
  61069. function hash(data, offset, length) {
  61070. let h0 = 1732584193,
  61071. h1 = -271733879,
  61072. h2 = -1732584194,
  61073. h3 = 271733878;
  61074. const paddedLength = (length + 72) & ~63;
  61075. const padded = new Uint8Array(paddedLength);
  61076. let i, j;
  61077. for (i = 0; i < length; ++i) {
  61078. padded[i] = data[offset++];
  61079. }
  61080. padded[i++] = 0x80;
  61081. const n = paddedLength - 8;
  61082. while (i < n) {
  61083. padded[i++] = 0;
  61084. }
  61085. padded[i++] = (length << 3) & 0xff;
  61086. padded[i++] = (length >> 5) & 0xff;
  61087. padded[i++] = (length >> 13) & 0xff;
  61088. padded[i++] = (length >> 21) & 0xff;
  61089. padded[i++] = (length >>> 29) & 0xff;
  61090. padded[i++] = 0;
  61091. padded[i++] = 0;
  61092. padded[i++] = 0;
  61093. const w = new Int32Array(16);
  61094. for (i = 0; i < paddedLength; ) {
  61095. for (j = 0; j < 16; ++j, i += 4) {
  61096. w[j] =
  61097. padded[i] |
  61098. (padded[i + 1] << 8) |
  61099. (padded[i + 2] << 16) |
  61100. (padded[i + 3] << 24);
  61101. }
  61102. let a = h0,
  61103. b = h1,
  61104. c = h2,
  61105. d = h3,
  61106. f,
  61107. g;
  61108. for (j = 0; j < 64; ++j) {
  61109. if (j < 16) {
  61110. f = (b & c) | (~b & d);
  61111. g = j;
  61112. } else if (j < 32) {
  61113. f = (d & b) | (~d & c);
  61114. g = (5 * j + 1) & 15;
  61115. } else if (j < 48) {
  61116. f = b ^ c ^ d;
  61117. g = (3 * j + 5) & 15;
  61118. } else {
  61119. f = c ^ (b | ~d);
  61120. g = (7 * j) & 15;
  61121. }
  61122. const tmp = d,
  61123. rotateArg = (a + f + k[j] + w[g]) | 0,
  61124. rotate = r[j];
  61125. d = c;
  61126. c = b;
  61127. b =
  61128. (b +
  61129. ((rotateArg << rotate) | (rotateArg >>> (32 - rotate)))) |
  61130. 0;
  61131. a = tmp;
  61132. }
  61133. h0 = (h0 + a) | 0;
  61134. h1 = (h1 + b) | 0;
  61135. h2 = (h2 + c) | 0;
  61136. h3 = (h3 + d) | 0;
  61137. }
  61138. return new Uint8Array([
  61139. h0 & 0xff,
  61140. (h0 >> 8) & 0xff,
  61141. (h0 >> 16) & 0xff,
  61142. (h0 >>> 24) & 0xff,
  61143. h1 & 0xff,
  61144. (h1 >> 8) & 0xff,
  61145. (h1 >> 16) & 0xff,
  61146. (h1 >>> 24) & 0xff,
  61147. h2 & 0xff,
  61148. (h2 >> 8) & 0xff,
  61149. (h2 >> 16) & 0xff,
  61150. (h2 >>> 24) & 0xff,
  61151. h3 & 0xff,
  61152. (h3 >> 8) & 0xff,
  61153. (h3 >> 16) & 0xff,
  61154. (h3 >>> 24) & 0xff,
  61155. ]);
  61156. }
  61157. return hash;
  61158. })();
  61159. exports.calculateMD5 = calculateMD5;
  61160. class Word64 {
  61161. constructor(highInteger, lowInteger) {
  61162. this.high = highInteger | 0;
  61163. this.low = lowInteger | 0;
  61164. }
  61165. and(word) {
  61166. this.high &= word.high;
  61167. this.low &= word.low;
  61168. }
  61169. xor(word) {
  61170. this.high ^= word.high;
  61171. this.low ^= word.low;
  61172. }
  61173. or(word) {
  61174. this.high |= word.high;
  61175. this.low |= word.low;
  61176. }
  61177. shiftRight(places) {
  61178. if (places >= 32) {
  61179. this.low = (this.high >>> (places - 32)) | 0;
  61180. this.high = 0;
  61181. } else {
  61182. this.low = (this.low >>> places) | (this.high << (32 - places));
  61183. this.high = (this.high >>> places) | 0;
  61184. }
  61185. }
  61186. shiftLeft(places) {
  61187. if (places >= 32) {
  61188. this.high = this.low << (places - 32);
  61189. this.low = 0;
  61190. } else {
  61191. this.high = (this.high << places) | (this.low >>> (32 - places));
  61192. this.low <<= places;
  61193. }
  61194. }
  61195. rotateRight(places) {
  61196. let low, high;
  61197. if (places & 32) {
  61198. high = this.low;
  61199. low = this.high;
  61200. } else {
  61201. low = this.low;
  61202. high = this.high;
  61203. }
  61204. places &= 31;
  61205. this.low = (low >>> places) | (high << (32 - places));
  61206. this.high = (high >>> places) | (low << (32 - places));
  61207. }
  61208. not() {
  61209. this.high = ~this.high;
  61210. this.low = ~this.low;
  61211. }
  61212. add(word) {
  61213. const lowAdd = (this.low >>> 0) + (word.low >>> 0);
  61214. let highAdd = (this.high >>> 0) + (word.high >>> 0);
  61215. if (lowAdd > 0xffffffff) {
  61216. highAdd += 1;
  61217. }
  61218. this.low = lowAdd | 0;
  61219. this.high = highAdd | 0;
  61220. }
  61221. copyTo(bytes, offset) {
  61222. bytes[offset] = (this.high >>> 24) & 0xff;
  61223. bytes[offset + 1] = (this.high >> 16) & 0xff;
  61224. bytes[offset + 2] = (this.high >> 8) & 0xff;
  61225. bytes[offset + 3] = this.high & 0xff;
  61226. bytes[offset + 4] = (this.low >>> 24) & 0xff;
  61227. bytes[offset + 5] = (this.low >> 16) & 0xff;
  61228. bytes[offset + 6] = (this.low >> 8) & 0xff;
  61229. bytes[offset + 7] = this.low & 0xff;
  61230. }
  61231. assign(word) {
  61232. this.high = word.high;
  61233. this.low = word.low;
  61234. }
  61235. }
  61236. const calculateSHA256 = (function calculateSHA256Closure() {
  61237. function rotr(x, n) {
  61238. return (x >>> n) | (x << (32 - n));
  61239. }
  61240. function ch(x, y, z) {
  61241. return (x & y) ^ (~x & z);
  61242. }
  61243. function maj(x, y, z) {
  61244. return (x & y) ^ (x & z) ^ (y & z);
  61245. }
  61246. function sigma(x) {
  61247. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  61248. }
  61249. function sigmaPrime(x) {
  61250. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  61251. }
  61252. function littleSigma(x) {
  61253. return rotr(x, 7) ^ rotr(x, 18) ^ (x >>> 3);
  61254. }
  61255. function littleSigmaPrime(x) {
  61256. return rotr(x, 17) ^ rotr(x, 19) ^ (x >>> 10);
  61257. }
  61258. const k = [
  61259. 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b,
  61260. 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01,
  61261. 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7,
  61262. 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
  61263. 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152,
  61264. 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
  61265. 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc,
  61266. 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
  61267. 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819,
  61268. 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08,
  61269. 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f,
  61270. 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
  61271. 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
  61272. ];
  61273. function hash(data, offset, length) {
  61274. let h0 = 0x6a09e667,
  61275. h1 = 0xbb67ae85,
  61276. h2 = 0x3c6ef372,
  61277. h3 = 0xa54ff53a,
  61278. h4 = 0x510e527f,
  61279. h5 = 0x9b05688c,
  61280. h6 = 0x1f83d9ab,
  61281. h7 = 0x5be0cd19;
  61282. const paddedLength = Math.ceil((length + 9) / 64) * 64;
  61283. const padded = new Uint8Array(paddedLength);
  61284. let i, j;
  61285. for (i = 0; i < length; ++i) {
  61286. padded[i] = data[offset++];
  61287. }
  61288. padded[i++] = 0x80;
  61289. const n = paddedLength - 8;
  61290. while (i < n) {
  61291. padded[i++] = 0;
  61292. }
  61293. padded[i++] = 0;
  61294. padded[i++] = 0;
  61295. padded[i++] = 0;
  61296. padded[i++] = (length >>> 29) & 0xff;
  61297. padded[i++] = (length >> 21) & 0xff;
  61298. padded[i++] = (length >> 13) & 0xff;
  61299. padded[i++] = (length >> 5) & 0xff;
  61300. padded[i++] = (length << 3) & 0xff;
  61301. const w = new Uint32Array(64);
  61302. for (i = 0; i < paddedLength; ) {
  61303. for (j = 0; j < 16; ++j) {
  61304. w[j] =
  61305. (padded[i] << 24) |
  61306. (padded[i + 1] << 16) |
  61307. (padded[i + 2] << 8) |
  61308. padded[i + 3];
  61309. i += 4;
  61310. }
  61311. for (j = 16; j < 64; ++j) {
  61312. w[j] =
  61313. (littleSigmaPrime(w[j - 2]) +
  61314. w[j - 7] +
  61315. littleSigma(w[j - 15]) +
  61316. w[j - 16]) |
  61317. 0;
  61318. }
  61319. let a = h0,
  61320. b = h1,
  61321. c = h2,
  61322. d = h3,
  61323. e = h4,
  61324. f = h5,
  61325. g = h6,
  61326. h = h7,
  61327. t1,
  61328. t2;
  61329. for (j = 0; j < 64; ++j) {
  61330. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  61331. t2 = sigma(a) + maj(a, b, c);
  61332. h = g;
  61333. g = f;
  61334. f = e;
  61335. e = (d + t1) | 0;
  61336. d = c;
  61337. c = b;
  61338. b = a;
  61339. a = (t1 + t2) | 0;
  61340. }
  61341. h0 = (h0 + a) | 0;
  61342. h1 = (h1 + b) | 0;
  61343. h2 = (h2 + c) | 0;
  61344. h3 = (h3 + d) | 0;
  61345. h4 = (h4 + e) | 0;
  61346. h5 = (h5 + f) | 0;
  61347. h6 = (h6 + g) | 0;
  61348. h7 = (h7 + h) | 0;
  61349. }
  61350. return new Uint8Array([
  61351. (h0 >> 24) & 0xff,
  61352. (h0 >> 16) & 0xff,
  61353. (h0 >> 8) & 0xff,
  61354. h0 & 0xff,
  61355. (h1 >> 24) & 0xff,
  61356. (h1 >> 16) & 0xff,
  61357. (h1 >> 8) & 0xff,
  61358. h1 & 0xff,
  61359. (h2 >> 24) & 0xff,
  61360. (h2 >> 16) & 0xff,
  61361. (h2 >> 8) & 0xff,
  61362. h2 & 0xff,
  61363. (h3 >> 24) & 0xff,
  61364. (h3 >> 16) & 0xff,
  61365. (h3 >> 8) & 0xff,
  61366. h3 & 0xff,
  61367. (h4 >> 24) & 0xff,
  61368. (h4 >> 16) & 0xff,
  61369. (h4 >> 8) & 0xff,
  61370. h4 & 0xff,
  61371. (h5 >> 24) & 0xff,
  61372. (h5 >> 16) & 0xff,
  61373. (h5 >> 8) & 0xff,
  61374. h5 & 0xff,
  61375. (h6 >> 24) & 0xff,
  61376. (h6 >> 16) & 0xff,
  61377. (h6 >> 8) & 0xff,
  61378. h6 & 0xff,
  61379. (h7 >> 24) & 0xff,
  61380. (h7 >> 16) & 0xff,
  61381. (h7 >> 8) & 0xff,
  61382. h7 & 0xff,
  61383. ]);
  61384. }
  61385. return hash;
  61386. })();
  61387. exports.calculateSHA256 = calculateSHA256;
  61388. const calculateSHA512 = (function calculateSHA512Closure() {
  61389. function ch(result, x, y, z, tmp) {
  61390. result.assign(x);
  61391. result.and(y);
  61392. tmp.assign(x);
  61393. tmp.not();
  61394. tmp.and(z);
  61395. result.xor(tmp);
  61396. }
  61397. function maj(result, x, y, z, tmp) {
  61398. result.assign(x);
  61399. result.and(y);
  61400. tmp.assign(x);
  61401. tmp.and(z);
  61402. result.xor(tmp);
  61403. tmp.assign(y);
  61404. tmp.and(z);
  61405. result.xor(tmp);
  61406. }
  61407. function sigma(result, x, tmp) {
  61408. result.assign(x);
  61409. result.rotateRight(28);
  61410. tmp.assign(x);
  61411. tmp.rotateRight(34);
  61412. result.xor(tmp);
  61413. tmp.assign(x);
  61414. tmp.rotateRight(39);
  61415. result.xor(tmp);
  61416. }
  61417. function sigmaPrime(result, x, tmp) {
  61418. result.assign(x);
  61419. result.rotateRight(14);
  61420. tmp.assign(x);
  61421. tmp.rotateRight(18);
  61422. result.xor(tmp);
  61423. tmp.assign(x);
  61424. tmp.rotateRight(41);
  61425. result.xor(tmp);
  61426. }
  61427. function littleSigma(result, x, tmp) {
  61428. result.assign(x);
  61429. result.rotateRight(1);
  61430. tmp.assign(x);
  61431. tmp.rotateRight(8);
  61432. result.xor(tmp);
  61433. tmp.assign(x);
  61434. tmp.shiftRight(7);
  61435. result.xor(tmp);
  61436. }
  61437. function littleSigmaPrime(result, x, tmp) {
  61438. result.assign(x);
  61439. result.rotateRight(19);
  61440. tmp.assign(x);
  61441. tmp.rotateRight(61);
  61442. result.xor(tmp);
  61443. tmp.assign(x);
  61444. tmp.shiftRight(6);
  61445. result.xor(tmp);
  61446. }
  61447. const k = [
  61448. new Word64(0x428a2f98, 0xd728ae22),
  61449. new Word64(0x71374491, 0x23ef65cd),
  61450. new Word64(0xb5c0fbcf, 0xec4d3b2f),
  61451. new Word64(0xe9b5dba5, 0x8189dbbc),
  61452. new Word64(0x3956c25b, 0xf348b538),
  61453. new Word64(0x59f111f1, 0xb605d019),
  61454. new Word64(0x923f82a4, 0xaf194f9b),
  61455. new Word64(0xab1c5ed5, 0xda6d8118),
  61456. new Word64(0xd807aa98, 0xa3030242),
  61457. new Word64(0x12835b01, 0x45706fbe),
  61458. new Word64(0x243185be, 0x4ee4b28c),
  61459. new Word64(0x550c7dc3, 0xd5ffb4e2),
  61460. new Word64(0x72be5d74, 0xf27b896f),
  61461. new Word64(0x80deb1fe, 0x3b1696b1),
  61462. new Word64(0x9bdc06a7, 0x25c71235),
  61463. new Word64(0xc19bf174, 0xcf692694),
  61464. new Word64(0xe49b69c1, 0x9ef14ad2),
  61465. new Word64(0xefbe4786, 0x384f25e3),
  61466. new Word64(0x0fc19dc6, 0x8b8cd5b5),
  61467. new Word64(0x240ca1cc, 0x77ac9c65),
  61468. new Word64(0x2de92c6f, 0x592b0275),
  61469. new Word64(0x4a7484aa, 0x6ea6e483),
  61470. new Word64(0x5cb0a9dc, 0xbd41fbd4),
  61471. new Word64(0x76f988da, 0x831153b5),
  61472. new Word64(0x983e5152, 0xee66dfab),
  61473. new Word64(0xa831c66d, 0x2db43210),
  61474. new Word64(0xb00327c8, 0x98fb213f),
  61475. new Word64(0xbf597fc7, 0xbeef0ee4),
  61476. new Word64(0xc6e00bf3, 0x3da88fc2),
  61477. new Word64(0xd5a79147, 0x930aa725),
  61478. new Word64(0x06ca6351, 0xe003826f),
  61479. new Word64(0x14292967, 0x0a0e6e70),
  61480. new Word64(0x27b70a85, 0x46d22ffc),
  61481. new Word64(0x2e1b2138, 0x5c26c926),
  61482. new Word64(0x4d2c6dfc, 0x5ac42aed),
  61483. new Word64(0x53380d13, 0x9d95b3df),
  61484. new Word64(0x650a7354, 0x8baf63de),
  61485. new Word64(0x766a0abb, 0x3c77b2a8),
  61486. new Word64(0x81c2c92e, 0x47edaee6),
  61487. new Word64(0x92722c85, 0x1482353b),
  61488. new Word64(0xa2bfe8a1, 0x4cf10364),
  61489. new Word64(0xa81a664b, 0xbc423001),
  61490. new Word64(0xc24b8b70, 0xd0f89791),
  61491. new Word64(0xc76c51a3, 0x0654be30),
  61492. new Word64(0xd192e819, 0xd6ef5218),
  61493. new Word64(0xd6990624, 0x5565a910),
  61494. new Word64(0xf40e3585, 0x5771202a),
  61495. new Word64(0x106aa070, 0x32bbd1b8),
  61496. new Word64(0x19a4c116, 0xb8d2d0c8),
  61497. new Word64(0x1e376c08, 0x5141ab53),
  61498. new Word64(0x2748774c, 0xdf8eeb99),
  61499. new Word64(0x34b0bcb5, 0xe19b48a8),
  61500. new Word64(0x391c0cb3, 0xc5c95a63),
  61501. new Word64(0x4ed8aa4a, 0xe3418acb),
  61502. new Word64(0x5b9cca4f, 0x7763e373),
  61503. new Word64(0x682e6ff3, 0xd6b2b8a3),
  61504. new Word64(0x748f82ee, 0x5defb2fc),
  61505. new Word64(0x78a5636f, 0x43172f60),
  61506. new Word64(0x84c87814, 0xa1f0ab72),
  61507. new Word64(0x8cc70208, 0x1a6439ec),
  61508. new Word64(0x90befffa, 0x23631e28),
  61509. new Word64(0xa4506ceb, 0xde82bde9),
  61510. new Word64(0xbef9a3f7, 0xb2c67915),
  61511. new Word64(0xc67178f2, 0xe372532b),
  61512. new Word64(0xca273ece, 0xea26619c),
  61513. new Word64(0xd186b8c7, 0x21c0c207),
  61514. new Word64(0xeada7dd6, 0xcde0eb1e),
  61515. new Word64(0xf57d4f7f, 0xee6ed178),
  61516. new Word64(0x06f067aa, 0x72176fba),
  61517. new Word64(0x0a637dc5, 0xa2c898a6),
  61518. new Word64(0x113f9804, 0xbef90dae),
  61519. new Word64(0x1b710b35, 0x131c471b),
  61520. new Word64(0x28db77f5, 0x23047d84),
  61521. new Word64(0x32caab7b, 0x40c72493),
  61522. new Word64(0x3c9ebe0a, 0x15c9bebc),
  61523. new Word64(0x431d67c4, 0x9c100d4c),
  61524. new Word64(0x4cc5d4be, 0xcb3e42b6),
  61525. new Word64(0x597f299c, 0xfc657e2a),
  61526. new Word64(0x5fcb6fab, 0x3ad6faec),
  61527. new Word64(0x6c44198c, 0x4a475817),
  61528. ];
  61529. function hash(data, offset, length, mode384 = false) {
  61530. let h0, h1, h2, h3, h4, h5, h6, h7;
  61531. if (!mode384) {
  61532. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  61533. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  61534. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  61535. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  61536. h4 = new Word64(0x510e527f, 0xade682d1);
  61537. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  61538. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  61539. h7 = new Word64(0x5be0cd19, 0x137e2179);
  61540. } else {
  61541. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  61542. h1 = new Word64(0x629a292a, 0x367cd507);
  61543. h2 = new Word64(0x9159015a, 0x3070dd17);
  61544. h3 = new Word64(0x152fecd8, 0xf70e5939);
  61545. h4 = new Word64(0x67332667, 0xffc00b31);
  61546. h5 = new Word64(0x8eb44a87, 0x68581511);
  61547. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  61548. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  61549. }
  61550. const paddedLength = Math.ceil((length + 17) / 128) * 128;
  61551. const padded = new Uint8Array(paddedLength);
  61552. let i, j;
  61553. for (i = 0; i < length; ++i) {
  61554. padded[i] = data[offset++];
  61555. }
  61556. padded[i++] = 0x80;
  61557. const n = paddedLength - 16;
  61558. while (i < n) {
  61559. padded[i++] = 0;
  61560. }
  61561. padded[i++] = 0;
  61562. padded[i++] = 0;
  61563. padded[i++] = 0;
  61564. padded[i++] = 0;
  61565. padded[i++] = 0;
  61566. padded[i++] = 0;
  61567. padded[i++] = 0;
  61568. padded[i++] = 0;
  61569. padded[i++] = 0;
  61570. padded[i++] = 0;
  61571. padded[i++] = 0;
  61572. padded[i++] = (length >>> 29) & 0xff;
  61573. padded[i++] = (length >> 21) & 0xff;
  61574. padded[i++] = (length >> 13) & 0xff;
  61575. padded[i++] = (length >> 5) & 0xff;
  61576. padded[i++] = (length << 3) & 0xff;
  61577. const w = new Array(80);
  61578. for (i = 0; i < 80; i++) {
  61579. w[i] = new Word64(0, 0);
  61580. }
  61581. let a = new Word64(0, 0),
  61582. b = new Word64(0, 0),
  61583. c = new Word64(0, 0);
  61584. let d = new Word64(0, 0),
  61585. e = new Word64(0, 0),
  61586. f = new Word64(0, 0);
  61587. let g = new Word64(0, 0),
  61588. h = new Word64(0, 0);
  61589. const t1 = new Word64(0, 0),
  61590. t2 = new Word64(0, 0);
  61591. const tmp1 = new Word64(0, 0),
  61592. tmp2 = new Word64(0, 0);
  61593. let tmp3;
  61594. for (i = 0; i < paddedLength; ) {
  61595. for (j = 0; j < 16; ++j) {
  61596. w[j].high =
  61597. (padded[i] << 24) |
  61598. (padded[i + 1] << 16) |
  61599. (padded[i + 2] << 8) |
  61600. padded[i + 3];
  61601. w[j].low =
  61602. (padded[i + 4] << 24) |
  61603. (padded[i + 5] << 16) |
  61604. (padded[i + 6] << 8) |
  61605. padded[i + 7];
  61606. i += 8;
  61607. }
  61608. for (j = 16; j < 80; ++j) {
  61609. tmp3 = w[j];
  61610. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  61611. tmp3.add(w[j - 7]);
  61612. littleSigma(tmp1, w[j - 15], tmp2);
  61613. tmp3.add(tmp1);
  61614. tmp3.add(w[j - 16]);
  61615. }
  61616. a.assign(h0);
  61617. b.assign(h1);
  61618. c.assign(h2);
  61619. d.assign(h3);
  61620. e.assign(h4);
  61621. f.assign(h5);
  61622. g.assign(h6);
  61623. h.assign(h7);
  61624. for (j = 0; j < 80; ++j) {
  61625. t1.assign(h);
  61626. sigmaPrime(tmp1, e, tmp2);
  61627. t1.add(tmp1);
  61628. ch(tmp1, e, f, g, tmp2);
  61629. t1.add(tmp1);
  61630. t1.add(k[j]);
  61631. t1.add(w[j]);
  61632. sigma(t2, a, tmp2);
  61633. maj(tmp1, a, b, c, tmp2);
  61634. t2.add(tmp1);
  61635. tmp3 = h;
  61636. h = g;
  61637. g = f;
  61638. f = e;
  61639. d.add(t1);
  61640. e = d;
  61641. d = c;
  61642. c = b;
  61643. b = a;
  61644. tmp3.assign(t1);
  61645. tmp3.add(t2);
  61646. a = tmp3;
  61647. }
  61648. h0.add(a);
  61649. h1.add(b);
  61650. h2.add(c);
  61651. h3.add(d);
  61652. h4.add(e);
  61653. h5.add(f);
  61654. h6.add(g);
  61655. h7.add(h);
  61656. }
  61657. let result;
  61658. if (!mode384) {
  61659. result = new Uint8Array(64);
  61660. h0.copyTo(result, 0);
  61661. h1.copyTo(result, 8);
  61662. h2.copyTo(result, 16);
  61663. h3.copyTo(result, 24);
  61664. h4.copyTo(result, 32);
  61665. h5.copyTo(result, 40);
  61666. h6.copyTo(result, 48);
  61667. h7.copyTo(result, 56);
  61668. } else {
  61669. result = new Uint8Array(48);
  61670. h0.copyTo(result, 0);
  61671. h1.copyTo(result, 8);
  61672. h2.copyTo(result, 16);
  61673. h3.copyTo(result, 24);
  61674. h4.copyTo(result, 32);
  61675. h5.copyTo(result, 40);
  61676. }
  61677. return result;
  61678. }
  61679. return hash;
  61680. })();
  61681. exports.calculateSHA512 = calculateSHA512;
  61682. function calculateSHA384(data, offset, length) {
  61683. return calculateSHA512(data, offset, length, true);
  61684. }
  61685. class NullCipher {
  61686. decryptBlock(data) {
  61687. return data;
  61688. }
  61689. encrypt(data) {
  61690. return data;
  61691. }
  61692. }
  61693. class AESBaseCipher {
  61694. constructor() {
  61695. if (this.constructor === AESBaseCipher) {
  61696. (0, _util.unreachable)("Cannot initialize AESBaseCipher.");
  61697. }
  61698. this._s = new Uint8Array([
  61699. 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67,
  61700. 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59,
  61701. 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7,
  61702. 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1,
  61703. 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05,
  61704. 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83,
  61705. 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29,
  61706. 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b,
  61707. 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa,
  61708. 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c,
  61709. 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc,
  61710. 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec,
  61711. 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19,
  61712. 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee,
  61713. 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49,
  61714. 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
  61715. 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4,
  61716. 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6,
  61717. 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70,
  61718. 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9,
  61719. 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e,
  61720. 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1,
  61721. 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0,
  61722. 0x54, 0xbb, 0x16,
  61723. ]);
  61724. this._inv_s = new Uint8Array([
  61725. 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3,
  61726. 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f,
  61727. 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54,
  61728. 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b,
  61729. 0x42, 0xfa, 0xc3, 0x4e, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24,
  61730. 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8,
  61731. 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d,
  61732. 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda,
  61733. 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, 0x90, 0xd8, 0xab,
  61734. 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3,
  61735. 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1,
  61736. 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41,
  61737. 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6,
  61738. 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9,
  61739. 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d,
  61740. 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b,
  61741. 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0,
  61742. 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07,
  61743. 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60,
  61744. 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f,
  61745. 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5,
  61746. 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b,
  61747. 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55,
  61748. 0x21, 0x0c, 0x7d,
  61749. ]);
  61750. this._mix = new Uint32Array([
  61751. 0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c,
  61752. 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553,
  61753. 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662,
  61754. 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad,
  61755. 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8,
  61756. 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf,
  61757. 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d,
  61758. 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a,
  61759. 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f,
  61760. 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0,
  61761. 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1,
  61762. 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e,
  61763. 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6,
  61764. 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1,
  61765. 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8,
  61766. 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f,
  61767. 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a,
  61768. 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815,
  61769. 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24,
  61770. 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190,
  61771. 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5,
  61772. 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2,
  61773. 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b,
  61774. 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c,
  61775. 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49,
  61776. 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc,
  61777. 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd,
  61778. 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2,
  61779. 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47,
  61780. 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360,
  61781. 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809,
  61782. 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e,
  61783. 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0,
  61784. 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df,
  61785. 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee,
  61786. 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621,
  61787. 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964,
  61788. 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043,
  61789. 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17,
  61790. 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430,
  61791. 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75,
  61792. 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba,
  61793. 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b,
  61794. 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4,
  61795. 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a,
  61796. 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d,
  61797. 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34,
  61798. 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713,
  61799. 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6,
  61800. 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999,
  61801. 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8,
  61802. 0x8d4697a3,
  61803. ]);
  61804. this._mixCol = new Uint8Array(256);
  61805. for (let i = 0; i < 256; i++) {
  61806. if (i < 128) {
  61807. this._mixCol[i] = i << 1;
  61808. } else {
  61809. this._mixCol[i] = (i << 1) ^ 0x1b;
  61810. }
  61811. }
  61812. this.buffer = new Uint8Array(16);
  61813. this.bufferPosition = 0;
  61814. }
  61815. _expandKey(cipherKey) {
  61816. (0, _util.unreachable)(
  61817. "Cannot call `_expandKey` on the base class"
  61818. );
  61819. }
  61820. _decrypt(input, key) {
  61821. let t, u, v;
  61822. const state = new Uint8Array(16);
  61823. state.set(input);
  61824. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  61825. state[j] ^= key[k];
  61826. }
  61827. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  61828. t = state[13];
  61829. state[13] = state[9];
  61830. state[9] = state[5];
  61831. state[5] = state[1];
  61832. state[1] = t;
  61833. t = state[14];
  61834. u = state[10];
  61835. state[14] = state[6];
  61836. state[10] = state[2];
  61837. state[6] = t;
  61838. state[2] = u;
  61839. t = state[15];
  61840. u = state[11];
  61841. v = state[7];
  61842. state[15] = state[3];
  61843. state[11] = t;
  61844. state[7] = u;
  61845. state[3] = v;
  61846. for (let j = 0; j < 16; ++j) {
  61847. state[j] = this._inv_s[state[j]];
  61848. }
  61849. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  61850. state[j] ^= key[k];
  61851. }
  61852. for (let j = 0; j < 16; j += 4) {
  61853. const s0 = this._mix[state[j]];
  61854. const s1 = this._mix[state[j + 1]];
  61855. const s2 = this._mix[state[j + 2]];
  61856. const s3 = this._mix[state[j + 3]];
  61857. t =
  61858. s0 ^
  61859. (s1 >>> 8) ^
  61860. (s1 << 24) ^
  61861. (s2 >>> 16) ^
  61862. (s2 << 16) ^
  61863. (s3 >>> 24) ^
  61864. (s3 << 8);
  61865. state[j] = (t >>> 24) & 0xff;
  61866. state[j + 1] = (t >> 16) & 0xff;
  61867. state[j + 2] = (t >> 8) & 0xff;
  61868. state[j + 3] = t & 0xff;
  61869. }
  61870. }
  61871. t = state[13];
  61872. state[13] = state[9];
  61873. state[9] = state[5];
  61874. state[5] = state[1];
  61875. state[1] = t;
  61876. t = state[14];
  61877. u = state[10];
  61878. state[14] = state[6];
  61879. state[10] = state[2];
  61880. state[6] = t;
  61881. state[2] = u;
  61882. t = state[15];
  61883. u = state[11];
  61884. v = state[7];
  61885. state[15] = state[3];
  61886. state[11] = t;
  61887. state[7] = u;
  61888. state[3] = v;
  61889. for (let j = 0; j < 16; ++j) {
  61890. state[j] = this._inv_s[state[j]];
  61891. state[j] ^= key[j];
  61892. }
  61893. return state;
  61894. }
  61895. _encrypt(input, key) {
  61896. const s = this._s;
  61897. let t, u, v;
  61898. const state = new Uint8Array(16);
  61899. state.set(input);
  61900. for (let j = 0; j < 16; ++j) {
  61901. state[j] ^= key[j];
  61902. }
  61903. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  61904. for (let j = 0; j < 16; ++j) {
  61905. state[j] = s[state[j]];
  61906. }
  61907. v = state[1];
  61908. state[1] = state[5];
  61909. state[5] = state[9];
  61910. state[9] = state[13];
  61911. state[13] = v;
  61912. v = state[2];
  61913. u = state[6];
  61914. state[2] = state[10];
  61915. state[6] = state[14];
  61916. state[10] = v;
  61917. state[14] = u;
  61918. v = state[3];
  61919. u = state[7];
  61920. t = state[11];
  61921. state[3] = state[15];
  61922. state[7] = v;
  61923. state[11] = u;
  61924. state[15] = t;
  61925. for (let j = 0; j < 16; j += 4) {
  61926. const s0 = state[j + 0];
  61927. const s1 = state[j + 1];
  61928. const s2 = state[j + 2];
  61929. const s3 = state[j + 3];
  61930. t = s0 ^ s1 ^ s2 ^ s3;
  61931. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  61932. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  61933. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  61934. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  61935. }
  61936. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  61937. state[j] ^= key[k];
  61938. }
  61939. }
  61940. for (let j = 0; j < 16; ++j) {
  61941. state[j] = s[state[j]];
  61942. }
  61943. v = state[1];
  61944. state[1] = state[5];
  61945. state[5] = state[9];
  61946. state[9] = state[13];
  61947. state[13] = v;
  61948. v = state[2];
  61949. u = state[6];
  61950. state[2] = state[10];
  61951. state[6] = state[14];
  61952. state[10] = v;
  61953. state[14] = u;
  61954. v = state[3];
  61955. u = state[7];
  61956. t = state[11];
  61957. state[3] = state[15];
  61958. state[7] = v;
  61959. state[11] = u;
  61960. state[15] = t;
  61961. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  61962. state[j] ^= key[k];
  61963. }
  61964. return state;
  61965. }
  61966. _decryptBlock2(data, finalize) {
  61967. const sourceLength = data.length;
  61968. let buffer = this.buffer,
  61969. bufferLength = this.bufferPosition;
  61970. const result = [];
  61971. let iv = this.iv;
  61972. for (let i = 0; i < sourceLength; ++i) {
  61973. buffer[bufferLength] = data[i];
  61974. ++bufferLength;
  61975. if (bufferLength < 16) {
  61976. continue;
  61977. }
  61978. const plain = this._decrypt(buffer, this._key);
  61979. for (let j = 0; j < 16; ++j) {
  61980. plain[j] ^= iv[j];
  61981. }
  61982. iv = buffer;
  61983. result.push(plain);
  61984. buffer = new Uint8Array(16);
  61985. bufferLength = 0;
  61986. }
  61987. this.buffer = buffer;
  61988. this.bufferLength = bufferLength;
  61989. this.iv = iv;
  61990. if (result.length === 0) {
  61991. return new Uint8Array(0);
  61992. }
  61993. let outputLength = 16 * result.length;
  61994. if (finalize) {
  61995. const lastBlock = result.at(-1);
  61996. let psLen = lastBlock[15];
  61997. if (psLen <= 16) {
  61998. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  61999. if (lastBlock[i] !== psLen) {
  62000. psLen = 0;
  62001. break;
  62002. }
  62003. }
  62004. outputLength -= psLen;
  62005. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  62006. }
  62007. }
  62008. const output = new Uint8Array(outputLength);
  62009. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  62010. output.set(result[i], j);
  62011. }
  62012. return output;
  62013. }
  62014. decryptBlock(data, finalize, iv = null) {
  62015. const sourceLength = data.length;
  62016. const buffer = this.buffer;
  62017. let bufferLength = this.bufferPosition;
  62018. if (iv) {
  62019. this.iv = iv;
  62020. } else {
  62021. for (
  62022. let i = 0;
  62023. bufferLength < 16 && i < sourceLength;
  62024. ++i, ++bufferLength
  62025. ) {
  62026. buffer[bufferLength] = data[i];
  62027. }
  62028. if (bufferLength < 16) {
  62029. this.bufferLength = bufferLength;
  62030. return new Uint8Array(0);
  62031. }
  62032. this.iv = buffer;
  62033. data = data.subarray(16);
  62034. }
  62035. this.buffer = new Uint8Array(16);
  62036. this.bufferLength = 0;
  62037. this.decryptBlock = this._decryptBlock2;
  62038. return this.decryptBlock(data, finalize);
  62039. }
  62040. encrypt(data, iv) {
  62041. const sourceLength = data.length;
  62042. let buffer = this.buffer,
  62043. bufferLength = this.bufferPosition;
  62044. const result = [];
  62045. if (!iv) {
  62046. iv = new Uint8Array(16);
  62047. }
  62048. for (let i = 0; i < sourceLength; ++i) {
  62049. buffer[bufferLength] = data[i];
  62050. ++bufferLength;
  62051. if (bufferLength < 16) {
  62052. continue;
  62053. }
  62054. for (let j = 0; j < 16; ++j) {
  62055. buffer[j] ^= iv[j];
  62056. }
  62057. const cipher = this._encrypt(buffer, this._key);
  62058. iv = cipher;
  62059. result.push(cipher);
  62060. buffer = new Uint8Array(16);
  62061. bufferLength = 0;
  62062. }
  62063. this.buffer = buffer;
  62064. this.bufferLength = bufferLength;
  62065. this.iv = iv;
  62066. if (result.length === 0) {
  62067. return new Uint8Array(0);
  62068. }
  62069. const outputLength = 16 * result.length;
  62070. const output = new Uint8Array(outputLength);
  62071. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  62072. output.set(result[i], j);
  62073. }
  62074. return output;
  62075. }
  62076. }
  62077. class AES128Cipher extends AESBaseCipher {
  62078. constructor(key) {
  62079. super();
  62080. this._cyclesOfRepetition = 10;
  62081. this._keySize = 160;
  62082. this._rcon = new Uint8Array([
  62083. 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36,
  62084. 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97,
  62085. 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72,
  62086. 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66,
  62087. 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04,
  62088. 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d,
  62089. 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3,
  62090. 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61,
  62091. 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a,
  62092. 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40,
  62093. 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc,
  62094. 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5,
  62095. 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a,
  62096. 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d,
  62097. 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c,
  62098. 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35,
  62099. 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4,
  62100. 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc,
  62101. 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08,
  62102. 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a,
  62103. 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d,
  62104. 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2,
  62105. 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74,
  62106. 0xe8, 0xcb, 0x8d,
  62107. ]);
  62108. this._key = this._expandKey(key);
  62109. }
  62110. _expandKey(cipherKey) {
  62111. const b = 176;
  62112. const s = this._s;
  62113. const rcon = this._rcon;
  62114. const result = new Uint8Array(b);
  62115. result.set(cipherKey);
  62116. for (let j = 16, i = 1; j < b; ++i) {
  62117. let t1 = result[j - 3];
  62118. let t2 = result[j - 2];
  62119. let t3 = result[j - 1];
  62120. let t4 = result[j - 4];
  62121. t1 = s[t1];
  62122. t2 = s[t2];
  62123. t3 = s[t3];
  62124. t4 = s[t4];
  62125. t1 ^= rcon[i];
  62126. for (let n = 0; n < 4; ++n) {
  62127. result[j] = t1 ^= result[j - 16];
  62128. j++;
  62129. result[j] = t2 ^= result[j - 16];
  62130. j++;
  62131. result[j] = t3 ^= result[j - 16];
  62132. j++;
  62133. result[j] = t4 ^= result[j - 16];
  62134. j++;
  62135. }
  62136. }
  62137. return result;
  62138. }
  62139. }
  62140. exports.AES128Cipher = AES128Cipher;
  62141. class AES256Cipher extends AESBaseCipher {
  62142. constructor(key) {
  62143. super();
  62144. this._cyclesOfRepetition = 14;
  62145. this._keySize = 224;
  62146. this._key = this._expandKey(key);
  62147. }
  62148. _expandKey(cipherKey) {
  62149. const b = 240;
  62150. const s = this._s;
  62151. const result = new Uint8Array(b);
  62152. result.set(cipherKey);
  62153. let r = 1;
  62154. let t1, t2, t3, t4;
  62155. for (let j = 32, i = 1; j < b; ++i) {
  62156. if (j % 32 === 16) {
  62157. t1 = s[t1];
  62158. t2 = s[t2];
  62159. t3 = s[t3];
  62160. t4 = s[t4];
  62161. } else if (j % 32 === 0) {
  62162. t1 = result[j - 3];
  62163. t2 = result[j - 2];
  62164. t3 = result[j - 1];
  62165. t4 = result[j - 4];
  62166. t1 = s[t1];
  62167. t2 = s[t2];
  62168. t3 = s[t3];
  62169. t4 = s[t4];
  62170. t1 ^= r;
  62171. if ((r <<= 1) >= 256) {
  62172. r = (r ^ 0x1b) & 0xff;
  62173. }
  62174. }
  62175. for (let n = 0; n < 4; ++n) {
  62176. result[j] = t1 ^= result[j - 32];
  62177. j++;
  62178. result[j] = t2 ^= result[j - 32];
  62179. j++;
  62180. result[j] = t3 ^= result[j - 32];
  62181. j++;
  62182. result[j] = t4 ^= result[j - 32];
  62183. j++;
  62184. }
  62185. }
  62186. return result;
  62187. }
  62188. }
  62189. exports.AES256Cipher = AES256Cipher;
  62190. class PDF17 {
  62191. checkOwnerPassword(
  62192. password,
  62193. ownerValidationSalt,
  62194. userBytes,
  62195. ownerPassword
  62196. ) {
  62197. const hashData = new Uint8Array(password.length + 56);
  62198. hashData.set(password, 0);
  62199. hashData.set(ownerValidationSalt, password.length);
  62200. hashData.set(
  62201. userBytes,
  62202. password.length + ownerValidationSalt.length
  62203. );
  62204. const result = calculateSHA256(hashData, 0, hashData.length);
  62205. return (0, _util.isArrayEqual)(result, ownerPassword);
  62206. }
  62207. checkUserPassword(password, userValidationSalt, userPassword) {
  62208. const hashData = new Uint8Array(password.length + 8);
  62209. hashData.set(password, 0);
  62210. hashData.set(userValidationSalt, password.length);
  62211. const result = calculateSHA256(hashData, 0, hashData.length);
  62212. return (0, _util.isArrayEqual)(result, userPassword);
  62213. }
  62214. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  62215. const hashData = new Uint8Array(password.length + 56);
  62216. hashData.set(password, 0);
  62217. hashData.set(ownerKeySalt, password.length);
  62218. hashData.set(userBytes, password.length + ownerKeySalt.length);
  62219. const key = calculateSHA256(hashData, 0, hashData.length);
  62220. const cipher = new AES256Cipher(key);
  62221. return cipher.decryptBlock(
  62222. ownerEncryption,
  62223. false,
  62224. new Uint8Array(16)
  62225. );
  62226. }
  62227. getUserKey(password, userKeySalt, userEncryption) {
  62228. const hashData = new Uint8Array(password.length + 8);
  62229. hashData.set(password, 0);
  62230. hashData.set(userKeySalt, password.length);
  62231. const key = calculateSHA256(hashData, 0, hashData.length);
  62232. const cipher = new AES256Cipher(key);
  62233. return cipher.decryptBlock(
  62234. userEncryption,
  62235. false,
  62236. new Uint8Array(16)
  62237. );
  62238. }
  62239. }
  62240. exports.PDF17 = PDF17;
  62241. const PDF20 = (function PDF20Closure() {
  62242. function calculatePDF20Hash(password, input, userBytes) {
  62243. let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  62244. let e = [0];
  62245. let i = 0;
  62246. while (i < 64 || e.at(-1) > i - 32) {
  62247. const combinedLength =
  62248. password.length + k.length + userBytes.length,
  62249. combinedArray = new Uint8Array(combinedLength);
  62250. let writeOffset = 0;
  62251. combinedArray.set(password, writeOffset);
  62252. writeOffset += password.length;
  62253. combinedArray.set(k, writeOffset);
  62254. writeOffset += k.length;
  62255. combinedArray.set(userBytes, writeOffset);
  62256. const k1 = new Uint8Array(combinedLength * 64);
  62257. for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) {
  62258. k1.set(combinedArray, pos);
  62259. }
  62260. const cipher = new AES128Cipher(k.subarray(0, 16));
  62261. e = cipher.encrypt(k1, k.subarray(16, 32));
  62262. let remainder = 0;
  62263. for (let z = 0; z < 16; z++) {
  62264. remainder *= 256 % 3;
  62265. remainder %= 3;
  62266. remainder += (e[z] >>> 0) % 3;
  62267. remainder %= 3;
  62268. }
  62269. if (remainder === 0) {
  62270. k = calculateSHA256(e, 0, e.length);
  62271. } else if (remainder === 1) {
  62272. k = calculateSHA384(e, 0, e.length);
  62273. } else if (remainder === 2) {
  62274. k = calculateSHA512(e, 0, e.length);
  62275. }
  62276. i++;
  62277. }
  62278. return k.subarray(0, 32);
  62279. }
  62280. class PDF20 {
  62281. hash(password, concatBytes, userBytes) {
  62282. return calculatePDF20Hash(password, concatBytes, userBytes);
  62283. }
  62284. checkOwnerPassword(
  62285. password,
  62286. ownerValidationSalt,
  62287. userBytes,
  62288. ownerPassword
  62289. ) {
  62290. const hashData = new Uint8Array(password.length + 56);
  62291. hashData.set(password, 0);
  62292. hashData.set(ownerValidationSalt, password.length);
  62293. hashData.set(
  62294. userBytes,
  62295. password.length + ownerValidationSalt.length
  62296. );
  62297. const result = calculatePDF20Hash(password, hashData, userBytes);
  62298. return (0, _util.isArrayEqual)(result, ownerPassword);
  62299. }
  62300. checkUserPassword(password, userValidationSalt, userPassword) {
  62301. const hashData = new Uint8Array(password.length + 8);
  62302. hashData.set(password, 0);
  62303. hashData.set(userValidationSalt, password.length);
  62304. const result = calculatePDF20Hash(password, hashData, []);
  62305. return (0, _util.isArrayEqual)(result, userPassword);
  62306. }
  62307. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  62308. const hashData = new Uint8Array(password.length + 56);
  62309. hashData.set(password, 0);
  62310. hashData.set(ownerKeySalt, password.length);
  62311. hashData.set(userBytes, password.length + ownerKeySalt.length);
  62312. const key = calculatePDF20Hash(password, hashData, userBytes);
  62313. const cipher = new AES256Cipher(key);
  62314. return cipher.decryptBlock(
  62315. ownerEncryption,
  62316. false,
  62317. new Uint8Array(16)
  62318. );
  62319. }
  62320. getUserKey(password, userKeySalt, userEncryption) {
  62321. const hashData = new Uint8Array(password.length + 8);
  62322. hashData.set(password, 0);
  62323. hashData.set(userKeySalt, password.length);
  62324. const key = calculatePDF20Hash(password, hashData, []);
  62325. const cipher = new AES256Cipher(key);
  62326. return cipher.decryptBlock(
  62327. userEncryption,
  62328. false,
  62329. new Uint8Array(16)
  62330. );
  62331. }
  62332. }
  62333. return PDF20;
  62334. })();
  62335. exports.PDF20 = PDF20;
  62336. class CipherTransform {
  62337. constructor(stringCipherConstructor, streamCipherConstructor) {
  62338. this.StringCipherConstructor = stringCipherConstructor;
  62339. this.StreamCipherConstructor = streamCipherConstructor;
  62340. }
  62341. createStream(stream, length) {
  62342. const cipher = new this.StreamCipherConstructor();
  62343. return new _decrypt_stream.DecryptStream(
  62344. stream,
  62345. length,
  62346. function cipherTransformDecryptStream(data, finalize) {
  62347. return cipher.decryptBlock(data, finalize);
  62348. }
  62349. );
  62350. }
  62351. decryptString(s) {
  62352. const cipher = new this.StringCipherConstructor();
  62353. let data = (0, _util.stringToBytes)(s);
  62354. data = cipher.decryptBlock(data, true);
  62355. return (0, _util.bytesToString)(data);
  62356. }
  62357. encryptString(s) {
  62358. const cipher = new this.StringCipherConstructor();
  62359. if (cipher instanceof AESBaseCipher) {
  62360. const strLen = s.length;
  62361. const pad = 16 - (strLen % 16);
  62362. s += String.fromCharCode(pad).repeat(pad);
  62363. const iv = new Uint8Array(16);
  62364. if (typeof crypto !== "undefined") {
  62365. crypto.getRandomValues(iv);
  62366. } else {
  62367. for (let i = 0; i < 16; i++) {
  62368. iv[i] = Math.floor(256 * Math.random());
  62369. }
  62370. }
  62371. let data = (0, _util.stringToBytes)(s);
  62372. data = cipher.encrypt(data, iv);
  62373. const buf = new Uint8Array(16 + data.length);
  62374. buf.set(iv);
  62375. buf.set(data, 16);
  62376. return (0, _util.bytesToString)(buf);
  62377. }
  62378. let data = (0, _util.stringToBytes)(s);
  62379. data = cipher.encrypt(data);
  62380. return (0, _util.bytesToString)(data);
  62381. }
  62382. }
  62383. const CipherTransformFactory =
  62384. (function CipherTransformFactoryClosure() {
  62385. const defaultPasswordBytes = new Uint8Array([
  62386. 0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x64, 0x00, 0x4e,
  62387. 0x56, 0xff, 0xfa, 0x01, 0x08, 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68,
  62388. 0x3e, 0x80, 0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a,
  62389. ]);
  62390. function createEncryptionKey20(
  62391. revision,
  62392. password,
  62393. ownerPassword,
  62394. ownerValidationSalt,
  62395. ownerKeySalt,
  62396. uBytes,
  62397. userPassword,
  62398. userValidationSalt,
  62399. userKeySalt,
  62400. ownerEncryption,
  62401. userEncryption,
  62402. perms
  62403. ) {
  62404. if (password) {
  62405. const passwordLength = Math.min(127, password.length);
  62406. password = password.subarray(0, passwordLength);
  62407. } else {
  62408. password = [];
  62409. }
  62410. let pdfAlgorithm;
  62411. if (revision === 6) {
  62412. pdfAlgorithm = new PDF20();
  62413. } else {
  62414. pdfAlgorithm = new PDF17();
  62415. }
  62416. if (
  62417. pdfAlgorithm.checkUserPassword(
  62418. password,
  62419. userValidationSalt,
  62420. userPassword
  62421. )
  62422. ) {
  62423. return pdfAlgorithm.getUserKey(
  62424. password,
  62425. userKeySalt,
  62426. userEncryption
  62427. );
  62428. } else if (
  62429. password.length &&
  62430. pdfAlgorithm.checkOwnerPassword(
  62431. password,
  62432. ownerValidationSalt,
  62433. uBytes,
  62434. ownerPassword
  62435. )
  62436. ) {
  62437. return pdfAlgorithm.getOwnerKey(
  62438. password,
  62439. ownerKeySalt,
  62440. uBytes,
  62441. ownerEncryption
  62442. );
  62443. }
  62444. return null;
  62445. }
  62446. function prepareKeyData(
  62447. fileId,
  62448. password,
  62449. ownerPassword,
  62450. userPassword,
  62451. flags,
  62452. revision,
  62453. keyLength,
  62454. encryptMetadata
  62455. ) {
  62456. const hashDataSize = 40 + ownerPassword.length + fileId.length;
  62457. const hashData = new Uint8Array(hashDataSize);
  62458. let i = 0,
  62459. j,
  62460. n;
  62461. if (password) {
  62462. n = Math.min(32, password.length);
  62463. for (; i < n; ++i) {
  62464. hashData[i] = password[i];
  62465. }
  62466. }
  62467. j = 0;
  62468. while (i < 32) {
  62469. hashData[i++] = defaultPasswordBytes[j++];
  62470. }
  62471. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  62472. hashData[i++] = ownerPassword[j];
  62473. }
  62474. hashData[i++] = flags & 0xff;
  62475. hashData[i++] = (flags >> 8) & 0xff;
  62476. hashData[i++] = (flags >> 16) & 0xff;
  62477. hashData[i++] = (flags >>> 24) & 0xff;
  62478. for (j = 0, n = fileId.length; j < n; ++j) {
  62479. hashData[i++] = fileId[j];
  62480. }
  62481. if (revision >= 4 && !encryptMetadata) {
  62482. hashData[i++] = 0xff;
  62483. hashData[i++] = 0xff;
  62484. hashData[i++] = 0xff;
  62485. hashData[i++] = 0xff;
  62486. }
  62487. let hash = calculateMD5(hashData, 0, i);
  62488. const keyLengthInBytes = keyLength >> 3;
  62489. if (revision >= 3) {
  62490. for (j = 0; j < 50; ++j) {
  62491. hash = calculateMD5(hash, 0, keyLengthInBytes);
  62492. }
  62493. }
  62494. const encryptionKey = hash.subarray(0, keyLengthInBytes);
  62495. let cipher, checkData;
  62496. if (revision >= 3) {
  62497. for (i = 0; i < 32; ++i) {
  62498. hashData[i] = defaultPasswordBytes[i];
  62499. }
  62500. for (j = 0, n = fileId.length; j < n; ++j) {
  62501. hashData[i++] = fileId[j];
  62502. }
  62503. cipher = new ARCFourCipher(encryptionKey);
  62504. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  62505. n = encryptionKey.length;
  62506. const derivedKey = new Uint8Array(n);
  62507. for (j = 1; j <= 19; ++j) {
  62508. for (let k = 0; k < n; ++k) {
  62509. derivedKey[k] = encryptionKey[k] ^ j;
  62510. }
  62511. cipher = new ARCFourCipher(derivedKey);
  62512. checkData = cipher.encryptBlock(checkData);
  62513. }
  62514. for (j = 0, n = checkData.length; j < n; ++j) {
  62515. if (userPassword[j] !== checkData[j]) {
  62516. return null;
  62517. }
  62518. }
  62519. } else {
  62520. cipher = new ARCFourCipher(encryptionKey);
  62521. checkData = cipher.encryptBlock(defaultPasswordBytes);
  62522. for (j = 0, n = checkData.length; j < n; ++j) {
  62523. if (userPassword[j] !== checkData[j]) {
  62524. return null;
  62525. }
  62526. }
  62527. }
  62528. return encryptionKey;
  62529. }
  62530. function decodeUserPassword(
  62531. password,
  62532. ownerPassword,
  62533. revision,
  62534. keyLength
  62535. ) {
  62536. const hashData = new Uint8Array(32);
  62537. let i = 0;
  62538. const n = Math.min(32, password.length);
  62539. for (; i < n; ++i) {
  62540. hashData[i] = password[i];
  62541. }
  62542. let j = 0;
  62543. while (i < 32) {
  62544. hashData[i++] = defaultPasswordBytes[j++];
  62545. }
  62546. let hash = calculateMD5(hashData, 0, i);
  62547. const keyLengthInBytes = keyLength >> 3;
  62548. if (revision >= 3) {
  62549. for (j = 0; j < 50; ++j) {
  62550. hash = calculateMD5(hash, 0, hash.length);
  62551. }
  62552. }
  62553. let cipher, userPassword;
  62554. if (revision >= 3) {
  62555. userPassword = ownerPassword;
  62556. const derivedKey = new Uint8Array(keyLengthInBytes);
  62557. for (j = 19; j >= 0; j--) {
  62558. for (let k = 0; k < keyLengthInBytes; ++k) {
  62559. derivedKey[k] = hash[k] ^ j;
  62560. }
  62561. cipher = new ARCFourCipher(derivedKey);
  62562. userPassword = cipher.encryptBlock(userPassword);
  62563. }
  62564. } else {
  62565. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  62566. userPassword = cipher.encryptBlock(ownerPassword);
  62567. }
  62568. return userPassword;
  62569. }
  62570. const identityName = _primitives.Name.get("Identity");
  62571. function buildObjectKey(num, gen, encryptionKey, isAes = false) {
  62572. const key = new Uint8Array(encryptionKey.length + 9);
  62573. const n = encryptionKey.length;
  62574. let i;
  62575. for (i = 0; i < n; ++i) {
  62576. key[i] = encryptionKey[i];
  62577. }
  62578. key[i++] = num & 0xff;
  62579. key[i++] = (num >> 8) & 0xff;
  62580. key[i++] = (num >> 16) & 0xff;
  62581. key[i++] = gen & 0xff;
  62582. key[i++] = (gen >> 8) & 0xff;
  62583. if (isAes) {
  62584. key[i++] = 0x73;
  62585. key[i++] = 0x41;
  62586. key[i++] = 0x6c;
  62587. key[i++] = 0x54;
  62588. }
  62589. const hash = calculateMD5(key, 0, i);
  62590. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  62591. }
  62592. function buildCipherConstructor(cf, name, num, gen, key) {
  62593. if (!(name instanceof _primitives.Name)) {
  62594. throw new _util.FormatError("Invalid crypt filter name.");
  62595. }
  62596. const cryptFilter = cf.get(name.name);
  62597. let cfm;
  62598. if (cryptFilter !== null && cryptFilter !== undefined) {
  62599. cfm = cryptFilter.get("CFM");
  62600. }
  62601. if (!cfm || cfm.name === "None") {
  62602. return function cipherTransformFactoryBuildCipherConstructorNone() {
  62603. return new NullCipher();
  62604. };
  62605. }
  62606. if (cfm.name === "V2") {
  62607. return function cipherTransformFactoryBuildCipherConstructorV2() {
  62608. return new ARCFourCipher(
  62609. buildObjectKey(num, gen, key, false)
  62610. );
  62611. };
  62612. }
  62613. if (cfm.name === "AESV2") {
  62614. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  62615. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  62616. };
  62617. }
  62618. if (cfm.name === "AESV3") {
  62619. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  62620. return new AES256Cipher(key);
  62621. };
  62622. }
  62623. throw new _util.FormatError("Unknown crypto method");
  62624. }
  62625. class CipherTransformFactory {
  62626. constructor(dict, fileId, password) {
  62627. const filter = dict.get("Filter");
  62628. if (!(0, _primitives.isName)(filter, "Standard")) {
  62629. throw new _util.FormatError("unknown encryption method");
  62630. }
  62631. this.filterName = filter.name;
  62632. this.dict = dict;
  62633. const algorithm = dict.get("V");
  62634. if (
  62635. !Number.isInteger(algorithm) ||
  62636. (algorithm !== 1 &&
  62637. algorithm !== 2 &&
  62638. algorithm !== 4 &&
  62639. algorithm !== 5)
  62640. ) {
  62641. throw new _util.FormatError(
  62642. "unsupported encryption algorithm"
  62643. );
  62644. }
  62645. this.algorithm = algorithm;
  62646. let keyLength = dict.get("Length");
  62647. if (!keyLength) {
  62648. if (algorithm <= 3) {
  62649. keyLength = 40;
  62650. } else {
  62651. const cfDict = dict.get("CF");
  62652. const streamCryptoName = dict.get("StmF");
  62653. if (
  62654. cfDict instanceof _primitives.Dict &&
  62655. streamCryptoName instanceof _primitives.Name
  62656. ) {
  62657. cfDict.suppressEncryption = true;
  62658. const handlerDict = cfDict.get(streamCryptoName.name);
  62659. keyLength =
  62660. (handlerDict && handlerDict.get("Length")) || 128;
  62661. if (keyLength < 40) {
  62662. keyLength <<= 3;
  62663. }
  62664. }
  62665. }
  62666. }
  62667. if (
  62668. !Number.isInteger(keyLength) ||
  62669. keyLength < 40 ||
  62670. keyLength % 8 !== 0
  62671. ) {
  62672. throw new _util.FormatError("invalid key length");
  62673. }
  62674. const ownerPassword = (0, _util.stringToBytes)(
  62675. dict.get("O")
  62676. ).subarray(0, 32);
  62677. const userPassword = (0, _util.stringToBytes)(
  62678. dict.get("U")
  62679. ).subarray(0, 32);
  62680. const flags = dict.get("P");
  62681. const revision = dict.get("R");
  62682. const encryptMetadata =
  62683. (algorithm === 4 || algorithm === 5) &&
  62684. dict.get("EncryptMetadata") !== false;
  62685. this.encryptMetadata = encryptMetadata;
  62686. const fileIdBytes = (0, _util.stringToBytes)(fileId);
  62687. let passwordBytes;
  62688. if (password) {
  62689. if (revision === 6) {
  62690. try {
  62691. password = (0, _util.utf8StringToString)(password);
  62692. } catch (ex) {
  62693. (0, _util.warn)(
  62694. "CipherTransformFactory: " +
  62695. "Unable to convert UTF8 encoded password."
  62696. );
  62697. }
  62698. }
  62699. passwordBytes = (0, _util.stringToBytes)(password);
  62700. }
  62701. let encryptionKey;
  62702. if (algorithm !== 5) {
  62703. encryptionKey = prepareKeyData(
  62704. fileIdBytes,
  62705. passwordBytes,
  62706. ownerPassword,
  62707. userPassword,
  62708. flags,
  62709. revision,
  62710. keyLength,
  62711. encryptMetadata
  62712. );
  62713. } else {
  62714. const ownerValidationSalt = (0, _util.stringToBytes)(
  62715. dict.get("O")
  62716. ).subarray(32, 40);
  62717. const ownerKeySalt = (0, _util.stringToBytes)(
  62718. dict.get("O")
  62719. ).subarray(40, 48);
  62720. const uBytes = (0, _util.stringToBytes)(
  62721. dict.get("U")
  62722. ).subarray(0, 48);
  62723. const userValidationSalt = (0, _util.stringToBytes)(
  62724. dict.get("U")
  62725. ).subarray(32, 40);
  62726. const userKeySalt = (0, _util.stringToBytes)(
  62727. dict.get("U")
  62728. ).subarray(40, 48);
  62729. const ownerEncryption = (0, _util.stringToBytes)(
  62730. dict.get("OE")
  62731. );
  62732. const userEncryption = (0, _util.stringToBytes)(
  62733. dict.get("UE")
  62734. );
  62735. const perms = (0, _util.stringToBytes)(dict.get("Perms"));
  62736. encryptionKey = createEncryptionKey20(
  62737. revision,
  62738. passwordBytes,
  62739. ownerPassword,
  62740. ownerValidationSalt,
  62741. ownerKeySalt,
  62742. uBytes,
  62743. userPassword,
  62744. userValidationSalt,
  62745. userKeySalt,
  62746. ownerEncryption,
  62747. userEncryption,
  62748. perms
  62749. );
  62750. }
  62751. if (!encryptionKey && !password) {
  62752. throw new _util.PasswordException(
  62753. "No password given",
  62754. _util.PasswordResponses.NEED_PASSWORD
  62755. );
  62756. } else if (!encryptionKey && password) {
  62757. const decodedPassword = decodeUserPassword(
  62758. passwordBytes,
  62759. ownerPassword,
  62760. revision,
  62761. keyLength
  62762. );
  62763. encryptionKey = prepareKeyData(
  62764. fileIdBytes,
  62765. decodedPassword,
  62766. ownerPassword,
  62767. userPassword,
  62768. flags,
  62769. revision,
  62770. keyLength,
  62771. encryptMetadata
  62772. );
  62773. }
  62774. if (!encryptionKey) {
  62775. throw new _util.PasswordException(
  62776. "Incorrect Password",
  62777. _util.PasswordResponses.INCORRECT_PASSWORD
  62778. );
  62779. }
  62780. this.encryptionKey = encryptionKey;
  62781. if (algorithm >= 4) {
  62782. const cf = dict.get("CF");
  62783. if (cf instanceof _primitives.Dict) {
  62784. cf.suppressEncryption = true;
  62785. }
  62786. this.cf = cf;
  62787. this.stmf = dict.get("StmF") || identityName;
  62788. this.strf = dict.get("StrF") || identityName;
  62789. this.eff = dict.get("EFF") || this.stmf;
  62790. }
  62791. }
  62792. createCipherTransform(num, gen) {
  62793. if (this.algorithm === 4 || this.algorithm === 5) {
  62794. return new CipherTransform(
  62795. buildCipherConstructor(
  62796. this.cf,
  62797. this.strf,
  62798. num,
  62799. gen,
  62800. this.encryptionKey
  62801. ),
  62802. buildCipherConstructor(
  62803. this.cf,
  62804. this.stmf,
  62805. num,
  62806. gen,
  62807. this.encryptionKey
  62808. )
  62809. );
  62810. }
  62811. const key = buildObjectKey(num, gen, this.encryptionKey, false);
  62812. const cipherConstructor =
  62813. function buildCipherCipherConstructor() {
  62814. return new ARCFourCipher(key);
  62815. };
  62816. return new CipherTransform(
  62817. cipherConstructor,
  62818. cipherConstructor
  62819. );
  62820. }
  62821. }
  62822. return CipherTransformFactory;
  62823. })();
  62824. exports.CipherTransformFactory = CipherTransformFactory;
  62825. /***/
  62826. },
  62827. /* 68 */
  62828. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62829. Object.defineProperty(exports, "__esModule", {
  62830. value: true,
  62831. });
  62832. exports.DecryptStream = void 0;
  62833. var _decode_stream = __w_pdfjs_require__(19);
  62834. const chunkSize = 512;
  62835. class DecryptStream extends _decode_stream.DecodeStream {
  62836. constructor(str, maybeLength, decrypt) {
  62837. super(maybeLength);
  62838. this.str = str;
  62839. this.dict = str.dict;
  62840. this.decrypt = decrypt;
  62841. this.nextChunk = null;
  62842. this.initialized = false;
  62843. }
  62844. readBlock() {
  62845. let chunk;
  62846. if (this.initialized) {
  62847. chunk = this.nextChunk;
  62848. } else {
  62849. chunk = this.str.getBytes(chunkSize);
  62850. this.initialized = true;
  62851. }
  62852. if (!chunk || chunk.length === 0) {
  62853. this.eof = true;
  62854. return;
  62855. }
  62856. this.nextChunk = this.str.getBytes(chunkSize);
  62857. const hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  62858. const decrypt = this.decrypt;
  62859. chunk = decrypt(chunk, !hasMoreData);
  62860. let bufferLength = this.bufferLength;
  62861. const n = chunk.length,
  62862. buffer = this.ensureBuffer(bufferLength + n);
  62863. for (let i = 0; i < n; i++) {
  62864. buffer[bufferLength++] = chunk[i];
  62865. }
  62866. this.bufferLength = bufferLength;
  62867. }
  62868. }
  62869. exports.DecryptStream = DecryptStream;
  62870. /***/
  62871. },
  62872. /* 69 */
  62873. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62874. Object.defineProperty(exports, "__esModule", {
  62875. value: true,
  62876. });
  62877. exports.Catalog = void 0;
  62878. var _core_utils = __w_pdfjs_require__(6);
  62879. var _util = __w_pdfjs_require__(2);
  62880. var _primitives = __w_pdfjs_require__(5);
  62881. var _name_number_tree = __w_pdfjs_require__(70);
  62882. var _base_stream = __w_pdfjs_require__(7);
  62883. var _cleanup_helper = __w_pdfjs_require__(71);
  62884. var _colorspace = __w_pdfjs_require__(14);
  62885. var _file_spec = __w_pdfjs_require__(72);
  62886. var _image_utils = __w_pdfjs_require__(59);
  62887. var _metadata_parser = __w_pdfjs_require__(73);
  62888. var _struct_tree = __w_pdfjs_require__(74);
  62889. function fetchDestination(dest) {
  62890. if (dest instanceof _primitives.Dict) {
  62891. dest = dest.get("D");
  62892. }
  62893. return Array.isArray(dest) ? dest : null;
  62894. }
  62895. class Catalog {
  62896. constructor(pdfManager, xref) {
  62897. this.pdfManager = pdfManager;
  62898. this.xref = xref;
  62899. this._catDict = xref.getCatalogObj();
  62900. if (!(this._catDict instanceof _primitives.Dict)) {
  62901. throw new _util.FormatError(
  62902. "Catalog object is not a dictionary."
  62903. );
  62904. }
  62905. this.toplevelPagesDict;
  62906. this._actualNumPages = null;
  62907. this.fontCache = new _primitives.RefSetCache();
  62908. this.builtInCMapCache = new Map();
  62909. this.standardFontDataCache = new Map();
  62910. this.globalImageCache = new _image_utils.GlobalImageCache();
  62911. this.pageKidsCountCache = new _primitives.RefSetCache();
  62912. this.pageIndexCache = new _primitives.RefSetCache();
  62913. this.nonBlendModesSet = new _primitives.RefSet();
  62914. }
  62915. get version() {
  62916. const version = this._catDict.get("Version");
  62917. return (0, _util.shadow)(
  62918. this,
  62919. "version",
  62920. version instanceof _primitives.Name ? version.name : null
  62921. );
  62922. }
  62923. get lang() {
  62924. const lang = this._catDict.get("Lang");
  62925. return (0, _util.shadow)(
  62926. this,
  62927. "lang",
  62928. typeof lang === "string"
  62929. ? (0, _util.stringToPDFString)(lang)
  62930. : null
  62931. );
  62932. }
  62933. get needsRendering() {
  62934. const needsRendering = this._catDict.get("NeedsRendering");
  62935. return (0, _util.shadow)(
  62936. this,
  62937. "needsRendering",
  62938. typeof needsRendering === "boolean" ? needsRendering : false
  62939. );
  62940. }
  62941. get collection() {
  62942. let collection = null;
  62943. try {
  62944. const obj = this._catDict.get("Collection");
  62945. if (obj instanceof _primitives.Dict && obj.size > 0) {
  62946. collection = obj;
  62947. }
  62948. } catch (ex) {
  62949. if (ex instanceof _core_utils.MissingDataException) {
  62950. throw ex;
  62951. }
  62952. (0, _util.info)(
  62953. "Cannot fetch Collection entry; assuming no collection is present."
  62954. );
  62955. }
  62956. return (0, _util.shadow)(this, "collection", collection);
  62957. }
  62958. get acroForm() {
  62959. let acroForm = null;
  62960. try {
  62961. const obj = this._catDict.get("AcroForm");
  62962. if (obj instanceof _primitives.Dict && obj.size > 0) {
  62963. acroForm = obj;
  62964. }
  62965. } catch (ex) {
  62966. if (ex instanceof _core_utils.MissingDataException) {
  62967. throw ex;
  62968. }
  62969. (0, _util.info)(
  62970. "Cannot fetch AcroForm entry; assuming no forms are present."
  62971. );
  62972. }
  62973. return (0, _util.shadow)(this, "acroForm", acroForm);
  62974. }
  62975. get acroFormRef() {
  62976. const value = this._catDict.getRaw("AcroForm");
  62977. return (0, _util.shadow)(
  62978. this,
  62979. "acroFormRef",
  62980. value instanceof _primitives.Ref ? value : null
  62981. );
  62982. }
  62983. get metadata() {
  62984. const streamRef = this._catDict.getRaw("Metadata");
  62985. if (!(streamRef instanceof _primitives.Ref)) {
  62986. return (0, _util.shadow)(this, "metadata", null);
  62987. }
  62988. let metadata = null;
  62989. try {
  62990. const suppressEncryption = !(
  62991. this.xref.encrypt && this.xref.encrypt.encryptMetadata
  62992. );
  62993. const stream = this.xref.fetch(streamRef, suppressEncryption);
  62994. if (
  62995. stream instanceof _base_stream.BaseStream &&
  62996. stream.dict instanceof _primitives.Dict
  62997. ) {
  62998. const type = stream.dict.get("Type");
  62999. const subtype = stream.dict.get("Subtype");
  63000. if (
  63001. (0, _primitives.isName)(type, "Metadata") &&
  63002. (0, _primitives.isName)(subtype, "XML")
  63003. ) {
  63004. const data = (0, _util.stringToUTF8String)(
  63005. stream.getString()
  63006. );
  63007. if (data) {
  63008. metadata = new _metadata_parser.MetadataParser(data)
  63009. .serializable;
  63010. }
  63011. }
  63012. }
  63013. } catch (ex) {
  63014. if (ex instanceof _core_utils.MissingDataException) {
  63015. throw ex;
  63016. }
  63017. (0, _util.info)(`Skipping invalid Metadata: "${ex}".`);
  63018. }
  63019. return (0, _util.shadow)(this, "metadata", metadata);
  63020. }
  63021. get markInfo() {
  63022. let markInfo = null;
  63023. try {
  63024. markInfo = this._readMarkInfo();
  63025. } catch (ex) {
  63026. if (ex instanceof _core_utils.MissingDataException) {
  63027. throw ex;
  63028. }
  63029. (0, _util.warn)("Unable to read mark info.");
  63030. }
  63031. return (0, _util.shadow)(this, "markInfo", markInfo);
  63032. }
  63033. _readMarkInfo() {
  63034. const obj = this._catDict.get("MarkInfo");
  63035. if (!(obj instanceof _primitives.Dict)) {
  63036. return null;
  63037. }
  63038. const markInfo = {
  63039. Marked: false,
  63040. UserProperties: false,
  63041. Suspects: false,
  63042. };
  63043. for (const key in markInfo) {
  63044. const value = obj.get(key);
  63045. if (typeof value === "boolean") {
  63046. markInfo[key] = value;
  63047. }
  63048. }
  63049. return markInfo;
  63050. }
  63051. get structTreeRoot() {
  63052. let structTree = null;
  63053. try {
  63054. structTree = this._readStructTreeRoot();
  63055. } catch (ex) {
  63056. if (ex instanceof _core_utils.MissingDataException) {
  63057. throw ex;
  63058. }
  63059. (0, _util.warn)("Unable read to structTreeRoot info.");
  63060. }
  63061. return (0, _util.shadow)(this, "structTreeRoot", structTree);
  63062. }
  63063. _readStructTreeRoot() {
  63064. const obj = this._catDict.get("StructTreeRoot");
  63065. if (!(obj instanceof _primitives.Dict)) {
  63066. return null;
  63067. }
  63068. const root = new _struct_tree.StructTreeRoot(obj);
  63069. root.init();
  63070. return root;
  63071. }
  63072. get toplevelPagesDict() {
  63073. const pagesObj = this._catDict.get("Pages");
  63074. if (!(pagesObj instanceof _primitives.Dict)) {
  63075. throw new _util.FormatError(
  63076. "Invalid top-level pages dictionary."
  63077. );
  63078. }
  63079. return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
  63080. }
  63081. get documentOutline() {
  63082. let obj = null;
  63083. try {
  63084. obj = this._readDocumentOutline();
  63085. } catch (ex) {
  63086. if (ex instanceof _core_utils.MissingDataException) {
  63087. throw ex;
  63088. }
  63089. (0, _util.warn)("Unable to read document outline.");
  63090. }
  63091. return (0, _util.shadow)(this, "documentOutline", obj);
  63092. }
  63093. _readDocumentOutline() {
  63094. let obj = this._catDict.get("Outlines");
  63095. if (!(obj instanceof _primitives.Dict)) {
  63096. return null;
  63097. }
  63098. obj = obj.getRaw("First");
  63099. if (!(obj instanceof _primitives.Ref)) {
  63100. return null;
  63101. }
  63102. const root = {
  63103. items: [],
  63104. };
  63105. const queue = [
  63106. {
  63107. obj,
  63108. parent: root,
  63109. },
  63110. ];
  63111. const processed = new _primitives.RefSet();
  63112. processed.put(obj);
  63113. const xref = this.xref,
  63114. blackColor = new Uint8ClampedArray(3);
  63115. while (queue.length > 0) {
  63116. const i = queue.shift();
  63117. const outlineDict = xref.fetchIfRef(i.obj);
  63118. if (outlineDict === null) {
  63119. continue;
  63120. }
  63121. if (!outlineDict.has("Title")) {
  63122. throw new _util.FormatError(
  63123. "Invalid outline item encountered."
  63124. );
  63125. }
  63126. const data = {
  63127. url: null,
  63128. dest: null,
  63129. };
  63130. Catalog.parseDestDictionary({
  63131. destDict: outlineDict,
  63132. resultObj: data,
  63133. docBaseUrl: this.pdfManager.docBaseUrl,
  63134. });
  63135. const title = outlineDict.get("Title");
  63136. const flags = outlineDict.get("F") || 0;
  63137. const color = outlineDict.getArray("C");
  63138. const count = outlineDict.get("Count");
  63139. let rgbColor = blackColor;
  63140. if (
  63141. Array.isArray(color) &&
  63142. color.length === 3 &&
  63143. (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)
  63144. ) {
  63145. rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(
  63146. color,
  63147. 0
  63148. );
  63149. }
  63150. const outlineItem = {
  63151. dest: data.dest,
  63152. url: data.url,
  63153. unsafeUrl: data.unsafeUrl,
  63154. newWindow: data.newWindow,
  63155. title: (0, _util.stringToPDFString)(title),
  63156. color: rgbColor,
  63157. count: Number.isInteger(count) ? count : undefined,
  63158. bold: !!(flags & 2),
  63159. italic: !!(flags & 1),
  63160. items: [],
  63161. };
  63162. i.parent.items.push(outlineItem);
  63163. obj = outlineDict.getRaw("First");
  63164. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  63165. queue.push({
  63166. obj,
  63167. parent: outlineItem,
  63168. });
  63169. processed.put(obj);
  63170. }
  63171. obj = outlineDict.getRaw("Next");
  63172. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  63173. queue.push({
  63174. obj,
  63175. parent: i.parent,
  63176. });
  63177. processed.put(obj);
  63178. }
  63179. }
  63180. return root.items.length > 0 ? root.items : null;
  63181. }
  63182. get permissions() {
  63183. let permissions = null;
  63184. try {
  63185. permissions = this._readPermissions();
  63186. } catch (ex) {
  63187. if (ex instanceof _core_utils.MissingDataException) {
  63188. throw ex;
  63189. }
  63190. (0, _util.warn)("Unable to read permissions.");
  63191. }
  63192. return (0, _util.shadow)(this, "permissions", permissions);
  63193. }
  63194. _readPermissions() {
  63195. const encrypt = this.xref.trailer.get("Encrypt");
  63196. if (!(encrypt instanceof _primitives.Dict)) {
  63197. return null;
  63198. }
  63199. let flags = encrypt.get("P");
  63200. if (typeof flags !== "number") {
  63201. return null;
  63202. }
  63203. flags += 2 ** 32;
  63204. const permissions = [];
  63205. for (const key in _util.PermissionFlag) {
  63206. const value = _util.PermissionFlag[key];
  63207. if (flags & value) {
  63208. permissions.push(value);
  63209. }
  63210. }
  63211. return permissions;
  63212. }
  63213. get optionalContentConfig() {
  63214. let config = null;
  63215. try {
  63216. const properties = this._catDict.get("OCProperties");
  63217. if (!properties) {
  63218. return (0, _util.shadow)(this, "optionalContentConfig", null);
  63219. }
  63220. const defaultConfig = properties.get("D");
  63221. if (!defaultConfig) {
  63222. return (0, _util.shadow)(this, "optionalContentConfig", null);
  63223. }
  63224. const groupsData = properties.get("OCGs");
  63225. if (!Array.isArray(groupsData)) {
  63226. return (0, _util.shadow)(this, "optionalContentConfig", null);
  63227. }
  63228. const groups = [];
  63229. const groupRefs = [];
  63230. for (const groupRef of groupsData) {
  63231. if (!(groupRef instanceof _primitives.Ref)) {
  63232. continue;
  63233. }
  63234. groupRefs.push(groupRef);
  63235. const group = this.xref.fetchIfRef(groupRef);
  63236. groups.push({
  63237. id: groupRef.toString(),
  63238. name:
  63239. typeof group.get("Name") === "string"
  63240. ? (0, _util.stringToPDFString)(group.get("Name"))
  63241. : null,
  63242. intent:
  63243. typeof group.get("Intent") === "string"
  63244. ? (0, _util.stringToPDFString)(group.get("Intent"))
  63245. : null,
  63246. });
  63247. }
  63248. config = this._readOptionalContentConfig(
  63249. defaultConfig,
  63250. groupRefs
  63251. );
  63252. config.groups = groups;
  63253. } catch (ex) {
  63254. if (ex instanceof _core_utils.MissingDataException) {
  63255. throw ex;
  63256. }
  63257. (0, _util.warn)(`Unable to read optional content config: ${ex}`);
  63258. }
  63259. return (0, _util.shadow)(this, "optionalContentConfig", config);
  63260. }
  63261. _readOptionalContentConfig(config, contentGroupRefs) {
  63262. function parseOnOff(refs) {
  63263. const onParsed = [];
  63264. if (Array.isArray(refs)) {
  63265. for (const value of refs) {
  63266. if (!(value instanceof _primitives.Ref)) {
  63267. continue;
  63268. }
  63269. if (contentGroupRefs.includes(value)) {
  63270. onParsed.push(value.toString());
  63271. }
  63272. }
  63273. }
  63274. return onParsed;
  63275. }
  63276. function parseOrder(refs, nestedLevels = 0) {
  63277. if (!Array.isArray(refs)) {
  63278. return null;
  63279. }
  63280. const order = [];
  63281. for (const value of refs) {
  63282. if (
  63283. value instanceof _primitives.Ref &&
  63284. contentGroupRefs.includes(value)
  63285. ) {
  63286. parsedOrderRefs.put(value);
  63287. order.push(value.toString());
  63288. continue;
  63289. }
  63290. const nestedOrder = parseNestedOrder(value, nestedLevels);
  63291. if (nestedOrder) {
  63292. order.push(nestedOrder);
  63293. }
  63294. }
  63295. if (nestedLevels > 0) {
  63296. return order;
  63297. }
  63298. const hiddenGroups = [];
  63299. for (const groupRef of contentGroupRefs) {
  63300. if (parsedOrderRefs.has(groupRef)) {
  63301. continue;
  63302. }
  63303. hiddenGroups.push(groupRef.toString());
  63304. }
  63305. if (hiddenGroups.length) {
  63306. order.push({
  63307. name: null,
  63308. order: hiddenGroups,
  63309. });
  63310. }
  63311. return order;
  63312. }
  63313. function parseNestedOrder(ref, nestedLevels) {
  63314. if (++nestedLevels > MAX_NESTED_LEVELS) {
  63315. (0, _util.warn)(
  63316. "parseNestedOrder - reached MAX_NESTED_LEVELS."
  63317. );
  63318. return null;
  63319. }
  63320. const value = xref.fetchIfRef(ref);
  63321. if (!Array.isArray(value)) {
  63322. return null;
  63323. }
  63324. const nestedName = xref.fetchIfRef(value[0]);
  63325. if (typeof nestedName !== "string") {
  63326. return null;
  63327. }
  63328. const nestedOrder = parseOrder(value.slice(1), nestedLevels);
  63329. if (!nestedOrder || !nestedOrder.length) {
  63330. return null;
  63331. }
  63332. return {
  63333. name: (0, _util.stringToPDFString)(nestedName),
  63334. order: nestedOrder,
  63335. };
  63336. }
  63337. const xref = this.xref,
  63338. parsedOrderRefs = new _primitives.RefSet(),
  63339. MAX_NESTED_LEVELS = 10;
  63340. return {
  63341. name:
  63342. typeof config.get("Name") === "string"
  63343. ? (0, _util.stringToPDFString)(config.get("Name"))
  63344. : null,
  63345. creator:
  63346. typeof config.get("Creator") === "string"
  63347. ? (0, _util.stringToPDFString)(config.get("Creator"))
  63348. : null,
  63349. baseState:
  63350. config.get("BaseState") instanceof _primitives.Name
  63351. ? config.get("BaseState").name
  63352. : null,
  63353. on: parseOnOff(config.get("ON")),
  63354. off: parseOnOff(config.get("OFF")),
  63355. order: parseOrder(config.get("Order")),
  63356. groups: null,
  63357. };
  63358. }
  63359. setActualNumPages(num = null) {
  63360. this._actualNumPages = num;
  63361. }
  63362. get hasActualNumPages() {
  63363. return this._actualNumPages !== null;
  63364. }
  63365. get _pagesCount() {
  63366. const obj = this.toplevelPagesDict.get("Count");
  63367. if (!Number.isInteger(obj)) {
  63368. throw new _util.FormatError(
  63369. "Page count in top-level pages dictionary is not an integer."
  63370. );
  63371. }
  63372. return (0, _util.shadow)(this, "_pagesCount", obj);
  63373. }
  63374. get numPages() {
  63375. return this.hasActualNumPages
  63376. ? this._actualNumPages
  63377. : this._pagesCount;
  63378. }
  63379. get destinations() {
  63380. const obj = this._readDests(),
  63381. dests = Object.create(null);
  63382. if (obj instanceof _name_number_tree.NameTree) {
  63383. for (const [key, value] of obj.getAll()) {
  63384. const dest = fetchDestination(value);
  63385. if (dest) {
  63386. dests[(0, _util.stringToPDFString)(key)] = dest;
  63387. }
  63388. }
  63389. } else if (obj instanceof _primitives.Dict) {
  63390. obj.forEach(function (key, value) {
  63391. const dest = fetchDestination(value);
  63392. if (dest) {
  63393. dests[key] = dest;
  63394. }
  63395. });
  63396. }
  63397. return (0, _util.shadow)(this, "destinations", dests);
  63398. }
  63399. getDestination(id) {
  63400. const obj = this._readDests();
  63401. if (obj instanceof _name_number_tree.NameTree) {
  63402. const dest = fetchDestination(obj.get(id));
  63403. if (dest) {
  63404. return dest;
  63405. }
  63406. const allDest = this.destinations[id];
  63407. if (allDest) {
  63408. (0, _util.warn)(
  63409. `Found "${id}" at an incorrect position in the NameTree.`
  63410. );
  63411. return allDest;
  63412. }
  63413. } else if (obj instanceof _primitives.Dict) {
  63414. const dest = fetchDestination(obj.get(id));
  63415. if (dest) {
  63416. return dest;
  63417. }
  63418. }
  63419. return null;
  63420. }
  63421. _readDests() {
  63422. const obj = this._catDict.get("Names");
  63423. if (obj && obj.has("Dests")) {
  63424. return new _name_number_tree.NameTree(
  63425. obj.getRaw("Dests"),
  63426. this.xref
  63427. );
  63428. } else if (this._catDict.has("Dests")) {
  63429. return this._catDict.get("Dests");
  63430. }
  63431. return undefined;
  63432. }
  63433. get pageLabels() {
  63434. let obj = null;
  63435. try {
  63436. obj = this._readPageLabels();
  63437. } catch (ex) {
  63438. if (ex instanceof _core_utils.MissingDataException) {
  63439. throw ex;
  63440. }
  63441. (0, _util.warn)("Unable to read page labels.");
  63442. }
  63443. return (0, _util.shadow)(this, "pageLabels", obj);
  63444. }
  63445. _readPageLabels() {
  63446. const obj = this._catDict.getRaw("PageLabels");
  63447. if (!obj) {
  63448. return null;
  63449. }
  63450. const pageLabels = new Array(this.numPages);
  63451. let style = null,
  63452. prefix = "";
  63453. const numberTree = new _name_number_tree.NumberTree(obj, this.xref);
  63454. const nums = numberTree.getAll();
  63455. let currentLabel = "",
  63456. currentIndex = 1;
  63457. for (let i = 0, ii = this.numPages; i < ii; i++) {
  63458. const labelDict = nums.get(i);
  63459. if (labelDict !== undefined) {
  63460. if (!(labelDict instanceof _primitives.Dict)) {
  63461. throw new _util.FormatError("PageLabel is not a dictionary.");
  63462. }
  63463. if (
  63464. labelDict.has("Type") &&
  63465. !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")
  63466. ) {
  63467. throw new _util.FormatError(
  63468. "Invalid type in PageLabel dictionary."
  63469. );
  63470. }
  63471. if (labelDict.has("S")) {
  63472. const s = labelDict.get("S");
  63473. if (!(s instanceof _primitives.Name)) {
  63474. throw new _util.FormatError(
  63475. "Invalid style in PageLabel dictionary."
  63476. );
  63477. }
  63478. style = s.name;
  63479. } else {
  63480. style = null;
  63481. }
  63482. if (labelDict.has("P")) {
  63483. const p = labelDict.get("P");
  63484. if (typeof p !== "string") {
  63485. throw new _util.FormatError(
  63486. "Invalid prefix in PageLabel dictionary."
  63487. );
  63488. }
  63489. prefix = (0, _util.stringToPDFString)(p);
  63490. } else {
  63491. prefix = "";
  63492. }
  63493. if (labelDict.has("St")) {
  63494. const st = labelDict.get("St");
  63495. if (!(Number.isInteger(st) && st >= 1)) {
  63496. throw new _util.FormatError(
  63497. "Invalid start in PageLabel dictionary."
  63498. );
  63499. }
  63500. currentIndex = st;
  63501. } else {
  63502. currentIndex = 1;
  63503. }
  63504. }
  63505. switch (style) {
  63506. case "D":
  63507. currentLabel = currentIndex;
  63508. break;
  63509. case "R":
  63510. case "r":
  63511. currentLabel = (0, _core_utils.toRomanNumerals)(
  63512. currentIndex,
  63513. style === "r"
  63514. );
  63515. break;
  63516. case "A":
  63517. case "a":
  63518. const LIMIT = 26;
  63519. const A_UPPER_CASE = 0x41,
  63520. A_LOWER_CASE = 0x61;
  63521. const baseCharCode =
  63522. style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  63523. const letterIndex = currentIndex - 1;
  63524. const character = String.fromCharCode(
  63525. baseCharCode + (letterIndex % LIMIT)
  63526. );
  63527. currentLabel = character.repeat(
  63528. Math.floor(letterIndex / LIMIT) + 1
  63529. );
  63530. break;
  63531. default:
  63532. if (style) {
  63533. throw new _util.FormatError(
  63534. `Invalid style "${style}" in PageLabel dictionary.`
  63535. );
  63536. }
  63537. currentLabel = "";
  63538. }
  63539. pageLabels[i] = prefix + currentLabel;
  63540. currentIndex++;
  63541. }
  63542. return pageLabels;
  63543. }
  63544. get pageLayout() {
  63545. const obj = this._catDict.get("PageLayout");
  63546. let pageLayout = "";
  63547. if (obj instanceof _primitives.Name) {
  63548. switch (obj.name) {
  63549. case "SinglePage":
  63550. case "OneColumn":
  63551. case "TwoColumnLeft":
  63552. case "TwoColumnRight":
  63553. case "TwoPageLeft":
  63554. case "TwoPageRight":
  63555. pageLayout = obj.name;
  63556. }
  63557. }
  63558. return (0, _util.shadow)(this, "pageLayout", pageLayout);
  63559. }
  63560. get pageMode() {
  63561. const obj = this._catDict.get("PageMode");
  63562. let pageMode = "UseNone";
  63563. if (obj instanceof _primitives.Name) {
  63564. switch (obj.name) {
  63565. case "UseNone":
  63566. case "UseOutlines":
  63567. case "UseThumbs":
  63568. case "FullScreen":
  63569. case "UseOC":
  63570. case "UseAttachments":
  63571. pageMode = obj.name;
  63572. }
  63573. }
  63574. return (0, _util.shadow)(this, "pageMode", pageMode);
  63575. }
  63576. get viewerPreferences() {
  63577. const obj = this._catDict.get("ViewerPreferences");
  63578. if (!(obj instanceof _primitives.Dict)) {
  63579. return (0, _util.shadow)(this, "viewerPreferences", null);
  63580. }
  63581. let prefs = null;
  63582. for (const key of obj.getKeys()) {
  63583. const value = obj.get(key);
  63584. let prefValue;
  63585. switch (key) {
  63586. case "HideToolbar":
  63587. case "HideMenubar":
  63588. case "HideWindowUI":
  63589. case "FitWindow":
  63590. case "CenterWindow":
  63591. case "DisplayDocTitle":
  63592. case "PickTrayByPDFSize":
  63593. if (typeof value === "boolean") {
  63594. prefValue = value;
  63595. }
  63596. break;
  63597. case "NonFullScreenPageMode":
  63598. if (value instanceof _primitives.Name) {
  63599. switch (value.name) {
  63600. case "UseNone":
  63601. case "UseOutlines":
  63602. case "UseThumbs":
  63603. case "UseOC":
  63604. prefValue = value.name;
  63605. break;
  63606. default:
  63607. prefValue = "UseNone";
  63608. }
  63609. }
  63610. break;
  63611. case "Direction":
  63612. if (value instanceof _primitives.Name) {
  63613. switch (value.name) {
  63614. case "L2R":
  63615. case "R2L":
  63616. prefValue = value.name;
  63617. break;
  63618. default:
  63619. prefValue = "L2R";
  63620. }
  63621. }
  63622. break;
  63623. case "ViewArea":
  63624. case "ViewClip":
  63625. case "PrintArea":
  63626. case "PrintClip":
  63627. if (value instanceof _primitives.Name) {
  63628. switch (value.name) {
  63629. case "MediaBox":
  63630. case "CropBox":
  63631. case "BleedBox":
  63632. case "TrimBox":
  63633. case "ArtBox":
  63634. prefValue = value.name;
  63635. break;
  63636. default:
  63637. prefValue = "CropBox";
  63638. }
  63639. }
  63640. break;
  63641. case "PrintScaling":
  63642. if (value instanceof _primitives.Name) {
  63643. switch (value.name) {
  63644. case "None":
  63645. case "AppDefault":
  63646. prefValue = value.name;
  63647. break;
  63648. default:
  63649. prefValue = "AppDefault";
  63650. }
  63651. }
  63652. break;
  63653. case "Duplex":
  63654. if (value instanceof _primitives.Name) {
  63655. switch (value.name) {
  63656. case "Simplex":
  63657. case "DuplexFlipShortEdge":
  63658. case "DuplexFlipLongEdge":
  63659. prefValue = value.name;
  63660. break;
  63661. default:
  63662. prefValue = "None";
  63663. }
  63664. }
  63665. break;
  63666. case "PrintPageRange":
  63667. if (Array.isArray(value) && value.length % 2 === 0) {
  63668. const isValid = value.every((page, i, arr) => {
  63669. return (
  63670. Number.isInteger(page) &&
  63671. page > 0 &&
  63672. (i === 0 || page >= arr[i - 1]) &&
  63673. page <= this.numPages
  63674. );
  63675. });
  63676. if (isValid) {
  63677. prefValue = value;
  63678. }
  63679. }
  63680. break;
  63681. case "NumCopies":
  63682. if (Number.isInteger(value) && value > 0) {
  63683. prefValue = value;
  63684. }
  63685. break;
  63686. default:
  63687. (0, _util.warn)(
  63688. `Ignoring non-standard key in ViewerPreferences: ${key}.`
  63689. );
  63690. continue;
  63691. }
  63692. if (prefValue === undefined) {
  63693. (0, _util.warn)(
  63694. `Bad value, for key "${key}", in ViewerPreferences: ${value}.`
  63695. );
  63696. continue;
  63697. }
  63698. if (!prefs) {
  63699. prefs = Object.create(null);
  63700. }
  63701. prefs[key] = prefValue;
  63702. }
  63703. return (0, _util.shadow)(this, "viewerPreferences", prefs);
  63704. }
  63705. get openAction() {
  63706. const obj = this._catDict.get("OpenAction");
  63707. const openAction = Object.create(null);
  63708. if (obj instanceof _primitives.Dict) {
  63709. const destDict = new _primitives.Dict(this.xref);
  63710. destDict.set("A", obj);
  63711. const resultObj = {
  63712. url: null,
  63713. dest: null,
  63714. action: null,
  63715. };
  63716. Catalog.parseDestDictionary({
  63717. destDict,
  63718. resultObj,
  63719. });
  63720. if (Array.isArray(resultObj.dest)) {
  63721. openAction.dest = resultObj.dest;
  63722. } else if (resultObj.action) {
  63723. openAction.action = resultObj.action;
  63724. }
  63725. } else if (Array.isArray(obj)) {
  63726. openAction.dest = obj;
  63727. }
  63728. return (0, _util.shadow)(
  63729. this,
  63730. "openAction",
  63731. (0, _util.objectSize)(openAction) > 0 ? openAction : null
  63732. );
  63733. }
  63734. get attachments() {
  63735. const obj = this._catDict.get("Names");
  63736. let attachments = null;
  63737. if (obj instanceof _primitives.Dict && obj.has("EmbeddedFiles")) {
  63738. const nameTree = new _name_number_tree.NameTree(
  63739. obj.getRaw("EmbeddedFiles"),
  63740. this.xref
  63741. );
  63742. for (const [key, value] of nameTree.getAll()) {
  63743. const fs = new _file_spec.FileSpec(value, this.xref);
  63744. if (!attachments) {
  63745. attachments = Object.create(null);
  63746. }
  63747. attachments[(0, _util.stringToPDFString)(key)] =
  63748. fs.serializable;
  63749. }
  63750. }
  63751. return (0, _util.shadow)(this, "attachments", attachments);
  63752. }
  63753. get xfaImages() {
  63754. const obj = this._catDict.get("Names");
  63755. let xfaImages = null;
  63756. if (obj instanceof _primitives.Dict && obj.has("XFAImages")) {
  63757. const nameTree = new _name_number_tree.NameTree(
  63758. obj.getRaw("XFAImages"),
  63759. this.xref
  63760. );
  63761. for (const [key, value] of nameTree.getAll()) {
  63762. if (!xfaImages) {
  63763. xfaImages = new _primitives.Dict(this.xref);
  63764. }
  63765. xfaImages.set((0, _util.stringToPDFString)(key), value);
  63766. }
  63767. }
  63768. return (0, _util.shadow)(this, "xfaImages", xfaImages);
  63769. }
  63770. _collectJavaScript() {
  63771. const obj = this._catDict.get("Names");
  63772. let javaScript = null;
  63773. function appendIfJavaScriptDict(name, jsDict) {
  63774. if (!(jsDict instanceof _primitives.Dict)) {
  63775. return;
  63776. }
  63777. if (!(0, _primitives.isName)(jsDict.get("S"), "JavaScript")) {
  63778. return;
  63779. }
  63780. let js = jsDict.get("JS");
  63781. if (js instanceof _base_stream.BaseStream) {
  63782. js = js.getString();
  63783. } else if (typeof js !== "string") {
  63784. return;
  63785. }
  63786. if (javaScript === null) {
  63787. javaScript = new Map();
  63788. }
  63789. js = (0, _util.stringToPDFString)(js).replace(/\u0000/g, "");
  63790. javaScript.set(name, js);
  63791. }
  63792. if (obj instanceof _primitives.Dict && obj.has("JavaScript")) {
  63793. const nameTree = new _name_number_tree.NameTree(
  63794. obj.getRaw("JavaScript"),
  63795. this.xref
  63796. );
  63797. for (const [key, value] of nameTree.getAll()) {
  63798. appendIfJavaScriptDict(
  63799. (0, _util.stringToPDFString)(key),
  63800. value
  63801. );
  63802. }
  63803. }
  63804. const openAction = this._catDict.get("OpenAction");
  63805. if (openAction) {
  63806. appendIfJavaScriptDict("OpenAction", openAction);
  63807. }
  63808. return javaScript;
  63809. }
  63810. get javaScript() {
  63811. const javaScript = this._collectJavaScript();
  63812. return (0, _util.shadow)(
  63813. this,
  63814. "javaScript",
  63815. javaScript ? [...javaScript.values()] : null
  63816. );
  63817. }
  63818. get jsActions() {
  63819. const javaScript = this._collectJavaScript();
  63820. let actions = (0, _core_utils.collectActions)(
  63821. this.xref,
  63822. this._catDict,
  63823. _util.DocumentActionEventType
  63824. );
  63825. if (javaScript) {
  63826. if (!actions) {
  63827. actions = Object.create(null);
  63828. }
  63829. for (const [key, val] of javaScript) {
  63830. if (key in actions) {
  63831. actions[key].push(val);
  63832. } else {
  63833. actions[key] = [val];
  63834. }
  63835. }
  63836. }
  63837. return (0, _util.shadow)(this, "jsActions", actions);
  63838. }
  63839. async fontFallback(id, handler) {
  63840. const translatedFonts = await Promise.all(this.fontCache);
  63841. for (const translatedFont of translatedFonts) {
  63842. if (translatedFont.loadedName === id) {
  63843. translatedFont.fallback(handler);
  63844. return;
  63845. }
  63846. }
  63847. }
  63848. async cleanup(manuallyTriggered = false) {
  63849. (0, _cleanup_helper.clearGlobalCaches)();
  63850. this.globalImageCache.clear(manuallyTriggered);
  63851. this.pageKidsCountCache.clear();
  63852. this.pageIndexCache.clear();
  63853. this.nonBlendModesSet.clear();
  63854. const translatedFonts = await Promise.all(this.fontCache);
  63855. for (const { dict } of translatedFonts) {
  63856. delete dict.cacheKey;
  63857. }
  63858. this.fontCache.clear();
  63859. this.builtInCMapCache.clear();
  63860. this.standardFontDataCache.clear();
  63861. }
  63862. async getPageDict(pageIndex) {
  63863. const nodesToVisit = [this.toplevelPagesDict];
  63864. const visitedNodes = new _primitives.RefSet();
  63865. const pagesRef = this._catDict.getRaw("Pages");
  63866. if (pagesRef instanceof _primitives.Ref) {
  63867. visitedNodes.put(pagesRef);
  63868. }
  63869. const xref = this.xref,
  63870. pageKidsCountCache = this.pageKidsCountCache,
  63871. pageIndexCache = this.pageIndexCache;
  63872. let currentPageIndex = 0;
  63873. while (nodesToVisit.length) {
  63874. const currentNode = nodesToVisit.pop();
  63875. if (currentNode instanceof _primitives.Ref) {
  63876. const count = pageKidsCountCache.get(currentNode);
  63877. if (count >= 0 && currentPageIndex + count <= pageIndex) {
  63878. currentPageIndex += count;
  63879. continue;
  63880. }
  63881. if (visitedNodes.has(currentNode)) {
  63882. throw new _util.FormatError(
  63883. "Pages tree contains circular reference."
  63884. );
  63885. }
  63886. visitedNodes.put(currentNode);
  63887. const obj = await xref.fetchAsync(currentNode);
  63888. if (obj instanceof _primitives.Dict) {
  63889. let type = obj.getRaw("Type");
  63890. if (type instanceof _primitives.Ref) {
  63891. type = await xref.fetchAsync(type);
  63892. }
  63893. if (
  63894. (0, _primitives.isName)(type, "Page") ||
  63895. !obj.has("Kids")
  63896. ) {
  63897. if (!pageKidsCountCache.has(currentNode)) {
  63898. pageKidsCountCache.put(currentNode, 1);
  63899. }
  63900. if (!pageIndexCache.has(currentNode)) {
  63901. pageIndexCache.put(currentNode, currentPageIndex);
  63902. }
  63903. if (currentPageIndex === pageIndex) {
  63904. return [obj, currentNode];
  63905. }
  63906. currentPageIndex++;
  63907. continue;
  63908. }
  63909. }
  63910. nodesToVisit.push(obj);
  63911. continue;
  63912. }
  63913. if (!(currentNode instanceof _primitives.Dict)) {
  63914. throw new _util.FormatError(
  63915. "Page dictionary kid reference points to wrong type of object."
  63916. );
  63917. }
  63918. const { objId } = currentNode;
  63919. let count = currentNode.getRaw("Count");
  63920. if (count instanceof _primitives.Ref) {
  63921. count = await xref.fetchAsync(count);
  63922. }
  63923. if (Number.isInteger(count) && count >= 0) {
  63924. if (objId && !pageKidsCountCache.has(objId)) {
  63925. pageKidsCountCache.put(objId, count);
  63926. }
  63927. if (currentPageIndex + count <= pageIndex) {
  63928. currentPageIndex += count;
  63929. continue;
  63930. }
  63931. }
  63932. let kids = currentNode.getRaw("Kids");
  63933. if (kids instanceof _primitives.Ref) {
  63934. kids = await xref.fetchAsync(kids);
  63935. }
  63936. if (!Array.isArray(kids)) {
  63937. let type = currentNode.getRaw("Type");
  63938. if (type instanceof _primitives.Ref) {
  63939. type = await xref.fetchAsync(type);
  63940. }
  63941. if (
  63942. (0, _primitives.isName)(type, "Page") ||
  63943. !currentNode.has("Kids")
  63944. ) {
  63945. if (currentPageIndex === pageIndex) {
  63946. return [currentNode, null];
  63947. }
  63948. currentPageIndex++;
  63949. continue;
  63950. }
  63951. throw new _util.FormatError(
  63952. "Page dictionary kids object is not an array."
  63953. );
  63954. }
  63955. for (let last = kids.length - 1; last >= 0; last--) {
  63956. nodesToVisit.push(kids[last]);
  63957. }
  63958. }
  63959. throw new Error(`Page index ${pageIndex} not found.`);
  63960. }
  63961. async getAllPageDicts(recoveryMode = false) {
  63962. const queue = [
  63963. {
  63964. currentNode: this.toplevelPagesDict,
  63965. posInKids: 0,
  63966. },
  63967. ];
  63968. const visitedNodes = new _primitives.RefSet();
  63969. const pagesRef = this._catDict.getRaw("Pages");
  63970. if (pagesRef instanceof _primitives.Ref) {
  63971. visitedNodes.put(pagesRef);
  63972. }
  63973. const map = new Map(),
  63974. xref = this.xref,
  63975. pageIndexCache = this.pageIndexCache;
  63976. let pageIndex = 0;
  63977. function addPageDict(pageDict, pageRef) {
  63978. if (pageRef && !pageIndexCache.has(pageRef)) {
  63979. pageIndexCache.put(pageRef, pageIndex);
  63980. }
  63981. map.set(pageIndex++, [pageDict, pageRef]);
  63982. }
  63983. function addPageError(error) {
  63984. if (
  63985. error instanceof _core_utils.XRefEntryException &&
  63986. !recoveryMode
  63987. ) {
  63988. throw error;
  63989. }
  63990. map.set(pageIndex++, [error, null]);
  63991. }
  63992. while (queue.length > 0) {
  63993. const queueItem = queue.at(-1);
  63994. const { currentNode, posInKids } = queueItem;
  63995. let kids = currentNode.getRaw("Kids");
  63996. if (kids instanceof _primitives.Ref) {
  63997. try {
  63998. kids = await xref.fetchAsync(kids);
  63999. } catch (ex) {
  64000. addPageError(ex);
  64001. break;
  64002. }
  64003. }
  64004. if (!Array.isArray(kids)) {
  64005. addPageError(
  64006. new _util.FormatError(
  64007. "Page dictionary kids object is not an array."
  64008. )
  64009. );
  64010. break;
  64011. }
  64012. if (posInKids >= kids.length) {
  64013. queue.pop();
  64014. continue;
  64015. }
  64016. const kidObj = kids[posInKids];
  64017. let obj;
  64018. if (kidObj instanceof _primitives.Ref) {
  64019. if (visitedNodes.has(kidObj)) {
  64020. addPageError(
  64021. new _util.FormatError(
  64022. "Pages tree contains circular reference."
  64023. )
  64024. );
  64025. break;
  64026. }
  64027. visitedNodes.put(kidObj);
  64028. try {
  64029. obj = await xref.fetchAsync(kidObj);
  64030. } catch (ex) {
  64031. addPageError(ex);
  64032. break;
  64033. }
  64034. } else {
  64035. obj = kidObj;
  64036. }
  64037. if (!(obj instanceof _primitives.Dict)) {
  64038. addPageError(
  64039. new _util.FormatError(
  64040. "Page dictionary kid reference points to wrong type of object."
  64041. )
  64042. );
  64043. break;
  64044. }
  64045. let type = obj.getRaw("Type");
  64046. if (type instanceof _primitives.Ref) {
  64047. try {
  64048. type = await xref.fetchAsync(type);
  64049. } catch (ex) {
  64050. addPageError(ex);
  64051. break;
  64052. }
  64053. }
  64054. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  64055. addPageDict(
  64056. obj,
  64057. kidObj instanceof _primitives.Ref ? kidObj : null
  64058. );
  64059. } else {
  64060. queue.push({
  64061. currentNode: obj,
  64062. posInKids: 0,
  64063. });
  64064. }
  64065. queueItem.posInKids++;
  64066. }
  64067. return map;
  64068. }
  64069. getPageIndex(pageRef) {
  64070. const cachedPageIndex = this.pageIndexCache.get(pageRef);
  64071. if (cachedPageIndex !== undefined) {
  64072. return Promise.resolve(cachedPageIndex);
  64073. }
  64074. const xref = this.xref;
  64075. function pagesBeforeRef(kidRef) {
  64076. let total = 0,
  64077. parentRef;
  64078. return xref
  64079. .fetchAsync(kidRef)
  64080. .then(function (node) {
  64081. if (
  64082. (0, _primitives.isRefsEqual)(kidRef, pageRef) &&
  64083. !(0, _primitives.isDict)(node, "Page") &&
  64084. !(
  64085. node instanceof _primitives.Dict &&
  64086. !node.has("Type") &&
  64087. node.has("Contents")
  64088. )
  64089. ) {
  64090. throw new _util.FormatError(
  64091. "The reference does not point to a /Page dictionary."
  64092. );
  64093. }
  64094. if (!node) {
  64095. return null;
  64096. }
  64097. if (!(node instanceof _primitives.Dict)) {
  64098. throw new _util.FormatError("Node must be a dictionary.");
  64099. }
  64100. parentRef = node.getRaw("Parent");
  64101. return node.getAsync("Parent");
  64102. })
  64103. .then(function (parent) {
  64104. if (!parent) {
  64105. return null;
  64106. }
  64107. if (!(parent instanceof _primitives.Dict)) {
  64108. throw new _util.FormatError("Parent must be a dictionary.");
  64109. }
  64110. return parent.getAsync("Kids");
  64111. })
  64112. .then(function (kids) {
  64113. if (!kids) {
  64114. return null;
  64115. }
  64116. const kidPromises = [];
  64117. let found = false;
  64118. for (let i = 0, ii = kids.length; i < ii; i++) {
  64119. const kid = kids[i];
  64120. if (!(kid instanceof _primitives.Ref)) {
  64121. throw new _util.FormatError("Kid must be a reference.");
  64122. }
  64123. if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
  64124. found = true;
  64125. break;
  64126. }
  64127. kidPromises.push(
  64128. xref.fetchAsync(kid).then(function (obj) {
  64129. if (!(obj instanceof _primitives.Dict)) {
  64130. throw new _util.FormatError(
  64131. "Kid node must be a dictionary."
  64132. );
  64133. }
  64134. if (obj.has("Count")) {
  64135. total += obj.get("Count");
  64136. } else {
  64137. total++;
  64138. }
  64139. })
  64140. );
  64141. }
  64142. if (!found) {
  64143. throw new _util.FormatError(
  64144. "Kid reference not found in parent's kids."
  64145. );
  64146. }
  64147. return Promise.all(kidPromises).then(function () {
  64148. return [total, parentRef];
  64149. });
  64150. });
  64151. }
  64152. let total = 0;
  64153. const next = (ref) =>
  64154. pagesBeforeRef(ref).then((args) => {
  64155. if (!args) {
  64156. this.pageIndexCache.put(pageRef, total);
  64157. return total;
  64158. }
  64159. const [count, parentRef] = args;
  64160. total += count;
  64161. return next(parentRef);
  64162. });
  64163. return next(pageRef);
  64164. }
  64165. get baseUrl() {
  64166. const uri = this._catDict.get("URI");
  64167. if (uri instanceof _primitives.Dict) {
  64168. const base = uri.get("Base");
  64169. if (typeof base === "string") {
  64170. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(
  64171. base,
  64172. null,
  64173. {
  64174. tryConvertEncoding: true,
  64175. }
  64176. );
  64177. if (absoluteUrl) {
  64178. return (0, _util.shadow)(this, "baseUrl", absoluteUrl.href);
  64179. }
  64180. }
  64181. }
  64182. return (0, _util.shadow)(this, "baseUrl", null);
  64183. }
  64184. static parseDestDictionary(params) {
  64185. const destDict = params.destDict;
  64186. if (!(destDict instanceof _primitives.Dict)) {
  64187. (0, _util.warn)(
  64188. "parseDestDictionary: `destDict` must be a dictionary."
  64189. );
  64190. return;
  64191. }
  64192. const resultObj = params.resultObj;
  64193. if (typeof resultObj !== "object") {
  64194. (0, _util.warn)(
  64195. "parseDestDictionary: `resultObj` must be an object."
  64196. );
  64197. return;
  64198. }
  64199. const docBaseUrl = params.docBaseUrl || null;
  64200. let action = destDict.get("A"),
  64201. url,
  64202. dest;
  64203. if (!(action instanceof _primitives.Dict)) {
  64204. if (destDict.has("Dest")) {
  64205. action = destDict.get("Dest");
  64206. } else {
  64207. action = destDict.get("AA");
  64208. if (action instanceof _primitives.Dict) {
  64209. if (action.has("D")) {
  64210. action = action.get("D");
  64211. } else if (action.has("U")) {
  64212. action = action.get("U");
  64213. }
  64214. }
  64215. }
  64216. }
  64217. if (action instanceof _primitives.Dict) {
  64218. const actionType = action.get("S");
  64219. if (!(actionType instanceof _primitives.Name)) {
  64220. (0, _util.warn)(
  64221. "parseDestDictionary: Invalid type in Action dictionary."
  64222. );
  64223. return;
  64224. }
  64225. const actionName = actionType.name;
  64226. switch (actionName) {
  64227. case "ResetForm":
  64228. const flags = action.get("Flags");
  64229. const include =
  64230. ((typeof flags === "number" ? flags : 0) & 1) === 0;
  64231. const fields = [];
  64232. const refs = [];
  64233. for (const obj of action.get("Fields") || []) {
  64234. if (obj instanceof _primitives.Ref) {
  64235. refs.push(obj.toString());
  64236. } else if (typeof obj === "string") {
  64237. fields.push((0, _util.stringToPDFString)(obj));
  64238. }
  64239. }
  64240. resultObj.resetForm = {
  64241. fields,
  64242. refs,
  64243. include,
  64244. };
  64245. break;
  64246. case "URI":
  64247. url = action.get("URI");
  64248. if (url instanceof _primitives.Name) {
  64249. url = "/" + url.name;
  64250. }
  64251. break;
  64252. case "GoTo":
  64253. dest = action.get("D");
  64254. break;
  64255. case "Launch":
  64256. case "GoToR":
  64257. const urlDict = action.get("F");
  64258. if (urlDict instanceof _primitives.Dict) {
  64259. url = urlDict.get("F") || null;
  64260. } else if (typeof urlDict === "string") {
  64261. url = urlDict;
  64262. }
  64263. let remoteDest = action.get("D");
  64264. if (remoteDest) {
  64265. if (remoteDest instanceof _primitives.Name) {
  64266. remoteDest = remoteDest.name;
  64267. }
  64268. if (typeof url === "string") {
  64269. const baseUrl = url.split("#")[0];
  64270. if (typeof remoteDest === "string") {
  64271. url = baseUrl + "#" + remoteDest;
  64272. } else if (Array.isArray(remoteDest)) {
  64273. url = baseUrl + "#" + JSON.stringify(remoteDest);
  64274. }
  64275. }
  64276. }
  64277. const newWindow = action.get("NewWindow");
  64278. if (typeof newWindow === "boolean") {
  64279. resultObj.newWindow = newWindow;
  64280. }
  64281. break;
  64282. case "Named":
  64283. const namedAction = action.get("N");
  64284. if (namedAction instanceof _primitives.Name) {
  64285. resultObj.action = namedAction.name;
  64286. }
  64287. break;
  64288. case "JavaScript":
  64289. const jsAction = action.get("JS");
  64290. let js;
  64291. if (jsAction instanceof _base_stream.BaseStream) {
  64292. js = jsAction.getString();
  64293. } else if (typeof jsAction === "string") {
  64294. js = jsAction;
  64295. }
  64296. const jsURL =
  64297. js &&
  64298. (0, _core_utils.recoverJsURL)(
  64299. (0, _util.stringToPDFString)(js)
  64300. );
  64301. if (jsURL) {
  64302. url = jsURL.url;
  64303. resultObj.newWindow = jsURL.newWindow;
  64304. break;
  64305. }
  64306. default:
  64307. if (
  64308. actionName === "JavaScript" ||
  64309. actionName === "SubmitForm"
  64310. ) {
  64311. break;
  64312. }
  64313. (0, _util.warn)(
  64314. `parseDestDictionary - unsupported action: "${actionName}".`
  64315. );
  64316. break;
  64317. }
  64318. } else if (destDict.has("Dest")) {
  64319. dest = destDict.get("Dest");
  64320. }
  64321. if (typeof url === "string") {
  64322. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(
  64323. url,
  64324. docBaseUrl,
  64325. {
  64326. addDefaultProtocol: true,
  64327. tryConvertEncoding: true,
  64328. }
  64329. );
  64330. if (absoluteUrl) {
  64331. resultObj.url = absoluteUrl.href;
  64332. }
  64333. resultObj.unsafeUrl = url;
  64334. }
  64335. if (dest) {
  64336. if (dest instanceof _primitives.Name) {
  64337. dest = dest.name;
  64338. }
  64339. if (typeof dest === "string") {
  64340. resultObj.dest = (0, _util.stringToPDFString)(dest);
  64341. } else if (Array.isArray(dest)) {
  64342. resultObj.dest = dest;
  64343. }
  64344. }
  64345. }
  64346. }
  64347. exports.Catalog = Catalog;
  64348. /***/
  64349. },
  64350. /* 70 */
  64351. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  64352. Object.defineProperty(exports, "__esModule", {
  64353. value: true,
  64354. });
  64355. exports.NumberTree = exports.NameTree = void 0;
  64356. var _primitives = __w_pdfjs_require__(5);
  64357. var _util = __w_pdfjs_require__(2);
  64358. class NameOrNumberTree {
  64359. constructor(root, xref, type) {
  64360. if (this.constructor === NameOrNumberTree) {
  64361. (0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
  64362. }
  64363. this.root = root;
  64364. this.xref = xref;
  64365. this._type = type;
  64366. }
  64367. getAll() {
  64368. const map = new Map();
  64369. if (!this.root) {
  64370. return map;
  64371. }
  64372. const xref = this.xref;
  64373. const processed = new _primitives.RefSet();
  64374. processed.put(this.root);
  64375. const queue = [this.root];
  64376. while (queue.length > 0) {
  64377. const obj = xref.fetchIfRef(queue.shift());
  64378. if (!(obj instanceof _primitives.Dict)) {
  64379. continue;
  64380. }
  64381. if (obj.has("Kids")) {
  64382. const kids = obj.get("Kids");
  64383. if (!Array.isArray(kids)) {
  64384. continue;
  64385. }
  64386. for (const kid of kids) {
  64387. if (processed.has(kid)) {
  64388. throw new _util.FormatError(
  64389. `Duplicate entry in "${this._type}" tree.`
  64390. );
  64391. }
  64392. queue.push(kid);
  64393. processed.put(kid);
  64394. }
  64395. continue;
  64396. }
  64397. const entries = obj.get(this._type);
  64398. if (!Array.isArray(entries)) {
  64399. continue;
  64400. }
  64401. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  64402. map.set(
  64403. xref.fetchIfRef(entries[i]),
  64404. xref.fetchIfRef(entries[i + 1])
  64405. );
  64406. }
  64407. }
  64408. return map;
  64409. }
  64410. get(key) {
  64411. if (!this.root) {
  64412. return null;
  64413. }
  64414. const xref = this.xref;
  64415. let kidsOrEntries = xref.fetchIfRef(this.root);
  64416. let loopCount = 0;
  64417. const MAX_LEVELS = 10;
  64418. while (kidsOrEntries.has("Kids")) {
  64419. if (++loopCount > MAX_LEVELS) {
  64420. (0, _util.warn)(
  64421. `Search depth limit reached for "${this._type}" tree.`
  64422. );
  64423. return null;
  64424. }
  64425. const kids = kidsOrEntries.get("Kids");
  64426. if (!Array.isArray(kids)) {
  64427. return null;
  64428. }
  64429. let l = 0,
  64430. r = kids.length - 1;
  64431. while (l <= r) {
  64432. const m = (l + r) >> 1;
  64433. const kid = xref.fetchIfRef(kids[m]);
  64434. const limits = kid.get("Limits");
  64435. if (key < xref.fetchIfRef(limits[0])) {
  64436. r = m - 1;
  64437. } else if (key > xref.fetchIfRef(limits[1])) {
  64438. l = m + 1;
  64439. } else {
  64440. kidsOrEntries = kid;
  64441. break;
  64442. }
  64443. }
  64444. if (l > r) {
  64445. return null;
  64446. }
  64447. }
  64448. const entries = kidsOrEntries.get(this._type);
  64449. if (Array.isArray(entries)) {
  64450. let l = 0,
  64451. r = entries.length - 2;
  64452. while (l <= r) {
  64453. const tmp = (l + r) >> 1,
  64454. m = tmp + (tmp & 1);
  64455. const currentKey = xref.fetchIfRef(entries[m]);
  64456. if (key < currentKey) {
  64457. r = m - 2;
  64458. } else if (key > currentKey) {
  64459. l = m + 2;
  64460. } else {
  64461. return xref.fetchIfRef(entries[m + 1]);
  64462. }
  64463. }
  64464. }
  64465. return null;
  64466. }
  64467. }
  64468. class NameTree extends NameOrNumberTree {
  64469. constructor(root, xref) {
  64470. super(root, xref, "Names");
  64471. }
  64472. }
  64473. exports.NameTree = NameTree;
  64474. class NumberTree extends NameOrNumberTree {
  64475. constructor(root, xref) {
  64476. super(root, xref, "Nums");
  64477. }
  64478. }
  64479. exports.NumberTree = NumberTree;
  64480. /***/
  64481. },
  64482. /* 71 */
  64483. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  64484. Object.defineProperty(exports, "__esModule", {
  64485. value: true,
  64486. });
  64487. exports.clearGlobalCaches = clearGlobalCaches;
  64488. var _primitives = __w_pdfjs_require__(5);
  64489. var _unicode = __w_pdfjs_require__(40);
  64490. function clearGlobalCaches() {
  64491. (0, _primitives.clearPrimitiveCaches)();
  64492. (0, _unicode.clearUnicodeCaches)();
  64493. }
  64494. /***/
  64495. },
  64496. /* 72 */
  64497. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  64498. Object.defineProperty(exports, "__esModule", {
  64499. value: true,
  64500. });
  64501. exports.FileSpec = void 0;
  64502. var _util = __w_pdfjs_require__(2);
  64503. var _base_stream = __w_pdfjs_require__(7);
  64504. var _primitives = __w_pdfjs_require__(5);
  64505. function pickPlatformItem(dict) {
  64506. if (dict.has("UF")) {
  64507. return dict.get("UF");
  64508. } else if (dict.has("F")) {
  64509. return dict.get("F");
  64510. } else if (dict.has("Unix")) {
  64511. return dict.get("Unix");
  64512. } else if (dict.has("Mac")) {
  64513. return dict.get("Mac");
  64514. } else if (dict.has("DOS")) {
  64515. return dict.get("DOS");
  64516. }
  64517. return null;
  64518. }
  64519. class FileSpec {
  64520. constructor(root, xref) {
  64521. if (!(root instanceof _primitives.Dict)) {
  64522. return;
  64523. }
  64524. this.xref = xref;
  64525. this.root = root;
  64526. if (root.has("FS")) {
  64527. this.fs = root.get("FS");
  64528. }
  64529. this.description = root.has("Desc")
  64530. ? (0, _util.stringToPDFString)(root.get("Desc"))
  64531. : "";
  64532. if (root.has("RF")) {
  64533. (0, _util.warn)("Related file specifications are not supported");
  64534. }
  64535. this.contentAvailable = true;
  64536. if (!root.has("EF")) {
  64537. this.contentAvailable = false;
  64538. (0, _util.warn)(
  64539. "Non-embedded file specifications are not supported"
  64540. );
  64541. }
  64542. }
  64543. get filename() {
  64544. if (!this._filename && this.root) {
  64545. const filename = pickPlatformItem(this.root) || "unnamed";
  64546. this._filename = (0, _util.stringToPDFString)(filename)
  64547. .replace(/\\\\/g, "\\")
  64548. .replace(/\\\//g, "/")
  64549. .replace(/\\/g, "/");
  64550. }
  64551. return this._filename;
  64552. }
  64553. get content() {
  64554. if (!this.contentAvailable) {
  64555. return null;
  64556. }
  64557. if (!this.contentRef && this.root) {
  64558. this.contentRef = pickPlatformItem(this.root.get("EF"));
  64559. }
  64560. let content = null;
  64561. if (this.contentRef) {
  64562. const fileObj = this.xref.fetchIfRef(this.contentRef);
  64563. if (fileObj instanceof _base_stream.BaseStream) {
  64564. content = fileObj.getBytes();
  64565. } else {
  64566. (0, _util.warn)(
  64567. "Embedded file specification points to non-existing/invalid content"
  64568. );
  64569. }
  64570. } else {
  64571. (0, _util.warn)(
  64572. "Embedded file specification does not have a content"
  64573. );
  64574. }
  64575. return content;
  64576. }
  64577. get serializable() {
  64578. return {
  64579. filename: this.filename,
  64580. content: this.content,
  64581. };
  64582. }
  64583. }
  64584. exports.FileSpec = FileSpec;
  64585. /***/
  64586. },
  64587. /* 73 */
  64588. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  64589. Object.defineProperty(exports, "__esModule", {
  64590. value: true,
  64591. });
  64592. exports.MetadataParser = void 0;
  64593. var _xml_parser = __w_pdfjs_require__(66);
  64594. class MetadataParser {
  64595. constructor(data) {
  64596. data = this._repair(data);
  64597. const parser = new _xml_parser.SimpleXMLParser({
  64598. lowerCaseName: true,
  64599. });
  64600. const xmlDocument = parser.parseFromString(data);
  64601. this._metadataMap = new Map();
  64602. this._data = data;
  64603. if (xmlDocument) {
  64604. this._parse(xmlDocument);
  64605. }
  64606. }
  64607. _repair(data) {
  64608. return data
  64609. .replace(/^[^<]+/, "")
  64610. .replace(/>\\376\\377([^<]+)/g, function (all, codes) {
  64611. const bytes = codes
  64612. .replace(
  64613. /\\([0-3])([0-7])([0-7])/g,
  64614. function (code, d1, d2, d3) {
  64615. return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
  64616. }
  64617. )
  64618. .replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
  64619. switch (name) {
  64620. case "amp":
  64621. return "&";
  64622. case "apos":
  64623. return "'";
  64624. case "gt":
  64625. return ">";
  64626. case "lt":
  64627. return "<";
  64628. case "quot":
  64629. return '"';
  64630. }
  64631. throw new Error(`_repair: ${name} isn't defined.`);
  64632. });
  64633. const charBuf = [];
  64634. for (let i = 0, ii = bytes.length; i < ii; i += 2) {
  64635. const code =
  64636. bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
  64637. if (
  64638. code >= 32 &&
  64639. code < 127 &&
  64640. code !== 60 &&
  64641. code !== 62 &&
  64642. code !== 38
  64643. ) {
  64644. charBuf.push(String.fromCharCode(code));
  64645. } else {
  64646. charBuf.push(
  64647. "&#x" + (0x10000 + code).toString(16).substring(1) + ";"
  64648. );
  64649. }
  64650. }
  64651. return ">" + charBuf.join("");
  64652. });
  64653. }
  64654. _getSequence(entry) {
  64655. const name = entry.nodeName;
  64656. if (
  64657. name !== "rdf:bag" &&
  64658. name !== "rdf:seq" &&
  64659. name !== "rdf:alt"
  64660. ) {
  64661. return null;
  64662. }
  64663. return entry.childNodes.filter(
  64664. (node) => node.nodeName === "rdf:li"
  64665. );
  64666. }
  64667. _parseArray(entry) {
  64668. if (!entry.hasChildNodes()) {
  64669. return;
  64670. }
  64671. const [seqNode] = entry.childNodes;
  64672. const sequence = this._getSequence(seqNode) || [];
  64673. this._metadataMap.set(
  64674. entry.nodeName,
  64675. sequence.map((node) => node.textContent.trim())
  64676. );
  64677. }
  64678. _parse(xmlDocument) {
  64679. let rdf = xmlDocument.documentElement;
  64680. if (rdf.nodeName !== "rdf:rdf") {
  64681. rdf = rdf.firstChild;
  64682. while (rdf && rdf.nodeName !== "rdf:rdf") {
  64683. rdf = rdf.nextSibling;
  64684. }
  64685. }
  64686. if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
  64687. return;
  64688. }
  64689. for (const desc of rdf.childNodes) {
  64690. if (desc.nodeName !== "rdf:description") {
  64691. continue;
  64692. }
  64693. for (const entry of desc.childNodes) {
  64694. const name = entry.nodeName;
  64695. switch (name) {
  64696. case "#text":
  64697. continue;
  64698. case "dc:creator":
  64699. case "dc:subject":
  64700. this._parseArray(entry);
  64701. continue;
  64702. }
  64703. this._metadataMap.set(name, entry.textContent.trim());
  64704. }
  64705. }
  64706. }
  64707. get serializable() {
  64708. return {
  64709. parsedData: this._metadataMap,
  64710. rawData: this._data,
  64711. };
  64712. }
  64713. }
  64714. exports.MetadataParser = MetadataParser;
  64715. /***/
  64716. },
  64717. /* 74 */
  64718. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  64719. Object.defineProperty(exports, "__esModule", {
  64720. value: true,
  64721. });
  64722. exports.StructTreeRoot = exports.StructTreePage = void 0;
  64723. var _primitives = __w_pdfjs_require__(5);
  64724. var _util = __w_pdfjs_require__(2);
  64725. var _name_number_tree = __w_pdfjs_require__(70);
  64726. const MAX_DEPTH = 40;
  64727. const StructElementType = {
  64728. PAGE_CONTENT: "PAGE_CONTENT",
  64729. STREAM_CONTENT: "STREAM_CONTENT",
  64730. OBJECT: "OBJECT",
  64731. ELEMENT: "ELEMENT",
  64732. };
  64733. class StructTreeRoot {
  64734. constructor(rootDict) {
  64735. this.dict = rootDict;
  64736. this.roleMap = new Map();
  64737. }
  64738. init() {
  64739. this.readRoleMap();
  64740. }
  64741. readRoleMap() {
  64742. const roleMapDict = this.dict.get("RoleMap");
  64743. if (!(roleMapDict instanceof _primitives.Dict)) {
  64744. return;
  64745. }
  64746. roleMapDict.forEach((key, value) => {
  64747. if (!(value instanceof _primitives.Name)) {
  64748. return;
  64749. }
  64750. this.roleMap.set(key, value.name);
  64751. });
  64752. }
  64753. }
  64754. exports.StructTreeRoot = StructTreeRoot;
  64755. class StructElementNode {
  64756. constructor(tree, dict) {
  64757. this.tree = tree;
  64758. this.dict = dict;
  64759. this.kids = [];
  64760. this.parseKids();
  64761. }
  64762. get role() {
  64763. const nameObj = this.dict.get("S");
  64764. const name =
  64765. nameObj instanceof _primitives.Name ? nameObj.name : "";
  64766. const { root } = this.tree;
  64767. if (root.roleMap.has(name)) {
  64768. return root.roleMap.get(name);
  64769. }
  64770. return name;
  64771. }
  64772. parseKids() {
  64773. let pageObjId = null;
  64774. const objRef = this.dict.getRaw("Pg");
  64775. if (objRef instanceof _primitives.Ref) {
  64776. pageObjId = objRef.toString();
  64777. }
  64778. const kids = this.dict.get("K");
  64779. if (Array.isArray(kids)) {
  64780. for (const kid of kids) {
  64781. const element = this.parseKid(pageObjId, kid);
  64782. if (element) {
  64783. this.kids.push(element);
  64784. }
  64785. }
  64786. } else {
  64787. const element = this.parseKid(pageObjId, kids);
  64788. if (element) {
  64789. this.kids.push(element);
  64790. }
  64791. }
  64792. }
  64793. parseKid(pageObjId, kid) {
  64794. if (Number.isInteger(kid)) {
  64795. if (this.tree.pageDict.objId !== pageObjId) {
  64796. return null;
  64797. }
  64798. return new StructElement({
  64799. type: StructElementType.PAGE_CONTENT,
  64800. mcid: kid,
  64801. pageObjId,
  64802. });
  64803. }
  64804. let kidDict = null;
  64805. if (kid instanceof _primitives.Ref) {
  64806. kidDict = this.dict.xref.fetch(kid);
  64807. } else if (kid instanceof _primitives.Dict) {
  64808. kidDict = kid;
  64809. }
  64810. if (!kidDict) {
  64811. return null;
  64812. }
  64813. const pageRef = kidDict.getRaw("Pg");
  64814. if (pageRef instanceof _primitives.Ref) {
  64815. pageObjId = pageRef.toString();
  64816. }
  64817. const type =
  64818. kidDict.get("Type") instanceof _primitives.Name
  64819. ? kidDict.get("Type").name
  64820. : null;
  64821. if (type === "MCR") {
  64822. if (this.tree.pageDict.objId !== pageObjId) {
  64823. return null;
  64824. }
  64825. return new StructElement({
  64826. type: StructElementType.STREAM_CONTENT,
  64827. refObjId:
  64828. kidDict.getRaw("Stm") instanceof _primitives.Ref
  64829. ? kidDict.getRaw("Stm").toString()
  64830. : null,
  64831. pageObjId,
  64832. mcid: kidDict.get("MCID"),
  64833. });
  64834. }
  64835. if (type === "OBJR") {
  64836. if (this.tree.pageDict.objId !== pageObjId) {
  64837. return null;
  64838. }
  64839. return new StructElement({
  64840. type: StructElementType.OBJECT,
  64841. refObjId:
  64842. kidDict.getRaw("Obj") instanceof _primitives.Ref
  64843. ? kidDict.getRaw("Obj").toString()
  64844. : null,
  64845. pageObjId,
  64846. });
  64847. }
  64848. return new StructElement({
  64849. type: StructElementType.ELEMENT,
  64850. dict: kidDict,
  64851. });
  64852. }
  64853. }
  64854. class StructElement {
  64855. constructor({
  64856. type,
  64857. dict = null,
  64858. mcid = null,
  64859. pageObjId = null,
  64860. refObjId = null,
  64861. }) {
  64862. this.type = type;
  64863. this.dict = dict;
  64864. this.mcid = mcid;
  64865. this.pageObjId = pageObjId;
  64866. this.refObjId = refObjId;
  64867. this.parentNode = null;
  64868. }
  64869. }
  64870. class StructTreePage {
  64871. constructor(structTreeRoot, pageDict) {
  64872. this.root = structTreeRoot;
  64873. this.rootDict = structTreeRoot ? structTreeRoot.dict : null;
  64874. this.pageDict = pageDict;
  64875. this.nodes = [];
  64876. }
  64877. parse() {
  64878. if (!this.root || !this.rootDict) {
  64879. return;
  64880. }
  64881. const parentTree = this.rootDict.get("ParentTree");
  64882. if (!parentTree) {
  64883. return;
  64884. }
  64885. const id = this.pageDict.get("StructParents");
  64886. if (!Number.isInteger(id)) {
  64887. return;
  64888. }
  64889. const numberTree = new _name_number_tree.NumberTree(
  64890. parentTree,
  64891. this.rootDict.xref
  64892. );
  64893. const parentArray = numberTree.get(id);
  64894. if (!Array.isArray(parentArray)) {
  64895. return;
  64896. }
  64897. const map = new Map();
  64898. for (const ref of parentArray) {
  64899. if (ref instanceof _primitives.Ref) {
  64900. this.addNode(this.rootDict.xref.fetch(ref), map);
  64901. }
  64902. }
  64903. }
  64904. addNode(dict, map, level = 0) {
  64905. if (level > MAX_DEPTH) {
  64906. (0, _util.warn)("StructTree MAX_DEPTH reached.");
  64907. return null;
  64908. }
  64909. if (map.has(dict)) {
  64910. return map.get(dict);
  64911. }
  64912. const element = new StructElementNode(this, dict);
  64913. map.set(dict, element);
  64914. const parent = dict.get("P");
  64915. if (
  64916. !parent ||
  64917. (0, _primitives.isName)(parent.get("Type"), "StructTreeRoot")
  64918. ) {
  64919. if (!this.addTopLevelNode(dict, element)) {
  64920. map.delete(dict);
  64921. }
  64922. return element;
  64923. }
  64924. const parentNode = this.addNode(parent, map, level + 1);
  64925. if (!parentNode) {
  64926. return element;
  64927. }
  64928. let save = false;
  64929. for (const kid of parentNode.kids) {
  64930. if (kid.type === StructElementType.ELEMENT && kid.dict === dict) {
  64931. kid.parentNode = element;
  64932. save = true;
  64933. }
  64934. }
  64935. if (!save) {
  64936. map.delete(dict);
  64937. }
  64938. return element;
  64939. }
  64940. addTopLevelNode(dict, element) {
  64941. const obj = this.rootDict.get("K");
  64942. if (!obj) {
  64943. return false;
  64944. }
  64945. if (obj instanceof _primitives.Dict) {
  64946. if (obj.objId !== dict.objId) {
  64947. return false;
  64948. }
  64949. this.nodes[0] = element;
  64950. return true;
  64951. }
  64952. if (!Array.isArray(obj)) {
  64953. return true;
  64954. }
  64955. let save = false;
  64956. for (let i = 0; i < obj.length; i++) {
  64957. const kidRef = obj[i];
  64958. if (kidRef && kidRef.toString() === dict.objId) {
  64959. this.nodes[i] = element;
  64960. save = true;
  64961. }
  64962. }
  64963. return save;
  64964. }
  64965. get serializable() {
  64966. function nodeToSerializable(node, parent, level = 0) {
  64967. if (level > MAX_DEPTH) {
  64968. (0, _util.warn)("StructTree too deep to be fully serialized.");
  64969. return;
  64970. }
  64971. const obj = Object.create(null);
  64972. obj.role = node.role;
  64973. obj.children = [];
  64974. parent.children.push(obj);
  64975. const alt = node.dict.get("Alt");
  64976. if (typeof alt === "string") {
  64977. obj.alt = (0, _util.stringToPDFString)(alt);
  64978. }
  64979. const lang = node.dict.get("Lang");
  64980. if (typeof lang === "string") {
  64981. obj.lang = (0, _util.stringToPDFString)(lang);
  64982. }
  64983. for (const kid of node.kids) {
  64984. const kidElement =
  64985. kid.type === StructElementType.ELEMENT
  64986. ? kid.parentNode
  64987. : null;
  64988. if (kidElement) {
  64989. nodeToSerializable(kidElement, obj, level + 1);
  64990. continue;
  64991. } else if (
  64992. kid.type === StructElementType.PAGE_CONTENT ||
  64993. kid.type === StructElementType.STREAM_CONTENT
  64994. ) {
  64995. obj.children.push({
  64996. type: "content",
  64997. id: `page${kid.pageObjId}_mcid${kid.mcid}`,
  64998. });
  64999. } else if (kid.type === StructElementType.OBJECT) {
  65000. obj.children.push({
  65001. type: "object",
  65002. id: kid.refObjId,
  65003. });
  65004. }
  65005. }
  65006. }
  65007. const root = Object.create(null);
  65008. root.children = [];
  65009. root.role = "Root";
  65010. for (const child of this.nodes) {
  65011. if (!child) {
  65012. continue;
  65013. }
  65014. nodeToSerializable(child, root);
  65015. }
  65016. return root;
  65017. }
  65018. }
  65019. exports.StructTreePage = StructTreePage;
  65020. /***/
  65021. },
  65022. /* 75 */
  65023. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65024. Object.defineProperty(exports, "__esModule", {
  65025. value: true,
  65026. });
  65027. exports.ObjectLoader = void 0;
  65028. var _primitives = __w_pdfjs_require__(5);
  65029. var _base_stream = __w_pdfjs_require__(7);
  65030. var _core_utils = __w_pdfjs_require__(6);
  65031. var _util = __w_pdfjs_require__(2);
  65032. function mayHaveChildren(value) {
  65033. return (
  65034. value instanceof _primitives.Ref ||
  65035. value instanceof _primitives.Dict ||
  65036. value instanceof _base_stream.BaseStream ||
  65037. Array.isArray(value)
  65038. );
  65039. }
  65040. function addChildren(node, nodesToVisit) {
  65041. if (node instanceof _primitives.Dict) {
  65042. node = node.getRawValues();
  65043. } else if (node instanceof _base_stream.BaseStream) {
  65044. node = node.dict.getRawValues();
  65045. } else if (!Array.isArray(node)) {
  65046. return;
  65047. }
  65048. for (const rawValue of node) {
  65049. if (mayHaveChildren(rawValue)) {
  65050. nodesToVisit.push(rawValue);
  65051. }
  65052. }
  65053. }
  65054. class ObjectLoader {
  65055. constructor(dict, keys, xref) {
  65056. this.dict = dict;
  65057. this.keys = keys;
  65058. this.xref = xref;
  65059. this.refSet = null;
  65060. }
  65061. async load() {
  65062. if (this.xref.stream.isDataLoaded) {
  65063. return undefined;
  65064. }
  65065. const { keys, dict } = this;
  65066. this.refSet = new _primitives.RefSet();
  65067. const nodesToVisit = [];
  65068. for (let i = 0, ii = keys.length; i < ii; i++) {
  65069. const rawValue = dict.getRaw(keys[i]);
  65070. if (rawValue !== undefined) {
  65071. nodesToVisit.push(rawValue);
  65072. }
  65073. }
  65074. return this._walk(nodesToVisit);
  65075. }
  65076. async _walk(nodesToVisit) {
  65077. const nodesToRevisit = [];
  65078. const pendingRequests = [];
  65079. while (nodesToVisit.length) {
  65080. let currentNode = nodesToVisit.pop();
  65081. if (currentNode instanceof _primitives.Ref) {
  65082. if (this.refSet.has(currentNode)) {
  65083. continue;
  65084. }
  65085. try {
  65086. this.refSet.put(currentNode);
  65087. currentNode = this.xref.fetch(currentNode);
  65088. } catch (ex) {
  65089. if (!(ex instanceof _core_utils.MissingDataException)) {
  65090. (0, _util.warn)(
  65091. `ObjectLoader._walk - requesting all data: "${ex}".`
  65092. );
  65093. this.refSet = null;
  65094. const { manager } = this.xref.stream;
  65095. return manager.requestAllChunks();
  65096. }
  65097. nodesToRevisit.push(currentNode);
  65098. pendingRequests.push({
  65099. begin: ex.begin,
  65100. end: ex.end,
  65101. });
  65102. }
  65103. }
  65104. if (currentNode instanceof _base_stream.BaseStream) {
  65105. const baseStreams = currentNode.getBaseStreams();
  65106. if (baseStreams) {
  65107. let foundMissingData = false;
  65108. for (const stream of baseStreams) {
  65109. if (stream.isDataLoaded) {
  65110. continue;
  65111. }
  65112. foundMissingData = true;
  65113. pendingRequests.push({
  65114. begin: stream.start,
  65115. end: stream.end,
  65116. });
  65117. }
  65118. if (foundMissingData) {
  65119. nodesToRevisit.push(currentNode);
  65120. }
  65121. }
  65122. }
  65123. addChildren(currentNode, nodesToVisit);
  65124. }
  65125. if (pendingRequests.length) {
  65126. await this.xref.stream.manager.requestRanges(pendingRequests);
  65127. for (const node of nodesToRevisit) {
  65128. if (node instanceof _primitives.Ref) {
  65129. this.refSet.remove(node);
  65130. }
  65131. }
  65132. return this._walk(nodesToRevisit);
  65133. }
  65134. this.refSet = null;
  65135. return undefined;
  65136. }
  65137. }
  65138. exports.ObjectLoader = ObjectLoader;
  65139. /***/
  65140. },
  65141. /* 76 */
  65142. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65143. Object.defineProperty(exports, "__esModule", {
  65144. value: true,
  65145. });
  65146. exports.XFAFactory = void 0;
  65147. var _xfa_object = __w_pdfjs_require__(77);
  65148. var _bind = __w_pdfjs_require__(81);
  65149. var _data = __w_pdfjs_require__(87);
  65150. var _fonts = __w_pdfjs_require__(85);
  65151. var _utils = __w_pdfjs_require__(78);
  65152. var _util = __w_pdfjs_require__(2);
  65153. var _parser = __w_pdfjs_require__(88);
  65154. var _xhtml = __w_pdfjs_require__(98);
  65155. class XFAFactory {
  65156. constructor(data) {
  65157. try {
  65158. this.root = new _parser.XFAParser().parse(
  65159. XFAFactory._createDocument(data)
  65160. );
  65161. const binder = new _bind.Binder(this.root);
  65162. this.form = binder.bind();
  65163. this.dataHandler = new _data.DataHandler(
  65164. this.root,
  65165. binder.getData()
  65166. );
  65167. this.form[_xfa_object.$globalData].template = this.form;
  65168. } catch (e) {
  65169. (0, _util.warn)(
  65170. `XFA - an error occurred during parsing and binding: ${e}`
  65171. );
  65172. }
  65173. }
  65174. isValid() {
  65175. return this.root && this.form;
  65176. }
  65177. _createPagesHelper() {
  65178. const iterator = this.form[_xfa_object.$toPages]();
  65179. return new Promise((resolve, reject) => {
  65180. const nextIteration = () => {
  65181. try {
  65182. const value = iterator.next();
  65183. if (value.done) {
  65184. resolve(value.value);
  65185. } else {
  65186. setTimeout(nextIteration, 0);
  65187. }
  65188. } catch (e) {
  65189. reject(e);
  65190. }
  65191. };
  65192. setTimeout(nextIteration, 0);
  65193. });
  65194. }
  65195. async _createPages() {
  65196. try {
  65197. this.pages = await this._createPagesHelper();
  65198. this.dims = this.pages.children.map((c) => {
  65199. const { width, height } = c.attributes.style;
  65200. return [0, 0, parseInt(width), parseInt(height)];
  65201. });
  65202. } catch (e) {
  65203. (0, _util.warn)(`XFA - an error occurred during layout: ${e}`);
  65204. }
  65205. }
  65206. getBoundingBox(pageIndex) {
  65207. return this.dims[pageIndex];
  65208. }
  65209. async getNumPages() {
  65210. if (!this.pages) {
  65211. await this._createPages();
  65212. }
  65213. return this.dims.length;
  65214. }
  65215. setImages(images) {
  65216. this.form[_xfa_object.$globalData].images = images;
  65217. }
  65218. setFonts(fonts) {
  65219. this.form[_xfa_object.$globalData].fontFinder =
  65220. new _fonts.FontFinder(fonts);
  65221. const missingFonts = [];
  65222. for (let typeface of this.form[_xfa_object.$globalData]
  65223. .usedTypefaces) {
  65224. typeface = (0, _utils.stripQuotes)(typeface);
  65225. const font =
  65226. this.form[_xfa_object.$globalData].fontFinder.find(typeface);
  65227. if (!font) {
  65228. missingFonts.push(typeface);
  65229. }
  65230. }
  65231. if (missingFonts.length > 0) {
  65232. return missingFonts;
  65233. }
  65234. return null;
  65235. }
  65236. appendFonts(fonts, reallyMissingFonts) {
  65237. this.form[_xfa_object.$globalData].fontFinder.add(
  65238. fonts,
  65239. reallyMissingFonts
  65240. );
  65241. }
  65242. async getPages() {
  65243. if (!this.pages) {
  65244. await this._createPages();
  65245. }
  65246. const pages = this.pages;
  65247. this.pages = null;
  65248. return pages;
  65249. }
  65250. serializeData(storage) {
  65251. return this.dataHandler.serialize(storage);
  65252. }
  65253. static _createDocument(data) {
  65254. if (!data["/xdp:xdp"]) {
  65255. return data["xdp:xdp"];
  65256. }
  65257. return Object.values(data).join("");
  65258. }
  65259. static getRichTextAsHtml(rc) {
  65260. if (!rc || typeof rc !== "string") {
  65261. return null;
  65262. }
  65263. try {
  65264. let root = new _parser.XFAParser(
  65265. _xhtml.XhtmlNamespace,
  65266. true
  65267. ).parse(rc);
  65268. if (!["body", "xhtml"].includes(root[_xfa_object.$nodeName])) {
  65269. const newRoot = _xhtml.XhtmlNamespace.body({});
  65270. newRoot[_xfa_object.$appendChild](root);
  65271. root = newRoot;
  65272. }
  65273. const result = root[_xfa_object.$toHTML]();
  65274. if (!result.success) {
  65275. return null;
  65276. }
  65277. const { html } = result;
  65278. const { attributes } = html;
  65279. if (attributes) {
  65280. if (attributes.class) {
  65281. attributes.class = attributes.class.filter(
  65282. (attr) => !attr.startsWith("xfa")
  65283. );
  65284. }
  65285. attributes.dir = "auto";
  65286. }
  65287. return {
  65288. html,
  65289. str: root[_xfa_object.$text](),
  65290. };
  65291. } catch (e) {
  65292. (0, _util.warn)(
  65293. `XFA - an error occurred during parsing of rich text: ${e}`
  65294. );
  65295. }
  65296. return null;
  65297. }
  65298. }
  65299. exports.XFAFactory = XFAFactory;
  65300. /***/
  65301. },
  65302. /* 77 */
  65303. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65304. Object.defineProperty(exports, "__esModule", {
  65305. value: true,
  65306. });
  65307. exports.XmlObject =
  65308. exports.XFAObjectArray =
  65309. exports.XFAObject =
  65310. exports.XFAAttribute =
  65311. exports.StringObject =
  65312. exports.OptionObject =
  65313. exports.Option10 =
  65314. exports.Option01 =
  65315. exports.IntegerObject =
  65316. exports.ContentObject =
  65317. exports.$uid =
  65318. exports.$toStyle =
  65319. exports.$toString =
  65320. exports.$toPages =
  65321. exports.$toHTML =
  65322. exports.$text =
  65323. exports.$tabIndex =
  65324. exports.$setValue =
  65325. exports.$setSetAttributes =
  65326. exports.$setId =
  65327. exports.$searchNode =
  65328. exports.$root =
  65329. exports.$resolvePrototypes =
  65330. exports.$removeChild =
  65331. exports.$pushPara =
  65332. exports.$pushGlyphs =
  65333. exports.$popPara =
  65334. exports.$onText =
  65335. exports.$onChildCheck =
  65336. exports.$onChild =
  65337. exports.$nsAttributes =
  65338. exports.$nodeName =
  65339. exports.$namespaceId =
  65340. exports.$isUsable =
  65341. exports.$isTransparent =
  65342. exports.$isThereMoreWidth =
  65343. exports.$isSplittable =
  65344. exports.$isNsAgnostic =
  65345. exports.$isDescendent =
  65346. exports.$isDataValue =
  65347. exports.$isCDATAXml =
  65348. exports.$isBindable =
  65349. exports.$insertAt =
  65350. exports.$indexOf =
  65351. exports.$ids =
  65352. exports.$hasSettableValue =
  65353. exports.$globalData =
  65354. exports.$getTemplateRoot =
  65355. exports.$getSubformParent =
  65356. exports.$getRealChildrenByNameIt =
  65357. exports.$getParent =
  65358. exports.$getNextPage =
  65359. exports.$getExtra =
  65360. exports.$getDataValue =
  65361. exports.$getContainedChildren =
  65362. exports.$getChildrenByNameIt =
  65363. exports.$getChildrenByName =
  65364. exports.$getChildrenByClass =
  65365. exports.$getChildren =
  65366. exports.$getAvailableSpace =
  65367. exports.$getAttributes =
  65368. exports.$getAttributeIt =
  65369. exports.$flushHTML =
  65370. exports.$finalize =
  65371. exports.$extra =
  65372. exports.$dump =
  65373. exports.$data =
  65374. exports.$content =
  65375. exports.$consumed =
  65376. exports.$clone =
  65377. exports.$cleanup =
  65378. exports.$cleanPage =
  65379. exports.$clean =
  65380. exports.$childrenToHTML =
  65381. exports.$appendChild =
  65382. exports.$addHTML =
  65383. exports.$acceptWhitespace =
  65384. void 0;
  65385. var _utils = __w_pdfjs_require__(78);
  65386. var _util = __w_pdfjs_require__(2);
  65387. var _core_utils = __w_pdfjs_require__(6);
  65388. var _namespaces = __w_pdfjs_require__(79);
  65389. var _som = __w_pdfjs_require__(80);
  65390. const $acceptWhitespace = Symbol();
  65391. exports.$acceptWhitespace = $acceptWhitespace;
  65392. const $addHTML = Symbol();
  65393. exports.$addHTML = $addHTML;
  65394. const $appendChild = Symbol();
  65395. exports.$appendChild = $appendChild;
  65396. const $childrenToHTML = Symbol();
  65397. exports.$childrenToHTML = $childrenToHTML;
  65398. const $clean = Symbol();
  65399. exports.$clean = $clean;
  65400. const $cleanPage = Symbol();
  65401. exports.$cleanPage = $cleanPage;
  65402. const $cleanup = Symbol();
  65403. exports.$cleanup = $cleanup;
  65404. const $clone = Symbol();
  65405. exports.$clone = $clone;
  65406. const $consumed = Symbol();
  65407. exports.$consumed = $consumed;
  65408. const $content = Symbol("content");
  65409. exports.$content = $content;
  65410. const $data = Symbol("data");
  65411. exports.$data = $data;
  65412. const $dump = Symbol();
  65413. exports.$dump = $dump;
  65414. const $extra = Symbol("extra");
  65415. exports.$extra = $extra;
  65416. const $finalize = Symbol();
  65417. exports.$finalize = $finalize;
  65418. const $flushHTML = Symbol();
  65419. exports.$flushHTML = $flushHTML;
  65420. const $getAttributeIt = Symbol();
  65421. exports.$getAttributeIt = $getAttributeIt;
  65422. const $getAttributes = Symbol();
  65423. exports.$getAttributes = $getAttributes;
  65424. const $getAvailableSpace = Symbol();
  65425. exports.$getAvailableSpace = $getAvailableSpace;
  65426. const $getChildrenByClass = Symbol();
  65427. exports.$getChildrenByClass = $getChildrenByClass;
  65428. const $getChildrenByName = Symbol();
  65429. exports.$getChildrenByName = $getChildrenByName;
  65430. const $getChildrenByNameIt = Symbol();
  65431. exports.$getChildrenByNameIt = $getChildrenByNameIt;
  65432. const $getDataValue = Symbol();
  65433. exports.$getDataValue = $getDataValue;
  65434. const $getExtra = Symbol();
  65435. exports.$getExtra = $getExtra;
  65436. const $getRealChildrenByNameIt = Symbol();
  65437. exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt;
  65438. const $getChildren = Symbol();
  65439. exports.$getChildren = $getChildren;
  65440. const $getContainedChildren = Symbol();
  65441. exports.$getContainedChildren = $getContainedChildren;
  65442. const $getNextPage = Symbol();
  65443. exports.$getNextPage = $getNextPage;
  65444. const $getSubformParent = Symbol();
  65445. exports.$getSubformParent = $getSubformParent;
  65446. const $getParent = Symbol();
  65447. exports.$getParent = $getParent;
  65448. const $getTemplateRoot = Symbol();
  65449. exports.$getTemplateRoot = $getTemplateRoot;
  65450. const $globalData = Symbol();
  65451. exports.$globalData = $globalData;
  65452. const $hasSettableValue = Symbol();
  65453. exports.$hasSettableValue = $hasSettableValue;
  65454. const $ids = Symbol();
  65455. exports.$ids = $ids;
  65456. const $indexOf = Symbol();
  65457. exports.$indexOf = $indexOf;
  65458. const $insertAt = Symbol();
  65459. exports.$insertAt = $insertAt;
  65460. const $isCDATAXml = Symbol();
  65461. exports.$isCDATAXml = $isCDATAXml;
  65462. const $isBindable = Symbol();
  65463. exports.$isBindable = $isBindable;
  65464. const $isDataValue = Symbol();
  65465. exports.$isDataValue = $isDataValue;
  65466. const $isDescendent = Symbol();
  65467. exports.$isDescendent = $isDescendent;
  65468. const $isNsAgnostic = Symbol();
  65469. exports.$isNsAgnostic = $isNsAgnostic;
  65470. const $isSplittable = Symbol();
  65471. exports.$isSplittable = $isSplittable;
  65472. const $isThereMoreWidth = Symbol();
  65473. exports.$isThereMoreWidth = $isThereMoreWidth;
  65474. const $isTransparent = Symbol();
  65475. exports.$isTransparent = $isTransparent;
  65476. const $isUsable = Symbol();
  65477. exports.$isUsable = $isUsable;
  65478. const $lastAttribute = Symbol();
  65479. const $namespaceId = Symbol("namespaceId");
  65480. exports.$namespaceId = $namespaceId;
  65481. const $nodeName = Symbol("nodeName");
  65482. exports.$nodeName = $nodeName;
  65483. const $nsAttributes = Symbol();
  65484. exports.$nsAttributes = $nsAttributes;
  65485. const $onChild = Symbol();
  65486. exports.$onChild = $onChild;
  65487. const $onChildCheck = Symbol();
  65488. exports.$onChildCheck = $onChildCheck;
  65489. const $onText = Symbol();
  65490. exports.$onText = $onText;
  65491. const $pushGlyphs = Symbol();
  65492. exports.$pushGlyphs = $pushGlyphs;
  65493. const $popPara = Symbol();
  65494. exports.$popPara = $popPara;
  65495. const $pushPara = Symbol();
  65496. exports.$pushPara = $pushPara;
  65497. const $removeChild = Symbol();
  65498. exports.$removeChild = $removeChild;
  65499. const $root = Symbol("root");
  65500. exports.$root = $root;
  65501. const $resolvePrototypes = Symbol();
  65502. exports.$resolvePrototypes = $resolvePrototypes;
  65503. const $searchNode = Symbol();
  65504. exports.$searchNode = $searchNode;
  65505. const $setId = Symbol();
  65506. exports.$setId = $setId;
  65507. const $setSetAttributes = Symbol();
  65508. exports.$setSetAttributes = $setSetAttributes;
  65509. const $setValue = Symbol();
  65510. exports.$setValue = $setValue;
  65511. const $tabIndex = Symbol();
  65512. exports.$tabIndex = $tabIndex;
  65513. const $text = Symbol();
  65514. exports.$text = $text;
  65515. const $toPages = Symbol();
  65516. exports.$toPages = $toPages;
  65517. const $toHTML = Symbol();
  65518. exports.$toHTML = $toHTML;
  65519. const $toString = Symbol();
  65520. exports.$toString = $toString;
  65521. const $toStyle = Symbol();
  65522. exports.$toStyle = $toStyle;
  65523. const $uid = Symbol("uid");
  65524. exports.$uid = $uid;
  65525. const _applyPrototype = Symbol();
  65526. const _attributes = Symbol();
  65527. const _attributeNames = Symbol();
  65528. const _children = Symbol("_children");
  65529. const _cloneAttribute = Symbol();
  65530. const _dataValue = Symbol();
  65531. const _defaultValue = Symbol();
  65532. const _filteredChildrenGenerator = Symbol();
  65533. const _getPrototype = Symbol();
  65534. const _getUnsetAttributes = Symbol();
  65535. const _hasChildren = Symbol();
  65536. const _max = Symbol();
  65537. const _options = Symbol();
  65538. const _parent = Symbol("parent");
  65539. const _resolvePrototypesHelper = Symbol();
  65540. const _setAttributes = Symbol();
  65541. const _validator = Symbol();
  65542. let uid = 0;
  65543. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  65544. class XFAObject {
  65545. constructor(nsId, name, hasChildren = false) {
  65546. this[$namespaceId] = nsId;
  65547. this[$nodeName] = name;
  65548. this[_hasChildren] = hasChildren;
  65549. this[_parent] = null;
  65550. this[_children] = [];
  65551. this[$uid] = `${name}${uid++}`;
  65552. this[$globalData] = null;
  65553. }
  65554. [$onChild](child) {
  65555. if (!this[_hasChildren] || !this[$onChildCheck](child)) {
  65556. return false;
  65557. }
  65558. const name = child[$nodeName];
  65559. const node = this[name];
  65560. if (node instanceof XFAObjectArray) {
  65561. if (node.push(child)) {
  65562. this[$appendChild](child);
  65563. return true;
  65564. }
  65565. } else {
  65566. if (node !== null) {
  65567. this[$removeChild](node);
  65568. }
  65569. this[name] = child;
  65570. this[$appendChild](child);
  65571. return true;
  65572. }
  65573. let id = "";
  65574. if (this.id) {
  65575. id = ` (id: ${this.id})`;
  65576. } else if (this.name) {
  65577. id = ` (name: ${this.name} ${this.h.value})`;
  65578. }
  65579. (0, _util.warn)(
  65580. `XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`
  65581. );
  65582. return false;
  65583. }
  65584. [$onChildCheck](child) {
  65585. return (
  65586. this.hasOwnProperty(child[$nodeName]) &&
  65587. child[$namespaceId] === this[$namespaceId]
  65588. );
  65589. }
  65590. [$isNsAgnostic]() {
  65591. return false;
  65592. }
  65593. [$acceptWhitespace]() {
  65594. return false;
  65595. }
  65596. [$isCDATAXml]() {
  65597. return false;
  65598. }
  65599. [$isBindable]() {
  65600. return false;
  65601. }
  65602. [$popPara]() {
  65603. if (this.para) {
  65604. this[$getTemplateRoot]()[$extra].paraStack.pop();
  65605. }
  65606. }
  65607. [$pushPara]() {
  65608. this[$getTemplateRoot]()[$extra].paraStack.push(this.para);
  65609. }
  65610. [$setId](ids) {
  65611. if (
  65612. this.id &&
  65613. this[$namespaceId] === _namespaces.NamespaceIds.template.id
  65614. ) {
  65615. ids.set(this.id, this);
  65616. }
  65617. }
  65618. [$getTemplateRoot]() {
  65619. return this[$globalData].template;
  65620. }
  65621. [$isSplittable]() {
  65622. return false;
  65623. }
  65624. [$isThereMoreWidth]() {
  65625. return false;
  65626. }
  65627. [$appendChild](child) {
  65628. child[_parent] = this;
  65629. this[_children].push(child);
  65630. if (!child[$globalData] && this[$globalData]) {
  65631. child[$globalData] = this[$globalData];
  65632. }
  65633. }
  65634. [$removeChild](child) {
  65635. const i = this[_children].indexOf(child);
  65636. this[_children].splice(i, 1);
  65637. }
  65638. [$hasSettableValue]() {
  65639. return this.hasOwnProperty("value");
  65640. }
  65641. [$setValue](_) {}
  65642. [$onText](_) {}
  65643. [$finalize]() {}
  65644. [$clean](builder) {
  65645. delete this[_hasChildren];
  65646. if (this[$cleanup]) {
  65647. builder.clean(this[$cleanup]);
  65648. delete this[$cleanup];
  65649. }
  65650. }
  65651. [$indexOf](child) {
  65652. return this[_children].indexOf(child);
  65653. }
  65654. [$insertAt](i, child) {
  65655. child[_parent] = this;
  65656. this[_children].splice(i, 0, child);
  65657. if (!child[$globalData] && this[$globalData]) {
  65658. child[$globalData] = this[$globalData];
  65659. }
  65660. }
  65661. [$isTransparent]() {
  65662. return !this.name;
  65663. }
  65664. [$lastAttribute]() {
  65665. return "";
  65666. }
  65667. [$text]() {
  65668. if (this[_children].length === 0) {
  65669. return this[$content];
  65670. }
  65671. return this[_children].map((c) => c[$text]()).join("");
  65672. }
  65673. get [_attributeNames]() {
  65674. const proto = Object.getPrototypeOf(this);
  65675. if (!proto._attributes) {
  65676. const attributes = (proto._attributes = new Set());
  65677. for (const name of Object.getOwnPropertyNames(this)) {
  65678. if (
  65679. this[name] === null ||
  65680. this[name] instanceof XFAObject ||
  65681. this[name] instanceof XFAObjectArray
  65682. ) {
  65683. break;
  65684. }
  65685. attributes.add(name);
  65686. }
  65687. }
  65688. return (0, _util.shadow)(this, _attributeNames, proto._attributes);
  65689. }
  65690. [$isDescendent](parent) {
  65691. let node = this;
  65692. while (node) {
  65693. if (node === parent) {
  65694. return true;
  65695. }
  65696. node = node[$getParent]();
  65697. }
  65698. return false;
  65699. }
  65700. [$getParent]() {
  65701. return this[_parent];
  65702. }
  65703. [$getSubformParent]() {
  65704. return this[$getParent]();
  65705. }
  65706. [$getChildren](name = null) {
  65707. if (!name) {
  65708. return this[_children];
  65709. }
  65710. return this[name];
  65711. }
  65712. [$dump]() {
  65713. const dumped = Object.create(null);
  65714. if (this[$content]) {
  65715. dumped.$content = this[$content];
  65716. }
  65717. for (const name of Object.getOwnPropertyNames(this)) {
  65718. const value = this[name];
  65719. if (value === null) {
  65720. continue;
  65721. }
  65722. if (value instanceof XFAObject) {
  65723. dumped[name] = value[$dump]();
  65724. } else if (value instanceof XFAObjectArray) {
  65725. if (!value.isEmpty()) {
  65726. dumped[name] = value.dump();
  65727. }
  65728. } else {
  65729. dumped[name] = value;
  65730. }
  65731. }
  65732. return dumped;
  65733. }
  65734. [$toStyle]() {
  65735. return null;
  65736. }
  65737. [$toHTML]() {
  65738. return _utils.HTMLResult.EMPTY;
  65739. }
  65740. *[$getContainedChildren]() {
  65741. for (const node of this[$getChildren]()) {
  65742. yield node;
  65743. }
  65744. }
  65745. *[_filteredChildrenGenerator](filter, include) {
  65746. for (const node of this[$getContainedChildren]()) {
  65747. if (!filter || include === filter.has(node[$nodeName])) {
  65748. const availableSpace = this[$getAvailableSpace]();
  65749. const res = node[$toHTML](availableSpace);
  65750. if (!res.success) {
  65751. this[$extra].failingNode = node;
  65752. }
  65753. yield res;
  65754. }
  65755. }
  65756. }
  65757. [$flushHTML]() {
  65758. return null;
  65759. }
  65760. [$addHTML](html, bbox) {
  65761. this[$extra].children.push(html);
  65762. }
  65763. [$getAvailableSpace]() {}
  65764. [$childrenToHTML]({ filter = null, include = true }) {
  65765. if (!this[$extra].generator) {
  65766. this[$extra].generator = this[_filteredChildrenGenerator](
  65767. filter,
  65768. include
  65769. );
  65770. } else {
  65771. const availableSpace = this[$getAvailableSpace]();
  65772. const res = this[$extra].failingNode[$toHTML](availableSpace);
  65773. if (!res.success) {
  65774. return res;
  65775. }
  65776. if (res.html) {
  65777. this[$addHTML](res.html, res.bbox);
  65778. }
  65779. delete this[$extra].failingNode;
  65780. }
  65781. while (true) {
  65782. const gen = this[$extra].generator.next();
  65783. if (gen.done) {
  65784. break;
  65785. }
  65786. const res = gen.value;
  65787. if (!res.success) {
  65788. return res;
  65789. }
  65790. if (res.html) {
  65791. this[$addHTML](res.html, res.bbox);
  65792. }
  65793. }
  65794. this[$extra].generator = null;
  65795. return _utils.HTMLResult.EMPTY;
  65796. }
  65797. [$setSetAttributes](attributes) {
  65798. this[_setAttributes] = new Set(Object.keys(attributes));
  65799. }
  65800. [_getUnsetAttributes](protoAttributes) {
  65801. const allAttr = this[_attributeNames];
  65802. const setAttr = this[_setAttributes];
  65803. return [...protoAttributes].filter(
  65804. (x) => allAttr.has(x) && !setAttr.has(x)
  65805. );
  65806. }
  65807. [$resolvePrototypes](ids, ancestors = new Set()) {
  65808. for (const child of this[_children]) {
  65809. child[_resolvePrototypesHelper](ids, ancestors);
  65810. }
  65811. }
  65812. [_resolvePrototypesHelper](ids, ancestors) {
  65813. const proto = this[_getPrototype](ids, ancestors);
  65814. if (proto) {
  65815. this[_applyPrototype](proto, ids, ancestors);
  65816. } else {
  65817. this[$resolvePrototypes](ids, ancestors);
  65818. }
  65819. }
  65820. [_getPrototype](ids, ancestors) {
  65821. const { use, usehref } = this;
  65822. if (!use && !usehref) {
  65823. return null;
  65824. }
  65825. let proto = null;
  65826. let somExpression = null;
  65827. let id = null;
  65828. let ref = use;
  65829. if (usehref) {
  65830. ref = usehref;
  65831. if (usehref.startsWith("#som(") && usehref.endsWith(")")) {
  65832. somExpression = usehref.slice(
  65833. "#som(".length,
  65834. usehref.length - 1
  65835. );
  65836. } else if (
  65837. usehref.startsWith(".#som(") &&
  65838. usehref.endsWith(")")
  65839. ) {
  65840. somExpression = usehref.slice(
  65841. ".#som(".length,
  65842. usehref.length - 1
  65843. );
  65844. } else if (usehref.startsWith("#")) {
  65845. id = usehref.slice(1);
  65846. } else if (usehref.startsWith(".#")) {
  65847. id = usehref.slice(2);
  65848. }
  65849. } else if (use.startsWith("#")) {
  65850. id = use.slice(1);
  65851. } else {
  65852. somExpression = use;
  65853. }
  65854. this.use = this.usehref = "";
  65855. if (id) {
  65856. proto = ids.get(id);
  65857. } else {
  65858. proto = (0, _som.searchNode)(
  65859. ids.get($root),
  65860. this,
  65861. somExpression,
  65862. true,
  65863. false
  65864. );
  65865. if (proto) {
  65866. proto = proto[0];
  65867. }
  65868. }
  65869. if (!proto) {
  65870. (0, _util.warn)(`XFA - Invalid prototype reference: ${ref}.`);
  65871. return null;
  65872. }
  65873. if (proto[$nodeName] !== this[$nodeName]) {
  65874. (0, _util.warn)(
  65875. `XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`
  65876. );
  65877. return null;
  65878. }
  65879. if (ancestors.has(proto)) {
  65880. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  65881. return null;
  65882. }
  65883. ancestors.add(proto);
  65884. const protoProto = proto[_getPrototype](ids, ancestors);
  65885. if (protoProto) {
  65886. proto[_applyPrototype](protoProto, ids, ancestors);
  65887. }
  65888. proto[$resolvePrototypes](ids, ancestors);
  65889. ancestors.delete(proto);
  65890. return proto;
  65891. }
  65892. [_applyPrototype](proto, ids, ancestors) {
  65893. if (ancestors.has(proto)) {
  65894. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  65895. return;
  65896. }
  65897. if (!this[$content] && proto[$content]) {
  65898. this[$content] = proto[$content];
  65899. }
  65900. const newAncestors = new Set(ancestors);
  65901. newAncestors.add(proto);
  65902. for (const unsetAttrName of this[_getUnsetAttributes](
  65903. proto[_setAttributes]
  65904. )) {
  65905. this[unsetAttrName] = proto[unsetAttrName];
  65906. if (this[_setAttributes]) {
  65907. this[_setAttributes].add(unsetAttrName);
  65908. }
  65909. }
  65910. for (const name of Object.getOwnPropertyNames(this)) {
  65911. if (this[_attributeNames].has(name)) {
  65912. continue;
  65913. }
  65914. const value = this[name];
  65915. const protoValue = proto[name];
  65916. if (value instanceof XFAObjectArray) {
  65917. for (const child of value[_children]) {
  65918. child[_resolvePrototypesHelper](ids, ancestors);
  65919. }
  65920. for (
  65921. let i = value[_children].length,
  65922. ii = protoValue[_children].length;
  65923. i < ii;
  65924. i++
  65925. ) {
  65926. const child = proto[_children][i][$clone]();
  65927. if (value.push(child)) {
  65928. child[_parent] = this;
  65929. this[_children].push(child);
  65930. child[_resolvePrototypesHelper](ids, ancestors);
  65931. } else {
  65932. break;
  65933. }
  65934. }
  65935. continue;
  65936. }
  65937. if (value !== null) {
  65938. value[$resolvePrototypes](ids, ancestors);
  65939. if (protoValue) {
  65940. value[_applyPrototype](protoValue, ids, ancestors);
  65941. }
  65942. continue;
  65943. }
  65944. if (protoValue !== null) {
  65945. const child = protoValue[$clone]();
  65946. child[_parent] = this;
  65947. this[name] = child;
  65948. this[_children].push(child);
  65949. child[_resolvePrototypesHelper](ids, ancestors);
  65950. }
  65951. }
  65952. }
  65953. static [_cloneAttribute](obj) {
  65954. if (Array.isArray(obj)) {
  65955. return obj.map((x) => XFAObject[_cloneAttribute](x));
  65956. }
  65957. if (typeof obj === "object" && obj !== null) {
  65958. return Object.assign({}, obj);
  65959. }
  65960. return obj;
  65961. }
  65962. [$clone]() {
  65963. const clone = Object.create(Object.getPrototypeOf(this));
  65964. for (const $symbol of Object.getOwnPropertySymbols(this)) {
  65965. try {
  65966. clone[$symbol] = this[$symbol];
  65967. } catch (_) {
  65968. (0, _util.shadow)(clone, $symbol, this[$symbol]);
  65969. }
  65970. }
  65971. clone[$uid] = `${clone[$nodeName]}${uid++}`;
  65972. clone[_children] = [];
  65973. for (const name of Object.getOwnPropertyNames(this)) {
  65974. if (this[_attributeNames].has(name)) {
  65975. clone[name] = XFAObject[_cloneAttribute](this[name]);
  65976. continue;
  65977. }
  65978. const value = this[name];
  65979. if (value instanceof XFAObjectArray) {
  65980. clone[name] = new XFAObjectArray(value[_max]);
  65981. } else {
  65982. clone[name] = null;
  65983. }
  65984. }
  65985. for (const child of this[_children]) {
  65986. const name = child[$nodeName];
  65987. const clonedChild = child[$clone]();
  65988. clone[_children].push(clonedChild);
  65989. clonedChild[_parent] = clone;
  65990. if (clone[name] === null) {
  65991. clone[name] = clonedChild;
  65992. } else {
  65993. clone[name][_children].push(clonedChild);
  65994. }
  65995. }
  65996. return clone;
  65997. }
  65998. [$getChildren](name = null) {
  65999. if (!name) {
  66000. return this[_children];
  66001. }
  66002. return this[_children].filter((c) => c[$nodeName] === name);
  66003. }
  66004. [$getChildrenByClass](name) {
  66005. return this[name];
  66006. }
  66007. [$getChildrenByName](name, allTransparent, first = true) {
  66008. return Array.from(
  66009. this[$getChildrenByNameIt](name, allTransparent, first)
  66010. );
  66011. }
  66012. *[$getChildrenByNameIt](name, allTransparent, first = true) {
  66013. if (name === "parent") {
  66014. yield this[_parent];
  66015. return;
  66016. }
  66017. for (const child of this[_children]) {
  66018. if (child[$nodeName] === name) {
  66019. yield child;
  66020. }
  66021. if (child.name === name) {
  66022. yield child;
  66023. }
  66024. if (allTransparent || child[$isTransparent]()) {
  66025. yield* child[$getChildrenByNameIt](name, allTransparent, false);
  66026. }
  66027. }
  66028. if (first && this[_attributeNames].has(name)) {
  66029. yield new XFAAttribute(this, name, this[name]);
  66030. }
  66031. }
  66032. }
  66033. exports.XFAObject = XFAObject;
  66034. class XFAObjectArray {
  66035. constructor(max = Infinity) {
  66036. this[_max] = max;
  66037. this[_children] = [];
  66038. }
  66039. push(child) {
  66040. const len = this[_children].length;
  66041. if (len <= this[_max]) {
  66042. this[_children].push(child);
  66043. return true;
  66044. }
  66045. (0, _util.warn)(
  66046. `XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`
  66047. );
  66048. return false;
  66049. }
  66050. isEmpty() {
  66051. return this[_children].length === 0;
  66052. }
  66053. dump() {
  66054. return this[_children].length === 1
  66055. ? this[_children][0][$dump]()
  66056. : this[_children].map((x) => x[$dump]());
  66057. }
  66058. [$clone]() {
  66059. const clone = new XFAObjectArray(this[_max]);
  66060. clone[_children] = this[_children].map((c) => c[$clone]());
  66061. return clone;
  66062. }
  66063. get children() {
  66064. return this[_children];
  66065. }
  66066. clear() {
  66067. this[_children].length = 0;
  66068. }
  66069. }
  66070. exports.XFAObjectArray = XFAObjectArray;
  66071. class XFAAttribute {
  66072. constructor(node, name, value) {
  66073. this[_parent] = node;
  66074. this[$nodeName] = name;
  66075. this[$content] = value;
  66076. this[$consumed] = false;
  66077. this[$uid] = `attribute${uid++}`;
  66078. }
  66079. [$getParent]() {
  66080. return this[_parent];
  66081. }
  66082. [$isDataValue]() {
  66083. return true;
  66084. }
  66085. [$getDataValue]() {
  66086. return this[$content].trim();
  66087. }
  66088. [$setValue](value) {
  66089. value = value.value || "";
  66090. this[$content] = value.toString();
  66091. }
  66092. [$text]() {
  66093. return this[$content];
  66094. }
  66095. [$isDescendent](parent) {
  66096. return (
  66097. this[_parent] === parent || this[_parent][$isDescendent](parent)
  66098. );
  66099. }
  66100. }
  66101. exports.XFAAttribute = XFAAttribute;
  66102. class XmlObject extends XFAObject {
  66103. constructor(nsId, name, attributes = {}) {
  66104. super(nsId, name);
  66105. this[$content] = "";
  66106. this[_dataValue] = null;
  66107. if (name !== "#text") {
  66108. const map = new Map();
  66109. this[_attributes] = map;
  66110. for (const [attrName, value] of Object.entries(attributes)) {
  66111. map.set(attrName, new XFAAttribute(this, attrName, value));
  66112. }
  66113. if (attributes.hasOwnProperty($nsAttributes)) {
  66114. const dataNode = attributes[$nsAttributes].xfa.dataNode;
  66115. if (dataNode !== undefined) {
  66116. if (dataNode === "dataGroup") {
  66117. this[_dataValue] = false;
  66118. } else if (dataNode === "dataValue") {
  66119. this[_dataValue] = true;
  66120. }
  66121. }
  66122. }
  66123. }
  66124. this[$consumed] = false;
  66125. }
  66126. [$toString](buf) {
  66127. const tagName = this[$nodeName];
  66128. if (tagName === "#text") {
  66129. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  66130. return;
  66131. }
  66132. const utf8TagName = (0, _util.utf8StringToString)(tagName);
  66133. const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : "";
  66134. buf.push(`<${prefix}${utf8TagName}`);
  66135. for (const [name, value] of this[_attributes].entries()) {
  66136. const utf8Name = (0, _util.utf8StringToString)(name);
  66137. buf.push(
  66138. ` ${utf8Name}="${(0, _core_utils.encodeToXmlString)(
  66139. value[$content]
  66140. )}"`
  66141. );
  66142. }
  66143. if (this[_dataValue] !== null) {
  66144. if (this[_dataValue]) {
  66145. buf.push(` xfa:dataNode="dataValue"`);
  66146. } else {
  66147. buf.push(` xfa:dataNode="dataGroup"`);
  66148. }
  66149. }
  66150. if (!this[$content] && this[_children].length === 0) {
  66151. buf.push("/>");
  66152. return;
  66153. }
  66154. buf.push(">");
  66155. if (this[$content]) {
  66156. if (typeof this[$content] === "string") {
  66157. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  66158. } else {
  66159. this[$content][$toString](buf);
  66160. }
  66161. } else {
  66162. for (const child of this[_children]) {
  66163. child[$toString](buf);
  66164. }
  66165. }
  66166. buf.push(`</${prefix}${utf8TagName}>`);
  66167. }
  66168. [$onChild](child) {
  66169. if (this[$content]) {
  66170. const node = new XmlObject(this[$namespaceId], "#text");
  66171. this[$appendChild](node);
  66172. node[$content] = this[$content];
  66173. this[$content] = "";
  66174. }
  66175. this[$appendChild](child);
  66176. return true;
  66177. }
  66178. [$onText](str) {
  66179. this[$content] += str;
  66180. }
  66181. [$finalize]() {
  66182. if (this[$content] && this[_children].length > 0) {
  66183. const node = new XmlObject(this[$namespaceId], "#text");
  66184. this[$appendChild](node);
  66185. node[$content] = this[$content];
  66186. delete this[$content];
  66187. }
  66188. }
  66189. [$toHTML]() {
  66190. if (this[$nodeName] === "#text") {
  66191. return _utils.HTMLResult.success({
  66192. name: "#text",
  66193. value: this[$content],
  66194. });
  66195. }
  66196. return _utils.HTMLResult.EMPTY;
  66197. }
  66198. [$getChildren](name = null) {
  66199. if (!name) {
  66200. return this[_children];
  66201. }
  66202. return this[_children].filter((c) => c[$nodeName] === name);
  66203. }
  66204. [$getAttributes]() {
  66205. return this[_attributes];
  66206. }
  66207. [$getChildrenByClass](name) {
  66208. const value = this[_attributes].get(name);
  66209. if (value !== undefined) {
  66210. return value;
  66211. }
  66212. return this[$getChildren](name);
  66213. }
  66214. *[$getChildrenByNameIt](name, allTransparent) {
  66215. const value = this[_attributes].get(name);
  66216. if (value) {
  66217. yield value;
  66218. }
  66219. for (const child of this[_children]) {
  66220. if (child[$nodeName] === name) {
  66221. yield child;
  66222. }
  66223. if (allTransparent) {
  66224. yield* child[$getChildrenByNameIt](name, allTransparent);
  66225. }
  66226. }
  66227. }
  66228. *[$getAttributeIt](name, skipConsumed) {
  66229. const value = this[_attributes].get(name);
  66230. if (value && (!skipConsumed || !value[$consumed])) {
  66231. yield value;
  66232. }
  66233. for (const child of this[_children]) {
  66234. yield* child[$getAttributeIt](name, skipConsumed);
  66235. }
  66236. }
  66237. *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {
  66238. for (const child of this[_children]) {
  66239. if (
  66240. child[$nodeName] === name &&
  66241. (!skipConsumed || !child[$consumed])
  66242. ) {
  66243. yield child;
  66244. }
  66245. if (allTransparent) {
  66246. yield* child[$getRealChildrenByNameIt](
  66247. name,
  66248. allTransparent,
  66249. skipConsumed
  66250. );
  66251. }
  66252. }
  66253. }
  66254. [$isDataValue]() {
  66255. if (this[_dataValue] === null) {
  66256. return (
  66257. this[_children].length === 0 ||
  66258. this[_children][0][$namespaceId] ===
  66259. _namespaces.NamespaceIds.xhtml.id
  66260. );
  66261. }
  66262. return this[_dataValue];
  66263. }
  66264. [$getDataValue]() {
  66265. if (this[_dataValue] === null) {
  66266. if (this[_children].length === 0) {
  66267. return this[$content].trim();
  66268. }
  66269. if (
  66270. this[_children][0][$namespaceId] ===
  66271. _namespaces.NamespaceIds.xhtml.id
  66272. ) {
  66273. return this[_children][0][$text]().trim();
  66274. }
  66275. return null;
  66276. }
  66277. return this[$content].trim();
  66278. }
  66279. [$setValue](value) {
  66280. value = value.value || "";
  66281. this[$content] = value.toString();
  66282. }
  66283. [$dump](hasNS = false) {
  66284. const dumped = Object.create(null);
  66285. if (hasNS) {
  66286. dumped.$ns = this[$namespaceId];
  66287. }
  66288. if (this[$content]) {
  66289. dumped.$content = this[$content];
  66290. }
  66291. dumped.$name = this[$nodeName];
  66292. dumped.children = [];
  66293. for (const child of this[_children]) {
  66294. dumped.children.push(child[$dump](hasNS));
  66295. }
  66296. dumped.attributes = Object.create(null);
  66297. for (const [name, value] of this[_attributes]) {
  66298. dumped.attributes[name] = value[$content];
  66299. }
  66300. return dumped;
  66301. }
  66302. }
  66303. exports.XmlObject = XmlObject;
  66304. class ContentObject extends XFAObject {
  66305. constructor(nsId, name) {
  66306. super(nsId, name);
  66307. this[$content] = "";
  66308. }
  66309. [$onText](text) {
  66310. this[$content] += text;
  66311. }
  66312. [$finalize]() {}
  66313. }
  66314. exports.ContentObject = ContentObject;
  66315. class OptionObject extends ContentObject {
  66316. constructor(nsId, name, options) {
  66317. super(nsId, name);
  66318. this[_options] = options;
  66319. }
  66320. [$finalize]() {
  66321. this[$content] = (0, _utils.getKeyword)({
  66322. data: this[$content],
  66323. defaultValue: this[_options][0],
  66324. validate: (k) => this[_options].includes(k),
  66325. });
  66326. }
  66327. [$clean](builder) {
  66328. super[$clean](builder);
  66329. delete this[_options];
  66330. }
  66331. }
  66332. exports.OptionObject = OptionObject;
  66333. class StringObject extends ContentObject {
  66334. [$finalize]() {
  66335. this[$content] = this[$content].trim();
  66336. }
  66337. }
  66338. exports.StringObject = StringObject;
  66339. class IntegerObject extends ContentObject {
  66340. constructor(nsId, name, defaultValue, validator) {
  66341. super(nsId, name);
  66342. this[_defaultValue] = defaultValue;
  66343. this[_validator] = validator;
  66344. }
  66345. [$finalize]() {
  66346. this[$content] = (0, _utils.getInteger)({
  66347. data: this[$content],
  66348. defaultValue: this[_defaultValue],
  66349. validate: this[_validator],
  66350. });
  66351. }
  66352. [$clean](builder) {
  66353. super[$clean](builder);
  66354. delete this[_defaultValue];
  66355. delete this[_validator];
  66356. }
  66357. }
  66358. exports.IntegerObject = IntegerObject;
  66359. class Option01 extends IntegerObject {
  66360. constructor(nsId, name) {
  66361. super(nsId, name, 0, (n) => n === 1);
  66362. }
  66363. }
  66364. exports.Option01 = Option01;
  66365. class Option10 extends IntegerObject {
  66366. constructor(nsId, name) {
  66367. super(nsId, name, 1, (n) => n === 0);
  66368. }
  66369. }
  66370. exports.Option10 = Option10;
  66371. /***/
  66372. },
  66373. /* 78 */
  66374. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  66375. Object.defineProperty(exports, "__esModule", {
  66376. value: true,
  66377. });
  66378. exports.HTMLResult = void 0;
  66379. exports.getBBox = getBBox;
  66380. exports.getColor = getColor;
  66381. exports.getFloat = getFloat;
  66382. exports.getInteger = getInteger;
  66383. exports.getKeyword = getKeyword;
  66384. exports.getMeasurement = getMeasurement;
  66385. exports.getRatio = getRatio;
  66386. exports.getRelevant = getRelevant;
  66387. exports.getStringOption = getStringOption;
  66388. exports.stripQuotes = stripQuotes;
  66389. var _util = __w_pdfjs_require__(2);
  66390. const dimConverters = {
  66391. pt: (x) => x,
  66392. cm: (x) => (x / 2.54) * 72,
  66393. mm: (x) => (x / (10 * 2.54)) * 72,
  66394. in: (x) => x * 72,
  66395. px: (x) => x,
  66396. };
  66397. const measurementPattern = /([+-]?\d+\.?\d*)(.*)/;
  66398. function stripQuotes(str) {
  66399. if (str.startsWith("'") || str.startsWith('"')) {
  66400. return str.slice(1, str.length - 1);
  66401. }
  66402. return str;
  66403. }
  66404. function getInteger({ data, defaultValue, validate }) {
  66405. if (!data) {
  66406. return defaultValue;
  66407. }
  66408. data = data.trim();
  66409. const n = parseInt(data, 10);
  66410. if (!isNaN(n) && validate(n)) {
  66411. return n;
  66412. }
  66413. return defaultValue;
  66414. }
  66415. function getFloat({ data, defaultValue, validate }) {
  66416. if (!data) {
  66417. return defaultValue;
  66418. }
  66419. data = data.trim();
  66420. const n = parseFloat(data);
  66421. if (!isNaN(n) && validate(n)) {
  66422. return n;
  66423. }
  66424. return defaultValue;
  66425. }
  66426. function getKeyword({ data, defaultValue, validate }) {
  66427. if (!data) {
  66428. return defaultValue;
  66429. }
  66430. data = data.trim();
  66431. if (validate(data)) {
  66432. return data;
  66433. }
  66434. return defaultValue;
  66435. }
  66436. function getStringOption(data, options) {
  66437. return getKeyword({
  66438. data,
  66439. defaultValue: options[0],
  66440. validate: (k) => options.includes(k),
  66441. });
  66442. }
  66443. function getMeasurement(str, def = "0") {
  66444. def = def || "0";
  66445. if (!str) {
  66446. return getMeasurement(def);
  66447. }
  66448. const match = str.trim().match(measurementPattern);
  66449. if (!match) {
  66450. return getMeasurement(def);
  66451. }
  66452. const [, valueStr, unit] = match;
  66453. const value = parseFloat(valueStr);
  66454. if (isNaN(value)) {
  66455. return getMeasurement(def);
  66456. }
  66457. if (value === 0) {
  66458. return 0;
  66459. }
  66460. const conv = dimConverters[unit];
  66461. if (conv) {
  66462. return conv(value);
  66463. }
  66464. return value;
  66465. }
  66466. function getRatio(data) {
  66467. if (!data) {
  66468. return {
  66469. num: 1,
  66470. den: 1,
  66471. };
  66472. }
  66473. const ratio = data
  66474. .trim()
  66475. .split(/\s*:\s*/)
  66476. .map((x) => parseFloat(x))
  66477. .filter((x) => !isNaN(x));
  66478. if (ratio.length === 1) {
  66479. ratio.push(1);
  66480. }
  66481. if (ratio.length === 0) {
  66482. return {
  66483. num: 1,
  66484. den: 1,
  66485. };
  66486. }
  66487. const [num, den] = ratio;
  66488. return {
  66489. num,
  66490. den,
  66491. };
  66492. }
  66493. function getRelevant(data) {
  66494. if (!data) {
  66495. return [];
  66496. }
  66497. return data
  66498. .trim()
  66499. .split(/\s+/)
  66500. .map((e) => {
  66501. return {
  66502. excluded: e[0] === "-",
  66503. viewname: e.substring(1),
  66504. };
  66505. });
  66506. }
  66507. function getColor(data, def = [0, 0, 0]) {
  66508. let [r, g, b] = def;
  66509. if (!data) {
  66510. return {
  66511. r,
  66512. g,
  66513. b,
  66514. };
  66515. }
  66516. const color = data
  66517. .trim()
  66518. .split(/\s*,\s*/)
  66519. .map((c) => Math.min(Math.max(0, parseInt(c.trim(), 10)), 255))
  66520. .map((c) => (isNaN(c) ? 0 : c));
  66521. if (color.length < 3) {
  66522. return {
  66523. r,
  66524. g,
  66525. b,
  66526. };
  66527. }
  66528. [r, g, b] = color;
  66529. return {
  66530. r,
  66531. g,
  66532. b,
  66533. };
  66534. }
  66535. function getBBox(data) {
  66536. const def = -1;
  66537. if (!data) {
  66538. return {
  66539. x: def,
  66540. y: def,
  66541. width: def,
  66542. height: def,
  66543. };
  66544. }
  66545. const bbox = data
  66546. .trim()
  66547. .split(/\s*,\s*/)
  66548. .map((m) => getMeasurement(m, "-1"));
  66549. if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {
  66550. return {
  66551. x: def,
  66552. y: def,
  66553. width: def,
  66554. height: def,
  66555. };
  66556. }
  66557. const [x, y, width, height] = bbox;
  66558. return {
  66559. x,
  66560. y,
  66561. width,
  66562. height,
  66563. };
  66564. }
  66565. class HTMLResult {
  66566. static get FAILURE() {
  66567. return (0, _util.shadow)(
  66568. this,
  66569. "FAILURE",
  66570. new HTMLResult(false, null, null, null)
  66571. );
  66572. }
  66573. static get EMPTY() {
  66574. return (0, _util.shadow)(
  66575. this,
  66576. "EMPTY",
  66577. new HTMLResult(true, null, null, null)
  66578. );
  66579. }
  66580. constructor(success, html, bbox, breakNode) {
  66581. this.success = success;
  66582. this.html = html;
  66583. this.bbox = bbox;
  66584. this.breakNode = breakNode;
  66585. }
  66586. isBreak() {
  66587. return !!this.breakNode;
  66588. }
  66589. static breakNode(node) {
  66590. return new HTMLResult(false, null, null, node);
  66591. }
  66592. static success(html, bbox = null) {
  66593. return new HTMLResult(true, html, bbox, null);
  66594. }
  66595. }
  66596. exports.HTMLResult = HTMLResult;
  66597. /***/
  66598. },
  66599. /* 79 */
  66600. /***/ (__unused_webpack_module, exports) => {
  66601. Object.defineProperty(exports, "__esModule", {
  66602. value: true,
  66603. });
  66604. exports.NamespaceIds = exports.$buildXFAObject = void 0;
  66605. const $buildXFAObject = Symbol();
  66606. exports.$buildXFAObject = $buildXFAObject;
  66607. const NamespaceIds = {
  66608. config: {
  66609. id: 0,
  66610. check: (ns) => ns.startsWith("http://www.xfa.org/schema/xci/"),
  66611. },
  66612. connectionSet: {
  66613. id: 1,
  66614. check: (ns) =>
  66615. ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/"),
  66616. },
  66617. datasets: {
  66618. id: 2,
  66619. check: (ns) => ns.startsWith("http://www.xfa.org/schema/xfa-data/"),
  66620. },
  66621. form: {
  66622. id: 3,
  66623. check: (ns) => ns.startsWith("http://www.xfa.org/schema/xfa-form/"),
  66624. },
  66625. localeSet: {
  66626. id: 4,
  66627. check: (ns) =>
  66628. ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/"),
  66629. },
  66630. pdf: {
  66631. id: 5,
  66632. check: (ns) => ns === "http://ns.adobe.com/xdp/pdf/",
  66633. },
  66634. signature: {
  66635. id: 6,
  66636. check: (ns) => ns === "http://www.w3.org/2000/09/xmldsig#",
  66637. },
  66638. sourceSet: {
  66639. id: 7,
  66640. check: (ns) =>
  66641. ns.startsWith("http://www.xfa.org/schema/xfa-source-set/"),
  66642. },
  66643. stylesheet: {
  66644. id: 8,
  66645. check: (ns) => ns === "http://www.w3.org/1999/XSL/Transform",
  66646. },
  66647. template: {
  66648. id: 9,
  66649. check: (ns) =>
  66650. ns.startsWith("http://www.xfa.org/schema/xfa-template/"),
  66651. },
  66652. xdc: {
  66653. id: 10,
  66654. check: (ns) => ns.startsWith("http://www.xfa.org/schema/xdc/"),
  66655. },
  66656. xdp: {
  66657. id: 11,
  66658. check: (ns) => ns === "http://ns.adobe.com/xdp/",
  66659. },
  66660. xfdf: {
  66661. id: 12,
  66662. check: (ns) => ns === "http://ns.adobe.com/xfdf/",
  66663. },
  66664. xhtml: {
  66665. id: 13,
  66666. check: (ns) => ns === "http://www.w3.org/1999/xhtml",
  66667. },
  66668. xmpmeta: {
  66669. id: 14,
  66670. check: (ns) => ns === "http://ns.adobe.com/xmpmeta/",
  66671. },
  66672. };
  66673. exports.NamespaceIds = NamespaceIds;
  66674. /***/
  66675. },
  66676. /* 80 */
  66677. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  66678. Object.defineProperty(exports, "__esModule", {
  66679. value: true,
  66680. });
  66681. exports.createDataNode = createDataNode;
  66682. exports.searchNode = searchNode;
  66683. var _xfa_object = __w_pdfjs_require__(77);
  66684. var _namespaces = __w_pdfjs_require__(79);
  66685. var _util = __w_pdfjs_require__(2);
  66686. const namePattern = /^[^.[]+/;
  66687. const indexPattern = /^[^\]]+/;
  66688. const operators = {
  66689. dot: 0,
  66690. dotDot: 1,
  66691. dotHash: 2,
  66692. dotBracket: 3,
  66693. dotParen: 4,
  66694. };
  66695. const shortcuts = new Map([
  66696. [
  66697. "$data",
  66698. (root, current) => (root.datasets ? root.datasets.data : root),
  66699. ],
  66700. [
  66701. "$record",
  66702. (root, current) =>
  66703. (root.datasets ? root.datasets.data : root)[
  66704. _xfa_object.$getChildren
  66705. ]()[0],
  66706. ],
  66707. ["$template", (root, current) => root.template],
  66708. ["$connectionSet", (root, current) => root.connectionSet],
  66709. ["$form", (root, current) => root.form],
  66710. ["$layout", (root, current) => root.layout],
  66711. ["$host", (root, current) => root.host],
  66712. ["$dataWindow", (root, current) => root.dataWindow],
  66713. ["$event", (root, current) => root.event],
  66714. ["!", (root, current) => root.datasets],
  66715. ["$xfa", (root, current) => root],
  66716. ["xfa", (root, current) => root],
  66717. ["$", (root, current) => current],
  66718. ]);
  66719. const somCache = new WeakMap();
  66720. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  66721. function parseIndex(index) {
  66722. index = index.trim();
  66723. if (index === "*") {
  66724. return Infinity;
  66725. }
  66726. return parseInt(index, 10) || 0;
  66727. }
  66728. function parseExpression(expr, dotDotAllowed, noExpr = true) {
  66729. let match = expr.match(namePattern);
  66730. if (!match) {
  66731. return null;
  66732. }
  66733. let [name] = match;
  66734. const parsed = [
  66735. {
  66736. name,
  66737. cacheName: "." + name,
  66738. index: 0,
  66739. js: null,
  66740. formCalc: null,
  66741. operator: operators.dot,
  66742. },
  66743. ];
  66744. let pos = name.length;
  66745. while (pos < expr.length) {
  66746. const spos = pos;
  66747. const char = expr.charAt(pos++);
  66748. if (char === "[") {
  66749. match = expr.slice(pos).match(indexPattern);
  66750. if (!match) {
  66751. (0, _util.warn)("XFA - Invalid index in SOM expression");
  66752. return null;
  66753. }
  66754. parsed.at(-1).index = parseIndex(match[0]);
  66755. pos += match[0].length + 1;
  66756. continue;
  66757. }
  66758. let operator;
  66759. switch (expr.charAt(pos)) {
  66760. case ".":
  66761. if (!dotDotAllowed) {
  66762. return null;
  66763. }
  66764. pos++;
  66765. operator = operators.dotDot;
  66766. break;
  66767. case "#":
  66768. pos++;
  66769. operator = operators.dotHash;
  66770. break;
  66771. case "[":
  66772. if (noExpr) {
  66773. (0, _util.warn)(
  66774. "XFA - SOM expression contains a FormCalc subexpression which is not supported for now."
  66775. );
  66776. return null;
  66777. }
  66778. operator = operators.dotBracket;
  66779. break;
  66780. case "(":
  66781. if (noExpr) {
  66782. (0, _util.warn)(
  66783. "XFA - SOM expression contains a JavaScript subexpression which is not supported for now."
  66784. );
  66785. return null;
  66786. }
  66787. operator = operators.dotParen;
  66788. break;
  66789. default:
  66790. operator = operators.dot;
  66791. break;
  66792. }
  66793. match = expr.slice(pos).match(namePattern);
  66794. if (!match) {
  66795. break;
  66796. }
  66797. [name] = match;
  66798. pos += name.length;
  66799. parsed.push({
  66800. name,
  66801. cacheName: expr.slice(spos, pos),
  66802. operator,
  66803. index: 0,
  66804. js: null,
  66805. formCalc: null,
  66806. });
  66807. }
  66808. return parsed;
  66809. }
  66810. function searchNode(
  66811. root,
  66812. container,
  66813. expr,
  66814. dotDotAllowed = true,
  66815. useCache = true
  66816. ) {
  66817. const parsed = parseExpression(expr, dotDotAllowed);
  66818. if (!parsed) {
  66819. return null;
  66820. }
  66821. const fn = shortcuts.get(parsed[0].name);
  66822. let i = 0;
  66823. let isQualified;
  66824. if (fn) {
  66825. isQualified = true;
  66826. root = [fn(root, container)];
  66827. i = 1;
  66828. } else {
  66829. isQualified = container === null;
  66830. root = [container || root];
  66831. }
  66832. for (let ii = parsed.length; i < ii; i++) {
  66833. const { name, cacheName, operator, index } = parsed[i];
  66834. const nodes = [];
  66835. for (const node of root) {
  66836. if (!(node instanceof _xfa_object.XFAObject)) {
  66837. continue;
  66838. }
  66839. let children, cached;
  66840. if (useCache) {
  66841. cached = somCache.get(node);
  66842. if (!cached) {
  66843. cached = new Map();
  66844. somCache.set(node, cached);
  66845. }
  66846. children = cached.get(cacheName);
  66847. }
  66848. if (!children) {
  66849. switch (operator) {
  66850. case operators.dot:
  66851. children = node[_xfa_object.$getChildrenByName](
  66852. name,
  66853. false
  66854. );
  66855. break;
  66856. case operators.dotDot:
  66857. children = node[_xfa_object.$getChildrenByName](name, true);
  66858. break;
  66859. case operators.dotHash:
  66860. children = node[_xfa_object.$getChildrenByClass](name);
  66861. if (children instanceof _xfa_object.XFAObjectArray) {
  66862. children = children.children;
  66863. } else {
  66864. children = [children];
  66865. }
  66866. break;
  66867. default:
  66868. break;
  66869. }
  66870. if (useCache) {
  66871. cached.set(cacheName, children);
  66872. }
  66873. }
  66874. if (children.length > 0) {
  66875. nodes.push(children);
  66876. }
  66877. }
  66878. if (nodes.length === 0 && !isQualified && i === 0) {
  66879. const parent = container[_xfa_object.$getParent]();
  66880. container = parent;
  66881. if (!container) {
  66882. return null;
  66883. }
  66884. i = -1;
  66885. root = [container];
  66886. continue;
  66887. }
  66888. if (isFinite(index)) {
  66889. root = nodes
  66890. .filter((node) => index < node.length)
  66891. .map((node) => node[index]);
  66892. } else {
  66893. root = nodes.flat();
  66894. }
  66895. }
  66896. if (root.length === 0) {
  66897. return null;
  66898. }
  66899. return root;
  66900. }
  66901. function createNodes(root, path) {
  66902. let node = null;
  66903. for (const { name, index } of path) {
  66904. for (let i = 0, ii = !isFinite(index) ? 0 : index; i <= ii; i++) {
  66905. const nsId =
  66906. root[_xfa_object.$namespaceId] === NS_DATASETS
  66907. ? -1
  66908. : root[_xfa_object.$namespaceId];
  66909. node = new _xfa_object.XmlObject(nsId, name);
  66910. root[_xfa_object.$appendChild](node);
  66911. }
  66912. root = node;
  66913. }
  66914. return node;
  66915. }
  66916. function createDataNode(root, container, expr) {
  66917. const parsed = parseExpression(expr);
  66918. if (!parsed) {
  66919. return null;
  66920. }
  66921. if (parsed.some((x) => x.operator === operators.dotDot)) {
  66922. return null;
  66923. }
  66924. const fn = shortcuts.get(parsed[0].name);
  66925. let i = 0;
  66926. if (fn) {
  66927. root = fn(root, container);
  66928. i = 1;
  66929. } else {
  66930. root = container || root;
  66931. }
  66932. for (let ii = parsed.length; i < ii; i++) {
  66933. const { name, operator, index } = parsed[i];
  66934. if (!isFinite(index)) {
  66935. parsed[i].index = 0;
  66936. return createNodes(root, parsed.slice(i));
  66937. }
  66938. let children;
  66939. switch (operator) {
  66940. case operators.dot:
  66941. children = root[_xfa_object.$getChildrenByName](name, false);
  66942. break;
  66943. case operators.dotDot:
  66944. children = root[_xfa_object.$getChildrenByName](name, true);
  66945. break;
  66946. case operators.dotHash:
  66947. children = root[_xfa_object.$getChildrenByClass](name);
  66948. if (children instanceof _xfa_object.XFAObjectArray) {
  66949. children = children.children;
  66950. } else {
  66951. children = [children];
  66952. }
  66953. break;
  66954. default:
  66955. break;
  66956. }
  66957. if (children.length === 0) {
  66958. return createNodes(root, parsed.slice(i));
  66959. }
  66960. if (index < children.length) {
  66961. const child = children[index];
  66962. if (!(child instanceof _xfa_object.XFAObject)) {
  66963. (0, _util.warn)(`XFA - Cannot create a node.`);
  66964. return null;
  66965. }
  66966. root = child;
  66967. } else {
  66968. parsed[i].index = index - children.length;
  66969. return createNodes(root, parsed.slice(i));
  66970. }
  66971. }
  66972. return null;
  66973. }
  66974. /***/
  66975. },
  66976. /* 81 */
  66977. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  66978. Object.defineProperty(exports, "__esModule", {
  66979. value: true,
  66980. });
  66981. exports.Binder = void 0;
  66982. var _xfa_object = __w_pdfjs_require__(77);
  66983. var _template = __w_pdfjs_require__(82);
  66984. var _som = __w_pdfjs_require__(80);
  66985. var _namespaces = __w_pdfjs_require__(79);
  66986. var _util = __w_pdfjs_require__(2);
  66987. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  66988. function createText(content) {
  66989. const node = new _template.Text({});
  66990. node[_xfa_object.$content] = content;
  66991. return node;
  66992. }
  66993. class Binder {
  66994. constructor(root) {
  66995. this.root = root;
  66996. this.datasets = root.datasets;
  66997. if (root.datasets && root.datasets.data) {
  66998. this.data = root.datasets.data;
  66999. } else {
  67000. this.data = new _xfa_object.XmlObject(
  67001. _namespaces.NamespaceIds.datasets.id,
  67002. "data"
  67003. );
  67004. }
  67005. this.emptyMerge =
  67006. this.data[_xfa_object.$getChildren]().length === 0;
  67007. this.root.form = this.form = root.template[_xfa_object.$clone]();
  67008. }
  67009. _isConsumeData() {
  67010. return !this.emptyMerge && this._mergeMode;
  67011. }
  67012. _isMatchTemplate() {
  67013. return !this._isConsumeData();
  67014. }
  67015. bind() {
  67016. this._bindElement(this.form, this.data);
  67017. return this.form;
  67018. }
  67019. getData() {
  67020. return this.data;
  67021. }
  67022. _bindValue(formNode, data, picture) {
  67023. formNode[_xfa_object.$data] = data;
  67024. if (formNode[_xfa_object.$hasSettableValue]()) {
  67025. if (data[_xfa_object.$isDataValue]()) {
  67026. const value = data[_xfa_object.$getDataValue]();
  67027. formNode[_xfa_object.$setValue](createText(value));
  67028. } else if (
  67029. formNode instanceof _template.Field &&
  67030. formNode.ui &&
  67031. formNode.ui.choiceList &&
  67032. formNode.ui.choiceList.open === "multiSelect"
  67033. ) {
  67034. const value = data[_xfa_object.$getChildren]()
  67035. .map((child) => child[_xfa_object.$content].trim())
  67036. .join("\n");
  67037. formNode[_xfa_object.$setValue](createText(value));
  67038. } else if (this._isConsumeData()) {
  67039. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  67040. }
  67041. } else if (
  67042. !data[_xfa_object.$isDataValue]() ||
  67043. this._isMatchTemplate()
  67044. ) {
  67045. this._bindElement(formNode, data);
  67046. } else {
  67047. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  67048. }
  67049. }
  67050. _findDataByNameToConsume(name, isValue, dataNode, global) {
  67051. if (!name) {
  67052. return null;
  67053. }
  67054. let generator, match;
  67055. for (let i = 0; i < 3; i++) {
  67056. generator = dataNode[_xfa_object.$getRealChildrenByNameIt](
  67057. name,
  67058. false,
  67059. true
  67060. );
  67061. while (true) {
  67062. match = generator.next().value;
  67063. if (!match) {
  67064. break;
  67065. }
  67066. if (isValue === match[_xfa_object.$isDataValue]()) {
  67067. return match;
  67068. }
  67069. }
  67070. if (
  67071. dataNode[_xfa_object.$namespaceId] ===
  67072. _namespaces.NamespaceIds.datasets.id &&
  67073. dataNode[_xfa_object.$nodeName] === "data"
  67074. ) {
  67075. break;
  67076. }
  67077. dataNode = dataNode[_xfa_object.$getParent]();
  67078. }
  67079. if (!global) {
  67080. return null;
  67081. }
  67082. generator = this.data[_xfa_object.$getRealChildrenByNameIt](
  67083. name,
  67084. true,
  67085. false
  67086. );
  67087. match = generator.next().value;
  67088. if (match) {
  67089. return match;
  67090. }
  67091. generator = this.data[_xfa_object.$getAttributeIt](name, true);
  67092. match = generator.next().value;
  67093. if (match && match[_xfa_object.$isDataValue]()) {
  67094. return match;
  67095. }
  67096. return null;
  67097. }
  67098. _setProperties(formNode, dataNode) {
  67099. if (!formNode.hasOwnProperty("setProperty")) {
  67100. return;
  67101. }
  67102. for (const { ref, target, connection } of formNode.setProperty
  67103. .children) {
  67104. if (connection) {
  67105. continue;
  67106. }
  67107. if (!ref) {
  67108. continue;
  67109. }
  67110. const nodes = (0, _som.searchNode)(
  67111. this.root,
  67112. dataNode,
  67113. ref,
  67114. false,
  67115. false
  67116. );
  67117. if (!nodes) {
  67118. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  67119. continue;
  67120. }
  67121. const [node] = nodes;
  67122. if (!node[_xfa_object.$isDescendent](this.data)) {
  67123. (0, _util.warn)(`XFA - Invalid node: must be a data node.`);
  67124. continue;
  67125. }
  67126. const targetNodes = (0, _som.searchNode)(
  67127. this.root,
  67128. formNode,
  67129. target,
  67130. false,
  67131. false
  67132. );
  67133. if (!targetNodes) {
  67134. (0, _util.warn)(`XFA - Invalid target: ${target}.`);
  67135. continue;
  67136. }
  67137. const [targetNode] = targetNodes;
  67138. if (!targetNode[_xfa_object.$isDescendent](formNode)) {
  67139. (0, _util.warn)(
  67140. `XFA - Invalid target: must be a property or subproperty.`
  67141. );
  67142. continue;
  67143. }
  67144. const targetParent = targetNode[_xfa_object.$getParent]();
  67145. if (
  67146. targetNode instanceof _template.SetProperty ||
  67147. targetParent instanceof _template.SetProperty
  67148. ) {
  67149. (0, _util.warn)(
  67150. `XFA - Invalid target: cannot be a setProperty or one of its properties.`
  67151. );
  67152. continue;
  67153. }
  67154. if (
  67155. targetNode instanceof _template.BindItems ||
  67156. targetParent instanceof _template.BindItems
  67157. ) {
  67158. (0, _util.warn)(
  67159. `XFA - Invalid target: cannot be a bindItems or one of its properties.`
  67160. );
  67161. continue;
  67162. }
  67163. const content = node[_xfa_object.$text]();
  67164. const name = targetNode[_xfa_object.$nodeName];
  67165. if (targetNode instanceof _xfa_object.XFAAttribute) {
  67166. const attrs = Object.create(null);
  67167. attrs[name] = content;
  67168. const obj = Reflect.construct(
  67169. Object.getPrototypeOf(targetParent).constructor,
  67170. [attrs]
  67171. );
  67172. targetParent[name] = obj[name];
  67173. continue;
  67174. }
  67175. if (!targetNode.hasOwnProperty(_xfa_object.$content)) {
  67176. (0, _util.warn)(`XFA - Invalid node to use in setProperty`);
  67177. continue;
  67178. }
  67179. targetNode[_xfa_object.$data] = node;
  67180. targetNode[_xfa_object.$content] = content;
  67181. targetNode[_xfa_object.$finalize]();
  67182. }
  67183. }
  67184. _bindItems(formNode, dataNode) {
  67185. if (
  67186. !formNode.hasOwnProperty("items") ||
  67187. !formNode.hasOwnProperty("bindItems") ||
  67188. formNode.bindItems.isEmpty()
  67189. ) {
  67190. return;
  67191. }
  67192. for (const item of formNode.items.children) {
  67193. formNode[_xfa_object.$removeChild](item);
  67194. }
  67195. formNode.items.clear();
  67196. const labels = new _template.Items({});
  67197. const values = new _template.Items({});
  67198. formNode[_xfa_object.$appendChild](labels);
  67199. formNode.items.push(labels);
  67200. formNode[_xfa_object.$appendChild](values);
  67201. formNode.items.push(values);
  67202. for (const { ref, labelRef, valueRef, connection } of formNode
  67203. .bindItems.children) {
  67204. if (connection) {
  67205. continue;
  67206. }
  67207. if (!ref) {
  67208. continue;
  67209. }
  67210. const nodes = (0, _som.searchNode)(
  67211. this.root,
  67212. dataNode,
  67213. ref,
  67214. false,
  67215. false
  67216. );
  67217. if (!nodes) {
  67218. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  67219. continue;
  67220. }
  67221. for (const node of nodes) {
  67222. if (!node[_xfa_object.$isDescendent](this.datasets)) {
  67223. (0, _util.warn)(
  67224. `XFA - Invalid ref (${ref}): must be a datasets child.`
  67225. );
  67226. continue;
  67227. }
  67228. const labelNodes = (0, _som.searchNode)(
  67229. this.root,
  67230. node,
  67231. labelRef,
  67232. true,
  67233. false
  67234. );
  67235. if (!labelNodes) {
  67236. (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`);
  67237. continue;
  67238. }
  67239. const [labelNode] = labelNodes;
  67240. if (!labelNode[_xfa_object.$isDescendent](this.datasets)) {
  67241. (0, _util.warn)(
  67242. `XFA - Invalid label: must be a datasets child.`
  67243. );
  67244. continue;
  67245. }
  67246. const valueNodes = (0, _som.searchNode)(
  67247. this.root,
  67248. node,
  67249. valueRef,
  67250. true,
  67251. false
  67252. );
  67253. if (!valueNodes) {
  67254. (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`);
  67255. continue;
  67256. }
  67257. const [valueNode] = valueNodes;
  67258. if (!valueNode[_xfa_object.$isDescendent](this.datasets)) {
  67259. (0, _util.warn)(
  67260. `XFA - Invalid value: must be a datasets child.`
  67261. );
  67262. continue;
  67263. }
  67264. const label = createText(labelNode[_xfa_object.$text]());
  67265. const value = createText(valueNode[_xfa_object.$text]());
  67266. labels[_xfa_object.$appendChild](label);
  67267. labels.text.push(label);
  67268. values[_xfa_object.$appendChild](value);
  67269. values.text.push(value);
  67270. }
  67271. }
  67272. }
  67273. _bindOccurrences(formNode, matches, picture) {
  67274. let baseClone;
  67275. if (matches.length > 1) {
  67276. baseClone = formNode[_xfa_object.$clone]();
  67277. baseClone[_xfa_object.$removeChild](baseClone.occur);
  67278. baseClone.occur = null;
  67279. }
  67280. this._bindValue(formNode, matches[0], picture);
  67281. this._setProperties(formNode, matches[0]);
  67282. this._bindItems(formNode, matches[0]);
  67283. if (matches.length === 1) {
  67284. return;
  67285. }
  67286. const parent = formNode[_xfa_object.$getParent]();
  67287. const name = formNode[_xfa_object.$nodeName];
  67288. const pos = parent[_xfa_object.$indexOf](formNode);
  67289. for (let i = 1, ii = matches.length; i < ii; i++) {
  67290. const match = matches[i];
  67291. const clone = baseClone[_xfa_object.$clone]();
  67292. parent[name].push(clone);
  67293. parent[_xfa_object.$insertAt](pos + i, clone);
  67294. this._bindValue(clone, match, picture);
  67295. this._setProperties(clone, match);
  67296. this._bindItems(clone, match);
  67297. }
  67298. }
  67299. _createOccurrences(formNode) {
  67300. if (!this.emptyMerge) {
  67301. return;
  67302. }
  67303. const { occur } = formNode;
  67304. if (!occur || occur.initial <= 1) {
  67305. return;
  67306. }
  67307. const parent = formNode[_xfa_object.$getParent]();
  67308. const name = formNode[_xfa_object.$nodeName];
  67309. if (!(parent[name] instanceof _xfa_object.XFAObjectArray)) {
  67310. return;
  67311. }
  67312. let currentNumber;
  67313. if (formNode.name) {
  67314. currentNumber = parent[name].children.filter(
  67315. (e) => e.name === formNode.name
  67316. ).length;
  67317. } else {
  67318. currentNumber = parent[name].children.length;
  67319. }
  67320. const pos = parent[_xfa_object.$indexOf](formNode) + 1;
  67321. const ii = occur.initial - currentNumber;
  67322. if (ii) {
  67323. const nodeClone = formNode[_xfa_object.$clone]();
  67324. nodeClone[_xfa_object.$removeChild](nodeClone.occur);
  67325. nodeClone.occur = null;
  67326. parent[name].push(nodeClone);
  67327. parent[_xfa_object.$insertAt](pos, nodeClone);
  67328. for (let i = 1; i < ii; i++) {
  67329. const clone = nodeClone[_xfa_object.$clone]();
  67330. parent[name].push(clone);
  67331. parent[_xfa_object.$insertAt](pos + i, clone);
  67332. }
  67333. }
  67334. }
  67335. _getOccurInfo(formNode) {
  67336. const { name, occur } = formNode;
  67337. if (!occur || !name) {
  67338. return [1, 1];
  67339. }
  67340. const max = occur.max === -1 ? Infinity : occur.max;
  67341. return [occur.min, max];
  67342. }
  67343. _setAndBind(formNode, dataNode) {
  67344. this._setProperties(formNode, dataNode);
  67345. this._bindItems(formNode, dataNode);
  67346. this._bindElement(formNode, dataNode);
  67347. }
  67348. _bindElement(formNode, dataNode) {
  67349. const uselessNodes = [];
  67350. this._createOccurrences(formNode);
  67351. for (const child of formNode[_xfa_object.$getChildren]()) {
  67352. if (child[_xfa_object.$data]) {
  67353. continue;
  67354. }
  67355. if (
  67356. this._mergeMode === undefined &&
  67357. child[_xfa_object.$nodeName] === "subform"
  67358. ) {
  67359. this._mergeMode = child.mergeMode === "consumeData";
  67360. const dataChildren = dataNode[_xfa_object.$getChildren]();
  67361. if (dataChildren.length > 0) {
  67362. this._bindOccurrences(child, [dataChildren[0]], null);
  67363. } else if (this.emptyMerge) {
  67364. const nsId =
  67365. dataNode[_xfa_object.$namespaceId] === NS_DATASETS
  67366. ? -1
  67367. : dataNode[_xfa_object.$namespaceId];
  67368. const dataChild = (child[_xfa_object.$data] =
  67369. new _xfa_object.XmlObject(nsId, child.name || "root"));
  67370. dataNode[_xfa_object.$appendChild](dataChild);
  67371. this._bindElement(child, dataChild);
  67372. }
  67373. continue;
  67374. }
  67375. if (!child[_xfa_object.$isBindable]()) {
  67376. continue;
  67377. }
  67378. let global = false;
  67379. let picture = null;
  67380. let ref = null;
  67381. let match = null;
  67382. if (child.bind) {
  67383. switch (child.bind.match) {
  67384. case "none":
  67385. this._setAndBind(child, dataNode);
  67386. continue;
  67387. case "global":
  67388. global = true;
  67389. break;
  67390. case "dataRef":
  67391. if (!child.bind.ref) {
  67392. (0, _util.warn)(
  67393. `XFA - ref is empty in node ${
  67394. child[_xfa_object.$nodeName]
  67395. }.`
  67396. );
  67397. this._setAndBind(child, dataNode);
  67398. continue;
  67399. }
  67400. ref = child.bind.ref;
  67401. break;
  67402. default:
  67403. break;
  67404. }
  67405. if (child.bind.picture) {
  67406. picture = child.bind.picture[_xfa_object.$content];
  67407. }
  67408. }
  67409. const [min, max] = this._getOccurInfo(child);
  67410. if (ref) {
  67411. match = (0, _som.searchNode)(
  67412. this.root,
  67413. dataNode,
  67414. ref,
  67415. true,
  67416. false
  67417. );
  67418. if (match === null) {
  67419. match = (0, _som.createDataNode)(this.data, dataNode, ref);
  67420. if (!match) {
  67421. continue;
  67422. }
  67423. if (this._isConsumeData()) {
  67424. match[_xfa_object.$consumed] = true;
  67425. }
  67426. this._setAndBind(child, match);
  67427. continue;
  67428. } else {
  67429. if (this._isConsumeData()) {
  67430. match = match.filter(
  67431. (node) => !node[_xfa_object.$consumed]
  67432. );
  67433. }
  67434. if (match.length > max) {
  67435. match = match.slice(0, max);
  67436. } else if (match.length === 0) {
  67437. match = null;
  67438. }
  67439. if (match && this._isConsumeData()) {
  67440. match.forEach((node) => {
  67441. node[_xfa_object.$consumed] = true;
  67442. });
  67443. }
  67444. }
  67445. } else {
  67446. if (!child.name) {
  67447. this._setAndBind(child, dataNode);
  67448. continue;
  67449. }
  67450. if (this._isConsumeData()) {
  67451. const matches = [];
  67452. while (matches.length < max) {
  67453. const found = this._findDataByNameToConsume(
  67454. child.name,
  67455. child[_xfa_object.$hasSettableValue](),
  67456. dataNode,
  67457. global
  67458. );
  67459. if (!found) {
  67460. break;
  67461. }
  67462. found[_xfa_object.$consumed] = true;
  67463. matches.push(found);
  67464. }
  67465. match = matches.length > 0 ? matches : null;
  67466. } else {
  67467. match = dataNode[_xfa_object.$getRealChildrenByNameIt](
  67468. child.name,
  67469. false,
  67470. this.emptyMerge
  67471. ).next().value;
  67472. if (!match) {
  67473. if (min === 0) {
  67474. uselessNodes.push(child);
  67475. continue;
  67476. }
  67477. const nsId =
  67478. dataNode[_xfa_object.$namespaceId] === NS_DATASETS
  67479. ? -1
  67480. : dataNode[_xfa_object.$namespaceId];
  67481. match = child[_xfa_object.$data] =
  67482. new _xfa_object.XmlObject(nsId, child.name);
  67483. if (this.emptyMerge) {
  67484. match[_xfa_object.$consumed] = true;
  67485. }
  67486. dataNode[_xfa_object.$appendChild](match);
  67487. this._setAndBind(child, match);
  67488. continue;
  67489. }
  67490. if (this.emptyMerge) {
  67491. match[_xfa_object.$consumed] = true;
  67492. }
  67493. match = [match];
  67494. }
  67495. }
  67496. if (match) {
  67497. this._bindOccurrences(child, match, picture);
  67498. } else if (min > 0) {
  67499. this._setAndBind(child, dataNode);
  67500. } else {
  67501. uselessNodes.push(child);
  67502. }
  67503. }
  67504. uselessNodes.forEach((node) =>
  67505. node[_xfa_object.$getParent]()[_xfa_object.$removeChild](node)
  67506. );
  67507. }
  67508. }
  67509. exports.Binder = Binder;
  67510. /***/
  67511. },
  67512. /* 82 */
  67513. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  67514. Object.defineProperty(exports, "__esModule", {
  67515. value: true,
  67516. });
  67517. exports.Value =
  67518. exports.Text =
  67519. exports.TemplateNamespace =
  67520. exports.Template =
  67521. exports.SetProperty =
  67522. exports.Items =
  67523. exports.Field =
  67524. exports.BindItems =
  67525. void 0;
  67526. var _xfa_object = __w_pdfjs_require__(77);
  67527. var _namespaces = __w_pdfjs_require__(79);
  67528. var _layout = __w_pdfjs_require__(83);
  67529. var _html_utils = __w_pdfjs_require__(84);
  67530. var _utils = __w_pdfjs_require__(78);
  67531. var _util = __w_pdfjs_require__(2);
  67532. var _fonts = __w_pdfjs_require__(85);
  67533. var _core_utils = __w_pdfjs_require__(6);
  67534. var _som = __w_pdfjs_require__(80);
  67535. const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id;
  67536. const SVG_NS = "http://www.w3.org/2000/svg";
  67537. const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2;
  67538. const MAX_EMPTY_PAGES = 3;
  67539. const DEFAULT_TAB_INDEX = 5000;
  67540. const HEADING_PATTERN = /^H(\d+)$/;
  67541. const MIMES = new Set([
  67542. "image/gif",
  67543. "image/jpeg",
  67544. "image/jpg",
  67545. "image/pjpeg",
  67546. "image/png",
  67547. "image/apng",
  67548. "image/x-png",
  67549. "image/bmp",
  67550. "image/x-ms-bmp",
  67551. "image/tiff",
  67552. "image/tif",
  67553. "application/octet-stream",
  67554. ]);
  67555. const IMAGES_HEADERS = [
  67556. [[0x42, 0x4d], "image/bmp"],
  67557. [[0xff, 0xd8, 0xff], "image/jpeg"],
  67558. [[0x49, 0x49, 0x2a, 0x00], "image/tiff"],
  67559. [[0x4d, 0x4d, 0x00, 0x2a], "image/tiff"],
  67560. [[0x47, 0x49, 0x46, 0x38, 0x39, 0x61], "image/gif"],
  67561. [[0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a], "image/png"],
  67562. ];
  67563. function getBorderDims(node) {
  67564. if (!node || !node.border) {
  67565. return {
  67566. w: 0,
  67567. h: 0,
  67568. };
  67569. }
  67570. const borderExtra = node.border[_xfa_object.$getExtra]();
  67571. if (!borderExtra) {
  67572. return {
  67573. w: 0,
  67574. h: 0,
  67575. };
  67576. }
  67577. return {
  67578. w:
  67579. borderExtra.widths[0] +
  67580. borderExtra.widths[2] +
  67581. borderExtra.insets[0] +
  67582. borderExtra.insets[2],
  67583. h:
  67584. borderExtra.widths[1] +
  67585. borderExtra.widths[3] +
  67586. borderExtra.insets[1] +
  67587. borderExtra.insets[3],
  67588. };
  67589. }
  67590. function hasMargin(node) {
  67591. return (
  67592. node.margin &&
  67593. (node.margin.topInset ||
  67594. node.margin.rightInset ||
  67595. node.margin.bottomInset ||
  67596. node.margin.leftInset)
  67597. );
  67598. }
  67599. function _setValue(templateNode, value) {
  67600. if (!templateNode.value) {
  67601. const nodeValue = new Value({});
  67602. templateNode[_xfa_object.$appendChild](nodeValue);
  67603. templateNode.value = nodeValue;
  67604. }
  67605. templateNode.value[_xfa_object.$setValue](value);
  67606. }
  67607. function* getContainedChildren(node) {
  67608. for (const child of node[_xfa_object.$getChildren]()) {
  67609. if (child instanceof SubformSet) {
  67610. yield* child[_xfa_object.$getContainedChildren]();
  67611. continue;
  67612. }
  67613. yield child;
  67614. }
  67615. }
  67616. function isRequired(node) {
  67617. return node.validate && node.validate.nullTest === "error";
  67618. }
  67619. function setTabIndex(node) {
  67620. while (node) {
  67621. if (!node.traversal) {
  67622. node[_xfa_object.$tabIndex] =
  67623. node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  67624. return;
  67625. }
  67626. if (node[_xfa_object.$tabIndex]) {
  67627. return;
  67628. }
  67629. let next = null;
  67630. for (const child of node.traversal[_xfa_object.$getChildren]()) {
  67631. if (child.operation === "next") {
  67632. next = child;
  67633. break;
  67634. }
  67635. }
  67636. if (!next || !next.ref) {
  67637. node[_xfa_object.$tabIndex] =
  67638. node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  67639. return;
  67640. }
  67641. const root = node[_xfa_object.$getTemplateRoot]();
  67642. node[_xfa_object.$tabIndex] = ++root[_xfa_object.$tabIndex];
  67643. const ref = root[_xfa_object.$searchNode](next.ref, node);
  67644. if (!ref) {
  67645. return;
  67646. }
  67647. node = ref[0];
  67648. }
  67649. }
  67650. function applyAssist(obj, attributes) {
  67651. const assist = obj.assist;
  67652. if (assist) {
  67653. const assistTitle = assist[_xfa_object.$toHTML]();
  67654. if (assistTitle) {
  67655. attributes.title = assistTitle;
  67656. }
  67657. const role = assist.role;
  67658. const match = role.match(HEADING_PATTERN);
  67659. if (match) {
  67660. const ariaRole = "heading";
  67661. const ariaLevel = match[1];
  67662. attributes.role = ariaRole;
  67663. attributes["aria-level"] = ariaLevel;
  67664. }
  67665. }
  67666. if (obj.layout === "table") {
  67667. attributes.role = "table";
  67668. } else if (obj.layout === "row") {
  67669. attributes.role = "row";
  67670. } else {
  67671. const parent = obj[_xfa_object.$getParent]();
  67672. if (parent.layout === "row") {
  67673. if (parent.assist && parent.assist.role === "TH") {
  67674. attributes.role = "columnheader";
  67675. } else {
  67676. attributes.role = "cell";
  67677. }
  67678. }
  67679. }
  67680. }
  67681. function ariaLabel(obj) {
  67682. if (!obj.assist) {
  67683. return null;
  67684. }
  67685. const assist = obj.assist;
  67686. if (assist.speak && assist.speak[_xfa_object.$content] !== "") {
  67687. return assist.speak[_xfa_object.$content];
  67688. }
  67689. if (assist.toolTip) {
  67690. return assist.toolTip[_xfa_object.$content];
  67691. }
  67692. return null;
  67693. }
  67694. function valueToHtml(value) {
  67695. return _utils.HTMLResult.success({
  67696. name: "div",
  67697. attributes: {
  67698. class: ["xfaRich"],
  67699. style: Object.create(null),
  67700. },
  67701. children: [
  67702. {
  67703. name: "span",
  67704. attributes: {
  67705. style: Object.create(null),
  67706. },
  67707. value,
  67708. },
  67709. ],
  67710. });
  67711. }
  67712. function setFirstUnsplittable(node) {
  67713. const root = node[_xfa_object.$getTemplateRoot]();
  67714. if (root[_xfa_object.$extra].firstUnsplittable === null) {
  67715. root[_xfa_object.$extra].firstUnsplittable = node;
  67716. root[_xfa_object.$extra].noLayoutFailure = true;
  67717. }
  67718. }
  67719. function unsetFirstUnsplittable(node) {
  67720. const root = node[_xfa_object.$getTemplateRoot]();
  67721. if (root[_xfa_object.$extra].firstUnsplittable === node) {
  67722. root[_xfa_object.$extra].noLayoutFailure = false;
  67723. }
  67724. }
  67725. function handleBreak(node) {
  67726. if (node[_xfa_object.$extra]) {
  67727. return false;
  67728. }
  67729. node[_xfa_object.$extra] = Object.create(null);
  67730. if (node.targetType === "auto") {
  67731. return false;
  67732. }
  67733. const root = node[_xfa_object.$getTemplateRoot]();
  67734. let target = null;
  67735. if (node.target) {
  67736. target = root[_xfa_object.$searchNode](
  67737. node.target,
  67738. node[_xfa_object.$getParent]()
  67739. );
  67740. if (!target) {
  67741. return false;
  67742. }
  67743. target = target[0];
  67744. }
  67745. const { currentPageArea, currentContentArea } =
  67746. root[_xfa_object.$extra];
  67747. if (node.targetType === "pageArea") {
  67748. if (!(target instanceof PageArea)) {
  67749. target = null;
  67750. }
  67751. if (node.startNew) {
  67752. node[_xfa_object.$extra].target = target || currentPageArea;
  67753. return true;
  67754. } else if (target && target !== currentPageArea) {
  67755. node[_xfa_object.$extra].target = target;
  67756. return true;
  67757. }
  67758. return false;
  67759. }
  67760. if (!(target instanceof ContentArea)) {
  67761. target = null;
  67762. }
  67763. const pageArea = target && target[_xfa_object.$getParent]();
  67764. let index;
  67765. let nextPageArea = pageArea;
  67766. if (node.startNew) {
  67767. if (target) {
  67768. const contentAreas = pageArea.contentArea.children;
  67769. const indexForCurrent = contentAreas.indexOf(currentContentArea);
  67770. const indexForTarget = contentAreas.indexOf(target);
  67771. if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) {
  67772. nextPageArea = null;
  67773. }
  67774. index = indexForTarget - 1;
  67775. } else {
  67776. index =
  67777. currentPageArea.contentArea.children.indexOf(
  67778. currentContentArea
  67779. );
  67780. }
  67781. } else if (target && target !== currentContentArea) {
  67782. const contentAreas = pageArea.contentArea.children;
  67783. index = contentAreas.indexOf(target) - 1;
  67784. nextPageArea = pageArea === currentPageArea ? null : pageArea;
  67785. } else {
  67786. return false;
  67787. }
  67788. node[_xfa_object.$extra].target = nextPageArea;
  67789. node[_xfa_object.$extra].index = index;
  67790. return true;
  67791. }
  67792. function handleOverflow(node, extraNode, space) {
  67793. const root = node[_xfa_object.$getTemplateRoot]();
  67794. const saved = root[_xfa_object.$extra].noLayoutFailure;
  67795. const savedMethod = extraNode[_xfa_object.$getSubformParent];
  67796. extraNode[_xfa_object.$getSubformParent] = () => node;
  67797. root[_xfa_object.$extra].noLayoutFailure = true;
  67798. const res = extraNode[_xfa_object.$toHTML](space);
  67799. node[_xfa_object.$addHTML](res.html, res.bbox);
  67800. root[_xfa_object.$extra].noLayoutFailure = saved;
  67801. extraNode[_xfa_object.$getSubformParent] = savedMethod;
  67802. }
  67803. class AppearanceFilter extends _xfa_object.StringObject {
  67804. constructor(attributes) {
  67805. super(TEMPLATE_NS_ID, "appearanceFilter");
  67806. this.id = attributes.id || "";
  67807. this.type = (0, _utils.getStringOption)(attributes.type, [
  67808. "optional",
  67809. "required",
  67810. ]);
  67811. this.use = attributes.use || "";
  67812. this.usehref = attributes.usehref || "";
  67813. }
  67814. }
  67815. class Arc extends _xfa_object.XFAObject {
  67816. constructor(attributes) {
  67817. super(TEMPLATE_NS_ID, "arc", true);
  67818. this.circular = (0, _utils.getInteger)({
  67819. data: attributes.circular,
  67820. defaultValue: 0,
  67821. validate: (x) => x === 1,
  67822. });
  67823. this.hand = (0, _utils.getStringOption)(attributes.hand, [
  67824. "even",
  67825. "left",
  67826. "right",
  67827. ]);
  67828. this.id = attributes.id || "";
  67829. this.startAngle = (0, _utils.getFloat)({
  67830. data: attributes.startAngle,
  67831. defaultValue: 0,
  67832. validate: (x) => true,
  67833. });
  67834. this.sweepAngle = (0, _utils.getFloat)({
  67835. data: attributes.sweepAngle,
  67836. defaultValue: 360,
  67837. validate: (x) => true,
  67838. });
  67839. this.use = attributes.use || "";
  67840. this.usehref = attributes.usehref || "";
  67841. this.edge = null;
  67842. this.fill = null;
  67843. }
  67844. [_xfa_object.$toHTML]() {
  67845. const edge = this.edge || new Edge({});
  67846. const edgeStyle = edge[_xfa_object.$toStyle]();
  67847. const style = Object.create(null);
  67848. if (this.fill && this.fill.presence === "visible") {
  67849. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  67850. } else {
  67851. style.fill = "transparent";
  67852. }
  67853. style.strokeWidth = (0, _html_utils.measureToString)(
  67854. edge.presence === "visible" ? edge.thickness : 0
  67855. );
  67856. style.stroke = edgeStyle.color;
  67857. let arc;
  67858. const attributes = {
  67859. xmlns: SVG_NS,
  67860. style: {
  67861. width: "100%",
  67862. height: "100%",
  67863. overflow: "visible",
  67864. },
  67865. };
  67866. if (this.sweepAngle === 360) {
  67867. arc = {
  67868. name: "ellipse",
  67869. attributes: {
  67870. xmlns: SVG_NS,
  67871. cx: "50%",
  67872. cy: "50%",
  67873. rx: "50%",
  67874. ry: "50%",
  67875. style,
  67876. },
  67877. };
  67878. } else {
  67879. const startAngle = (this.startAngle * Math.PI) / 180;
  67880. const sweepAngle = (this.sweepAngle * Math.PI) / 180;
  67881. const largeArc = this.sweepAngle > 180 ? 1 : 0;
  67882. const [x1, y1, x2, y2] = [
  67883. 50 * (1 + Math.cos(startAngle)),
  67884. 50 * (1 - Math.sin(startAngle)),
  67885. 50 * (1 + Math.cos(startAngle + sweepAngle)),
  67886. 50 * (1 - Math.sin(startAngle + sweepAngle)),
  67887. ];
  67888. arc = {
  67889. name: "path",
  67890. attributes: {
  67891. xmlns: SVG_NS,
  67892. d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`,
  67893. vectorEffect: "non-scaling-stroke",
  67894. style,
  67895. },
  67896. };
  67897. Object.assign(attributes, {
  67898. viewBox: "0 0 100 100",
  67899. preserveAspectRatio: "none",
  67900. });
  67901. }
  67902. const svg = {
  67903. name: "svg",
  67904. children: [arc],
  67905. attributes,
  67906. };
  67907. const parent =
  67908. this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  67909. if (hasMargin(parent)) {
  67910. return _utils.HTMLResult.success({
  67911. name: "div",
  67912. attributes: {
  67913. style: {
  67914. display: "inline",
  67915. width: "100%",
  67916. height: "100%",
  67917. },
  67918. },
  67919. children: [svg],
  67920. });
  67921. }
  67922. svg.attributes.style.position = "absolute";
  67923. return _utils.HTMLResult.success(svg);
  67924. }
  67925. }
  67926. class Area extends _xfa_object.XFAObject {
  67927. constructor(attributes) {
  67928. super(TEMPLATE_NS_ID, "area", true);
  67929. this.colSpan = (0, _utils.getInteger)({
  67930. data: attributes.colSpan,
  67931. defaultValue: 1,
  67932. validate: (n) => n >= 1 || n === -1,
  67933. });
  67934. this.id = attributes.id || "";
  67935. this.name = attributes.name || "";
  67936. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  67937. this.use = attributes.use || "";
  67938. this.usehref = attributes.usehref || "";
  67939. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  67940. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  67941. this.desc = null;
  67942. this.extras = null;
  67943. this.area = new _xfa_object.XFAObjectArray();
  67944. this.draw = new _xfa_object.XFAObjectArray();
  67945. this.exObject = new _xfa_object.XFAObjectArray();
  67946. this.exclGroup = new _xfa_object.XFAObjectArray();
  67947. this.field = new _xfa_object.XFAObjectArray();
  67948. this.subform = new _xfa_object.XFAObjectArray();
  67949. this.subformSet = new _xfa_object.XFAObjectArray();
  67950. }
  67951. *[_xfa_object.$getContainedChildren]() {
  67952. yield* getContainedChildren(this);
  67953. }
  67954. [_xfa_object.$isTransparent]() {
  67955. return true;
  67956. }
  67957. [_xfa_object.$isBindable]() {
  67958. return true;
  67959. }
  67960. [_xfa_object.$addHTML](html, bbox) {
  67961. const [x, y, w, h] = bbox;
  67962. this[_xfa_object.$extra].width = Math.max(
  67963. this[_xfa_object.$extra].width,
  67964. x + w
  67965. );
  67966. this[_xfa_object.$extra].height = Math.max(
  67967. this[_xfa_object.$extra].height,
  67968. y + h
  67969. );
  67970. this[_xfa_object.$extra].children.push(html);
  67971. }
  67972. [_xfa_object.$getAvailableSpace]() {
  67973. return this[_xfa_object.$extra].availableSpace;
  67974. }
  67975. [_xfa_object.$toHTML](availableSpace) {
  67976. const style = (0, _html_utils.toStyle)(this, "position");
  67977. const attributes = {
  67978. style,
  67979. id: this[_xfa_object.$uid],
  67980. class: ["xfaArea"],
  67981. };
  67982. if ((0, _html_utils.isPrintOnly)(this)) {
  67983. attributes.class.push("xfaPrintOnly");
  67984. }
  67985. if (this.name) {
  67986. attributes.xfaName = this.name;
  67987. }
  67988. const children = [];
  67989. this[_xfa_object.$extra] = {
  67990. children,
  67991. width: 0,
  67992. height: 0,
  67993. availableSpace,
  67994. };
  67995. const result = this[_xfa_object.$childrenToHTML]({
  67996. filter: new Set([
  67997. "area",
  67998. "draw",
  67999. "field",
  68000. "exclGroup",
  68001. "subform",
  68002. "subformSet",
  68003. ]),
  68004. include: true,
  68005. });
  68006. if (!result.success) {
  68007. if (result.isBreak()) {
  68008. return result;
  68009. }
  68010. delete this[_xfa_object.$extra];
  68011. return _utils.HTMLResult.FAILURE;
  68012. }
  68013. style.width = (0, _html_utils.measureToString)(
  68014. this[_xfa_object.$extra].width
  68015. );
  68016. style.height = (0, _html_utils.measureToString)(
  68017. this[_xfa_object.$extra].height
  68018. );
  68019. const html = {
  68020. name: "div",
  68021. attributes,
  68022. children,
  68023. };
  68024. const bbox = [
  68025. this.x,
  68026. this.y,
  68027. this[_xfa_object.$extra].width,
  68028. this[_xfa_object.$extra].height,
  68029. ];
  68030. delete this[_xfa_object.$extra];
  68031. return _utils.HTMLResult.success(html, bbox);
  68032. }
  68033. }
  68034. class Assist extends _xfa_object.XFAObject {
  68035. constructor(attributes) {
  68036. super(TEMPLATE_NS_ID, "assist", true);
  68037. this.id = attributes.id || "";
  68038. this.role = attributes.role || "";
  68039. this.use = attributes.use || "";
  68040. this.usehref = attributes.usehref || "";
  68041. this.speak = null;
  68042. this.toolTip = null;
  68043. }
  68044. [_xfa_object.$toHTML]() {
  68045. return this.toolTip && this.toolTip[_xfa_object.$content]
  68046. ? this.toolTip[_xfa_object.$content]
  68047. : null;
  68048. }
  68049. }
  68050. class Barcode extends _xfa_object.XFAObject {
  68051. constructor(attributes) {
  68052. super(TEMPLATE_NS_ID, "barcode", true);
  68053. this.charEncoding = (0, _utils.getKeyword)({
  68054. data: attributes.charEncoding
  68055. ? attributes.charEncoding.toLowerCase()
  68056. : "",
  68057. defaultValue: "",
  68058. validate: (k) =>
  68059. [
  68060. "utf-8",
  68061. "big-five",
  68062. "fontspecific",
  68063. "gbk",
  68064. "gb-18030",
  68065. "gb-2312",
  68066. "ksc-5601",
  68067. "none",
  68068. "shift-jis",
  68069. "ucs-2",
  68070. "utf-16",
  68071. ].includes(k) || k.match(/iso-8859-\d{2}/),
  68072. });
  68073. this.checksum = (0, _utils.getStringOption)(attributes.checksum, [
  68074. "none",
  68075. "1mod10",
  68076. "1mod10_1mod11",
  68077. "2mod10",
  68078. "auto",
  68079. ]);
  68080. this.dataColumnCount = (0, _utils.getInteger)({
  68081. data: attributes.dataColumnCount,
  68082. defaultValue: -1,
  68083. validate: (x) => x >= 0,
  68084. });
  68085. this.dataLength = (0, _utils.getInteger)({
  68086. data: attributes.dataLength,
  68087. defaultValue: -1,
  68088. validate: (x) => x >= 0,
  68089. });
  68090. this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, [
  68091. "none",
  68092. "flateCompress",
  68093. ]);
  68094. this.dataRowCount = (0, _utils.getInteger)({
  68095. data: attributes.dataRowCount,
  68096. defaultValue: -1,
  68097. validate: (x) => x >= 0,
  68098. });
  68099. this.endChar = attributes.endChar || "";
  68100. this.errorCorrectionLevel = (0, _utils.getInteger)({
  68101. data: attributes.errorCorrectionLevel,
  68102. defaultValue: -1,
  68103. validate: (x) => x >= 0 && x <= 8,
  68104. });
  68105. this.id = attributes.id || "";
  68106. this.moduleHeight = (0, _utils.getMeasurement)(
  68107. attributes.moduleHeight,
  68108. "5mm"
  68109. );
  68110. this.moduleWidth = (0, _utils.getMeasurement)(
  68111. attributes.moduleWidth,
  68112. "0.25mm"
  68113. );
  68114. this.printCheckDigit = (0, _utils.getInteger)({
  68115. data: attributes.printCheckDigit,
  68116. defaultValue: 0,
  68117. validate: (x) => x === 1,
  68118. });
  68119. this.rowColumnRatio = (0, _utils.getRatio)(
  68120. attributes.rowColumnRatio
  68121. );
  68122. this.startChar = attributes.startChar || "";
  68123. this.textLocation = (0, _utils.getStringOption)(
  68124. attributes.textLocation,
  68125. ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]
  68126. );
  68127. this.truncate = (0, _utils.getInteger)({
  68128. data: attributes.truncate,
  68129. defaultValue: 0,
  68130. validate: (x) => x === 1,
  68131. });
  68132. this.type = (0, _utils.getStringOption)(
  68133. attributes.type ? attributes.type.toLowerCase() : "",
  68134. [
  68135. "aztec",
  68136. "codabar",
  68137. "code2of5industrial",
  68138. "code2of5interleaved",
  68139. "code2of5matrix",
  68140. "code2of5standard",
  68141. "code3of9",
  68142. "code3of9extended",
  68143. "code11",
  68144. "code49",
  68145. "code93",
  68146. "code128",
  68147. "code128a",
  68148. "code128b",
  68149. "code128c",
  68150. "code128sscc",
  68151. "datamatrix",
  68152. "ean8",
  68153. "ean8add2",
  68154. "ean8add5",
  68155. "ean13",
  68156. "ean13add2",
  68157. "ean13add5",
  68158. "ean13pwcd",
  68159. "fim",
  68160. "logmars",
  68161. "maxicode",
  68162. "msi",
  68163. "pdf417",
  68164. "pdf417macro",
  68165. "plessey",
  68166. "postauscust2",
  68167. "postauscust3",
  68168. "postausreplypaid",
  68169. "postausstandard",
  68170. "postukrm4scc",
  68171. "postusdpbc",
  68172. "postusimb",
  68173. "postusstandard",
  68174. "postus5zip",
  68175. "qrcode",
  68176. "rfid",
  68177. "rss14",
  68178. "rss14expanded",
  68179. "rss14limited",
  68180. "rss14stacked",
  68181. "rss14stackedomni",
  68182. "rss14truncated",
  68183. "telepen",
  68184. "ucc128",
  68185. "ucc128random",
  68186. "ucc128sscc",
  68187. "upca",
  68188. "upcaadd2",
  68189. "upcaadd5",
  68190. "upcapwcd",
  68191. "upce",
  68192. "upceadd2",
  68193. "upceadd5",
  68194. "upcean2",
  68195. "upcean5",
  68196. "upsmaxicode",
  68197. ]
  68198. );
  68199. this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, [
  68200. "usCarrier",
  68201. "internationalCarrier",
  68202. "secureSymbol",
  68203. "standardSymbol",
  68204. ]);
  68205. this.use = attributes.use || "";
  68206. this.usehref = attributes.usehref || "";
  68207. this.wideNarrowRatio = (0, _utils.getRatio)(
  68208. attributes.wideNarrowRatio
  68209. );
  68210. this.encrypt = null;
  68211. this.extras = null;
  68212. }
  68213. }
  68214. class Bind extends _xfa_object.XFAObject {
  68215. constructor(attributes) {
  68216. super(TEMPLATE_NS_ID, "bind", true);
  68217. this.match = (0, _utils.getStringOption)(attributes.match, [
  68218. "once",
  68219. "dataRef",
  68220. "global",
  68221. "none",
  68222. ]);
  68223. this.ref = attributes.ref || "";
  68224. this.picture = null;
  68225. }
  68226. }
  68227. class BindItems extends _xfa_object.XFAObject {
  68228. constructor(attributes) {
  68229. super(TEMPLATE_NS_ID, "bindItems");
  68230. this.connection = attributes.connection || "";
  68231. this.labelRef = attributes.labelRef || "";
  68232. this.ref = attributes.ref || "";
  68233. this.valueRef = attributes.valueRef || "";
  68234. }
  68235. }
  68236. exports.BindItems = BindItems;
  68237. class Bookend extends _xfa_object.XFAObject {
  68238. constructor(attributes) {
  68239. super(TEMPLATE_NS_ID, "bookend");
  68240. this.id = attributes.id || "";
  68241. this.leader = attributes.leader || "";
  68242. this.trailer = attributes.trailer || "";
  68243. this.use = attributes.use || "";
  68244. this.usehref = attributes.usehref || "";
  68245. }
  68246. }
  68247. class BooleanElement extends _xfa_object.Option01 {
  68248. constructor(attributes) {
  68249. super(TEMPLATE_NS_ID, "boolean");
  68250. this.id = attributes.id || "";
  68251. this.name = attributes.name || "";
  68252. this.use = attributes.use || "";
  68253. this.usehref = attributes.usehref || "";
  68254. }
  68255. [_xfa_object.$toHTML](availableSpace) {
  68256. return valueToHtml(this[_xfa_object.$content] === 1 ? "1" : "0");
  68257. }
  68258. }
  68259. class Border extends _xfa_object.XFAObject {
  68260. constructor(attributes) {
  68261. super(TEMPLATE_NS_ID, "border", true);
  68262. this.break = (0, _utils.getStringOption)(attributes.break, [
  68263. "close",
  68264. "open",
  68265. ]);
  68266. this.hand = (0, _utils.getStringOption)(attributes.hand, [
  68267. "even",
  68268. "left",
  68269. "right",
  68270. ]);
  68271. this.id = attributes.id || "";
  68272. this.presence = (0, _utils.getStringOption)(attributes.presence, [
  68273. "visible",
  68274. "hidden",
  68275. "inactive",
  68276. "invisible",
  68277. ]);
  68278. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  68279. this.use = attributes.use || "";
  68280. this.usehref = attributes.usehref || "";
  68281. this.corner = new _xfa_object.XFAObjectArray(4);
  68282. this.edge = new _xfa_object.XFAObjectArray(4);
  68283. this.extras = null;
  68284. this.fill = null;
  68285. this.margin = null;
  68286. }
  68287. [_xfa_object.$getExtra]() {
  68288. if (!this[_xfa_object.$extra]) {
  68289. const edges = this.edge.children.slice();
  68290. if (edges.length < 4) {
  68291. const defaultEdge = edges.at(-1) || new Edge({});
  68292. for (let i = edges.length; i < 4; i++) {
  68293. edges.push(defaultEdge);
  68294. }
  68295. }
  68296. const widths = edges.map((edge) => edge.thickness);
  68297. const insets = [0, 0, 0, 0];
  68298. if (this.margin) {
  68299. insets[0] = this.margin.topInset;
  68300. insets[1] = this.margin.rightInset;
  68301. insets[2] = this.margin.bottomInset;
  68302. insets[3] = this.margin.leftInset;
  68303. }
  68304. this[_xfa_object.$extra] = {
  68305. widths,
  68306. insets,
  68307. edges,
  68308. };
  68309. }
  68310. return this[_xfa_object.$extra];
  68311. }
  68312. [_xfa_object.$toStyle]() {
  68313. const { edges } = this[_xfa_object.$getExtra]();
  68314. const edgeStyles = edges.map((node) => {
  68315. const style = node[_xfa_object.$toStyle]();
  68316. style.color = style.color || "#000000";
  68317. return style;
  68318. });
  68319. const style = Object.create(null);
  68320. if (this.margin) {
  68321. Object.assign(style, this.margin[_xfa_object.$toStyle]());
  68322. }
  68323. if (this.fill && this.fill.presence === "visible") {
  68324. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  68325. }
  68326. if (this.corner.children.some((node) => node.radius !== 0)) {
  68327. const cornerStyles = this.corner.children.map((node) =>
  68328. node[_xfa_object.$toStyle]()
  68329. );
  68330. if (cornerStyles.length === 2 || cornerStyles.length === 3) {
  68331. const last = cornerStyles.at(-1);
  68332. for (let i = cornerStyles.length; i < 4; i++) {
  68333. cornerStyles.push(last);
  68334. }
  68335. }
  68336. style.borderRadius = cornerStyles.map((s) => s.radius).join(" ");
  68337. }
  68338. switch (this.presence) {
  68339. case "invisible":
  68340. case "hidden":
  68341. style.borderStyle = "";
  68342. break;
  68343. case "inactive":
  68344. style.borderStyle = "none";
  68345. break;
  68346. default:
  68347. style.borderStyle = edgeStyles.map((s) => s.style).join(" ");
  68348. break;
  68349. }
  68350. style.borderWidth = edgeStyles.map((s) => s.width).join(" ");
  68351. style.borderColor = edgeStyles.map((s) => s.color).join(" ");
  68352. return style;
  68353. }
  68354. }
  68355. class Break extends _xfa_object.XFAObject {
  68356. constructor(attributes) {
  68357. super(TEMPLATE_NS_ID, "break", true);
  68358. this.after = (0, _utils.getStringOption)(attributes.after, [
  68359. "auto",
  68360. "contentArea",
  68361. "pageArea",
  68362. "pageEven",
  68363. "pageOdd",
  68364. ]);
  68365. this.afterTarget = attributes.afterTarget || "";
  68366. this.before = (0, _utils.getStringOption)(attributes.before, [
  68367. "auto",
  68368. "contentArea",
  68369. "pageArea",
  68370. "pageEven",
  68371. "pageOdd",
  68372. ]);
  68373. this.beforeTarget = attributes.beforeTarget || "";
  68374. this.bookendLeader = attributes.bookendLeader || "";
  68375. this.bookendTrailer = attributes.bookendTrailer || "";
  68376. this.id = attributes.id || "";
  68377. this.overflowLeader = attributes.overflowLeader || "";
  68378. this.overflowTarget = attributes.overflowTarget || "";
  68379. this.overflowTrailer = attributes.overflowTrailer || "";
  68380. this.startNew = (0, _utils.getInteger)({
  68381. data: attributes.startNew,
  68382. defaultValue: 0,
  68383. validate: (x) => x === 1,
  68384. });
  68385. this.use = attributes.use || "";
  68386. this.usehref = attributes.usehref || "";
  68387. this.extras = null;
  68388. }
  68389. }
  68390. class BreakAfter extends _xfa_object.XFAObject {
  68391. constructor(attributes) {
  68392. super(TEMPLATE_NS_ID, "breakAfter", true);
  68393. this.id = attributes.id || "";
  68394. this.leader = attributes.leader || "";
  68395. this.startNew = (0, _utils.getInteger)({
  68396. data: attributes.startNew,
  68397. defaultValue: 0,
  68398. validate: (x) => x === 1,
  68399. });
  68400. this.target = attributes.target || "";
  68401. this.targetType = (0, _utils.getStringOption)(
  68402. attributes.targetType,
  68403. ["auto", "contentArea", "pageArea"]
  68404. );
  68405. this.trailer = attributes.trailer || "";
  68406. this.use = attributes.use || "";
  68407. this.usehref = attributes.usehref || "";
  68408. this.script = null;
  68409. }
  68410. }
  68411. class BreakBefore extends _xfa_object.XFAObject {
  68412. constructor(attributes) {
  68413. super(TEMPLATE_NS_ID, "breakBefore", true);
  68414. this.id = attributes.id || "";
  68415. this.leader = attributes.leader || "";
  68416. this.startNew = (0, _utils.getInteger)({
  68417. data: attributes.startNew,
  68418. defaultValue: 0,
  68419. validate: (x) => x === 1,
  68420. });
  68421. this.target = attributes.target || "";
  68422. this.targetType = (0, _utils.getStringOption)(
  68423. attributes.targetType,
  68424. ["auto", "contentArea", "pageArea"]
  68425. );
  68426. this.trailer = attributes.trailer || "";
  68427. this.use = attributes.use || "";
  68428. this.usehref = attributes.usehref || "";
  68429. this.script = null;
  68430. }
  68431. [_xfa_object.$toHTML](availableSpace) {
  68432. this[_xfa_object.$extra] = {};
  68433. return _utils.HTMLResult.FAILURE;
  68434. }
  68435. }
  68436. class Button extends _xfa_object.XFAObject {
  68437. constructor(attributes) {
  68438. super(TEMPLATE_NS_ID, "button", true);
  68439. this.highlight = (0, _utils.getStringOption)(attributes.highlight, [
  68440. "inverted",
  68441. "none",
  68442. "outline",
  68443. "push",
  68444. ]);
  68445. this.id = attributes.id || "";
  68446. this.use = attributes.use || "";
  68447. this.usehref = attributes.usehref || "";
  68448. this.extras = null;
  68449. }
  68450. [_xfa_object.$toHTML](availableSpace) {
  68451. const parent = this[_xfa_object.$getParent]();
  68452. const grandpa = parent[_xfa_object.$getParent]();
  68453. const htmlButton = {
  68454. name: "button",
  68455. attributes: {
  68456. id: this[_xfa_object.$uid],
  68457. class: ["xfaButton"],
  68458. style: {},
  68459. },
  68460. children: [],
  68461. };
  68462. for (const event of grandpa.event.children) {
  68463. if (event.activity !== "click" || !event.script) {
  68464. continue;
  68465. }
  68466. const jsURL = (0, _core_utils.recoverJsURL)(
  68467. event.script[_xfa_object.$content]
  68468. );
  68469. if (!jsURL) {
  68470. continue;
  68471. }
  68472. const href = (0, _html_utils.fixURL)(jsURL.url);
  68473. if (!href) {
  68474. continue;
  68475. }
  68476. htmlButton.children.push({
  68477. name: "a",
  68478. attributes: {
  68479. id: "link" + this[_xfa_object.$uid],
  68480. href,
  68481. newWindow: jsURL.newWindow,
  68482. class: ["xfaLink"],
  68483. style: {},
  68484. },
  68485. children: [],
  68486. });
  68487. }
  68488. return _utils.HTMLResult.success(htmlButton);
  68489. }
  68490. }
  68491. class Calculate extends _xfa_object.XFAObject {
  68492. constructor(attributes) {
  68493. super(TEMPLATE_NS_ID, "calculate", true);
  68494. this.id = attributes.id || "";
  68495. this.override = (0, _utils.getStringOption)(attributes.override, [
  68496. "disabled",
  68497. "error",
  68498. "ignore",
  68499. "warning",
  68500. ]);
  68501. this.use = attributes.use || "";
  68502. this.usehref = attributes.usehref || "";
  68503. this.extras = null;
  68504. this.message = null;
  68505. this.script = null;
  68506. }
  68507. }
  68508. class Caption extends _xfa_object.XFAObject {
  68509. constructor(attributes) {
  68510. super(TEMPLATE_NS_ID, "caption", true);
  68511. this.id = attributes.id || "";
  68512. this.placement = (0, _utils.getStringOption)(attributes.placement, [
  68513. "left",
  68514. "bottom",
  68515. "inline",
  68516. "right",
  68517. "top",
  68518. ]);
  68519. this.presence = (0, _utils.getStringOption)(attributes.presence, [
  68520. "visible",
  68521. "hidden",
  68522. "inactive",
  68523. "invisible",
  68524. ]);
  68525. this.reserve = Math.ceil(
  68526. (0, _utils.getMeasurement)(attributes.reserve)
  68527. );
  68528. this.use = attributes.use || "";
  68529. this.usehref = attributes.usehref || "";
  68530. this.extras = null;
  68531. this.font = null;
  68532. this.margin = null;
  68533. this.para = null;
  68534. this.value = null;
  68535. }
  68536. [_xfa_object.$setValue](value) {
  68537. _setValue(this, value);
  68538. }
  68539. [_xfa_object.$getExtra](availableSpace) {
  68540. if (!this[_xfa_object.$extra]) {
  68541. let { width, height } = availableSpace;
  68542. switch (this.placement) {
  68543. case "left":
  68544. case "right":
  68545. case "inline":
  68546. width = this.reserve <= 0 ? width : this.reserve;
  68547. break;
  68548. case "top":
  68549. case "bottom":
  68550. height = this.reserve <= 0 ? height : this.reserve;
  68551. break;
  68552. }
  68553. this[_xfa_object.$extra] = (0, _html_utils.layoutNode)(this, {
  68554. width,
  68555. height,
  68556. });
  68557. }
  68558. return this[_xfa_object.$extra];
  68559. }
  68560. [_xfa_object.$toHTML](availableSpace) {
  68561. if (!this.value) {
  68562. return _utils.HTMLResult.EMPTY;
  68563. }
  68564. this[_xfa_object.$pushPara]();
  68565. const value = this.value[_xfa_object.$toHTML](availableSpace).html;
  68566. if (!value) {
  68567. this[_xfa_object.$popPara]();
  68568. return _utils.HTMLResult.EMPTY;
  68569. }
  68570. const savedReserve = this.reserve;
  68571. if (this.reserve <= 0) {
  68572. const { w, h } = this[_xfa_object.$getExtra](availableSpace);
  68573. switch (this.placement) {
  68574. case "left":
  68575. case "right":
  68576. case "inline":
  68577. this.reserve = w;
  68578. break;
  68579. case "top":
  68580. case "bottom":
  68581. this.reserve = h;
  68582. break;
  68583. }
  68584. }
  68585. const children = [];
  68586. if (typeof value === "string") {
  68587. children.push({
  68588. name: "#text",
  68589. value,
  68590. });
  68591. } else {
  68592. children.push(value);
  68593. }
  68594. const style = (0, _html_utils.toStyle)(
  68595. this,
  68596. "font",
  68597. "margin",
  68598. "visibility"
  68599. );
  68600. switch (this.placement) {
  68601. case "left":
  68602. case "right":
  68603. if (this.reserve > 0) {
  68604. style.width = (0, _html_utils.measureToString)(this.reserve);
  68605. }
  68606. break;
  68607. case "top":
  68608. case "bottom":
  68609. if (this.reserve > 0) {
  68610. style.height = (0, _html_utils.measureToString)(this.reserve);
  68611. }
  68612. break;
  68613. }
  68614. (0, _html_utils.setPara)(this, null, value);
  68615. this[_xfa_object.$popPara]();
  68616. this.reserve = savedReserve;
  68617. return _utils.HTMLResult.success({
  68618. name: "div",
  68619. attributes: {
  68620. style,
  68621. class: ["xfaCaption"],
  68622. },
  68623. children,
  68624. });
  68625. }
  68626. }
  68627. class Certificate extends _xfa_object.StringObject {
  68628. constructor(attributes) {
  68629. super(TEMPLATE_NS_ID, "certificate");
  68630. this.id = attributes.id || "";
  68631. this.name = attributes.name || "";
  68632. this.use = attributes.use || "";
  68633. this.usehref = attributes.usehref || "";
  68634. }
  68635. }
  68636. class Certificates extends _xfa_object.XFAObject {
  68637. constructor(attributes) {
  68638. super(TEMPLATE_NS_ID, "certificates", true);
  68639. this.credentialServerPolicy = (0, _utils.getStringOption)(
  68640. attributes.credentialServerPolicy,
  68641. ["optional", "required"]
  68642. );
  68643. this.id = attributes.id || "";
  68644. this.url = attributes.url || "";
  68645. this.urlPolicy = attributes.urlPolicy || "";
  68646. this.use = attributes.use || "";
  68647. this.usehref = attributes.usehref || "";
  68648. this.encryption = null;
  68649. this.issuers = null;
  68650. this.keyUsage = null;
  68651. this.oids = null;
  68652. this.signing = null;
  68653. this.subjectDNs = null;
  68654. }
  68655. }
  68656. class CheckButton extends _xfa_object.XFAObject {
  68657. constructor(attributes) {
  68658. super(TEMPLATE_NS_ID, "checkButton", true);
  68659. this.id = attributes.id || "";
  68660. this.mark = (0, _utils.getStringOption)(attributes.mark, [
  68661. "default",
  68662. "check",
  68663. "circle",
  68664. "cross",
  68665. "diamond",
  68666. "square",
  68667. "star",
  68668. ]);
  68669. this.shape = (0, _utils.getStringOption)(attributes.shape, [
  68670. "square",
  68671. "round",
  68672. ]);
  68673. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  68674. this.use = attributes.use || "";
  68675. this.usehref = attributes.usehref || "";
  68676. this.border = null;
  68677. this.extras = null;
  68678. this.margin = null;
  68679. }
  68680. [_xfa_object.$toHTML](availableSpace) {
  68681. const style = (0, _html_utils.toStyle)("margin");
  68682. const size = (0, _html_utils.measureToString)(this.size);
  68683. style.width = style.height = size;
  68684. let type;
  68685. let className;
  68686. let groupId;
  68687. const field =
  68688. this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  68689. const items =
  68690. (field.items.children.length &&
  68691. field.items.children[0][_xfa_object.$toHTML]().html) ||
  68692. [];
  68693. const exportedValue = {
  68694. on: (items[0] !== undefined ? items[0] : "on").toString(),
  68695. off: (items[1] !== undefined ? items[1] : "off").toString(),
  68696. };
  68697. const value =
  68698. (field.value && field.value[_xfa_object.$text]()) || "off";
  68699. const checked = value === exportedValue.on || undefined;
  68700. const container = field[_xfa_object.$getSubformParent]();
  68701. const fieldId = field[_xfa_object.$uid];
  68702. let dataId;
  68703. if (container instanceof ExclGroup) {
  68704. groupId = container[_xfa_object.$uid];
  68705. type = "radio";
  68706. className = "xfaRadio";
  68707. dataId =
  68708. (container[_xfa_object.$data] &&
  68709. container[_xfa_object.$data][_xfa_object.$uid]) ||
  68710. container[_xfa_object.$uid];
  68711. } else {
  68712. type = "checkbox";
  68713. className = "xfaCheckbox";
  68714. dataId =
  68715. (field[_xfa_object.$data] &&
  68716. field[_xfa_object.$data][_xfa_object.$uid]) ||
  68717. field[_xfa_object.$uid];
  68718. }
  68719. const input = {
  68720. name: "input",
  68721. attributes: {
  68722. class: [className],
  68723. style,
  68724. fieldId,
  68725. dataId,
  68726. type,
  68727. checked,
  68728. xfaOn: exportedValue.on,
  68729. xfaOff: exportedValue.off,
  68730. "aria-label": ariaLabel(field),
  68731. "aria-required": false,
  68732. },
  68733. };
  68734. if (groupId) {
  68735. input.attributes.name = groupId;
  68736. }
  68737. if (isRequired(field)) {
  68738. input.attributes["aria-required"] = true;
  68739. input.attributes.required = true;
  68740. }
  68741. return _utils.HTMLResult.success({
  68742. name: "label",
  68743. attributes: {
  68744. class: ["xfaLabel"],
  68745. },
  68746. children: [input],
  68747. });
  68748. }
  68749. }
  68750. class ChoiceList extends _xfa_object.XFAObject {
  68751. constructor(attributes) {
  68752. super(TEMPLATE_NS_ID, "choiceList", true);
  68753. this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, [
  68754. "select",
  68755. "exit",
  68756. ]);
  68757. this.id = attributes.id || "";
  68758. this.open = (0, _utils.getStringOption)(attributes.open, [
  68759. "userControl",
  68760. "always",
  68761. "multiSelect",
  68762. "onEntry",
  68763. ]);
  68764. this.textEntry = (0, _utils.getInteger)({
  68765. data: attributes.textEntry,
  68766. defaultValue: 0,
  68767. validate: (x) => x === 1,
  68768. });
  68769. this.use = attributes.use || "";
  68770. this.usehref = attributes.usehref || "";
  68771. this.border = null;
  68772. this.extras = null;
  68773. this.margin = null;
  68774. }
  68775. [_xfa_object.$toHTML](availableSpace) {
  68776. const style = (0, _html_utils.toStyle)(this, "border", "margin");
  68777. const ui = this[_xfa_object.$getParent]();
  68778. const field = ui[_xfa_object.$getParent]();
  68779. const fontSize = (field.font && field.font.size) || 10;
  68780. const optionStyle = {
  68781. fontSize: `calc(${fontSize}px * var(--scale-factor))`,
  68782. };
  68783. const children = [];
  68784. if (field.items.children.length > 0) {
  68785. const items = field.items;
  68786. let displayedIndex = 0;
  68787. let saveIndex = 0;
  68788. if (items.children.length === 2) {
  68789. displayedIndex = items.children[0].save;
  68790. saveIndex = 1 - displayedIndex;
  68791. }
  68792. const displayed =
  68793. items.children[displayedIndex][_xfa_object.$toHTML]().html;
  68794. const values =
  68795. items.children[saveIndex][_xfa_object.$toHTML]().html;
  68796. let selected = false;
  68797. const value =
  68798. (field.value && field.value[_xfa_object.$text]()) || "";
  68799. for (let i = 0, ii = displayed.length; i < ii; i++) {
  68800. const option = {
  68801. name: "option",
  68802. attributes: {
  68803. value: values[i] || displayed[i],
  68804. style: optionStyle,
  68805. },
  68806. value: displayed[i],
  68807. };
  68808. if (values[i] === value) {
  68809. option.attributes.selected = selected = true;
  68810. }
  68811. children.push(option);
  68812. }
  68813. if (!selected) {
  68814. children.splice(0, 0, {
  68815. name: "option",
  68816. attributes: {
  68817. hidden: true,
  68818. selected: true,
  68819. },
  68820. value: " ",
  68821. });
  68822. }
  68823. }
  68824. const selectAttributes = {
  68825. class: ["xfaSelect"],
  68826. fieldId: field[_xfa_object.$uid],
  68827. dataId:
  68828. (field[_xfa_object.$data] &&
  68829. field[_xfa_object.$data][_xfa_object.$uid]) ||
  68830. field[_xfa_object.$uid],
  68831. style,
  68832. "aria-label": ariaLabel(field),
  68833. "aria-required": false,
  68834. };
  68835. if (isRequired(field)) {
  68836. selectAttributes["aria-required"] = true;
  68837. selectAttributes.required = true;
  68838. }
  68839. if (this.open === "multiSelect") {
  68840. selectAttributes.multiple = true;
  68841. }
  68842. return _utils.HTMLResult.success({
  68843. name: "label",
  68844. attributes: {
  68845. class: ["xfaLabel"],
  68846. },
  68847. children: [
  68848. {
  68849. name: "select",
  68850. children,
  68851. attributes: selectAttributes,
  68852. },
  68853. ],
  68854. });
  68855. }
  68856. }
  68857. class Color extends _xfa_object.XFAObject {
  68858. constructor(attributes) {
  68859. super(TEMPLATE_NS_ID, "color", true);
  68860. this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, [
  68861. "SRGB",
  68862. ]);
  68863. this.id = attributes.id || "";
  68864. this.use = attributes.use || "";
  68865. this.usehref = attributes.usehref || "";
  68866. this.value = attributes.value
  68867. ? (0, _utils.getColor)(attributes.value)
  68868. : "";
  68869. this.extras = null;
  68870. }
  68871. [_xfa_object.$hasSettableValue]() {
  68872. return false;
  68873. }
  68874. [_xfa_object.$toStyle]() {
  68875. return this.value
  68876. ? _util.Util.makeHexColor(
  68877. this.value.r,
  68878. this.value.g,
  68879. this.value.b
  68880. )
  68881. : null;
  68882. }
  68883. }
  68884. class Comb extends _xfa_object.XFAObject {
  68885. constructor(attributes) {
  68886. super(TEMPLATE_NS_ID, "comb");
  68887. this.id = attributes.id || "";
  68888. this.numberOfCells = (0, _utils.getInteger)({
  68889. data: attributes.numberOfCells,
  68890. defaultValue: 0,
  68891. validate: (x) => x >= 0,
  68892. });
  68893. this.use = attributes.use || "";
  68894. this.usehref = attributes.usehref || "";
  68895. }
  68896. }
  68897. class Connect extends _xfa_object.XFAObject {
  68898. constructor(attributes) {
  68899. super(TEMPLATE_NS_ID, "connect", true);
  68900. this.connection = attributes.connection || "";
  68901. this.id = attributes.id || "";
  68902. this.ref = attributes.ref || "";
  68903. this.usage = (0, _utils.getStringOption)(attributes.usage, [
  68904. "exportAndImport",
  68905. "exportOnly",
  68906. "importOnly",
  68907. ]);
  68908. this.use = attributes.use || "";
  68909. this.usehref = attributes.usehref || "";
  68910. this.picture = null;
  68911. }
  68912. }
  68913. class ContentArea extends _xfa_object.XFAObject {
  68914. constructor(attributes) {
  68915. super(TEMPLATE_NS_ID, "contentArea", true);
  68916. this.h = (0, _utils.getMeasurement)(attributes.h);
  68917. this.id = attributes.id || "";
  68918. this.name = attributes.name || "";
  68919. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  68920. this.use = attributes.use || "";
  68921. this.usehref = attributes.usehref || "";
  68922. this.w = (0, _utils.getMeasurement)(attributes.w);
  68923. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  68924. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  68925. this.desc = null;
  68926. this.extras = null;
  68927. }
  68928. [_xfa_object.$toHTML](availableSpace) {
  68929. const left = (0, _html_utils.measureToString)(this.x);
  68930. const top = (0, _html_utils.measureToString)(this.y);
  68931. const style = {
  68932. left,
  68933. top,
  68934. width: (0, _html_utils.measureToString)(this.w),
  68935. height: (0, _html_utils.measureToString)(this.h),
  68936. };
  68937. const classNames = ["xfaContentarea"];
  68938. if ((0, _html_utils.isPrintOnly)(this)) {
  68939. classNames.push("xfaPrintOnly");
  68940. }
  68941. return _utils.HTMLResult.success({
  68942. name: "div",
  68943. children: [],
  68944. attributes: {
  68945. style,
  68946. class: classNames,
  68947. id: this[_xfa_object.$uid],
  68948. },
  68949. });
  68950. }
  68951. }
  68952. class Corner extends _xfa_object.XFAObject {
  68953. constructor(attributes) {
  68954. super(TEMPLATE_NS_ID, "corner", true);
  68955. this.id = attributes.id || "";
  68956. this.inverted = (0, _utils.getInteger)({
  68957. data: attributes.inverted,
  68958. defaultValue: 0,
  68959. validate: (x) => x === 1,
  68960. });
  68961. this.join = (0, _utils.getStringOption)(attributes.join, [
  68962. "square",
  68963. "round",
  68964. ]);
  68965. this.presence = (0, _utils.getStringOption)(attributes.presence, [
  68966. "visible",
  68967. "hidden",
  68968. "inactive",
  68969. "invisible",
  68970. ]);
  68971. this.radius = (0, _utils.getMeasurement)(attributes.radius);
  68972. this.stroke = (0, _utils.getStringOption)(attributes.stroke, [
  68973. "solid",
  68974. "dashDot",
  68975. "dashDotDot",
  68976. "dashed",
  68977. "dotted",
  68978. "embossed",
  68979. "etched",
  68980. "lowered",
  68981. "raised",
  68982. ]);
  68983. this.thickness = (0, _utils.getMeasurement)(
  68984. attributes.thickness,
  68985. "0.5pt"
  68986. );
  68987. this.use = attributes.use || "";
  68988. this.usehref = attributes.usehref || "";
  68989. this.color = null;
  68990. this.extras = null;
  68991. }
  68992. [_xfa_object.$toStyle]() {
  68993. const style = (0, _html_utils.toStyle)(this, "visibility");
  68994. style.radius = (0, _html_utils.measureToString)(
  68995. this.join === "square" ? 0 : this.radius
  68996. );
  68997. return style;
  68998. }
  68999. }
  69000. class DateElement extends _xfa_object.ContentObject {
  69001. constructor(attributes) {
  69002. super(TEMPLATE_NS_ID, "date");
  69003. this.id = attributes.id || "";
  69004. this.name = attributes.name || "";
  69005. this.use = attributes.use || "";
  69006. this.usehref = attributes.usehref || "";
  69007. }
  69008. [_xfa_object.$finalize]() {
  69009. const date = this[_xfa_object.$content].trim();
  69010. this[_xfa_object.$content] = date ? new Date(date) : null;
  69011. }
  69012. [_xfa_object.$toHTML](availableSpace) {
  69013. return valueToHtml(
  69014. this[_xfa_object.$content]
  69015. ? this[_xfa_object.$content].toString()
  69016. : ""
  69017. );
  69018. }
  69019. }
  69020. class DateTime extends _xfa_object.ContentObject {
  69021. constructor(attributes) {
  69022. super(TEMPLATE_NS_ID, "dateTime");
  69023. this.id = attributes.id || "";
  69024. this.name = attributes.name || "";
  69025. this.use = attributes.use || "";
  69026. this.usehref = attributes.usehref || "";
  69027. }
  69028. [_xfa_object.$finalize]() {
  69029. const date = this[_xfa_object.$content].trim();
  69030. this[_xfa_object.$content] = date ? new Date(date) : null;
  69031. }
  69032. [_xfa_object.$toHTML](availableSpace) {
  69033. return valueToHtml(
  69034. this[_xfa_object.$content]
  69035. ? this[_xfa_object.$content].toString()
  69036. : ""
  69037. );
  69038. }
  69039. }
  69040. class DateTimeEdit extends _xfa_object.XFAObject {
  69041. constructor(attributes) {
  69042. super(TEMPLATE_NS_ID, "dateTimeEdit", true);
  69043. this.hScrollPolicy = (0, _utils.getStringOption)(
  69044. attributes.hScrollPolicy,
  69045. ["auto", "off", "on"]
  69046. );
  69047. this.id = attributes.id || "";
  69048. this.picker = (0, _utils.getStringOption)(attributes.picker, [
  69049. "host",
  69050. "none",
  69051. ]);
  69052. this.use = attributes.use || "";
  69053. this.usehref = attributes.usehref || "";
  69054. this.border = null;
  69055. this.comb = null;
  69056. this.extras = null;
  69057. this.margin = null;
  69058. }
  69059. [_xfa_object.$toHTML](availableSpace) {
  69060. const style = (0, _html_utils.toStyle)(
  69061. this,
  69062. "border",
  69063. "font",
  69064. "margin"
  69065. );
  69066. const field =
  69067. this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  69068. const html = {
  69069. name: "input",
  69070. attributes: {
  69071. type: "text",
  69072. fieldId: field[_xfa_object.$uid],
  69073. dataId:
  69074. (field[_xfa_object.$data] &&
  69075. field[_xfa_object.$data][_xfa_object.$uid]) ||
  69076. field[_xfa_object.$uid],
  69077. class: ["xfaTextfield"],
  69078. style,
  69079. "aria-label": ariaLabel(field),
  69080. "aria-required": false,
  69081. },
  69082. };
  69083. if (isRequired(field)) {
  69084. html.attributes["aria-required"] = true;
  69085. html.attributes.required = true;
  69086. }
  69087. return _utils.HTMLResult.success({
  69088. name: "label",
  69089. attributes: {
  69090. class: ["xfaLabel"],
  69091. },
  69092. children: [html],
  69093. });
  69094. }
  69095. }
  69096. class Decimal extends _xfa_object.ContentObject {
  69097. constructor(attributes) {
  69098. super(TEMPLATE_NS_ID, "decimal");
  69099. this.fracDigits = (0, _utils.getInteger)({
  69100. data: attributes.fracDigits,
  69101. defaultValue: 2,
  69102. validate: (x) => true,
  69103. });
  69104. this.id = attributes.id || "";
  69105. this.leadDigits = (0, _utils.getInteger)({
  69106. data: attributes.leadDigits,
  69107. defaultValue: -1,
  69108. validate: (x) => true,
  69109. });
  69110. this.name = attributes.name || "";
  69111. this.use = attributes.use || "";
  69112. this.usehref = attributes.usehref || "";
  69113. }
  69114. [_xfa_object.$finalize]() {
  69115. const number = parseFloat(this[_xfa_object.$content].trim());
  69116. this[_xfa_object.$content] = isNaN(number) ? null : number;
  69117. }
  69118. [_xfa_object.$toHTML](availableSpace) {
  69119. return valueToHtml(
  69120. this[_xfa_object.$content] !== null
  69121. ? this[_xfa_object.$content].toString()
  69122. : ""
  69123. );
  69124. }
  69125. }
  69126. class DefaultUi extends _xfa_object.XFAObject {
  69127. constructor(attributes) {
  69128. super(TEMPLATE_NS_ID, "defaultUi", true);
  69129. this.id = attributes.id || "";
  69130. this.use = attributes.use || "";
  69131. this.usehref = attributes.usehref || "";
  69132. this.extras = null;
  69133. }
  69134. }
  69135. class Desc extends _xfa_object.XFAObject {
  69136. constructor(attributes) {
  69137. super(TEMPLATE_NS_ID, "desc", true);
  69138. this.id = attributes.id || "";
  69139. this.use = attributes.use || "";
  69140. this.usehref = attributes.usehref || "";
  69141. this.boolean = new _xfa_object.XFAObjectArray();
  69142. this.date = new _xfa_object.XFAObjectArray();
  69143. this.dateTime = new _xfa_object.XFAObjectArray();
  69144. this.decimal = new _xfa_object.XFAObjectArray();
  69145. this.exData = new _xfa_object.XFAObjectArray();
  69146. this.float = new _xfa_object.XFAObjectArray();
  69147. this.image = new _xfa_object.XFAObjectArray();
  69148. this.integer = new _xfa_object.XFAObjectArray();
  69149. this.text = new _xfa_object.XFAObjectArray();
  69150. this.time = new _xfa_object.XFAObjectArray();
  69151. }
  69152. }
  69153. class DigestMethod extends _xfa_object.OptionObject {
  69154. constructor(attributes) {
  69155. super(TEMPLATE_NS_ID, "digestMethod", [
  69156. "",
  69157. "SHA1",
  69158. "SHA256",
  69159. "SHA512",
  69160. "RIPEMD160",
  69161. ]);
  69162. this.id = attributes.id || "";
  69163. this.use = attributes.use || "";
  69164. this.usehref = attributes.usehref || "";
  69165. }
  69166. }
  69167. class DigestMethods extends _xfa_object.XFAObject {
  69168. constructor(attributes) {
  69169. super(TEMPLATE_NS_ID, "digestMethods", true);
  69170. this.id = attributes.id || "";
  69171. this.type = (0, _utils.getStringOption)(attributes.type, [
  69172. "optional",
  69173. "required",
  69174. ]);
  69175. this.use = attributes.use || "";
  69176. this.usehref = attributes.usehref || "";
  69177. this.digestMethod = new _xfa_object.XFAObjectArray();
  69178. }
  69179. }
  69180. class Draw extends _xfa_object.XFAObject {
  69181. constructor(attributes) {
  69182. super(TEMPLATE_NS_ID, "draw", true);
  69183. this.anchorType = (0, _utils.getStringOption)(
  69184. attributes.anchorType,
  69185. [
  69186. "topLeft",
  69187. "bottomCenter",
  69188. "bottomLeft",
  69189. "bottomRight",
  69190. "middleCenter",
  69191. "middleLeft",
  69192. "middleRight",
  69193. "topCenter",
  69194. "topRight",
  69195. ]
  69196. );
  69197. this.colSpan = (0, _utils.getInteger)({
  69198. data: attributes.colSpan,
  69199. defaultValue: 1,
  69200. validate: (n) => n >= 1 || n === -1,
  69201. });
  69202. this.h = attributes.h
  69203. ? (0, _utils.getMeasurement)(attributes.h)
  69204. : "";
  69205. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, [
  69206. "left",
  69207. "center",
  69208. "justify",
  69209. "justifyAll",
  69210. "radix",
  69211. "right",
  69212. ]);
  69213. this.id = attributes.id || "";
  69214. this.locale = attributes.locale || "";
  69215. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  69216. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  69217. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  69218. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  69219. this.name = attributes.name || "";
  69220. this.presence = (0, _utils.getStringOption)(attributes.presence, [
  69221. "visible",
  69222. "hidden",
  69223. "inactive",
  69224. "invisible",
  69225. ]);
  69226. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  69227. this.rotate = (0, _utils.getInteger)({
  69228. data: attributes.rotate,
  69229. defaultValue: 0,
  69230. validate: (x) => x % 90 === 0,
  69231. });
  69232. this.use = attributes.use || "";
  69233. this.usehref = attributes.usehref || "";
  69234. this.w = attributes.w
  69235. ? (0, _utils.getMeasurement)(attributes.w)
  69236. : "";
  69237. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  69238. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  69239. this.assist = null;
  69240. this.border = null;
  69241. this.caption = null;
  69242. this.desc = null;
  69243. this.extras = null;
  69244. this.font = null;
  69245. this.keep = null;
  69246. this.margin = null;
  69247. this.para = null;
  69248. this.traversal = null;
  69249. this.ui = null;
  69250. this.value = null;
  69251. this.setProperty = new _xfa_object.XFAObjectArray();
  69252. }
  69253. [_xfa_object.$setValue](value) {
  69254. _setValue(this, value);
  69255. }
  69256. [_xfa_object.$toHTML](availableSpace) {
  69257. setTabIndex(this);
  69258. if (this.presence === "hidden" || this.presence === "inactive") {
  69259. return _utils.HTMLResult.EMPTY;
  69260. }
  69261. (0, _html_utils.fixDimensions)(this);
  69262. this[_xfa_object.$pushPara]();
  69263. const savedW = this.w;
  69264. const savedH = this.h;
  69265. const { w, h, isBroken } = (0, _html_utils.layoutNode)(
  69266. this,
  69267. availableSpace
  69268. );
  69269. if (w && this.w === "") {
  69270. if (
  69271. isBroken &&
  69272. this[_xfa_object.$getSubformParent]()[
  69273. _xfa_object.$isThereMoreWidth
  69274. ]()
  69275. ) {
  69276. this[_xfa_object.$popPara]();
  69277. return _utils.HTMLResult.FAILURE;
  69278. }
  69279. this.w = w;
  69280. }
  69281. if (h && this.h === "") {
  69282. this.h = h;
  69283. }
  69284. setFirstUnsplittable(this);
  69285. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  69286. this.w = savedW;
  69287. this.h = savedH;
  69288. this[_xfa_object.$popPara]();
  69289. return _utils.HTMLResult.FAILURE;
  69290. }
  69291. unsetFirstUnsplittable(this);
  69292. const style = (0, _html_utils.toStyle)(
  69293. this,
  69294. "font",
  69295. "hAlign",
  69296. "dimensions",
  69297. "position",
  69298. "presence",
  69299. "rotate",
  69300. "anchorType",
  69301. "border",
  69302. "margin"
  69303. );
  69304. (0, _html_utils.setMinMaxDimensions)(this, style);
  69305. if (style.margin) {
  69306. style.padding = style.margin;
  69307. delete style.margin;
  69308. }
  69309. const classNames = ["xfaDraw"];
  69310. if (this.font) {
  69311. classNames.push("xfaFont");
  69312. }
  69313. if ((0, _html_utils.isPrintOnly)(this)) {
  69314. classNames.push("xfaPrintOnly");
  69315. }
  69316. const attributes = {
  69317. style,
  69318. id: this[_xfa_object.$uid],
  69319. class: classNames,
  69320. };
  69321. if (this.name) {
  69322. attributes.xfaName = this.name;
  69323. }
  69324. const html = {
  69325. name: "div",
  69326. attributes,
  69327. children: [],
  69328. };
  69329. applyAssist(this, attributes);
  69330. const bbox = (0, _html_utils.computeBbox)(
  69331. this,
  69332. html,
  69333. availableSpace
  69334. );
  69335. const value = this.value
  69336. ? this.value[_xfa_object.$toHTML](availableSpace).html
  69337. : null;
  69338. if (value === null) {
  69339. this.w = savedW;
  69340. this.h = savedH;
  69341. this[_xfa_object.$popPara]();
  69342. return _utils.HTMLResult.success(
  69343. (0, _html_utils.createWrapper)(this, html),
  69344. bbox
  69345. );
  69346. }
  69347. html.children.push(value);
  69348. (0, _html_utils.setPara)(this, style, value);
  69349. this.w = savedW;
  69350. this.h = savedH;
  69351. this[_xfa_object.$popPara]();
  69352. return _utils.HTMLResult.success(
  69353. (0, _html_utils.createWrapper)(this, html),
  69354. bbox
  69355. );
  69356. }
  69357. }
  69358. class Edge extends _xfa_object.XFAObject {
  69359. constructor(attributes) {
  69360. super(TEMPLATE_NS_ID, "edge", true);
  69361. this.cap = (0, _utils.getStringOption)(attributes.cap, [
  69362. "square",
  69363. "butt",
  69364. "round",
  69365. ]);
  69366. this.id = attributes.id || "";
  69367. this.presence = (0, _utils.getStringOption)(attributes.presence, [
  69368. "visible",
  69369. "hidden",
  69370. "inactive",
  69371. "invisible",
  69372. ]);
  69373. this.stroke = (0, _utils.getStringOption)(attributes.stroke, [
  69374. "solid",
  69375. "dashDot",
  69376. "dashDotDot",
  69377. "dashed",
  69378. "dotted",
  69379. "embossed",
  69380. "etched",
  69381. "lowered",
  69382. "raised",
  69383. ]);
  69384. this.thickness = (0, _utils.getMeasurement)(
  69385. attributes.thickness,
  69386. "0.5pt"
  69387. );
  69388. this.use = attributes.use || "";
  69389. this.usehref = attributes.usehref || "";
  69390. this.color = null;
  69391. this.extras = null;
  69392. }
  69393. [_xfa_object.$toStyle]() {
  69394. const style = (0, _html_utils.toStyle)(this, "visibility");
  69395. Object.assign(style, {
  69396. linecap: this.cap,
  69397. width: (0, _html_utils.measureToString)(this.thickness),
  69398. color: this.color
  69399. ? this.color[_xfa_object.$toStyle]()
  69400. : "#000000",
  69401. style: "",
  69402. });
  69403. if (this.presence !== "visible") {
  69404. style.style = "none";
  69405. } else {
  69406. switch (this.stroke) {
  69407. case "solid":
  69408. style.style = "solid";
  69409. break;
  69410. case "dashDot":
  69411. style.style = "dashed";
  69412. break;
  69413. case "dashDotDot":
  69414. style.style = "dashed";
  69415. break;
  69416. case "dashed":
  69417. style.style = "dashed";
  69418. break;
  69419. case "dotted":
  69420. style.style = "dotted";
  69421. break;
  69422. case "embossed":
  69423. style.style = "ridge";
  69424. break;
  69425. case "etched":
  69426. style.style = "groove";
  69427. break;
  69428. case "lowered":
  69429. style.style = "inset";
  69430. break;
  69431. case "raised":
  69432. style.style = "outset";
  69433. break;
  69434. }
  69435. }
  69436. return style;
  69437. }
  69438. }
  69439. class Encoding extends _xfa_object.OptionObject {
  69440. constructor(attributes) {
  69441. super(TEMPLATE_NS_ID, "encoding", [
  69442. "adbe.x509.rsa_sha1",
  69443. "adbe.pkcs7.detached",
  69444. "adbe.pkcs7.sha1",
  69445. ]);
  69446. this.id = attributes.id || "";
  69447. this.use = attributes.use || "";
  69448. this.usehref = attributes.usehref || "";
  69449. }
  69450. }
  69451. class Encodings extends _xfa_object.XFAObject {
  69452. constructor(attributes) {
  69453. super(TEMPLATE_NS_ID, "encodings", true);
  69454. this.id = attributes.id || "";
  69455. this.type = (0, _utils.getStringOption)(attributes.type, [
  69456. "optional",
  69457. "required",
  69458. ]);
  69459. this.use = attributes.use || "";
  69460. this.usehref = attributes.usehref || "";
  69461. this.encoding = new _xfa_object.XFAObjectArray();
  69462. }
  69463. }
  69464. class Encrypt extends _xfa_object.XFAObject {
  69465. constructor(attributes) {
  69466. super(TEMPLATE_NS_ID, "encrypt", true);
  69467. this.id = attributes.id || "";
  69468. this.use = attributes.use || "";
  69469. this.usehref = attributes.usehref || "";
  69470. this.certificate = null;
  69471. }
  69472. }
  69473. class EncryptData extends _xfa_object.XFAObject {
  69474. constructor(attributes) {
  69475. super(TEMPLATE_NS_ID, "encryptData", true);
  69476. this.id = attributes.id || "";
  69477. this.operation = (0, _utils.getStringOption)(attributes.operation, [
  69478. "encrypt",
  69479. "decrypt",
  69480. ]);
  69481. this.target = attributes.target || "";
  69482. this.use = attributes.use || "";
  69483. this.usehref = attributes.usehref || "";
  69484. this.filter = null;
  69485. this.manifest = null;
  69486. }
  69487. }
  69488. class Encryption extends _xfa_object.XFAObject {
  69489. constructor(attributes) {
  69490. super(TEMPLATE_NS_ID, "encryption", true);
  69491. this.id = attributes.id || "";
  69492. this.type = (0, _utils.getStringOption)(attributes.type, [
  69493. "optional",
  69494. "required",
  69495. ]);
  69496. this.use = attributes.use || "";
  69497. this.usehref = attributes.usehref || "";
  69498. this.certificate = new _xfa_object.XFAObjectArray();
  69499. }
  69500. }
  69501. class EncryptionMethod extends _xfa_object.OptionObject {
  69502. constructor(attributes) {
  69503. super(TEMPLATE_NS_ID, "encryptionMethod", [
  69504. "",
  69505. "AES256-CBC",
  69506. "TRIPLEDES-CBC",
  69507. "AES128-CBC",
  69508. "AES192-CBC",
  69509. ]);
  69510. this.id = attributes.id || "";
  69511. this.use = attributes.use || "";
  69512. this.usehref = attributes.usehref || "";
  69513. }
  69514. }
  69515. class EncryptionMethods extends _xfa_object.XFAObject {
  69516. constructor(attributes) {
  69517. super(TEMPLATE_NS_ID, "encryptionMethods", true);
  69518. this.id = attributes.id || "";
  69519. this.type = (0, _utils.getStringOption)(attributes.type, [
  69520. "optional",
  69521. "required",
  69522. ]);
  69523. this.use = attributes.use || "";
  69524. this.usehref = attributes.usehref || "";
  69525. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  69526. }
  69527. }
  69528. class Event extends _xfa_object.XFAObject {
  69529. constructor(attributes) {
  69530. super(TEMPLATE_NS_ID, "event", true);
  69531. this.activity = (0, _utils.getStringOption)(attributes.activity, [
  69532. "click",
  69533. "change",
  69534. "docClose",
  69535. "docReady",
  69536. "enter",
  69537. "exit",
  69538. "full",
  69539. "indexChange",
  69540. "initialize",
  69541. "mouseDown",
  69542. "mouseEnter",
  69543. "mouseExit",
  69544. "mouseUp",
  69545. "postExecute",
  69546. "postOpen",
  69547. "postPrint",
  69548. "postSave",
  69549. "postSign",
  69550. "postSubmit",
  69551. "preExecute",
  69552. "preOpen",
  69553. "prePrint",
  69554. "preSave",
  69555. "preSign",
  69556. "preSubmit",
  69557. "ready",
  69558. "validationState",
  69559. ]);
  69560. this.id = attributes.id || "";
  69561. this.listen = (0, _utils.getStringOption)(attributes.listen, [
  69562. "refOnly",
  69563. "refAndDescendents",
  69564. ]);
  69565. this.name = attributes.name || "";
  69566. this.ref = attributes.ref || "";
  69567. this.use = attributes.use || "";
  69568. this.usehref = attributes.usehref || "";
  69569. this.extras = null;
  69570. this.encryptData = null;
  69571. this.execute = null;
  69572. this.script = null;
  69573. this.signData = null;
  69574. this.submit = null;
  69575. }
  69576. }
  69577. class ExData extends _xfa_object.ContentObject {
  69578. constructor(attributes) {
  69579. super(TEMPLATE_NS_ID, "exData");
  69580. this.contentType = attributes.contentType || "";
  69581. this.href = attributes.href || "";
  69582. this.id = attributes.id || "";
  69583. this.maxLength = (0, _utils.getInteger)({
  69584. data: attributes.maxLength,
  69585. defaultValue: -1,
  69586. validate: (x) => x >= -1,
  69587. });
  69588. this.name = attributes.name || "";
  69589. this.rid = attributes.rid || "";
  69590. this.transferEncoding = (0, _utils.getStringOption)(
  69591. attributes.transferEncoding,
  69592. ["none", "base64", "package"]
  69593. );
  69594. this.use = attributes.use || "";
  69595. this.usehref = attributes.usehref || "";
  69596. }
  69597. [_xfa_object.$isCDATAXml]() {
  69598. return this.contentType === "text/html";
  69599. }
  69600. [_xfa_object.$onChild](child) {
  69601. if (
  69602. this.contentType === "text/html" &&
  69603. child[_xfa_object.$namespaceId] ===
  69604. _namespaces.NamespaceIds.xhtml.id
  69605. ) {
  69606. this[_xfa_object.$content] = child;
  69607. return true;
  69608. }
  69609. if (this.contentType === "text/xml") {
  69610. this[_xfa_object.$content] = child;
  69611. return true;
  69612. }
  69613. return false;
  69614. }
  69615. [_xfa_object.$toHTML](availableSpace) {
  69616. if (
  69617. this.contentType !== "text/html" ||
  69618. !this[_xfa_object.$content]
  69619. ) {
  69620. return _utils.HTMLResult.EMPTY;
  69621. }
  69622. return this[_xfa_object.$content][_xfa_object.$toHTML](
  69623. availableSpace
  69624. );
  69625. }
  69626. }
  69627. class ExObject extends _xfa_object.XFAObject {
  69628. constructor(attributes) {
  69629. super(TEMPLATE_NS_ID, "exObject", true);
  69630. this.archive = attributes.archive || "";
  69631. this.classId = attributes.classId || "";
  69632. this.codeBase = attributes.codeBase || "";
  69633. this.codeType = attributes.codeType || "";
  69634. this.id = attributes.id || "";
  69635. this.name = attributes.name || "";
  69636. this.use = attributes.use || "";
  69637. this.usehref = attributes.usehref || "";
  69638. this.extras = null;
  69639. this.boolean = new _xfa_object.XFAObjectArray();
  69640. this.date = new _xfa_object.XFAObjectArray();
  69641. this.dateTime = new _xfa_object.XFAObjectArray();
  69642. this.decimal = new _xfa_object.XFAObjectArray();
  69643. this.exData = new _xfa_object.XFAObjectArray();
  69644. this.exObject = new _xfa_object.XFAObjectArray();
  69645. this.float = new _xfa_object.XFAObjectArray();
  69646. this.image = new _xfa_object.XFAObjectArray();
  69647. this.integer = new _xfa_object.XFAObjectArray();
  69648. this.text = new _xfa_object.XFAObjectArray();
  69649. this.time = new _xfa_object.XFAObjectArray();
  69650. }
  69651. }
  69652. class ExclGroup extends _xfa_object.XFAObject {
  69653. constructor(attributes) {
  69654. super(TEMPLATE_NS_ID, "exclGroup", true);
  69655. this.access = (0, _utils.getStringOption)(attributes.access, [
  69656. "open",
  69657. "nonInteractive",
  69658. "protected",
  69659. "readOnly",
  69660. ]);
  69661. this.accessKey = attributes.accessKey || "";
  69662. this.anchorType = (0, _utils.getStringOption)(
  69663. attributes.anchorType,
  69664. [
  69665. "topLeft",
  69666. "bottomCenter",
  69667. "bottomLeft",
  69668. "bottomRight",
  69669. "middleCenter",
  69670. "middleLeft",
  69671. "middleRight",
  69672. "topCenter",
  69673. "topRight",
  69674. ]
  69675. );
  69676. this.colSpan = (0, _utils.getInteger)({
  69677. data: attributes.colSpan,
  69678. defaultValue: 1,
  69679. validate: (n) => n >= 1 || n === -1,
  69680. });
  69681. this.h = attributes.h
  69682. ? (0, _utils.getMeasurement)(attributes.h)
  69683. : "";
  69684. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, [
  69685. "left",
  69686. "center",
  69687. "justify",
  69688. "justifyAll",
  69689. "radix",
  69690. "right",
  69691. ]);
  69692. this.id = attributes.id || "";
  69693. this.layout = (0, _utils.getStringOption)(attributes.layout, [
  69694. "position",
  69695. "lr-tb",
  69696. "rl-row",
  69697. "rl-tb",
  69698. "row",
  69699. "table",
  69700. "tb",
  69701. ]);
  69702. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  69703. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  69704. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  69705. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  69706. this.name = attributes.name || "";
  69707. this.presence = (0, _utils.getStringOption)(attributes.presence, [
  69708. "visible",
  69709. "hidden",
  69710. "inactive",
  69711. "invisible",
  69712. ]);
  69713. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  69714. this.use = attributes.use || "";
  69715. this.usehref = attributes.usehref || "";
  69716. this.w = attributes.w
  69717. ? (0, _utils.getMeasurement)(attributes.w)
  69718. : "";
  69719. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  69720. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  69721. this.assist = null;
  69722. this.bind = null;
  69723. this.border = null;
  69724. this.calculate = null;
  69725. this.caption = null;
  69726. this.desc = null;
  69727. this.extras = null;
  69728. this.margin = null;
  69729. this.para = null;
  69730. this.traversal = null;
  69731. this.validate = null;
  69732. this.connect = new _xfa_object.XFAObjectArray();
  69733. this.event = new _xfa_object.XFAObjectArray();
  69734. this.field = new _xfa_object.XFAObjectArray();
  69735. this.setProperty = new _xfa_object.XFAObjectArray();
  69736. }
  69737. [_xfa_object.$isBindable]() {
  69738. return true;
  69739. }
  69740. [_xfa_object.$hasSettableValue]() {
  69741. return true;
  69742. }
  69743. [_xfa_object.$setValue](value) {
  69744. for (const field of this.field.children) {
  69745. if (!field.value) {
  69746. const nodeValue = new Value({});
  69747. field[_xfa_object.$appendChild](nodeValue);
  69748. field.value = nodeValue;
  69749. }
  69750. field.value[_xfa_object.$setValue](value);
  69751. }
  69752. }
  69753. [_xfa_object.$isThereMoreWidth]() {
  69754. return (
  69755. (this.layout.endsWith("-tb") &&
  69756. this[_xfa_object.$extra].attempt === 0 &&
  69757. this[_xfa_object.$extra].numberInLine > 0) ||
  69758. this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]()
  69759. );
  69760. }
  69761. [_xfa_object.$isSplittable]() {
  69762. const parent = this[_xfa_object.$getSubformParent]();
  69763. if (!parent[_xfa_object.$isSplittable]()) {
  69764. return false;
  69765. }
  69766. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  69767. return this[_xfa_object.$extra]._isSplittable;
  69768. }
  69769. if (this.layout === "position" || this.layout.includes("row")) {
  69770. this[_xfa_object.$extra]._isSplittable = false;
  69771. return false;
  69772. }
  69773. if (
  69774. parent.layout &&
  69775. parent.layout.endsWith("-tb") &&
  69776. parent[_xfa_object.$extra].numberInLine !== 0
  69777. ) {
  69778. return false;
  69779. }
  69780. this[_xfa_object.$extra]._isSplittable = true;
  69781. return true;
  69782. }
  69783. [_xfa_object.$flushHTML]() {
  69784. return (0, _layout.flushHTML)(this);
  69785. }
  69786. [_xfa_object.$addHTML](html, bbox) {
  69787. (0, _layout.addHTML)(this, html, bbox);
  69788. }
  69789. [_xfa_object.$getAvailableSpace]() {
  69790. return (0, _layout.getAvailableSpace)(this);
  69791. }
  69792. [_xfa_object.$toHTML](availableSpace) {
  69793. setTabIndex(this);
  69794. if (
  69795. this.presence === "hidden" ||
  69796. this.presence === "inactive" ||
  69797. this.h === 0 ||
  69798. this.w === 0
  69799. ) {
  69800. return _utils.HTMLResult.EMPTY;
  69801. }
  69802. (0, _html_utils.fixDimensions)(this);
  69803. const children = [];
  69804. const attributes = {
  69805. id: this[_xfa_object.$uid],
  69806. class: [],
  69807. };
  69808. (0, _html_utils.setAccess)(this, attributes.class);
  69809. if (!this[_xfa_object.$extra]) {
  69810. this[_xfa_object.$extra] = Object.create(null);
  69811. }
  69812. Object.assign(this[_xfa_object.$extra], {
  69813. children,
  69814. attributes,
  69815. attempt: 0,
  69816. line: null,
  69817. numberInLine: 0,
  69818. availableSpace: {
  69819. width: Math.min(this.w || Infinity, availableSpace.width),
  69820. height: Math.min(this.h || Infinity, availableSpace.height),
  69821. },
  69822. width: 0,
  69823. height: 0,
  69824. prevHeight: 0,
  69825. currentWidth: 0,
  69826. });
  69827. const isSplittable = this[_xfa_object.$isSplittable]();
  69828. if (!isSplittable) {
  69829. setFirstUnsplittable(this);
  69830. }
  69831. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  69832. return _utils.HTMLResult.FAILURE;
  69833. }
  69834. const filter = new Set(["field"]);
  69835. if (this.layout.includes("row")) {
  69836. const columnWidths =
  69837. this[_xfa_object.$getSubformParent]().columnWidths;
  69838. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  69839. this[_xfa_object.$extra].columnWidths = columnWidths;
  69840. this[_xfa_object.$extra].currentColumn = 0;
  69841. }
  69842. }
  69843. const style = (0, _html_utils.toStyle)(
  69844. this,
  69845. "anchorType",
  69846. "dimensions",
  69847. "position",
  69848. "presence",
  69849. "border",
  69850. "margin",
  69851. "hAlign"
  69852. );
  69853. const classNames = ["xfaExclgroup"];
  69854. const cl = (0, _html_utils.layoutClass)(this);
  69855. if (cl) {
  69856. classNames.push(cl);
  69857. }
  69858. if ((0, _html_utils.isPrintOnly)(this)) {
  69859. classNames.push("xfaPrintOnly");
  69860. }
  69861. attributes.style = style;
  69862. attributes.class = classNames;
  69863. if (this.name) {
  69864. attributes.xfaName = this.name;
  69865. }
  69866. this[_xfa_object.$pushPara]();
  69867. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  69868. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  69869. for (
  69870. ;
  69871. this[_xfa_object.$extra].attempt < maxRun;
  69872. this[_xfa_object.$extra].attempt++
  69873. ) {
  69874. if (
  69875. isLrTb &&
  69876. this[_xfa_object.$extra].attempt ===
  69877. MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1
  69878. ) {
  69879. this[_xfa_object.$extra].numberInLine = 0;
  69880. }
  69881. const result = this[_xfa_object.$childrenToHTML]({
  69882. filter,
  69883. include: true,
  69884. });
  69885. if (result.success) {
  69886. break;
  69887. }
  69888. if (result.isBreak()) {
  69889. this[_xfa_object.$popPara]();
  69890. return result;
  69891. }
  69892. if (
  69893. isLrTb &&
  69894. this[_xfa_object.$extra].attempt === 0 &&
  69895. this[_xfa_object.$extra].numberInLine === 0 &&
  69896. !this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra]
  69897. .noLayoutFailure
  69898. ) {
  69899. this[_xfa_object.$extra].attempt = maxRun;
  69900. break;
  69901. }
  69902. }
  69903. this[_xfa_object.$popPara]();
  69904. if (!isSplittable) {
  69905. unsetFirstUnsplittable(this);
  69906. }
  69907. if (this[_xfa_object.$extra].attempt === maxRun) {
  69908. if (!isSplittable) {
  69909. delete this[_xfa_object.$extra];
  69910. }
  69911. return _utils.HTMLResult.FAILURE;
  69912. }
  69913. let marginH = 0;
  69914. let marginV = 0;
  69915. if (this.margin) {
  69916. marginH = this.margin.leftInset + this.margin.rightInset;
  69917. marginV = this.margin.topInset + this.margin.bottomInset;
  69918. }
  69919. const width = Math.max(
  69920. this[_xfa_object.$extra].width + marginH,
  69921. this.w || 0
  69922. );
  69923. const height = Math.max(
  69924. this[_xfa_object.$extra].height + marginV,
  69925. this.h || 0
  69926. );
  69927. const bbox = [this.x, this.y, width, height];
  69928. if (this.w === "") {
  69929. style.width = (0, _html_utils.measureToString)(width);
  69930. }
  69931. if (this.h === "") {
  69932. style.height = (0, _html_utils.measureToString)(height);
  69933. }
  69934. const html = {
  69935. name: "div",
  69936. attributes,
  69937. children,
  69938. };
  69939. applyAssist(this, attributes);
  69940. delete this[_xfa_object.$extra];
  69941. return _utils.HTMLResult.success(
  69942. (0, _html_utils.createWrapper)(this, html),
  69943. bbox
  69944. );
  69945. }
  69946. }
  69947. class Execute extends _xfa_object.XFAObject {
  69948. constructor(attributes) {
  69949. super(TEMPLATE_NS_ID, "execute");
  69950. this.connection = attributes.connection || "";
  69951. this.executeType = (0, _utils.getStringOption)(
  69952. attributes.executeType,
  69953. ["import", "remerge"]
  69954. );
  69955. this.id = attributes.id || "";
  69956. this.runAt = (0, _utils.getStringOption)(attributes.runAt, [
  69957. "client",
  69958. "both",
  69959. "server",
  69960. ]);
  69961. this.use = attributes.use || "";
  69962. this.usehref = attributes.usehref || "";
  69963. }
  69964. }
  69965. class Extras extends _xfa_object.XFAObject {
  69966. constructor(attributes) {
  69967. super(TEMPLATE_NS_ID, "extras", true);
  69968. this.id = attributes.id || "";
  69969. this.name = attributes.name || "";
  69970. this.use = attributes.use || "";
  69971. this.usehref = attributes.usehref || "";
  69972. this.boolean = new _xfa_object.XFAObjectArray();
  69973. this.date = new _xfa_object.XFAObjectArray();
  69974. this.dateTime = new _xfa_object.XFAObjectArray();
  69975. this.decimal = new _xfa_object.XFAObjectArray();
  69976. this.exData = new _xfa_object.XFAObjectArray();
  69977. this.extras = new _xfa_object.XFAObjectArray();
  69978. this.float = new _xfa_object.XFAObjectArray();
  69979. this.image = new _xfa_object.XFAObjectArray();
  69980. this.integer = new _xfa_object.XFAObjectArray();
  69981. this.text = new _xfa_object.XFAObjectArray();
  69982. this.time = new _xfa_object.XFAObjectArray();
  69983. }
  69984. }
  69985. class Field extends _xfa_object.XFAObject {
  69986. constructor(attributes) {
  69987. super(TEMPLATE_NS_ID, "field", true);
  69988. this.access = (0, _utils.getStringOption)(attributes.access, [
  69989. "open",
  69990. "nonInteractive",
  69991. "protected",
  69992. "readOnly",
  69993. ]);
  69994. this.accessKey = attributes.accessKey || "";
  69995. this.anchorType = (0, _utils.getStringOption)(
  69996. attributes.anchorType,
  69997. [
  69998. "topLeft",
  69999. "bottomCenter",
  70000. "bottomLeft",
  70001. "bottomRight",
  70002. "middleCenter",
  70003. "middleLeft",
  70004. "middleRight",
  70005. "topCenter",
  70006. "topRight",
  70007. ]
  70008. );
  70009. this.colSpan = (0, _utils.getInteger)({
  70010. data: attributes.colSpan,
  70011. defaultValue: 1,
  70012. validate: (n) => n >= 1 || n === -1,
  70013. });
  70014. this.h = attributes.h
  70015. ? (0, _utils.getMeasurement)(attributes.h)
  70016. : "";
  70017. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, [
  70018. "left",
  70019. "center",
  70020. "justify",
  70021. "justifyAll",
  70022. "radix",
  70023. "right",
  70024. ]);
  70025. this.id = attributes.id || "";
  70026. this.locale = attributes.locale || "";
  70027. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  70028. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  70029. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  70030. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  70031. this.name = attributes.name || "";
  70032. this.presence = (0, _utils.getStringOption)(attributes.presence, [
  70033. "visible",
  70034. "hidden",
  70035. "inactive",
  70036. "invisible",
  70037. ]);
  70038. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  70039. this.rotate = (0, _utils.getInteger)({
  70040. data: attributes.rotate,
  70041. defaultValue: 0,
  70042. validate: (x) => x % 90 === 0,
  70043. });
  70044. this.use = attributes.use || "";
  70045. this.usehref = attributes.usehref || "";
  70046. this.w = attributes.w
  70047. ? (0, _utils.getMeasurement)(attributes.w)
  70048. : "";
  70049. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  70050. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  70051. this.assist = null;
  70052. this.bind = null;
  70053. this.border = null;
  70054. this.calculate = null;
  70055. this.caption = null;
  70056. this.desc = null;
  70057. this.extras = null;
  70058. this.font = null;
  70059. this.format = null;
  70060. this.items = new _xfa_object.XFAObjectArray(2);
  70061. this.keep = null;
  70062. this.margin = null;
  70063. this.para = null;
  70064. this.traversal = null;
  70065. this.ui = null;
  70066. this.validate = null;
  70067. this.value = null;
  70068. this.bindItems = new _xfa_object.XFAObjectArray();
  70069. this.connect = new _xfa_object.XFAObjectArray();
  70070. this.event = new _xfa_object.XFAObjectArray();
  70071. this.setProperty = new _xfa_object.XFAObjectArray();
  70072. }
  70073. [_xfa_object.$isBindable]() {
  70074. return true;
  70075. }
  70076. [_xfa_object.$setValue](value) {
  70077. _setValue(this, value);
  70078. }
  70079. [_xfa_object.$toHTML](availableSpace) {
  70080. setTabIndex(this);
  70081. if (!this.ui) {
  70082. this.ui = new Ui({});
  70083. this.ui[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  70084. this[_xfa_object.$appendChild](this.ui);
  70085. let node;
  70086. switch (this.items.children.length) {
  70087. case 0:
  70088. node = new TextEdit({});
  70089. this.ui.textEdit = node;
  70090. break;
  70091. case 1:
  70092. node = new CheckButton({});
  70093. this.ui.checkButton = node;
  70094. break;
  70095. case 2:
  70096. node = new ChoiceList({});
  70097. this.ui.choiceList = node;
  70098. break;
  70099. }
  70100. this.ui[_xfa_object.$appendChild](node);
  70101. }
  70102. if (
  70103. !this.ui ||
  70104. this.presence === "hidden" ||
  70105. this.presence === "inactive" ||
  70106. this.h === 0 ||
  70107. this.w === 0
  70108. ) {
  70109. return _utils.HTMLResult.EMPTY;
  70110. }
  70111. if (this.caption) {
  70112. delete this.caption[_xfa_object.$extra];
  70113. }
  70114. this[_xfa_object.$pushPara]();
  70115. const caption = this.caption
  70116. ? this.caption[_xfa_object.$toHTML](availableSpace).html
  70117. : null;
  70118. const savedW = this.w;
  70119. const savedH = this.h;
  70120. let marginH = 0;
  70121. let marginV = 0;
  70122. if (this.margin) {
  70123. marginH = this.margin.leftInset + this.margin.rightInset;
  70124. marginV = this.margin.topInset + this.margin.bottomInset;
  70125. }
  70126. let borderDims = null;
  70127. if (this.w === "" || this.h === "") {
  70128. let width = null;
  70129. let height = null;
  70130. let uiW = 0;
  70131. let uiH = 0;
  70132. if (this.ui.checkButton) {
  70133. uiW = uiH = this.ui.checkButton.size;
  70134. } else {
  70135. const { w, h } = (0, _html_utils.layoutNode)(
  70136. this,
  70137. availableSpace
  70138. );
  70139. if (w !== null) {
  70140. uiW = w;
  70141. uiH = h;
  70142. } else {
  70143. uiH = (0, _fonts.getMetrics)(this.font, true).lineNoGap;
  70144. }
  70145. }
  70146. borderDims = getBorderDims(this.ui[_xfa_object.$getExtra]());
  70147. uiW += borderDims.w;
  70148. uiH += borderDims.h;
  70149. if (this.caption) {
  70150. const { w, h, isBroken } =
  70151. this.caption[_xfa_object.$getExtra](availableSpace);
  70152. if (
  70153. isBroken &&
  70154. this[_xfa_object.$getSubformParent]()[
  70155. _xfa_object.$isThereMoreWidth
  70156. ]()
  70157. ) {
  70158. this[_xfa_object.$popPara]();
  70159. return _utils.HTMLResult.FAILURE;
  70160. }
  70161. width = w;
  70162. height = h;
  70163. switch (this.caption.placement) {
  70164. case "left":
  70165. case "right":
  70166. case "inline":
  70167. width += uiW;
  70168. break;
  70169. case "top":
  70170. case "bottom":
  70171. height += uiH;
  70172. break;
  70173. }
  70174. } else {
  70175. width = uiW;
  70176. height = uiH;
  70177. }
  70178. if (width && this.w === "") {
  70179. width += marginH;
  70180. this.w = Math.min(
  70181. this.maxW <= 0 ? Infinity : this.maxW,
  70182. this.minW + 1 < width ? width : this.minW
  70183. );
  70184. }
  70185. if (height && this.h === "") {
  70186. height += marginV;
  70187. this.h = Math.min(
  70188. this.maxH <= 0 ? Infinity : this.maxH,
  70189. this.minH + 1 < height ? height : this.minH
  70190. );
  70191. }
  70192. }
  70193. this[_xfa_object.$popPara]();
  70194. (0, _html_utils.fixDimensions)(this);
  70195. setFirstUnsplittable(this);
  70196. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  70197. this.w = savedW;
  70198. this.h = savedH;
  70199. this[_xfa_object.$popPara]();
  70200. return _utils.HTMLResult.FAILURE;
  70201. }
  70202. unsetFirstUnsplittable(this);
  70203. const style = (0, _html_utils.toStyle)(
  70204. this,
  70205. "font",
  70206. "dimensions",
  70207. "position",
  70208. "rotate",
  70209. "anchorType",
  70210. "presence",
  70211. "margin",
  70212. "hAlign"
  70213. );
  70214. (0, _html_utils.setMinMaxDimensions)(this, style);
  70215. const classNames = ["xfaField"];
  70216. if (this.font) {
  70217. classNames.push("xfaFont");
  70218. }
  70219. if ((0, _html_utils.isPrintOnly)(this)) {
  70220. classNames.push("xfaPrintOnly");
  70221. }
  70222. const attributes = {
  70223. style,
  70224. id: this[_xfa_object.$uid],
  70225. class: classNames,
  70226. };
  70227. if (style.margin) {
  70228. style.padding = style.margin;
  70229. delete style.margin;
  70230. }
  70231. (0, _html_utils.setAccess)(this, classNames);
  70232. if (this.name) {
  70233. attributes.xfaName = this.name;
  70234. }
  70235. const children = [];
  70236. const html = {
  70237. name: "div",
  70238. attributes,
  70239. children,
  70240. };
  70241. applyAssist(this, attributes);
  70242. const borderStyle = this.border
  70243. ? this.border[_xfa_object.$toStyle]()
  70244. : null;
  70245. const bbox = (0, _html_utils.computeBbox)(
  70246. this,
  70247. html,
  70248. availableSpace
  70249. );
  70250. const ui = this.ui[_xfa_object.$toHTML]().html;
  70251. if (!ui) {
  70252. Object.assign(style, borderStyle);
  70253. return _utils.HTMLResult.success(
  70254. (0, _html_utils.createWrapper)(this, html),
  70255. bbox
  70256. );
  70257. }
  70258. if (this[_xfa_object.$tabIndex]) {
  70259. if (ui.children && ui.children[0]) {
  70260. ui.children[0].attributes.tabindex =
  70261. this[_xfa_object.$tabIndex];
  70262. } else {
  70263. ui.attributes.tabindex = this[_xfa_object.$tabIndex];
  70264. }
  70265. }
  70266. if (!ui.attributes.style) {
  70267. ui.attributes.style = Object.create(null);
  70268. }
  70269. let aElement = null;
  70270. if (this.ui.button) {
  70271. if (ui.children.length === 1) {
  70272. [aElement] = ui.children.splice(0, 1);
  70273. }
  70274. Object.assign(ui.attributes.style, borderStyle);
  70275. } else {
  70276. Object.assign(style, borderStyle);
  70277. }
  70278. children.push(ui);
  70279. if (this.value) {
  70280. if (this.ui.imageEdit) {
  70281. ui.children.push(this.value[_xfa_object.$toHTML]().html);
  70282. } else if (!this.ui.button) {
  70283. let value = "";
  70284. if (this.value.exData) {
  70285. value = this.value.exData[_xfa_object.$text]();
  70286. } else if (this.value.text) {
  70287. value = this.value.text[_xfa_object.$getExtra]();
  70288. } else {
  70289. const htmlValue = this.value[_xfa_object.$toHTML]().html;
  70290. if (htmlValue !== null) {
  70291. value = htmlValue.children[0].value;
  70292. }
  70293. }
  70294. if (
  70295. this.ui.textEdit &&
  70296. this.value.text &&
  70297. this.value.text.maxChars
  70298. ) {
  70299. ui.children[0].attributes.maxLength =
  70300. this.value.text.maxChars;
  70301. }
  70302. if (value) {
  70303. if (this.ui.numericEdit) {
  70304. value = parseFloat(value);
  70305. value = isNaN(value) ? "" : value.toString();
  70306. }
  70307. if (ui.children[0].name === "textarea") {
  70308. ui.children[0].attributes.textContent = value;
  70309. } else {
  70310. ui.children[0].attributes.value = value;
  70311. }
  70312. }
  70313. }
  70314. }
  70315. if (!this.ui.imageEdit && ui.children && ui.children[0] && this.h) {
  70316. borderDims =
  70317. borderDims || getBorderDims(this.ui[_xfa_object.$getExtra]());
  70318. let captionHeight = 0;
  70319. if (
  70320. this.caption &&
  70321. ["top", "bottom"].includes(this.caption.placement)
  70322. ) {
  70323. captionHeight = this.caption.reserve;
  70324. if (captionHeight <= 0) {
  70325. captionHeight =
  70326. this.caption[_xfa_object.$getExtra](availableSpace).h;
  70327. }
  70328. const inputHeight =
  70329. this.h - captionHeight - marginV - borderDims.h;
  70330. ui.children[0].attributes.style.height = (0,
  70331. _html_utils.measureToString)(inputHeight);
  70332. } else {
  70333. ui.children[0].attributes.style.height = "100%";
  70334. }
  70335. }
  70336. if (aElement) {
  70337. ui.children.push(aElement);
  70338. }
  70339. if (!caption) {
  70340. if (ui.attributes.class) {
  70341. ui.attributes.class.push("xfaLeft");
  70342. }
  70343. this.w = savedW;
  70344. this.h = savedH;
  70345. return _utils.HTMLResult.success(
  70346. (0, _html_utils.createWrapper)(this, html),
  70347. bbox
  70348. );
  70349. }
  70350. if (this.ui.button) {
  70351. if (style.padding) {
  70352. delete style.padding;
  70353. }
  70354. if (caption.name === "div") {
  70355. caption.name = "span";
  70356. }
  70357. ui.children.push(caption);
  70358. return _utils.HTMLResult.success(html, bbox);
  70359. } else if (this.ui.checkButton) {
  70360. caption.attributes.class[0] = "xfaCaptionForCheckButton";
  70361. }
  70362. if (!ui.attributes.class) {
  70363. ui.attributes.class = [];
  70364. }
  70365. ui.children.splice(0, 0, caption);
  70366. switch (this.caption.placement) {
  70367. case "left":
  70368. ui.attributes.class.push("xfaLeft");
  70369. break;
  70370. case "right":
  70371. ui.attributes.class.push("xfaRight");
  70372. break;
  70373. case "top":
  70374. ui.attributes.class.push("xfaTop");
  70375. break;
  70376. case "bottom":
  70377. ui.attributes.class.push("xfaBottom");
  70378. break;
  70379. case "inline":
  70380. ui.attributes.class.push("xfaLeft");
  70381. break;
  70382. }
  70383. this.w = savedW;
  70384. this.h = savedH;
  70385. return _utils.HTMLResult.success(
  70386. (0, _html_utils.createWrapper)(this, html),
  70387. bbox
  70388. );
  70389. }
  70390. }
  70391. exports.Field = Field;
  70392. class Fill extends _xfa_object.XFAObject {
  70393. constructor(attributes) {
  70394. super(TEMPLATE_NS_ID, "fill", true);
  70395. this.id = attributes.id || "";
  70396. this.presence = (0, _utils.getStringOption)(attributes.presence, [
  70397. "visible",
  70398. "hidden",
  70399. "inactive",
  70400. "invisible",
  70401. ]);
  70402. this.use = attributes.use || "";
  70403. this.usehref = attributes.usehref || "";
  70404. this.color = null;
  70405. this.extras = null;
  70406. this.linear = null;
  70407. this.pattern = null;
  70408. this.radial = null;
  70409. this.solid = null;
  70410. this.stipple = null;
  70411. }
  70412. [_xfa_object.$toStyle]() {
  70413. const parent = this[_xfa_object.$getParent]();
  70414. const grandpa = parent[_xfa_object.$getParent]();
  70415. const ggrandpa = grandpa[_xfa_object.$getParent]();
  70416. const style = Object.create(null);
  70417. let propName = "color";
  70418. let altPropName = propName;
  70419. if (parent instanceof Border) {
  70420. propName = "background-color";
  70421. altPropName = "background";
  70422. if (ggrandpa instanceof Ui) {
  70423. style.backgroundColor = "white";
  70424. }
  70425. }
  70426. if (parent instanceof Rectangle || parent instanceof Arc) {
  70427. propName = altPropName = "fill";
  70428. style.fill = "white";
  70429. }
  70430. for (const name of Object.getOwnPropertyNames(this)) {
  70431. if (name === "extras" || name === "color") {
  70432. continue;
  70433. }
  70434. const obj = this[name];
  70435. if (!(obj instanceof _xfa_object.XFAObject)) {
  70436. continue;
  70437. }
  70438. const color = obj[_xfa_object.$toStyle](this.color);
  70439. if (color) {
  70440. style[color.startsWith("#") ? propName : altPropName] = color;
  70441. }
  70442. return style;
  70443. }
  70444. if (this.color && this.color.value) {
  70445. const color = this.color[_xfa_object.$toStyle]();
  70446. style[color.startsWith("#") ? propName : altPropName] = color;
  70447. }
  70448. return style;
  70449. }
  70450. }
  70451. class Filter extends _xfa_object.XFAObject {
  70452. constructor(attributes) {
  70453. super(TEMPLATE_NS_ID, "filter", true);
  70454. this.addRevocationInfo = (0, _utils.getStringOption)(
  70455. attributes.addRevocationInfo,
  70456. ["", "required", "optional", "none"]
  70457. );
  70458. this.id = attributes.id || "";
  70459. this.name = attributes.name || "";
  70460. this.use = attributes.use || "";
  70461. this.usehref = attributes.usehref || "";
  70462. this.version = (0, _utils.getInteger)({
  70463. data: this.version,
  70464. defaultValue: 5,
  70465. validate: (x) => x >= 1 && x <= 5,
  70466. });
  70467. this.appearanceFilter = null;
  70468. this.certificates = null;
  70469. this.digestMethods = null;
  70470. this.encodings = null;
  70471. this.encryptionMethods = null;
  70472. this.handler = null;
  70473. this.lockDocument = null;
  70474. this.mdp = null;
  70475. this.reasons = null;
  70476. this.timeStamp = null;
  70477. }
  70478. }
  70479. class Float extends _xfa_object.ContentObject {
  70480. constructor(attributes) {
  70481. super(TEMPLATE_NS_ID, "float");
  70482. this.id = attributes.id || "";
  70483. this.name = attributes.name || "";
  70484. this.use = attributes.use || "";
  70485. this.usehref = attributes.usehref || "";
  70486. }
  70487. [_xfa_object.$finalize]() {
  70488. const number = parseFloat(this[_xfa_object.$content].trim());
  70489. this[_xfa_object.$content] = isNaN(number) ? null : number;
  70490. }
  70491. [_xfa_object.$toHTML](availableSpace) {
  70492. return valueToHtml(
  70493. this[_xfa_object.$content] !== null
  70494. ? this[_xfa_object.$content].toString()
  70495. : ""
  70496. );
  70497. }
  70498. }
  70499. class Font extends _xfa_object.XFAObject {
  70500. constructor(attributes) {
  70501. super(TEMPLATE_NS_ID, "font", true);
  70502. this.baselineShift = (0, _utils.getMeasurement)(
  70503. attributes.baselineShift
  70504. );
  70505. this.fontHorizontalScale = (0, _utils.getFloat)({
  70506. data: attributes.fontHorizontalScale,
  70507. defaultValue: 100,
  70508. validate: (x) => x >= 0,
  70509. });
  70510. this.fontVerticalScale = (0, _utils.getFloat)({
  70511. data: attributes.fontVerticalScale,
  70512. defaultValue: 100,
  70513. validate: (x) => x >= 0,
  70514. });
  70515. this.id = attributes.id || "";
  70516. this.kerningMode = (0, _utils.getStringOption)(
  70517. attributes.kerningMode,
  70518. ["none", "pair"]
  70519. );
  70520. this.letterSpacing = (0, _utils.getMeasurement)(
  70521. attributes.letterSpacing,
  70522. "0"
  70523. );
  70524. this.lineThrough = (0, _utils.getInteger)({
  70525. data: attributes.lineThrough,
  70526. defaultValue: 0,
  70527. validate: (x) => x === 1 || x === 2,
  70528. });
  70529. this.lineThroughPeriod = (0, _utils.getStringOption)(
  70530. attributes.lineThroughPeriod,
  70531. ["all", "word"]
  70532. );
  70533. this.overline = (0, _utils.getInteger)({
  70534. data: attributes.overline,
  70535. defaultValue: 0,
  70536. validate: (x) => x === 1 || x === 2,
  70537. });
  70538. this.overlinePeriod = (0, _utils.getStringOption)(
  70539. attributes.overlinePeriod,
  70540. ["all", "word"]
  70541. );
  70542. this.posture = (0, _utils.getStringOption)(attributes.posture, [
  70543. "normal",
  70544. "italic",
  70545. ]);
  70546. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  70547. this.typeface = attributes.typeface || "Courier";
  70548. this.underline = (0, _utils.getInteger)({
  70549. data: attributes.underline,
  70550. defaultValue: 0,
  70551. validate: (x) => x === 1 || x === 2,
  70552. });
  70553. this.underlinePeriod = (0, _utils.getStringOption)(
  70554. attributes.underlinePeriod,
  70555. ["all", "word"]
  70556. );
  70557. this.use = attributes.use || "";
  70558. this.usehref = attributes.usehref || "";
  70559. this.weight = (0, _utils.getStringOption)(attributes.weight, [
  70560. "normal",
  70561. "bold",
  70562. ]);
  70563. this.extras = null;
  70564. this.fill = null;
  70565. }
  70566. [_xfa_object.$clean](builder) {
  70567. super[_xfa_object.$clean](builder);
  70568. this[_xfa_object.$globalData].usedTypefaces.add(this.typeface);
  70569. }
  70570. [_xfa_object.$toStyle]() {
  70571. const style = (0, _html_utils.toStyle)(this, "fill");
  70572. const color = style.color;
  70573. if (color) {
  70574. if (color === "#000000") {
  70575. delete style.color;
  70576. } else if (!color.startsWith("#")) {
  70577. style.background = color;
  70578. style.backgroundClip = "text";
  70579. style.color = "transparent";
  70580. }
  70581. }
  70582. if (this.baselineShift) {
  70583. style.verticalAlign = (0, _html_utils.measureToString)(
  70584. this.baselineShift
  70585. );
  70586. }
  70587. style.fontKerning = this.kerningMode === "none" ? "none" : "normal";
  70588. style.letterSpacing = (0, _html_utils.measureToString)(
  70589. this.letterSpacing
  70590. );
  70591. if (this.lineThrough !== 0) {
  70592. style.textDecoration = "line-through";
  70593. if (this.lineThrough === 2) {
  70594. style.textDecorationStyle = "double";
  70595. }
  70596. }
  70597. if (this.overline !== 0) {
  70598. style.textDecoration = "overline";
  70599. if (this.overline === 2) {
  70600. style.textDecorationStyle = "double";
  70601. }
  70602. }
  70603. style.fontStyle = this.posture;
  70604. style.fontSize = (0, _html_utils.measureToString)(0.99 * this.size);
  70605. (0, _html_utils.setFontFamily)(
  70606. this,
  70607. this,
  70608. this[_xfa_object.$globalData].fontFinder,
  70609. style
  70610. );
  70611. if (this.underline !== 0) {
  70612. style.textDecoration = "underline";
  70613. if (this.underline === 2) {
  70614. style.textDecorationStyle = "double";
  70615. }
  70616. }
  70617. style.fontWeight = this.weight;
  70618. return style;
  70619. }
  70620. }
  70621. class Format extends _xfa_object.XFAObject {
  70622. constructor(attributes) {
  70623. super(TEMPLATE_NS_ID, "format", true);
  70624. this.id = attributes.id || "";
  70625. this.use = attributes.use || "";
  70626. this.usehref = attributes.usehref || "";
  70627. this.extras = null;
  70628. this.picture = null;
  70629. }
  70630. }
  70631. class Handler extends _xfa_object.StringObject {
  70632. constructor(attributes) {
  70633. super(TEMPLATE_NS_ID, "handler");
  70634. this.id = attributes.id || "";
  70635. this.type = (0, _utils.getStringOption)(attributes.type, [
  70636. "optional",
  70637. "required",
  70638. ]);
  70639. this.use = attributes.use || "";
  70640. this.usehref = attributes.usehref || "";
  70641. }
  70642. }
  70643. class Hyphenation extends _xfa_object.XFAObject {
  70644. constructor(attributes) {
  70645. super(TEMPLATE_NS_ID, "hyphenation");
  70646. this.excludeAllCaps = (0, _utils.getInteger)({
  70647. data: attributes.excludeAllCaps,
  70648. defaultValue: 0,
  70649. validate: (x) => x === 1,
  70650. });
  70651. this.excludeInitialCap = (0, _utils.getInteger)({
  70652. data: attributes.excludeInitialCap,
  70653. defaultValue: 0,
  70654. validate: (x) => x === 1,
  70655. });
  70656. this.hyphenate = (0, _utils.getInteger)({
  70657. data: attributes.hyphenate,
  70658. defaultValue: 0,
  70659. validate: (x) => x === 1,
  70660. });
  70661. this.id = attributes.id || "";
  70662. this.pushCharacterCount = (0, _utils.getInteger)({
  70663. data: attributes.pushCharacterCount,
  70664. defaultValue: 3,
  70665. validate: (x) => x >= 0,
  70666. });
  70667. this.remainCharacterCount = (0, _utils.getInteger)({
  70668. data: attributes.remainCharacterCount,
  70669. defaultValue: 3,
  70670. validate: (x) => x >= 0,
  70671. });
  70672. this.use = attributes.use || "";
  70673. this.usehref = attributes.usehref || "";
  70674. this.wordCharacterCount = (0, _utils.getInteger)({
  70675. data: attributes.wordCharacterCount,
  70676. defaultValue: 7,
  70677. validate: (x) => x >= 0,
  70678. });
  70679. }
  70680. }
  70681. class Image extends _xfa_object.StringObject {
  70682. constructor(attributes) {
  70683. super(TEMPLATE_NS_ID, "image");
  70684. this.aspect = (0, _utils.getStringOption)(attributes.aspect, [
  70685. "fit",
  70686. "actual",
  70687. "height",
  70688. "none",
  70689. "width",
  70690. ]);
  70691. this.contentType = attributes.contentType || "";
  70692. this.href = attributes.href || "";
  70693. this.id = attributes.id || "";
  70694. this.name = attributes.name || "";
  70695. this.transferEncoding = (0, _utils.getStringOption)(
  70696. attributes.transferEncoding,
  70697. ["base64", "none", "package"]
  70698. );
  70699. this.use = attributes.use || "";
  70700. this.usehref = attributes.usehref || "";
  70701. }
  70702. [_xfa_object.$toHTML]() {
  70703. if (
  70704. this.contentType &&
  70705. !MIMES.has(this.contentType.toLowerCase())
  70706. ) {
  70707. return _utils.HTMLResult.EMPTY;
  70708. }
  70709. let buffer =
  70710. this[_xfa_object.$globalData].images &&
  70711. this[_xfa_object.$globalData].images.get(this.href);
  70712. if (!buffer && (this.href || !this[_xfa_object.$content])) {
  70713. return _utils.HTMLResult.EMPTY;
  70714. }
  70715. if (!buffer && this.transferEncoding === "base64") {
  70716. buffer = (0, _util.stringToBytes)(
  70717. atob(this[_xfa_object.$content])
  70718. );
  70719. }
  70720. if (!buffer) {
  70721. return _utils.HTMLResult.EMPTY;
  70722. }
  70723. if (!this.contentType) {
  70724. for (const [header, type] of IMAGES_HEADERS) {
  70725. if (
  70726. buffer.length > header.length &&
  70727. header.every((x, i) => x === buffer[i])
  70728. ) {
  70729. this.contentType = type;
  70730. break;
  70731. }
  70732. }
  70733. if (!this.contentType) {
  70734. return _utils.HTMLResult.EMPTY;
  70735. }
  70736. }
  70737. const blob = new Blob([buffer], {
  70738. type: this.contentType,
  70739. });
  70740. let style;
  70741. switch (this.aspect) {
  70742. case "fit":
  70743. case "actual":
  70744. break;
  70745. case "height":
  70746. style = {
  70747. height: "100%",
  70748. objectFit: "fill",
  70749. };
  70750. break;
  70751. case "none":
  70752. style = {
  70753. width: "100%",
  70754. height: "100%",
  70755. objectFit: "fill",
  70756. };
  70757. break;
  70758. case "width":
  70759. style = {
  70760. width: "100%",
  70761. objectFit: "fill",
  70762. };
  70763. break;
  70764. }
  70765. const parent = this[_xfa_object.$getParent]();
  70766. return _utils.HTMLResult.success({
  70767. name: "img",
  70768. attributes: {
  70769. class: ["xfaImage"],
  70770. style,
  70771. src: URL.createObjectURL(blob),
  70772. alt: parent
  70773. ? ariaLabel(parent[_xfa_object.$getParent]())
  70774. : null,
  70775. },
  70776. });
  70777. }
  70778. }
  70779. class ImageEdit extends _xfa_object.XFAObject {
  70780. constructor(attributes) {
  70781. super(TEMPLATE_NS_ID, "imageEdit", true);
  70782. this.data = (0, _utils.getStringOption)(attributes.data, [
  70783. "link",
  70784. "embed",
  70785. ]);
  70786. this.id = attributes.id || "";
  70787. this.use = attributes.use || "";
  70788. this.usehref = attributes.usehref || "";
  70789. this.border = null;
  70790. this.extras = null;
  70791. this.margin = null;
  70792. }
  70793. [_xfa_object.$toHTML](availableSpace) {
  70794. if (this.data === "embed") {
  70795. return _utils.HTMLResult.success({
  70796. name: "div",
  70797. children: [],
  70798. attributes: {},
  70799. });
  70800. }
  70801. return _utils.HTMLResult.EMPTY;
  70802. }
  70803. }
  70804. class Integer extends _xfa_object.ContentObject {
  70805. constructor(attributes) {
  70806. super(TEMPLATE_NS_ID, "integer");
  70807. this.id = attributes.id || "";
  70808. this.name = attributes.name || "";
  70809. this.use = attributes.use || "";
  70810. this.usehref = attributes.usehref || "";
  70811. }
  70812. [_xfa_object.$finalize]() {
  70813. const number = parseInt(this[_xfa_object.$content].trim(), 10);
  70814. this[_xfa_object.$content] = isNaN(number) ? null : number;
  70815. }
  70816. [_xfa_object.$toHTML](availableSpace) {
  70817. return valueToHtml(
  70818. this[_xfa_object.$content] !== null
  70819. ? this[_xfa_object.$content].toString()
  70820. : ""
  70821. );
  70822. }
  70823. }
  70824. class Issuers extends _xfa_object.XFAObject {
  70825. constructor(attributes) {
  70826. super(TEMPLATE_NS_ID, "issuers", true);
  70827. this.id = attributes.id || "";
  70828. this.type = (0, _utils.getStringOption)(attributes.type, [
  70829. "optional",
  70830. "required",
  70831. ]);
  70832. this.use = attributes.use || "";
  70833. this.usehref = attributes.usehref || "";
  70834. this.certificate = new _xfa_object.XFAObjectArray();
  70835. }
  70836. }
  70837. class Items extends _xfa_object.XFAObject {
  70838. constructor(attributes) {
  70839. super(TEMPLATE_NS_ID, "items", true);
  70840. this.id = attributes.id || "";
  70841. this.name = attributes.name || "";
  70842. this.presence = (0, _utils.getStringOption)(attributes.presence, [
  70843. "visible",
  70844. "hidden",
  70845. "inactive",
  70846. "invisible",
  70847. ]);
  70848. this.ref = attributes.ref || "";
  70849. this.save = (0, _utils.getInteger)({
  70850. data: attributes.save,
  70851. defaultValue: 0,
  70852. validate: (x) => x === 1,
  70853. });
  70854. this.use = attributes.use || "";
  70855. this.usehref = attributes.usehref || "";
  70856. this.boolean = new _xfa_object.XFAObjectArray();
  70857. this.date = new _xfa_object.XFAObjectArray();
  70858. this.dateTime = new _xfa_object.XFAObjectArray();
  70859. this.decimal = new _xfa_object.XFAObjectArray();
  70860. this.exData = new _xfa_object.XFAObjectArray();
  70861. this.float = new _xfa_object.XFAObjectArray();
  70862. this.image = new _xfa_object.XFAObjectArray();
  70863. this.integer = new _xfa_object.XFAObjectArray();
  70864. this.text = new _xfa_object.XFAObjectArray();
  70865. this.time = new _xfa_object.XFAObjectArray();
  70866. }
  70867. [_xfa_object.$toHTML]() {
  70868. const output = [];
  70869. for (const child of this[_xfa_object.$getChildren]()) {
  70870. output.push(child[_xfa_object.$text]());
  70871. }
  70872. return _utils.HTMLResult.success(output);
  70873. }
  70874. }
  70875. exports.Items = Items;
  70876. class Keep extends _xfa_object.XFAObject {
  70877. constructor(attributes) {
  70878. super(TEMPLATE_NS_ID, "keep", true);
  70879. this.id = attributes.id || "";
  70880. const options = ["none", "contentArea", "pageArea"];
  70881. this.intact = (0, _utils.getStringOption)(
  70882. attributes.intact,
  70883. options
  70884. );
  70885. this.next = (0, _utils.getStringOption)(attributes.next, options);
  70886. this.previous = (0, _utils.getStringOption)(
  70887. attributes.previous,
  70888. options
  70889. );
  70890. this.use = attributes.use || "";
  70891. this.usehref = attributes.usehref || "";
  70892. this.extras = null;
  70893. }
  70894. }
  70895. class KeyUsage extends _xfa_object.XFAObject {
  70896. constructor(attributes) {
  70897. super(TEMPLATE_NS_ID, "keyUsage");
  70898. const options = ["", "yes", "no"];
  70899. this.crlSign = (0, _utils.getStringOption)(
  70900. attributes.crlSign,
  70901. options
  70902. );
  70903. this.dataEncipherment = (0, _utils.getStringOption)(
  70904. attributes.dataEncipherment,
  70905. options
  70906. );
  70907. this.decipherOnly = (0, _utils.getStringOption)(
  70908. attributes.decipherOnly,
  70909. options
  70910. );
  70911. this.digitalSignature = (0, _utils.getStringOption)(
  70912. attributes.digitalSignature,
  70913. options
  70914. );
  70915. this.encipherOnly = (0, _utils.getStringOption)(
  70916. attributes.encipherOnly,
  70917. options
  70918. );
  70919. this.id = attributes.id || "";
  70920. this.keyAgreement = (0, _utils.getStringOption)(
  70921. attributes.keyAgreement,
  70922. options
  70923. );
  70924. this.keyCertSign = (0, _utils.getStringOption)(
  70925. attributes.keyCertSign,
  70926. options
  70927. );
  70928. this.keyEncipherment = (0, _utils.getStringOption)(
  70929. attributes.keyEncipherment,
  70930. options
  70931. );
  70932. this.nonRepudiation = (0, _utils.getStringOption)(
  70933. attributes.nonRepudiation,
  70934. options
  70935. );
  70936. this.type = (0, _utils.getStringOption)(attributes.type, [
  70937. "optional",
  70938. "required",
  70939. ]);
  70940. this.use = attributes.use || "";
  70941. this.usehref = attributes.usehref || "";
  70942. }
  70943. }
  70944. class Line extends _xfa_object.XFAObject {
  70945. constructor(attributes) {
  70946. super(TEMPLATE_NS_ID, "line", true);
  70947. this.hand = (0, _utils.getStringOption)(attributes.hand, [
  70948. "even",
  70949. "left",
  70950. "right",
  70951. ]);
  70952. this.id = attributes.id || "";
  70953. this.slope = (0, _utils.getStringOption)(attributes.slope, [
  70954. "\\",
  70955. "/",
  70956. ]);
  70957. this.use = attributes.use || "";
  70958. this.usehref = attributes.usehref || "";
  70959. this.edge = null;
  70960. }
  70961. [_xfa_object.$toHTML]() {
  70962. const parent =
  70963. this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  70964. const edge = this.edge || new Edge({});
  70965. const edgeStyle = edge[_xfa_object.$toStyle]();
  70966. const style = Object.create(null);
  70967. const thickness = edge.presence === "visible" ? edge.thickness : 0;
  70968. style.strokeWidth = (0, _html_utils.measureToString)(thickness);
  70969. style.stroke = edgeStyle.color;
  70970. let x1, y1, x2, y2;
  70971. let width = "100%";
  70972. let height = "100%";
  70973. if (parent.w <= thickness) {
  70974. [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"];
  70975. width = style.strokeWidth;
  70976. } else if (parent.h <= thickness) {
  70977. [x1, y1, x2, y2] = [0, "50%", "100%", "50%"];
  70978. height = style.strokeWidth;
  70979. } else {
  70980. if (this.slope === "\\") {
  70981. [x1, y1, x2, y2] = [0, 0, "100%", "100%"];
  70982. } else {
  70983. [x1, y1, x2, y2] = [0, "100%", "100%", 0];
  70984. }
  70985. }
  70986. const line = {
  70987. name: "line",
  70988. attributes: {
  70989. xmlns: SVG_NS,
  70990. x1,
  70991. y1,
  70992. x2,
  70993. y2,
  70994. style,
  70995. },
  70996. };
  70997. const svg = {
  70998. name: "svg",
  70999. children: [line],
  71000. attributes: {
  71001. xmlns: SVG_NS,
  71002. width,
  71003. height,
  71004. style: {
  71005. overflow: "visible",
  71006. },
  71007. },
  71008. };
  71009. if (hasMargin(parent)) {
  71010. return _utils.HTMLResult.success({
  71011. name: "div",
  71012. attributes: {
  71013. style: {
  71014. display: "inline",
  71015. width: "100%",
  71016. height: "100%",
  71017. },
  71018. },
  71019. children: [svg],
  71020. });
  71021. }
  71022. svg.attributes.style.position = "absolute";
  71023. return _utils.HTMLResult.success(svg);
  71024. }
  71025. }
  71026. class Linear extends _xfa_object.XFAObject {
  71027. constructor(attributes) {
  71028. super(TEMPLATE_NS_ID, "linear", true);
  71029. this.id = attributes.id || "";
  71030. this.type = (0, _utils.getStringOption)(attributes.type, [
  71031. "toRight",
  71032. "toBottom",
  71033. "toLeft",
  71034. "toTop",
  71035. ]);
  71036. this.use = attributes.use || "";
  71037. this.usehref = attributes.usehref || "";
  71038. this.color = null;
  71039. this.extras = null;
  71040. }
  71041. [_xfa_object.$toStyle](startColor) {
  71042. startColor = startColor
  71043. ? startColor[_xfa_object.$toStyle]()
  71044. : "#FFFFFF";
  71045. const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
  71046. const endColor = this.color
  71047. ? this.color[_xfa_object.$toStyle]()
  71048. : "#000000";
  71049. return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
  71050. }
  71051. }
  71052. class LockDocument extends _xfa_object.ContentObject {
  71053. constructor(attributes) {
  71054. super(TEMPLATE_NS_ID, "lockDocument");
  71055. this.id = attributes.id || "";
  71056. this.type = (0, _utils.getStringOption)(attributes.type, [
  71057. "optional",
  71058. "required",
  71059. ]);
  71060. this.use = attributes.use || "";
  71061. this.usehref = attributes.usehref || "";
  71062. }
  71063. [_xfa_object.$finalize]() {
  71064. this[_xfa_object.$content] = (0, _utils.getStringOption)(
  71065. this[_xfa_object.$content],
  71066. ["auto", "0", "1"]
  71067. );
  71068. }
  71069. }
  71070. class Manifest extends _xfa_object.XFAObject {
  71071. constructor(attributes) {
  71072. super(TEMPLATE_NS_ID, "manifest", true);
  71073. this.action = (0, _utils.getStringOption)(attributes.action, [
  71074. "include",
  71075. "all",
  71076. "exclude",
  71077. ]);
  71078. this.id = attributes.id || "";
  71079. this.name = attributes.name || "";
  71080. this.use = attributes.use || "";
  71081. this.usehref = attributes.usehref || "";
  71082. this.extras = null;
  71083. this.ref = new _xfa_object.XFAObjectArray();
  71084. }
  71085. }
  71086. class Margin extends _xfa_object.XFAObject {
  71087. constructor(attributes) {
  71088. super(TEMPLATE_NS_ID, "margin", true);
  71089. this.bottomInset = (0, _utils.getMeasurement)(
  71090. attributes.bottomInset,
  71091. "0"
  71092. );
  71093. this.id = attributes.id || "";
  71094. this.leftInset = (0, _utils.getMeasurement)(
  71095. attributes.leftInset,
  71096. "0"
  71097. );
  71098. this.rightInset = (0, _utils.getMeasurement)(
  71099. attributes.rightInset,
  71100. "0"
  71101. );
  71102. this.topInset = (0, _utils.getMeasurement)(
  71103. attributes.topInset,
  71104. "0"
  71105. );
  71106. this.use = attributes.use || "";
  71107. this.usehref = attributes.usehref || "";
  71108. this.extras = null;
  71109. }
  71110. [_xfa_object.$toStyle]() {
  71111. return {
  71112. margin:
  71113. (0, _html_utils.measureToString)(this.topInset) +
  71114. " " +
  71115. (0, _html_utils.measureToString)(this.rightInset) +
  71116. " " +
  71117. (0, _html_utils.measureToString)(this.bottomInset) +
  71118. " " +
  71119. (0, _html_utils.measureToString)(this.leftInset),
  71120. };
  71121. }
  71122. }
  71123. class Mdp extends _xfa_object.XFAObject {
  71124. constructor(attributes) {
  71125. super(TEMPLATE_NS_ID, "mdp");
  71126. this.id = attributes.id || "";
  71127. this.permissions = (0, _utils.getInteger)({
  71128. data: attributes.permissions,
  71129. defaultValue: 2,
  71130. validate: (x) => x === 1 || x === 3,
  71131. });
  71132. this.signatureType = (0, _utils.getStringOption)(
  71133. attributes.signatureType,
  71134. ["filler", "author"]
  71135. );
  71136. this.use = attributes.use || "";
  71137. this.usehref = attributes.usehref || "";
  71138. }
  71139. }
  71140. class Medium extends _xfa_object.XFAObject {
  71141. constructor(attributes) {
  71142. super(TEMPLATE_NS_ID, "medium");
  71143. this.id = attributes.id || "";
  71144. this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox);
  71145. this.long = (0, _utils.getMeasurement)(attributes.long);
  71146. this.orientation = (0, _utils.getStringOption)(
  71147. attributes.orientation,
  71148. ["portrait", "landscape"]
  71149. );
  71150. this.short = (0, _utils.getMeasurement)(attributes.short);
  71151. this.stock = attributes.stock || "";
  71152. this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, [
  71153. "auto",
  71154. "delegate",
  71155. "pageFront",
  71156. ]);
  71157. this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, [
  71158. "auto",
  71159. "delegate",
  71160. ]);
  71161. this.use = attributes.use || "";
  71162. this.usehref = attributes.usehref || "";
  71163. }
  71164. }
  71165. class Message extends _xfa_object.XFAObject {
  71166. constructor(attributes) {
  71167. super(TEMPLATE_NS_ID, "message", true);
  71168. this.id = attributes.id || "";
  71169. this.use = attributes.use || "";
  71170. this.usehref = attributes.usehref || "";
  71171. this.text = new _xfa_object.XFAObjectArray();
  71172. }
  71173. }
  71174. class NumericEdit extends _xfa_object.XFAObject {
  71175. constructor(attributes) {
  71176. super(TEMPLATE_NS_ID, "numericEdit", true);
  71177. this.hScrollPolicy = (0, _utils.getStringOption)(
  71178. attributes.hScrollPolicy,
  71179. ["auto", "off", "on"]
  71180. );
  71181. this.id = attributes.id || "";
  71182. this.use = attributes.use || "";
  71183. this.usehref = attributes.usehref || "";
  71184. this.border = null;
  71185. this.comb = null;
  71186. this.extras = null;
  71187. this.margin = null;
  71188. }
  71189. [_xfa_object.$toHTML](availableSpace) {
  71190. const style = (0, _html_utils.toStyle)(
  71191. this,
  71192. "border",
  71193. "font",
  71194. "margin"
  71195. );
  71196. const field =
  71197. this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  71198. const html = {
  71199. name: "input",
  71200. attributes: {
  71201. type: "text",
  71202. fieldId: field[_xfa_object.$uid],
  71203. dataId:
  71204. (field[_xfa_object.$data] &&
  71205. field[_xfa_object.$data][_xfa_object.$uid]) ||
  71206. field[_xfa_object.$uid],
  71207. class: ["xfaTextfield"],
  71208. style,
  71209. "aria-label": ariaLabel(field),
  71210. "aria-required": false,
  71211. },
  71212. };
  71213. if (isRequired(field)) {
  71214. html.attributes["aria-required"] = true;
  71215. html.attributes.required = true;
  71216. }
  71217. return _utils.HTMLResult.success({
  71218. name: "label",
  71219. attributes: {
  71220. class: ["xfaLabel"],
  71221. },
  71222. children: [html],
  71223. });
  71224. }
  71225. }
  71226. class Occur extends _xfa_object.XFAObject {
  71227. constructor(attributes) {
  71228. super(TEMPLATE_NS_ID, "occur", true);
  71229. this.id = attributes.id || "";
  71230. this.initial =
  71231. attributes.initial !== ""
  71232. ? (0, _utils.getInteger)({
  71233. data: attributes.initial,
  71234. defaultValue: "",
  71235. validate: (x) => true,
  71236. })
  71237. : "";
  71238. this.max =
  71239. attributes.max !== ""
  71240. ? (0, _utils.getInteger)({
  71241. data: attributes.max,
  71242. defaultValue: 1,
  71243. validate: (x) => true,
  71244. })
  71245. : "";
  71246. this.min =
  71247. attributes.min !== ""
  71248. ? (0, _utils.getInteger)({
  71249. data: attributes.min,
  71250. defaultValue: 1,
  71251. validate: (x) => true,
  71252. })
  71253. : "";
  71254. this.use = attributes.use || "";
  71255. this.usehref = attributes.usehref || "";
  71256. this.extras = null;
  71257. }
  71258. [_xfa_object.$clean]() {
  71259. const parent = this[_xfa_object.$getParent]();
  71260. const originalMin = this.min;
  71261. if (this.min === "") {
  71262. this.min =
  71263. parent instanceof PageArea || parent instanceof PageSet ? 0 : 1;
  71264. }
  71265. if (this.max === "") {
  71266. if (originalMin === "") {
  71267. this.max =
  71268. parent instanceof PageArea || parent instanceof PageSet
  71269. ? -1
  71270. : 1;
  71271. } else {
  71272. this.max = this.min;
  71273. }
  71274. }
  71275. if (this.max !== -1 && this.max < this.min) {
  71276. this.max = this.min;
  71277. }
  71278. if (this.initial === "") {
  71279. this.initial = parent instanceof Template ? 1 : this.min;
  71280. }
  71281. }
  71282. }
  71283. class Oid extends _xfa_object.StringObject {
  71284. constructor(attributes) {
  71285. super(TEMPLATE_NS_ID, "oid");
  71286. this.id = attributes.id || "";
  71287. this.name = attributes.name || "";
  71288. this.use = attributes.use || "";
  71289. this.usehref = attributes.usehref || "";
  71290. }
  71291. }
  71292. class Oids extends _xfa_object.XFAObject {
  71293. constructor(attributes) {
  71294. super(TEMPLATE_NS_ID, "oids", true);
  71295. this.id = attributes.id || "";
  71296. this.type = (0, _utils.getStringOption)(attributes.type, [
  71297. "optional",
  71298. "required",
  71299. ]);
  71300. this.use = attributes.use || "";
  71301. this.usehref = attributes.usehref || "";
  71302. this.oid = new _xfa_object.XFAObjectArray();
  71303. }
  71304. }
  71305. class Overflow extends _xfa_object.XFAObject {
  71306. constructor(attributes) {
  71307. super(TEMPLATE_NS_ID, "overflow");
  71308. this.id = attributes.id || "";
  71309. this.leader = attributes.leader || "";
  71310. this.target = attributes.target || "";
  71311. this.trailer = attributes.trailer || "";
  71312. this.use = attributes.use || "";
  71313. this.usehref = attributes.usehref || "";
  71314. }
  71315. [_xfa_object.$getExtra]() {
  71316. if (!this[_xfa_object.$extra]) {
  71317. const parent = this[_xfa_object.$getParent]();
  71318. const root = this[_xfa_object.$getTemplateRoot]();
  71319. const target = root[_xfa_object.$searchNode](this.target, parent);
  71320. const leader = root[_xfa_object.$searchNode](this.leader, parent);
  71321. const trailer = root[_xfa_object.$searchNode](
  71322. this.trailer,
  71323. parent
  71324. );
  71325. this[_xfa_object.$extra] = {
  71326. target: (target && target[0]) || null,
  71327. leader: (leader && leader[0]) || null,
  71328. trailer: (trailer && trailer[0]) || null,
  71329. addLeader: false,
  71330. addTrailer: false,
  71331. };
  71332. }
  71333. return this[_xfa_object.$extra];
  71334. }
  71335. }
  71336. class PageArea extends _xfa_object.XFAObject {
  71337. constructor(attributes) {
  71338. super(TEMPLATE_NS_ID, "pageArea", true);
  71339. this.blankOrNotBlank = (0, _utils.getStringOption)(
  71340. attributes.blankOrNotBlank,
  71341. ["any", "blank", "notBlank"]
  71342. );
  71343. this.id = attributes.id || "";
  71344. this.initialNumber = (0, _utils.getInteger)({
  71345. data: attributes.initialNumber,
  71346. defaultValue: 1,
  71347. validate: (x) => true,
  71348. });
  71349. this.name = attributes.name || "";
  71350. this.numbered = (0, _utils.getInteger)({
  71351. data: attributes.numbered,
  71352. defaultValue: 1,
  71353. validate: (x) => true,
  71354. });
  71355. this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, [
  71356. "any",
  71357. "even",
  71358. "odd",
  71359. ]);
  71360. this.pagePosition = (0, _utils.getStringOption)(
  71361. attributes.pagePosition,
  71362. ["any", "first", "last", "only", "rest"]
  71363. );
  71364. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  71365. this.use = attributes.use || "";
  71366. this.usehref = attributes.usehref || "";
  71367. this.desc = null;
  71368. this.extras = null;
  71369. this.medium = null;
  71370. this.occur = null;
  71371. this.area = new _xfa_object.XFAObjectArray();
  71372. this.contentArea = new _xfa_object.XFAObjectArray();
  71373. this.draw = new _xfa_object.XFAObjectArray();
  71374. this.exclGroup = new _xfa_object.XFAObjectArray();
  71375. this.field = new _xfa_object.XFAObjectArray();
  71376. this.subform = new _xfa_object.XFAObjectArray();
  71377. }
  71378. [_xfa_object.$isUsable]() {
  71379. if (!this[_xfa_object.$extra]) {
  71380. this[_xfa_object.$extra] = {
  71381. numberOfUse: 0,
  71382. };
  71383. return true;
  71384. }
  71385. return (
  71386. !this.occur ||
  71387. this.occur.max === -1 ||
  71388. this[_xfa_object.$extra].numberOfUse < this.occur.max
  71389. );
  71390. }
  71391. [_xfa_object.$cleanPage]() {
  71392. delete this[_xfa_object.$extra];
  71393. }
  71394. [_xfa_object.$getNextPage]() {
  71395. if (!this[_xfa_object.$extra]) {
  71396. this[_xfa_object.$extra] = {
  71397. numberOfUse: 0,
  71398. };
  71399. }
  71400. const parent = this[_xfa_object.$getParent]();
  71401. if (parent.relation === "orderedOccurrence") {
  71402. if (this[_xfa_object.$isUsable]()) {
  71403. this[_xfa_object.$extra].numberOfUse += 1;
  71404. return this;
  71405. }
  71406. }
  71407. return parent[_xfa_object.$getNextPage]();
  71408. }
  71409. [_xfa_object.$getAvailableSpace]() {
  71410. return (
  71411. this[_xfa_object.$extra].space || {
  71412. width: 0,
  71413. height: 0,
  71414. }
  71415. );
  71416. }
  71417. [_xfa_object.$toHTML]() {
  71418. if (!this[_xfa_object.$extra]) {
  71419. this[_xfa_object.$extra] = {
  71420. numberOfUse: 1,
  71421. };
  71422. }
  71423. const children = [];
  71424. this[_xfa_object.$extra].children = children;
  71425. const style = Object.create(null);
  71426. if (this.medium && this.medium.short && this.medium.long) {
  71427. style.width = (0, _html_utils.measureToString)(this.medium.short);
  71428. style.height = (0, _html_utils.measureToString)(this.medium.long);
  71429. this[_xfa_object.$extra].space = {
  71430. width: this.medium.short,
  71431. height: this.medium.long,
  71432. };
  71433. if (this.medium.orientation === "landscape") {
  71434. const x = style.width;
  71435. style.width = style.height;
  71436. style.height = x;
  71437. this[_xfa_object.$extra].space = {
  71438. width: this.medium.long,
  71439. height: this.medium.short,
  71440. };
  71441. }
  71442. } else {
  71443. (0, _util.warn)(
  71444. "XFA - No medium specified in pageArea: please file a bug."
  71445. );
  71446. }
  71447. this[_xfa_object.$childrenToHTML]({
  71448. filter: new Set(["area", "draw", "field", "subform"]),
  71449. include: true,
  71450. });
  71451. this[_xfa_object.$childrenToHTML]({
  71452. filter: new Set(["contentArea"]),
  71453. include: true,
  71454. });
  71455. return _utils.HTMLResult.success({
  71456. name: "div",
  71457. children,
  71458. attributes: {
  71459. class: ["xfaPage"],
  71460. id: this[_xfa_object.$uid],
  71461. style,
  71462. xfaName: this.name,
  71463. },
  71464. });
  71465. }
  71466. }
  71467. class PageSet extends _xfa_object.XFAObject {
  71468. constructor(attributes) {
  71469. super(TEMPLATE_NS_ID, "pageSet", true);
  71470. this.duplexImposition = (0, _utils.getStringOption)(
  71471. attributes.duplexImposition,
  71472. ["longEdge", "shortEdge"]
  71473. );
  71474. this.id = attributes.id || "";
  71475. this.name = attributes.name || "";
  71476. this.relation = (0, _utils.getStringOption)(attributes.relation, [
  71477. "orderedOccurrence",
  71478. "duplexPaginated",
  71479. "simplexPaginated",
  71480. ]);
  71481. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  71482. this.use = attributes.use || "";
  71483. this.usehref = attributes.usehref || "";
  71484. this.extras = null;
  71485. this.occur = null;
  71486. this.pageArea = new _xfa_object.XFAObjectArray();
  71487. this.pageSet = new _xfa_object.XFAObjectArray();
  71488. }
  71489. [_xfa_object.$cleanPage]() {
  71490. for (const page of this.pageArea.children) {
  71491. page[_xfa_object.$cleanPage]();
  71492. }
  71493. for (const page of this.pageSet.children) {
  71494. page[_xfa_object.$cleanPage]();
  71495. }
  71496. }
  71497. [_xfa_object.$isUsable]() {
  71498. return (
  71499. !this.occur ||
  71500. this.occur.max === -1 ||
  71501. this[_xfa_object.$extra].numberOfUse < this.occur.max
  71502. );
  71503. }
  71504. [_xfa_object.$getNextPage]() {
  71505. if (!this[_xfa_object.$extra]) {
  71506. this[_xfa_object.$extra] = {
  71507. numberOfUse: 1,
  71508. pageIndex: -1,
  71509. pageSetIndex: -1,
  71510. };
  71511. }
  71512. if (this.relation === "orderedOccurrence") {
  71513. if (
  71514. this[_xfa_object.$extra].pageIndex + 1 <
  71515. this.pageArea.children.length
  71516. ) {
  71517. this[_xfa_object.$extra].pageIndex += 1;
  71518. const pageArea =
  71519. this.pageArea.children[this[_xfa_object.$extra].pageIndex];
  71520. return pageArea[_xfa_object.$getNextPage]();
  71521. }
  71522. if (
  71523. this[_xfa_object.$extra].pageSetIndex + 1 <
  71524. this.pageSet.children.length
  71525. ) {
  71526. this[_xfa_object.$extra].pageSetIndex += 1;
  71527. return this.pageSet.children[
  71528. this[_xfa_object.$extra].pageSetIndex
  71529. ][_xfa_object.$getNextPage]();
  71530. }
  71531. if (this[_xfa_object.$isUsable]()) {
  71532. this[_xfa_object.$extra].numberOfUse += 1;
  71533. this[_xfa_object.$extra].pageIndex = -1;
  71534. this[_xfa_object.$extra].pageSetIndex = -1;
  71535. return this[_xfa_object.$getNextPage]();
  71536. }
  71537. const parent = this[_xfa_object.$getParent]();
  71538. if (parent instanceof PageSet) {
  71539. return parent[_xfa_object.$getNextPage]();
  71540. }
  71541. this[_xfa_object.$cleanPage]();
  71542. return this[_xfa_object.$getNextPage]();
  71543. }
  71544. const pageNumber =
  71545. this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra]
  71546. .pageNumber;
  71547. const parity = pageNumber % 2 === 0 ? "even" : "odd";
  71548. const position = pageNumber === 0 ? "first" : "rest";
  71549. let page = this.pageArea.children.find(
  71550. (p) => p.oddOrEven === parity && p.pagePosition === position
  71551. );
  71552. if (page) {
  71553. return page;
  71554. }
  71555. page = this.pageArea.children.find(
  71556. (p) => p.oddOrEven === "any" && p.pagePosition === position
  71557. );
  71558. if (page) {
  71559. return page;
  71560. }
  71561. page = this.pageArea.children.find(
  71562. (p) => p.oddOrEven === "any" && p.pagePosition === "any"
  71563. );
  71564. if (page) {
  71565. return page;
  71566. }
  71567. return this.pageArea.children[0];
  71568. }
  71569. }
  71570. class Para extends _xfa_object.XFAObject {
  71571. constructor(attributes) {
  71572. super(TEMPLATE_NS_ID, "para", true);
  71573. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, [
  71574. "left",
  71575. "center",
  71576. "justify",
  71577. "justifyAll",
  71578. "radix",
  71579. "right",
  71580. ]);
  71581. this.id = attributes.id || "";
  71582. this.lineHeight = attributes.lineHeight
  71583. ? (0, _utils.getMeasurement)(attributes.lineHeight, "0pt")
  71584. : "";
  71585. this.marginLeft = attributes.marginLeft
  71586. ? (0, _utils.getMeasurement)(attributes.marginLeft, "0pt")
  71587. : "";
  71588. this.marginRight = attributes.marginRight
  71589. ? (0, _utils.getMeasurement)(attributes.marginRight, "0pt")
  71590. : "";
  71591. this.orphans = (0, _utils.getInteger)({
  71592. data: attributes.orphans,
  71593. defaultValue: 0,
  71594. validate: (x) => x >= 0,
  71595. });
  71596. this.preserve = attributes.preserve || "";
  71597. this.radixOffset = attributes.radixOffset
  71598. ? (0, _utils.getMeasurement)(attributes.radixOffset, "0pt")
  71599. : "";
  71600. this.spaceAbove = attributes.spaceAbove
  71601. ? (0, _utils.getMeasurement)(attributes.spaceAbove, "0pt")
  71602. : "";
  71603. this.spaceBelow = attributes.spaceBelow
  71604. ? (0, _utils.getMeasurement)(attributes.spaceBelow, "0pt")
  71605. : "";
  71606. this.tabDefault = attributes.tabDefault
  71607. ? (0, _utils.getMeasurement)(this.tabDefault)
  71608. : "";
  71609. this.tabStops = (attributes.tabStops || "")
  71610. .trim()
  71611. .split(/\s+/)
  71612. .map((x, i) => (i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x));
  71613. this.textIndent = attributes.textIndent
  71614. ? (0, _utils.getMeasurement)(attributes.textIndent, "0pt")
  71615. : "";
  71616. this.use = attributes.use || "";
  71617. this.usehref = attributes.usehref || "";
  71618. this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, [
  71619. "top",
  71620. "bottom",
  71621. "middle",
  71622. ]);
  71623. this.widows = (0, _utils.getInteger)({
  71624. data: attributes.widows,
  71625. defaultValue: 0,
  71626. validate: (x) => x >= 0,
  71627. });
  71628. this.hyphenation = null;
  71629. }
  71630. [_xfa_object.$toStyle]() {
  71631. const style = (0, _html_utils.toStyle)(this, "hAlign");
  71632. if (this.marginLeft !== "") {
  71633. style.paddingLeft = (0, _html_utils.measureToString)(
  71634. this.marginLeft
  71635. );
  71636. }
  71637. if (this.marginRight !== "") {
  71638. style.paddingight = (0, _html_utils.measureToString)(
  71639. this.marginRight
  71640. );
  71641. }
  71642. if (this.spaceAbove !== "") {
  71643. style.paddingTop = (0, _html_utils.measureToString)(
  71644. this.spaceAbove
  71645. );
  71646. }
  71647. if (this.spaceBelow !== "") {
  71648. style.paddingBottom = (0, _html_utils.measureToString)(
  71649. this.spaceBelow
  71650. );
  71651. }
  71652. if (this.textIndent !== "") {
  71653. style.textIndent = (0, _html_utils.measureToString)(
  71654. this.textIndent
  71655. );
  71656. (0, _html_utils.fixTextIndent)(style);
  71657. }
  71658. if (this.lineHeight > 0) {
  71659. style.lineHeight = (0, _html_utils.measureToString)(
  71660. this.lineHeight
  71661. );
  71662. }
  71663. if (this.tabDefault !== "") {
  71664. style.tabSize = (0, _html_utils.measureToString)(this.tabDefault);
  71665. }
  71666. if (this.tabStops.length > 0) {
  71667. }
  71668. if (this.hyphenatation) {
  71669. Object.assign(style, this.hyphenatation[_xfa_object.$toStyle]());
  71670. }
  71671. return style;
  71672. }
  71673. }
  71674. class PasswordEdit extends _xfa_object.XFAObject {
  71675. constructor(attributes) {
  71676. super(TEMPLATE_NS_ID, "passwordEdit", true);
  71677. this.hScrollPolicy = (0, _utils.getStringOption)(
  71678. attributes.hScrollPolicy,
  71679. ["auto", "off", "on"]
  71680. );
  71681. this.id = attributes.id || "";
  71682. this.passwordChar = attributes.passwordChar || "*";
  71683. this.use = attributes.use || "";
  71684. this.usehref = attributes.usehref || "";
  71685. this.border = null;
  71686. this.extras = null;
  71687. this.margin = null;
  71688. }
  71689. }
  71690. class Pattern extends _xfa_object.XFAObject {
  71691. constructor(attributes) {
  71692. super(TEMPLATE_NS_ID, "pattern", true);
  71693. this.id = attributes.id || "";
  71694. this.type = (0, _utils.getStringOption)(attributes.type, [
  71695. "crossHatch",
  71696. "crossDiagonal",
  71697. "diagonalLeft",
  71698. "diagonalRight",
  71699. "horizontal",
  71700. "vertical",
  71701. ]);
  71702. this.use = attributes.use || "";
  71703. this.usehref = attributes.usehref || "";
  71704. this.color = null;
  71705. this.extras = null;
  71706. }
  71707. [_xfa_object.$toStyle](startColor) {
  71708. startColor = startColor
  71709. ? startColor[_xfa_object.$toStyle]()
  71710. : "#FFFFFF";
  71711. const endColor = this.color
  71712. ? this.color[_xfa_object.$toStyle]()
  71713. : "#000000";
  71714. const width = 5;
  71715. const cmd = "repeating-linear-gradient";
  71716. const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${
  71717. 2 * width
  71718. }px`;
  71719. switch (this.type) {
  71720. case "crossHatch":
  71721. return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
  71722. case "crossDiagonal":
  71723. return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
  71724. case "diagonalLeft":
  71725. return `${cmd}(45deg,${colors})`;
  71726. case "diagonalRight":
  71727. return `${cmd}(-45deg,${colors})`;
  71728. case "horizontal":
  71729. return `${cmd}(to top,${colors})`;
  71730. case "vertical":
  71731. return `${cmd}(to right,${colors})`;
  71732. }
  71733. return "";
  71734. }
  71735. }
  71736. class Picture extends _xfa_object.StringObject {
  71737. constructor(attributes) {
  71738. super(TEMPLATE_NS_ID, "picture");
  71739. this.id = attributes.id || "";
  71740. this.use = attributes.use || "";
  71741. this.usehref = attributes.usehref || "";
  71742. }
  71743. }
  71744. class Proto extends _xfa_object.XFAObject {
  71745. constructor(attributes) {
  71746. super(TEMPLATE_NS_ID, "proto", true);
  71747. this.appearanceFilter = new _xfa_object.XFAObjectArray();
  71748. this.arc = new _xfa_object.XFAObjectArray();
  71749. this.area = new _xfa_object.XFAObjectArray();
  71750. this.assist = new _xfa_object.XFAObjectArray();
  71751. this.barcode = new _xfa_object.XFAObjectArray();
  71752. this.bindItems = new _xfa_object.XFAObjectArray();
  71753. this.bookend = new _xfa_object.XFAObjectArray();
  71754. this.boolean = new _xfa_object.XFAObjectArray();
  71755. this.border = new _xfa_object.XFAObjectArray();
  71756. this.break = new _xfa_object.XFAObjectArray();
  71757. this.breakAfter = new _xfa_object.XFAObjectArray();
  71758. this.breakBefore = new _xfa_object.XFAObjectArray();
  71759. this.button = new _xfa_object.XFAObjectArray();
  71760. this.calculate = new _xfa_object.XFAObjectArray();
  71761. this.caption = new _xfa_object.XFAObjectArray();
  71762. this.certificate = new _xfa_object.XFAObjectArray();
  71763. this.certificates = new _xfa_object.XFAObjectArray();
  71764. this.checkButton = new _xfa_object.XFAObjectArray();
  71765. this.choiceList = new _xfa_object.XFAObjectArray();
  71766. this.color = new _xfa_object.XFAObjectArray();
  71767. this.comb = new _xfa_object.XFAObjectArray();
  71768. this.connect = new _xfa_object.XFAObjectArray();
  71769. this.contentArea = new _xfa_object.XFAObjectArray();
  71770. this.corner = new _xfa_object.XFAObjectArray();
  71771. this.date = new _xfa_object.XFAObjectArray();
  71772. this.dateTime = new _xfa_object.XFAObjectArray();
  71773. this.dateTimeEdit = new _xfa_object.XFAObjectArray();
  71774. this.decimal = new _xfa_object.XFAObjectArray();
  71775. this.defaultUi = new _xfa_object.XFAObjectArray();
  71776. this.desc = new _xfa_object.XFAObjectArray();
  71777. this.digestMethod = new _xfa_object.XFAObjectArray();
  71778. this.digestMethods = new _xfa_object.XFAObjectArray();
  71779. this.draw = new _xfa_object.XFAObjectArray();
  71780. this.edge = new _xfa_object.XFAObjectArray();
  71781. this.encoding = new _xfa_object.XFAObjectArray();
  71782. this.encodings = new _xfa_object.XFAObjectArray();
  71783. this.encrypt = new _xfa_object.XFAObjectArray();
  71784. this.encryptData = new _xfa_object.XFAObjectArray();
  71785. this.encryption = new _xfa_object.XFAObjectArray();
  71786. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  71787. this.encryptionMethods = new _xfa_object.XFAObjectArray();
  71788. this.event = new _xfa_object.XFAObjectArray();
  71789. this.exData = new _xfa_object.XFAObjectArray();
  71790. this.exObject = new _xfa_object.XFAObjectArray();
  71791. this.exclGroup = new _xfa_object.XFAObjectArray();
  71792. this.execute = new _xfa_object.XFAObjectArray();
  71793. this.extras = new _xfa_object.XFAObjectArray();
  71794. this.field = new _xfa_object.XFAObjectArray();
  71795. this.fill = new _xfa_object.XFAObjectArray();
  71796. this.filter = new _xfa_object.XFAObjectArray();
  71797. this.float = new _xfa_object.XFAObjectArray();
  71798. this.font = new _xfa_object.XFAObjectArray();
  71799. this.format = new _xfa_object.XFAObjectArray();
  71800. this.handler = new _xfa_object.XFAObjectArray();
  71801. this.hyphenation = new _xfa_object.XFAObjectArray();
  71802. this.image = new _xfa_object.XFAObjectArray();
  71803. this.imageEdit = new _xfa_object.XFAObjectArray();
  71804. this.integer = new _xfa_object.XFAObjectArray();
  71805. this.issuers = new _xfa_object.XFAObjectArray();
  71806. this.items = new _xfa_object.XFAObjectArray();
  71807. this.keep = new _xfa_object.XFAObjectArray();
  71808. this.keyUsage = new _xfa_object.XFAObjectArray();
  71809. this.line = new _xfa_object.XFAObjectArray();
  71810. this.linear = new _xfa_object.XFAObjectArray();
  71811. this.lockDocument = new _xfa_object.XFAObjectArray();
  71812. this.manifest = new _xfa_object.XFAObjectArray();
  71813. this.margin = new _xfa_object.XFAObjectArray();
  71814. this.mdp = new _xfa_object.XFAObjectArray();
  71815. this.medium = new _xfa_object.XFAObjectArray();
  71816. this.message = new _xfa_object.XFAObjectArray();
  71817. this.numericEdit = new _xfa_object.XFAObjectArray();
  71818. this.occur = new _xfa_object.XFAObjectArray();
  71819. this.oid = new _xfa_object.XFAObjectArray();
  71820. this.oids = new _xfa_object.XFAObjectArray();
  71821. this.overflow = new _xfa_object.XFAObjectArray();
  71822. this.pageArea = new _xfa_object.XFAObjectArray();
  71823. this.pageSet = new _xfa_object.XFAObjectArray();
  71824. this.para = new _xfa_object.XFAObjectArray();
  71825. this.passwordEdit = new _xfa_object.XFAObjectArray();
  71826. this.pattern = new _xfa_object.XFAObjectArray();
  71827. this.picture = new _xfa_object.XFAObjectArray();
  71828. this.radial = new _xfa_object.XFAObjectArray();
  71829. this.reason = new _xfa_object.XFAObjectArray();
  71830. this.reasons = new _xfa_object.XFAObjectArray();
  71831. this.rectangle = new _xfa_object.XFAObjectArray();
  71832. this.ref = new _xfa_object.XFAObjectArray();
  71833. this.script = new _xfa_object.XFAObjectArray();
  71834. this.setProperty = new _xfa_object.XFAObjectArray();
  71835. this.signData = new _xfa_object.XFAObjectArray();
  71836. this.signature = new _xfa_object.XFAObjectArray();
  71837. this.signing = new _xfa_object.XFAObjectArray();
  71838. this.solid = new _xfa_object.XFAObjectArray();
  71839. this.speak = new _xfa_object.XFAObjectArray();
  71840. this.stipple = new _xfa_object.XFAObjectArray();
  71841. this.subform = new _xfa_object.XFAObjectArray();
  71842. this.subformSet = new _xfa_object.XFAObjectArray();
  71843. this.subjectDN = new _xfa_object.XFAObjectArray();
  71844. this.subjectDNs = new _xfa_object.XFAObjectArray();
  71845. this.submit = new _xfa_object.XFAObjectArray();
  71846. this.text = new _xfa_object.XFAObjectArray();
  71847. this.textEdit = new _xfa_object.XFAObjectArray();
  71848. this.time = new _xfa_object.XFAObjectArray();
  71849. this.timeStamp = new _xfa_object.XFAObjectArray();
  71850. this.toolTip = new _xfa_object.XFAObjectArray();
  71851. this.traversal = new _xfa_object.XFAObjectArray();
  71852. this.traverse = new _xfa_object.XFAObjectArray();
  71853. this.ui = new _xfa_object.XFAObjectArray();
  71854. this.validate = new _xfa_object.XFAObjectArray();
  71855. this.value = new _xfa_object.XFAObjectArray();
  71856. this.variables = new _xfa_object.XFAObjectArray();
  71857. }
  71858. }
  71859. class Radial extends _xfa_object.XFAObject {
  71860. constructor(attributes) {
  71861. super(TEMPLATE_NS_ID, "radial", true);
  71862. this.id = attributes.id || "";
  71863. this.type = (0, _utils.getStringOption)(attributes.type, [
  71864. "toEdge",
  71865. "toCenter",
  71866. ]);
  71867. this.use = attributes.use || "";
  71868. this.usehref = attributes.usehref || "";
  71869. this.color = null;
  71870. this.extras = null;
  71871. }
  71872. [_xfa_object.$toStyle](startColor) {
  71873. startColor = startColor
  71874. ? startColor[_xfa_object.$toStyle]()
  71875. : "#FFFFFF";
  71876. const endColor = this.color
  71877. ? this.color[_xfa_object.$toStyle]()
  71878. : "#000000";
  71879. const colors =
  71880. this.type === "toEdge"
  71881. ? `${startColor},${endColor}`
  71882. : `${endColor},${startColor}`;
  71883. return `radial-gradient(circle at center, ${colors})`;
  71884. }
  71885. }
  71886. class Reason extends _xfa_object.StringObject {
  71887. constructor(attributes) {
  71888. super(TEMPLATE_NS_ID, "reason");
  71889. this.id = attributes.id || "";
  71890. this.name = attributes.name || "";
  71891. this.use = attributes.use || "";
  71892. this.usehref = attributes.usehref || "";
  71893. }
  71894. }
  71895. class Reasons extends _xfa_object.XFAObject {
  71896. constructor(attributes) {
  71897. super(TEMPLATE_NS_ID, "reasons", true);
  71898. this.id = attributes.id || "";
  71899. this.type = (0, _utils.getStringOption)(attributes.type, [
  71900. "optional",
  71901. "required",
  71902. ]);
  71903. this.use = attributes.use || "";
  71904. this.usehref = attributes.usehref || "";
  71905. this.reason = new _xfa_object.XFAObjectArray();
  71906. }
  71907. }
  71908. class Rectangle extends _xfa_object.XFAObject {
  71909. constructor(attributes) {
  71910. super(TEMPLATE_NS_ID, "rectangle", true);
  71911. this.hand = (0, _utils.getStringOption)(attributes.hand, [
  71912. "even",
  71913. "left",
  71914. "right",
  71915. ]);
  71916. this.id = attributes.id || "";
  71917. this.use = attributes.use || "";
  71918. this.usehref = attributes.usehref || "";
  71919. this.corner = new _xfa_object.XFAObjectArray(4);
  71920. this.edge = new _xfa_object.XFAObjectArray(4);
  71921. this.fill = null;
  71922. }
  71923. [_xfa_object.$toHTML]() {
  71924. const edge = this.edge.children.length
  71925. ? this.edge.children[0]
  71926. : new Edge({});
  71927. const edgeStyle = edge[_xfa_object.$toStyle]();
  71928. const style = Object.create(null);
  71929. if (this.fill && this.fill.presence === "visible") {
  71930. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  71931. } else {
  71932. style.fill = "transparent";
  71933. }
  71934. style.strokeWidth = (0, _html_utils.measureToString)(
  71935. edge.presence === "visible" ? edge.thickness : 0
  71936. );
  71937. style.stroke = edgeStyle.color;
  71938. const corner = this.corner.children.length
  71939. ? this.corner.children[0]
  71940. : new Corner({});
  71941. const cornerStyle = corner[_xfa_object.$toStyle]();
  71942. const rect = {
  71943. name: "rect",
  71944. attributes: {
  71945. xmlns: SVG_NS,
  71946. width: "100%",
  71947. height: "100%",
  71948. x: 0,
  71949. y: 0,
  71950. rx: cornerStyle.radius,
  71951. ry: cornerStyle.radius,
  71952. style,
  71953. },
  71954. };
  71955. const svg = {
  71956. name: "svg",
  71957. children: [rect],
  71958. attributes: {
  71959. xmlns: SVG_NS,
  71960. style: {
  71961. overflow: "visible",
  71962. },
  71963. width: "100%",
  71964. height: "100%",
  71965. },
  71966. };
  71967. const parent =
  71968. this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  71969. if (hasMargin(parent)) {
  71970. return _utils.HTMLResult.success({
  71971. name: "div",
  71972. attributes: {
  71973. style: {
  71974. display: "inline",
  71975. width: "100%",
  71976. height: "100%",
  71977. },
  71978. },
  71979. children: [svg],
  71980. });
  71981. }
  71982. svg.attributes.style.position = "absolute";
  71983. return _utils.HTMLResult.success(svg);
  71984. }
  71985. }
  71986. class RefElement extends _xfa_object.StringObject {
  71987. constructor(attributes) {
  71988. super(TEMPLATE_NS_ID, "ref");
  71989. this.id = attributes.id || "";
  71990. this.use = attributes.use || "";
  71991. this.usehref = attributes.usehref || "";
  71992. }
  71993. }
  71994. class Script extends _xfa_object.StringObject {
  71995. constructor(attributes) {
  71996. super(TEMPLATE_NS_ID, "script");
  71997. this.binding = attributes.binding || "";
  71998. this.contentType = attributes.contentType || "";
  71999. this.id = attributes.id || "";
  72000. this.name = attributes.name || "";
  72001. this.runAt = (0, _utils.getStringOption)(attributes.runAt, [
  72002. "client",
  72003. "both",
  72004. "server",
  72005. ]);
  72006. this.use = attributes.use || "";
  72007. this.usehref = attributes.usehref || "";
  72008. }
  72009. }
  72010. class SetProperty extends _xfa_object.XFAObject {
  72011. constructor(attributes) {
  72012. super(TEMPLATE_NS_ID, "setProperty");
  72013. this.connection = attributes.connection || "";
  72014. this.ref = attributes.ref || "";
  72015. this.target = attributes.target || "";
  72016. }
  72017. }
  72018. exports.SetProperty = SetProperty;
  72019. class SignData extends _xfa_object.XFAObject {
  72020. constructor(attributes) {
  72021. super(TEMPLATE_NS_ID, "signData", true);
  72022. this.id = attributes.id || "";
  72023. this.operation = (0, _utils.getStringOption)(attributes.operation, [
  72024. "sign",
  72025. "clear",
  72026. "verify",
  72027. ]);
  72028. this.ref = attributes.ref || "";
  72029. this.target = attributes.target || "";
  72030. this.use = attributes.use || "";
  72031. this.usehref = attributes.usehref || "";
  72032. this.filter = null;
  72033. this.manifest = null;
  72034. }
  72035. }
  72036. class Signature extends _xfa_object.XFAObject {
  72037. constructor(attributes) {
  72038. super(TEMPLATE_NS_ID, "signature", true);
  72039. this.id = attributes.id || "";
  72040. this.type = (0, _utils.getStringOption)(attributes.type, [
  72041. "PDF1.3",
  72042. "PDF1.6",
  72043. ]);
  72044. this.use = attributes.use || "";
  72045. this.usehref = attributes.usehref || "";
  72046. this.border = null;
  72047. this.extras = null;
  72048. this.filter = null;
  72049. this.manifest = null;
  72050. this.margin = null;
  72051. }
  72052. }
  72053. class Signing extends _xfa_object.XFAObject {
  72054. constructor(attributes) {
  72055. super(TEMPLATE_NS_ID, "signing", true);
  72056. this.id = attributes.id || "";
  72057. this.type = (0, _utils.getStringOption)(attributes.type, [
  72058. "optional",
  72059. "required",
  72060. ]);
  72061. this.use = attributes.use || "";
  72062. this.usehref = attributes.usehref || "";
  72063. this.certificate = new _xfa_object.XFAObjectArray();
  72064. }
  72065. }
  72066. class Solid extends _xfa_object.XFAObject {
  72067. constructor(attributes) {
  72068. super(TEMPLATE_NS_ID, "solid", true);
  72069. this.id = attributes.id || "";
  72070. this.use = attributes.use || "";
  72071. this.usehref = attributes.usehref || "";
  72072. this.extras = null;
  72073. }
  72074. [_xfa_object.$toStyle](startColor) {
  72075. return startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  72076. }
  72077. }
  72078. class Speak extends _xfa_object.StringObject {
  72079. constructor(attributes) {
  72080. super(TEMPLATE_NS_ID, "speak");
  72081. this.disable = (0, _utils.getInteger)({
  72082. data: attributes.disable,
  72083. defaultValue: 0,
  72084. validate: (x) => x === 1,
  72085. });
  72086. this.id = attributes.id || "";
  72087. this.priority = (0, _utils.getStringOption)(attributes.priority, [
  72088. "custom",
  72089. "caption",
  72090. "name",
  72091. "toolTip",
  72092. ]);
  72093. this.rid = attributes.rid || "";
  72094. this.use = attributes.use || "";
  72095. this.usehref = attributes.usehref || "";
  72096. }
  72097. }
  72098. class Stipple extends _xfa_object.XFAObject {
  72099. constructor(attributes) {
  72100. super(TEMPLATE_NS_ID, "stipple", true);
  72101. this.id = attributes.id || "";
  72102. this.rate = (0, _utils.getInteger)({
  72103. data: attributes.rate,
  72104. defaultValue: 50,
  72105. validate: (x) => x >= 0 && x <= 100,
  72106. });
  72107. this.use = attributes.use || "";
  72108. this.usehref = attributes.usehref || "";
  72109. this.color = null;
  72110. this.extras = null;
  72111. }
  72112. [_xfa_object.$toStyle](bgColor) {
  72113. const alpha = this.rate / 100;
  72114. return _util.Util.makeHexColor(
  72115. Math.round(bgColor.value.r * (1 - alpha) + this.value.r * alpha),
  72116. Math.round(bgColor.value.g * (1 - alpha) + this.value.g * alpha),
  72117. Math.round(bgColor.value.b * (1 - alpha) + this.value.b * alpha)
  72118. );
  72119. }
  72120. }
  72121. class Subform extends _xfa_object.XFAObject {
  72122. constructor(attributes) {
  72123. super(TEMPLATE_NS_ID, "subform", true);
  72124. this.access = (0, _utils.getStringOption)(attributes.access, [
  72125. "open",
  72126. "nonInteractive",
  72127. "protected",
  72128. "readOnly",
  72129. ]);
  72130. this.allowMacro = (0, _utils.getInteger)({
  72131. data: attributes.allowMacro,
  72132. defaultValue: 0,
  72133. validate: (x) => x === 1,
  72134. });
  72135. this.anchorType = (0, _utils.getStringOption)(
  72136. attributes.anchorType,
  72137. [
  72138. "topLeft",
  72139. "bottomCenter",
  72140. "bottomLeft",
  72141. "bottomRight",
  72142. "middleCenter",
  72143. "middleLeft",
  72144. "middleRight",
  72145. "topCenter",
  72146. "topRight",
  72147. ]
  72148. );
  72149. this.colSpan = (0, _utils.getInteger)({
  72150. data: attributes.colSpan,
  72151. defaultValue: 1,
  72152. validate: (n) => n >= 1 || n === -1,
  72153. });
  72154. this.columnWidths = (attributes.columnWidths || "")
  72155. .trim()
  72156. .split(/\s+/)
  72157. .map((x) => (x === "-1" ? -1 : (0, _utils.getMeasurement)(x)));
  72158. this.h = attributes.h
  72159. ? (0, _utils.getMeasurement)(attributes.h)
  72160. : "";
  72161. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, [
  72162. "left",
  72163. "center",
  72164. "justify",
  72165. "justifyAll",
  72166. "radix",
  72167. "right",
  72168. ]);
  72169. this.id = attributes.id || "";
  72170. this.layout = (0, _utils.getStringOption)(attributes.layout, [
  72171. "position",
  72172. "lr-tb",
  72173. "rl-row",
  72174. "rl-tb",
  72175. "row",
  72176. "table",
  72177. "tb",
  72178. ]);
  72179. this.locale = attributes.locale || "";
  72180. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  72181. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  72182. this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, [
  72183. "consumeData",
  72184. "matchTemplate",
  72185. ]);
  72186. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  72187. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  72188. this.name = attributes.name || "";
  72189. this.presence = (0, _utils.getStringOption)(attributes.presence, [
  72190. "visible",
  72191. "hidden",
  72192. "inactive",
  72193. "invisible",
  72194. ]);
  72195. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  72196. this.restoreState = (0, _utils.getStringOption)(
  72197. attributes.restoreState,
  72198. ["manual", "auto"]
  72199. );
  72200. this.scope = (0, _utils.getStringOption)(attributes.scope, [
  72201. "name",
  72202. "none",
  72203. ]);
  72204. this.use = attributes.use || "";
  72205. this.usehref = attributes.usehref || "";
  72206. this.w = attributes.w
  72207. ? (0, _utils.getMeasurement)(attributes.w)
  72208. : "";
  72209. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  72210. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  72211. this.assist = null;
  72212. this.bind = null;
  72213. this.bookend = null;
  72214. this.border = null;
  72215. this.break = null;
  72216. this.calculate = null;
  72217. this.desc = null;
  72218. this.extras = null;
  72219. this.keep = null;
  72220. this.margin = null;
  72221. this.occur = null;
  72222. this.overflow = null;
  72223. this.pageSet = null;
  72224. this.para = null;
  72225. this.traversal = null;
  72226. this.validate = null;
  72227. this.variables = null;
  72228. this.area = new _xfa_object.XFAObjectArray();
  72229. this.breakAfter = new _xfa_object.XFAObjectArray();
  72230. this.breakBefore = new _xfa_object.XFAObjectArray();
  72231. this.connect = new _xfa_object.XFAObjectArray();
  72232. this.draw = new _xfa_object.XFAObjectArray();
  72233. this.event = new _xfa_object.XFAObjectArray();
  72234. this.exObject = new _xfa_object.XFAObjectArray();
  72235. this.exclGroup = new _xfa_object.XFAObjectArray();
  72236. this.field = new _xfa_object.XFAObjectArray();
  72237. this.proto = new _xfa_object.XFAObjectArray();
  72238. this.setProperty = new _xfa_object.XFAObjectArray();
  72239. this.subform = new _xfa_object.XFAObjectArray();
  72240. this.subformSet = new _xfa_object.XFAObjectArray();
  72241. }
  72242. [_xfa_object.$getSubformParent]() {
  72243. const parent = this[_xfa_object.$getParent]();
  72244. if (parent instanceof SubformSet) {
  72245. return parent[_xfa_object.$getSubformParent]();
  72246. }
  72247. return parent;
  72248. }
  72249. [_xfa_object.$isBindable]() {
  72250. return true;
  72251. }
  72252. [_xfa_object.$isThereMoreWidth]() {
  72253. return (
  72254. (this.layout.endsWith("-tb") &&
  72255. this[_xfa_object.$extra].attempt === 0 &&
  72256. this[_xfa_object.$extra].numberInLine > 0) ||
  72257. this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]()
  72258. );
  72259. }
  72260. *[_xfa_object.$getContainedChildren]() {
  72261. yield* getContainedChildren(this);
  72262. }
  72263. [_xfa_object.$flushHTML]() {
  72264. return (0, _layout.flushHTML)(this);
  72265. }
  72266. [_xfa_object.$addHTML](html, bbox) {
  72267. (0, _layout.addHTML)(this, html, bbox);
  72268. }
  72269. [_xfa_object.$getAvailableSpace]() {
  72270. return (0, _layout.getAvailableSpace)(this);
  72271. }
  72272. [_xfa_object.$isSplittable]() {
  72273. const parent = this[_xfa_object.$getSubformParent]();
  72274. if (!parent[_xfa_object.$isSplittable]()) {
  72275. return false;
  72276. }
  72277. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  72278. return this[_xfa_object.$extra]._isSplittable;
  72279. }
  72280. if (this.layout === "position" || this.layout.includes("row")) {
  72281. this[_xfa_object.$extra]._isSplittable = false;
  72282. return false;
  72283. }
  72284. if (this.keep && this.keep.intact !== "none") {
  72285. this[_xfa_object.$extra]._isSplittable = false;
  72286. return false;
  72287. }
  72288. if (
  72289. parent.layout &&
  72290. parent.layout.endsWith("-tb") &&
  72291. parent[_xfa_object.$extra].numberInLine !== 0
  72292. ) {
  72293. return false;
  72294. }
  72295. this[_xfa_object.$extra]._isSplittable = true;
  72296. return true;
  72297. }
  72298. [_xfa_object.$toHTML](availableSpace) {
  72299. setTabIndex(this);
  72300. if (this.break) {
  72301. if (
  72302. this.break.after !== "auto" ||
  72303. this.break.afterTarget !== ""
  72304. ) {
  72305. const node = new BreakAfter({
  72306. targetType: this.break.after,
  72307. target: this.break.afterTarget,
  72308. startNew: this.break.startNew.toString(),
  72309. });
  72310. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  72311. this[_xfa_object.$appendChild](node);
  72312. this.breakAfter.push(node);
  72313. }
  72314. if (
  72315. this.break.before !== "auto" ||
  72316. this.break.beforeTarget !== ""
  72317. ) {
  72318. const node = new BreakBefore({
  72319. targetType: this.break.before,
  72320. target: this.break.beforeTarget,
  72321. startNew: this.break.startNew.toString(),
  72322. });
  72323. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  72324. this[_xfa_object.$appendChild](node);
  72325. this.breakBefore.push(node);
  72326. }
  72327. if (this.break.overflowTarget !== "") {
  72328. const node = new Overflow({
  72329. target: this.break.overflowTarget,
  72330. leader: this.break.overflowLeader,
  72331. trailer: this.break.overflowTrailer,
  72332. });
  72333. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  72334. this[_xfa_object.$appendChild](node);
  72335. this.overflow.push(node);
  72336. }
  72337. this[_xfa_object.$removeChild](this.break);
  72338. this.break = null;
  72339. }
  72340. if (this.presence === "hidden" || this.presence === "inactive") {
  72341. return _utils.HTMLResult.EMPTY;
  72342. }
  72343. if (
  72344. this.breakBefore.children.length > 1 ||
  72345. this.breakAfter.children.length > 1
  72346. ) {
  72347. (0, _util.warn)(
  72348. "XFA - Several breakBefore or breakAfter in subforms: please file a bug."
  72349. );
  72350. }
  72351. if (this.breakBefore.children.length >= 1) {
  72352. const breakBefore = this.breakBefore.children[0];
  72353. if (handleBreak(breakBefore)) {
  72354. return _utils.HTMLResult.breakNode(breakBefore);
  72355. }
  72356. }
  72357. if (
  72358. this[_xfa_object.$extra] &&
  72359. this[_xfa_object.$extra].afterBreakAfter
  72360. ) {
  72361. return _utils.HTMLResult.EMPTY;
  72362. }
  72363. (0, _html_utils.fixDimensions)(this);
  72364. const children = [];
  72365. const attributes = {
  72366. id: this[_xfa_object.$uid],
  72367. class: [],
  72368. };
  72369. (0, _html_utils.setAccess)(this, attributes.class);
  72370. if (!this[_xfa_object.$extra]) {
  72371. this[_xfa_object.$extra] = Object.create(null);
  72372. }
  72373. Object.assign(this[_xfa_object.$extra], {
  72374. children,
  72375. line: null,
  72376. attributes,
  72377. attempt: 0,
  72378. numberInLine: 0,
  72379. availableSpace: {
  72380. width: Math.min(this.w || Infinity, availableSpace.width),
  72381. height: Math.min(this.h || Infinity, availableSpace.height),
  72382. },
  72383. width: 0,
  72384. height: 0,
  72385. prevHeight: 0,
  72386. currentWidth: 0,
  72387. });
  72388. const root = this[_xfa_object.$getTemplateRoot]();
  72389. const savedNoLayoutFailure =
  72390. root[_xfa_object.$extra].noLayoutFailure;
  72391. const isSplittable = this[_xfa_object.$isSplittable]();
  72392. if (!isSplittable) {
  72393. setFirstUnsplittable(this);
  72394. }
  72395. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  72396. return _utils.HTMLResult.FAILURE;
  72397. }
  72398. const filter = new Set([
  72399. "area",
  72400. "draw",
  72401. "exclGroup",
  72402. "field",
  72403. "subform",
  72404. "subformSet",
  72405. ]);
  72406. if (this.layout.includes("row")) {
  72407. const columnWidths =
  72408. this[_xfa_object.$getSubformParent]().columnWidths;
  72409. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  72410. this[_xfa_object.$extra].columnWidths = columnWidths;
  72411. this[_xfa_object.$extra].currentColumn = 0;
  72412. }
  72413. }
  72414. const style = (0, _html_utils.toStyle)(
  72415. this,
  72416. "anchorType",
  72417. "dimensions",
  72418. "position",
  72419. "presence",
  72420. "border",
  72421. "margin",
  72422. "hAlign"
  72423. );
  72424. const classNames = ["xfaSubform"];
  72425. const cl = (0, _html_utils.layoutClass)(this);
  72426. if (cl) {
  72427. classNames.push(cl);
  72428. }
  72429. attributes.style = style;
  72430. attributes.class = classNames;
  72431. if (this.name) {
  72432. attributes.xfaName = this.name;
  72433. }
  72434. if (this.overflow) {
  72435. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  72436. if (overflowExtra.addLeader) {
  72437. overflowExtra.addLeader = false;
  72438. handleOverflow(this, overflowExtra.leader, availableSpace);
  72439. }
  72440. }
  72441. this[_xfa_object.$pushPara]();
  72442. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  72443. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  72444. for (
  72445. ;
  72446. this[_xfa_object.$extra].attempt < maxRun;
  72447. this[_xfa_object.$extra].attempt++
  72448. ) {
  72449. if (
  72450. isLrTb &&
  72451. this[_xfa_object.$extra].attempt ===
  72452. MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1
  72453. ) {
  72454. this[_xfa_object.$extra].numberInLine = 0;
  72455. }
  72456. const result = this[_xfa_object.$childrenToHTML]({
  72457. filter,
  72458. include: true,
  72459. });
  72460. if (result.success) {
  72461. break;
  72462. }
  72463. if (result.isBreak()) {
  72464. this[_xfa_object.$popPara]();
  72465. return result;
  72466. }
  72467. if (
  72468. isLrTb &&
  72469. this[_xfa_object.$extra].attempt === 0 &&
  72470. this[_xfa_object.$extra].numberInLine === 0 &&
  72471. !root[_xfa_object.$extra].noLayoutFailure
  72472. ) {
  72473. this[_xfa_object.$extra].attempt = maxRun;
  72474. break;
  72475. }
  72476. }
  72477. this[_xfa_object.$popPara]();
  72478. if (!isSplittable) {
  72479. unsetFirstUnsplittable(this);
  72480. }
  72481. root[_xfa_object.$extra].noLayoutFailure = savedNoLayoutFailure;
  72482. if (this[_xfa_object.$extra].attempt === maxRun) {
  72483. if (this.overflow) {
  72484. this[_xfa_object.$getTemplateRoot]()[
  72485. _xfa_object.$extra
  72486. ].overflowNode = this.overflow;
  72487. }
  72488. if (!isSplittable) {
  72489. delete this[_xfa_object.$extra];
  72490. }
  72491. return _utils.HTMLResult.FAILURE;
  72492. }
  72493. if (this.overflow) {
  72494. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  72495. if (overflowExtra.addTrailer) {
  72496. overflowExtra.addTrailer = false;
  72497. handleOverflow(this, overflowExtra.trailer, availableSpace);
  72498. }
  72499. }
  72500. let marginH = 0;
  72501. let marginV = 0;
  72502. if (this.margin) {
  72503. marginH = this.margin.leftInset + this.margin.rightInset;
  72504. marginV = this.margin.topInset + this.margin.bottomInset;
  72505. }
  72506. const width = Math.max(
  72507. this[_xfa_object.$extra].width + marginH,
  72508. this.w || 0
  72509. );
  72510. const height = Math.max(
  72511. this[_xfa_object.$extra].height + marginV,
  72512. this.h || 0
  72513. );
  72514. const bbox = [this.x, this.y, width, height];
  72515. if (this.w === "") {
  72516. style.width = (0, _html_utils.measureToString)(width);
  72517. }
  72518. if (this.h === "") {
  72519. style.height = (0, _html_utils.measureToString)(height);
  72520. }
  72521. if (
  72522. (style.width === "0px" || style.height === "0px") &&
  72523. children.length === 0
  72524. ) {
  72525. return _utils.HTMLResult.EMPTY;
  72526. }
  72527. const html = {
  72528. name: "div",
  72529. attributes,
  72530. children,
  72531. };
  72532. applyAssist(this, attributes);
  72533. const result = _utils.HTMLResult.success(
  72534. (0, _html_utils.createWrapper)(this, html),
  72535. bbox
  72536. );
  72537. if (this.breakAfter.children.length >= 1) {
  72538. const breakAfter = this.breakAfter.children[0];
  72539. if (handleBreak(breakAfter)) {
  72540. this[_xfa_object.$extra].afterBreakAfter = result;
  72541. return _utils.HTMLResult.breakNode(breakAfter);
  72542. }
  72543. }
  72544. delete this[_xfa_object.$extra];
  72545. return result;
  72546. }
  72547. }
  72548. class SubformSet extends _xfa_object.XFAObject {
  72549. constructor(attributes) {
  72550. super(TEMPLATE_NS_ID, "subformSet", true);
  72551. this.id = attributes.id || "";
  72552. this.name = attributes.name || "";
  72553. this.relation = (0, _utils.getStringOption)(attributes.relation, [
  72554. "ordered",
  72555. "choice",
  72556. "unordered",
  72557. ]);
  72558. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  72559. this.use = attributes.use || "";
  72560. this.usehref = attributes.usehref || "";
  72561. this.bookend = null;
  72562. this.break = null;
  72563. this.desc = null;
  72564. this.extras = null;
  72565. this.occur = null;
  72566. this.overflow = null;
  72567. this.breakAfter = new _xfa_object.XFAObjectArray();
  72568. this.breakBefore = new _xfa_object.XFAObjectArray();
  72569. this.subform = new _xfa_object.XFAObjectArray();
  72570. this.subformSet = new _xfa_object.XFAObjectArray();
  72571. }
  72572. *[_xfa_object.$getContainedChildren]() {
  72573. yield* getContainedChildren(this);
  72574. }
  72575. [_xfa_object.$getSubformParent]() {
  72576. let parent = this[_xfa_object.$getParent]();
  72577. while (!(parent instanceof Subform)) {
  72578. parent = parent[_xfa_object.$getParent]();
  72579. }
  72580. return parent;
  72581. }
  72582. [_xfa_object.$isBindable]() {
  72583. return true;
  72584. }
  72585. }
  72586. class SubjectDN extends _xfa_object.ContentObject {
  72587. constructor(attributes) {
  72588. super(TEMPLATE_NS_ID, "subjectDN");
  72589. this.delimiter = attributes.delimiter || ",";
  72590. this.id = attributes.id || "";
  72591. this.name = attributes.name || "";
  72592. this.use = attributes.use || "";
  72593. this.usehref = attributes.usehref || "";
  72594. }
  72595. [_xfa_object.$finalize]() {
  72596. this[_xfa_object.$content] = new Map(
  72597. this[_xfa_object.$content].split(this.delimiter).map((kv) => {
  72598. kv = kv.split("=", 2);
  72599. kv[0] = kv[0].trim();
  72600. return kv;
  72601. })
  72602. );
  72603. }
  72604. }
  72605. class SubjectDNs extends _xfa_object.XFAObject {
  72606. constructor(attributes) {
  72607. super(TEMPLATE_NS_ID, "subjectDNs", true);
  72608. this.id = attributes.id || "";
  72609. this.type = (0, _utils.getStringOption)(attributes.type, [
  72610. "optional",
  72611. "required",
  72612. ]);
  72613. this.use = attributes.use || "";
  72614. this.usehref = attributes.usehref || "";
  72615. this.subjectDN = new _xfa_object.XFAObjectArray();
  72616. }
  72617. }
  72618. class Submit extends _xfa_object.XFAObject {
  72619. constructor(attributes) {
  72620. super(TEMPLATE_NS_ID, "submit", true);
  72621. this.embedPDF = (0, _utils.getInteger)({
  72622. data: attributes.embedPDF,
  72623. defaultValue: 0,
  72624. validate: (x) => x === 1,
  72625. });
  72626. this.format = (0, _utils.getStringOption)(attributes.format, [
  72627. "xdp",
  72628. "formdata",
  72629. "pdf",
  72630. "urlencoded",
  72631. "xfd",
  72632. "xml",
  72633. ]);
  72634. this.id = attributes.id || "";
  72635. this.target = attributes.target || "";
  72636. this.textEncoding = (0, _utils.getKeyword)({
  72637. data: attributes.textEncoding
  72638. ? attributes.textEncoding.toLowerCase()
  72639. : "",
  72640. defaultValue: "",
  72641. validate: (k) =>
  72642. [
  72643. "utf-8",
  72644. "big-five",
  72645. "fontspecific",
  72646. "gbk",
  72647. "gb-18030",
  72648. "gb-2312",
  72649. "ksc-5601",
  72650. "none",
  72651. "shift-jis",
  72652. "ucs-2",
  72653. "utf-16",
  72654. ].includes(k) || k.match(/iso-8859-\d{2}/),
  72655. });
  72656. this.use = attributes.use || "";
  72657. this.usehref = attributes.usehref || "";
  72658. this.xdpContent = attributes.xdpContent || "";
  72659. this.encrypt = null;
  72660. this.encryptData = new _xfa_object.XFAObjectArray();
  72661. this.signData = new _xfa_object.XFAObjectArray();
  72662. }
  72663. }
  72664. class Template extends _xfa_object.XFAObject {
  72665. constructor(attributes) {
  72666. super(TEMPLATE_NS_ID, "template", true);
  72667. this.baseProfile = (0, _utils.getStringOption)(
  72668. attributes.baseProfile,
  72669. ["full", "interactiveForms"]
  72670. );
  72671. this.extras = null;
  72672. this.subform = new _xfa_object.XFAObjectArray();
  72673. }
  72674. [_xfa_object.$finalize]() {
  72675. if (this.subform.children.length === 0) {
  72676. (0, _util.warn)("XFA - No subforms in template node.");
  72677. }
  72678. if (this.subform.children.length >= 2) {
  72679. (0, _util.warn)(
  72680. "XFA - Several subforms in template node: please file a bug."
  72681. );
  72682. }
  72683. this[_xfa_object.$tabIndex] = DEFAULT_TAB_INDEX;
  72684. }
  72685. [_xfa_object.$isSplittable]() {
  72686. return true;
  72687. }
  72688. [_xfa_object.$searchNode](expr, container) {
  72689. if (expr.startsWith("#")) {
  72690. return [this[_xfa_object.$ids].get(expr.slice(1))];
  72691. }
  72692. return (0, _som.searchNode)(this, container, expr, true, true);
  72693. }
  72694. *[_xfa_object.$toPages]() {
  72695. if (!this.subform.children.length) {
  72696. return _utils.HTMLResult.success({
  72697. name: "div",
  72698. children: [],
  72699. });
  72700. }
  72701. this[_xfa_object.$extra] = {
  72702. overflowNode: null,
  72703. firstUnsplittable: null,
  72704. currentContentArea: null,
  72705. currentPageArea: null,
  72706. noLayoutFailure: false,
  72707. pageNumber: 1,
  72708. pagePosition: "first",
  72709. oddOrEven: "odd",
  72710. blankOrNotBlank: "nonBlank",
  72711. paraStack: [],
  72712. };
  72713. const root = this.subform.children[0];
  72714. root.pageSet[_xfa_object.$cleanPage]();
  72715. const pageAreas = root.pageSet.pageArea.children;
  72716. const mainHtml = {
  72717. name: "div",
  72718. children: [],
  72719. };
  72720. let pageArea = null;
  72721. let breakBefore = null;
  72722. let breakBeforeTarget = null;
  72723. if (root.breakBefore.children.length >= 1) {
  72724. breakBefore = root.breakBefore.children[0];
  72725. breakBeforeTarget = breakBefore.target;
  72726. } else if (
  72727. root.subform.children.length >= 1 &&
  72728. root.subform.children[0].breakBefore.children.length >= 1
  72729. ) {
  72730. breakBefore = root.subform.children[0].breakBefore.children[0];
  72731. breakBeforeTarget = breakBefore.target;
  72732. } else if (root.break && root.break.beforeTarget) {
  72733. breakBefore = root.break;
  72734. breakBeforeTarget = breakBefore.beforeTarget;
  72735. } else if (
  72736. root.subform.children.length >= 1 &&
  72737. root.subform.children[0].break &&
  72738. root.subform.children[0].break.beforeTarget
  72739. ) {
  72740. breakBefore = root.subform.children[0].break;
  72741. breakBeforeTarget = breakBefore.beforeTarget;
  72742. }
  72743. if (breakBefore) {
  72744. const target = this[_xfa_object.$searchNode](
  72745. breakBeforeTarget,
  72746. breakBefore[_xfa_object.$getParent]()
  72747. );
  72748. if (target instanceof PageArea) {
  72749. pageArea = target;
  72750. breakBefore[_xfa_object.$extra] = {};
  72751. }
  72752. }
  72753. if (!pageArea) {
  72754. pageArea = pageAreas[0];
  72755. }
  72756. pageArea[_xfa_object.$extra] = {
  72757. numberOfUse: 1,
  72758. };
  72759. const pageAreaParent = pageArea[_xfa_object.$getParent]();
  72760. pageAreaParent[_xfa_object.$extra] = {
  72761. numberOfUse: 1,
  72762. pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea),
  72763. pageSetIndex: 0,
  72764. };
  72765. let targetPageArea;
  72766. let leader = null;
  72767. let trailer = null;
  72768. let hasSomething = true;
  72769. let hasSomethingCounter = 0;
  72770. let startIndex = 0;
  72771. while (true) {
  72772. if (!hasSomething) {
  72773. mainHtml.children.pop();
  72774. if (++hasSomethingCounter === MAX_EMPTY_PAGES) {
  72775. (0, _util.warn)(
  72776. "XFA - Something goes wrong: please file a bug."
  72777. );
  72778. return mainHtml;
  72779. }
  72780. } else {
  72781. hasSomethingCounter = 0;
  72782. }
  72783. targetPageArea = null;
  72784. this[_xfa_object.$extra].currentPageArea = pageArea;
  72785. const page = pageArea[_xfa_object.$toHTML]().html;
  72786. mainHtml.children.push(page);
  72787. if (leader) {
  72788. this[_xfa_object.$extra].noLayoutFailure = true;
  72789. page.children.push(
  72790. leader[_xfa_object.$toHTML](
  72791. pageArea[_xfa_object.$extra].space
  72792. ).html
  72793. );
  72794. leader = null;
  72795. }
  72796. if (trailer) {
  72797. this[_xfa_object.$extra].noLayoutFailure = true;
  72798. page.children.push(
  72799. trailer[_xfa_object.$toHTML](
  72800. pageArea[_xfa_object.$extra].space
  72801. ).html
  72802. );
  72803. trailer = null;
  72804. }
  72805. const contentAreas = pageArea.contentArea.children;
  72806. const htmlContentAreas = page.children.filter((node) =>
  72807. node.attributes.class.includes("xfaContentarea")
  72808. );
  72809. hasSomething = false;
  72810. this[_xfa_object.$extra].firstUnsplittable = null;
  72811. this[_xfa_object.$extra].noLayoutFailure = false;
  72812. const flush = (index) => {
  72813. const html = root[_xfa_object.$flushHTML]();
  72814. if (html) {
  72815. hasSomething =
  72816. hasSomething ||
  72817. (html.children && html.children.length !== 0);
  72818. htmlContentAreas[index].children.push(html);
  72819. }
  72820. };
  72821. for (let i = startIndex, ii = contentAreas.length; i < ii; i++) {
  72822. const contentArea = (this[
  72823. _xfa_object.$extra
  72824. ].currentContentArea = contentAreas[i]);
  72825. const space = {
  72826. width: contentArea.w,
  72827. height: contentArea.h,
  72828. };
  72829. startIndex = 0;
  72830. if (leader) {
  72831. htmlContentAreas[i].children.push(
  72832. leader[_xfa_object.$toHTML](space).html
  72833. );
  72834. leader = null;
  72835. }
  72836. if (trailer) {
  72837. htmlContentAreas[i].children.push(
  72838. trailer[_xfa_object.$toHTML](space).html
  72839. );
  72840. trailer = null;
  72841. }
  72842. const html = root[_xfa_object.$toHTML](space);
  72843. if (html.success) {
  72844. if (html.html) {
  72845. hasSomething =
  72846. hasSomething ||
  72847. (html.html.children && html.html.children.length !== 0);
  72848. htmlContentAreas[i].children.push(html.html);
  72849. } else if (!hasSomething && mainHtml.children.length > 1) {
  72850. mainHtml.children.pop();
  72851. }
  72852. return mainHtml;
  72853. }
  72854. if (html.isBreak()) {
  72855. const node = html.breakNode;
  72856. flush(i);
  72857. if (node.targetType === "auto") {
  72858. continue;
  72859. }
  72860. if (node.leader) {
  72861. leader = this[_xfa_object.$searchNode](
  72862. node.leader,
  72863. node[_xfa_object.$getParent]()
  72864. );
  72865. leader = leader ? leader[0] : null;
  72866. }
  72867. if (node.trailer) {
  72868. trailer = this[_xfa_object.$searchNode](
  72869. node.trailer,
  72870. node[_xfa_object.$getParent]()
  72871. );
  72872. trailer = trailer ? trailer[0] : null;
  72873. }
  72874. if (node.targetType === "pageArea") {
  72875. targetPageArea = node[_xfa_object.$extra].target;
  72876. i = Infinity;
  72877. } else if (!node[_xfa_object.$extra].target) {
  72878. i = node[_xfa_object.$extra].index;
  72879. } else {
  72880. targetPageArea = node[_xfa_object.$extra].target;
  72881. startIndex = node[_xfa_object.$extra].index + 1;
  72882. i = Infinity;
  72883. }
  72884. continue;
  72885. }
  72886. if (this[_xfa_object.$extra].overflowNode) {
  72887. const node = this[_xfa_object.$extra].overflowNode;
  72888. this[_xfa_object.$extra].overflowNode = null;
  72889. const overflowExtra = node[_xfa_object.$getExtra]();
  72890. const target = overflowExtra.target;
  72891. overflowExtra.addLeader = overflowExtra.leader !== null;
  72892. overflowExtra.addTrailer = overflowExtra.trailer !== null;
  72893. flush(i);
  72894. const currentIndex = i;
  72895. i = Infinity;
  72896. if (target instanceof PageArea) {
  72897. targetPageArea = target;
  72898. } else if (target instanceof ContentArea) {
  72899. const index = contentAreas.indexOf(target);
  72900. if (index !== -1) {
  72901. if (index > currentIndex) {
  72902. i = index - 1;
  72903. } else {
  72904. startIndex = index;
  72905. }
  72906. } else {
  72907. targetPageArea = target[_xfa_object.$getParent]();
  72908. startIndex =
  72909. targetPageArea.contentArea.children.indexOf(target);
  72910. }
  72911. }
  72912. continue;
  72913. }
  72914. flush(i);
  72915. }
  72916. this[_xfa_object.$extra].pageNumber += 1;
  72917. if (targetPageArea) {
  72918. if (targetPageArea[_xfa_object.$isUsable]()) {
  72919. targetPageArea[_xfa_object.$extra].numberOfUse += 1;
  72920. } else {
  72921. targetPageArea = null;
  72922. }
  72923. }
  72924. pageArea = targetPageArea || pageArea[_xfa_object.$getNextPage]();
  72925. yield null;
  72926. }
  72927. }
  72928. }
  72929. exports.Template = Template;
  72930. class Text extends _xfa_object.ContentObject {
  72931. constructor(attributes) {
  72932. super(TEMPLATE_NS_ID, "text");
  72933. this.id = attributes.id || "";
  72934. this.maxChars = (0, _utils.getInteger)({
  72935. data: attributes.maxChars,
  72936. defaultValue: 0,
  72937. validate: (x) => x >= 0,
  72938. });
  72939. this.name = attributes.name || "";
  72940. this.rid = attributes.rid || "";
  72941. this.use = attributes.use || "";
  72942. this.usehref = attributes.usehref || "";
  72943. }
  72944. [_xfa_object.$acceptWhitespace]() {
  72945. return true;
  72946. }
  72947. [_xfa_object.$onChild](child) {
  72948. if (
  72949. child[_xfa_object.$namespaceId] ===
  72950. _namespaces.NamespaceIds.xhtml.id
  72951. ) {
  72952. this[_xfa_object.$content] = child;
  72953. return true;
  72954. }
  72955. (0, _util.warn)(
  72956. `XFA - Invalid content in Text: ${child[_xfa_object.$nodeName]}.`
  72957. );
  72958. return false;
  72959. }
  72960. [_xfa_object.$onText](str) {
  72961. if (this[_xfa_object.$content] instanceof _xfa_object.XFAObject) {
  72962. return;
  72963. }
  72964. super[_xfa_object.$onText](str);
  72965. }
  72966. [_xfa_object.$finalize]() {
  72967. if (typeof this[_xfa_object.$content] === "string") {
  72968. this[_xfa_object.$content] = this[_xfa_object.$content].replace(
  72969. /\r\n/g,
  72970. "\n"
  72971. );
  72972. }
  72973. }
  72974. [_xfa_object.$getExtra]() {
  72975. if (typeof this[_xfa_object.$content] === "string") {
  72976. return this[_xfa_object.$content]
  72977. .split(/[\u2029\u2028\n]/)
  72978. .reduce((acc, line) => {
  72979. if (line) {
  72980. acc.push(line);
  72981. }
  72982. return acc;
  72983. }, [])
  72984. .join("\n");
  72985. }
  72986. return this[_xfa_object.$content][_xfa_object.$text]();
  72987. }
  72988. [_xfa_object.$toHTML](availableSpace) {
  72989. if (typeof this[_xfa_object.$content] === "string") {
  72990. const html = valueToHtml(this[_xfa_object.$content]).html;
  72991. if (this[_xfa_object.$content].includes("\u2029")) {
  72992. html.name = "div";
  72993. html.children = [];
  72994. this[_xfa_object.$content]
  72995. .split("\u2029")
  72996. .map((para) =>
  72997. para.split(/[\u2028\n]/).reduce((acc, line) => {
  72998. acc.push(
  72999. {
  73000. name: "span",
  73001. value: line,
  73002. },
  73003. {
  73004. name: "br",
  73005. }
  73006. );
  73007. return acc;
  73008. }, [])
  73009. )
  73010. .forEach((lines) => {
  73011. html.children.push({
  73012. name: "p",
  73013. children: lines,
  73014. });
  73015. });
  73016. } else if (/[\u2028\n]/.test(this[_xfa_object.$content])) {
  73017. html.name = "div";
  73018. html.children = [];
  73019. this[_xfa_object.$content]
  73020. .split(/[\u2028\n]/)
  73021. .forEach((line) => {
  73022. html.children.push(
  73023. {
  73024. name: "span",
  73025. value: line,
  73026. },
  73027. {
  73028. name: "br",
  73029. }
  73030. );
  73031. });
  73032. }
  73033. return _utils.HTMLResult.success(html);
  73034. }
  73035. return this[_xfa_object.$content][_xfa_object.$toHTML](
  73036. availableSpace
  73037. );
  73038. }
  73039. }
  73040. exports.Text = Text;
  73041. class TextEdit extends _xfa_object.XFAObject {
  73042. constructor(attributes) {
  73043. super(TEMPLATE_NS_ID, "textEdit", true);
  73044. this.allowRichText = (0, _utils.getInteger)({
  73045. data: attributes.allowRichText,
  73046. defaultValue: 0,
  73047. validate: (x) => x === 1,
  73048. });
  73049. this.hScrollPolicy = (0, _utils.getStringOption)(
  73050. attributes.hScrollPolicy,
  73051. ["auto", "off", "on"]
  73052. );
  73053. this.id = attributes.id || "";
  73054. this.multiLine = (0, _utils.getInteger)({
  73055. data: attributes.multiLine,
  73056. defaultValue: "",
  73057. validate: (x) => x === 0 || x === 1,
  73058. });
  73059. this.use = attributes.use || "";
  73060. this.usehref = attributes.usehref || "";
  73061. this.vScrollPolicy = (0, _utils.getStringOption)(
  73062. attributes.vScrollPolicy,
  73063. ["auto", "off", "on"]
  73064. );
  73065. this.border = null;
  73066. this.comb = null;
  73067. this.extras = null;
  73068. this.margin = null;
  73069. }
  73070. [_xfa_object.$toHTML](availableSpace) {
  73071. const style = (0, _html_utils.toStyle)(
  73072. this,
  73073. "border",
  73074. "font",
  73075. "margin"
  73076. );
  73077. let html;
  73078. const field =
  73079. this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  73080. if (this.multiLine === "") {
  73081. this.multiLine = field instanceof Draw ? 1 : 0;
  73082. }
  73083. if (this.multiLine === 1) {
  73084. html = {
  73085. name: "textarea",
  73086. attributes: {
  73087. dataId:
  73088. (field[_xfa_object.$data] &&
  73089. field[_xfa_object.$data][_xfa_object.$uid]) ||
  73090. field[_xfa_object.$uid],
  73091. fieldId: field[_xfa_object.$uid],
  73092. class: ["xfaTextfield"],
  73093. style,
  73094. "aria-label": ariaLabel(field),
  73095. "aria-required": false,
  73096. },
  73097. };
  73098. } else {
  73099. html = {
  73100. name: "input",
  73101. attributes: {
  73102. type: "text",
  73103. dataId:
  73104. (field[_xfa_object.$data] &&
  73105. field[_xfa_object.$data][_xfa_object.$uid]) ||
  73106. field[_xfa_object.$uid],
  73107. fieldId: field[_xfa_object.$uid],
  73108. class: ["xfaTextfield"],
  73109. style,
  73110. "aria-label": ariaLabel(field),
  73111. "aria-required": false,
  73112. },
  73113. };
  73114. }
  73115. if (isRequired(field)) {
  73116. html.attributes["aria-required"] = true;
  73117. html.attributes.required = true;
  73118. }
  73119. return _utils.HTMLResult.success({
  73120. name: "label",
  73121. attributes: {
  73122. class: ["xfaLabel"],
  73123. },
  73124. children: [html],
  73125. });
  73126. }
  73127. }
  73128. class Time extends _xfa_object.StringObject {
  73129. constructor(attributes) {
  73130. super(TEMPLATE_NS_ID, "time");
  73131. this.id = attributes.id || "";
  73132. this.name = attributes.name || "";
  73133. this.use = attributes.use || "";
  73134. this.usehref = attributes.usehref || "";
  73135. }
  73136. [_xfa_object.$finalize]() {
  73137. const date = this[_xfa_object.$content].trim();
  73138. this[_xfa_object.$content] = date ? new Date(date) : null;
  73139. }
  73140. [_xfa_object.$toHTML](availableSpace) {
  73141. return valueToHtml(
  73142. this[_xfa_object.$content]
  73143. ? this[_xfa_object.$content].toString()
  73144. : ""
  73145. );
  73146. }
  73147. }
  73148. class TimeStamp extends _xfa_object.XFAObject {
  73149. constructor(attributes) {
  73150. super(TEMPLATE_NS_ID, "timeStamp");
  73151. this.id = attributes.id || "";
  73152. this.server = attributes.server || "";
  73153. this.type = (0, _utils.getStringOption)(attributes.type, [
  73154. "optional",
  73155. "required",
  73156. ]);
  73157. this.use = attributes.use || "";
  73158. this.usehref = attributes.usehref || "";
  73159. }
  73160. }
  73161. class ToolTip extends _xfa_object.StringObject {
  73162. constructor(attributes) {
  73163. super(TEMPLATE_NS_ID, "toolTip");
  73164. this.id = attributes.id || "";
  73165. this.rid = attributes.rid || "";
  73166. this.use = attributes.use || "";
  73167. this.usehref = attributes.usehref || "";
  73168. }
  73169. }
  73170. class Traversal extends _xfa_object.XFAObject {
  73171. constructor(attributes) {
  73172. super(TEMPLATE_NS_ID, "traversal", true);
  73173. this.id = attributes.id || "";
  73174. this.use = attributes.use || "";
  73175. this.usehref = attributes.usehref || "";
  73176. this.extras = null;
  73177. this.traverse = new _xfa_object.XFAObjectArray();
  73178. }
  73179. }
  73180. class Traverse extends _xfa_object.XFAObject {
  73181. constructor(attributes) {
  73182. super(TEMPLATE_NS_ID, "traverse", true);
  73183. this.id = attributes.id || "";
  73184. this.operation = (0, _utils.getStringOption)(attributes.operation, [
  73185. "next",
  73186. "back",
  73187. "down",
  73188. "first",
  73189. "left",
  73190. "right",
  73191. "up",
  73192. ]);
  73193. this.ref = attributes.ref || "";
  73194. this.use = attributes.use || "";
  73195. this.usehref = attributes.usehref || "";
  73196. this.extras = null;
  73197. this.script = null;
  73198. }
  73199. get name() {
  73200. return this.operation;
  73201. }
  73202. [_xfa_object.$isTransparent]() {
  73203. return false;
  73204. }
  73205. }
  73206. class Ui extends _xfa_object.XFAObject {
  73207. constructor(attributes) {
  73208. super(TEMPLATE_NS_ID, "ui", true);
  73209. this.id = attributes.id || "";
  73210. this.use = attributes.use || "";
  73211. this.usehref = attributes.usehref || "";
  73212. this.extras = null;
  73213. this.picture = null;
  73214. this.barcode = null;
  73215. this.button = null;
  73216. this.checkButton = null;
  73217. this.choiceList = null;
  73218. this.dateTimeEdit = null;
  73219. this.defaultUi = null;
  73220. this.imageEdit = null;
  73221. this.numericEdit = null;
  73222. this.passwordEdit = null;
  73223. this.signature = null;
  73224. this.textEdit = null;
  73225. }
  73226. [_xfa_object.$getExtra]() {
  73227. if (this[_xfa_object.$extra] === undefined) {
  73228. for (const name of Object.getOwnPropertyNames(this)) {
  73229. if (name === "extras" || name === "picture") {
  73230. continue;
  73231. }
  73232. const obj = this[name];
  73233. if (!(obj instanceof _xfa_object.XFAObject)) {
  73234. continue;
  73235. }
  73236. this[_xfa_object.$extra] = obj;
  73237. return obj;
  73238. }
  73239. this[_xfa_object.$extra] = null;
  73240. }
  73241. return this[_xfa_object.$extra];
  73242. }
  73243. [_xfa_object.$toHTML](availableSpace) {
  73244. const obj = this[_xfa_object.$getExtra]();
  73245. if (obj) {
  73246. return obj[_xfa_object.$toHTML](availableSpace);
  73247. }
  73248. return _utils.HTMLResult.EMPTY;
  73249. }
  73250. }
  73251. class Validate extends _xfa_object.XFAObject {
  73252. constructor(attributes) {
  73253. super(TEMPLATE_NS_ID, "validate", true);
  73254. this.formatTest = (0, _utils.getStringOption)(
  73255. attributes.formatTest,
  73256. ["warning", "disabled", "error"]
  73257. );
  73258. this.id = attributes.id || "";
  73259. this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, [
  73260. "disabled",
  73261. "error",
  73262. "warning",
  73263. ]);
  73264. this.scriptTest = (0, _utils.getStringOption)(
  73265. attributes.scriptTest,
  73266. ["error", "disabled", "warning"]
  73267. );
  73268. this.use = attributes.use || "";
  73269. this.usehref = attributes.usehref || "";
  73270. this.extras = null;
  73271. this.message = null;
  73272. this.picture = null;
  73273. this.script = null;
  73274. }
  73275. }
  73276. class Value extends _xfa_object.XFAObject {
  73277. constructor(attributes) {
  73278. super(TEMPLATE_NS_ID, "value", true);
  73279. this.id = attributes.id || "";
  73280. this.override = (0, _utils.getInteger)({
  73281. data: attributes.override,
  73282. defaultValue: 0,
  73283. validate: (x) => x === 1,
  73284. });
  73285. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  73286. this.use = attributes.use || "";
  73287. this.usehref = attributes.usehref || "";
  73288. this.arc = null;
  73289. this.boolean = null;
  73290. this.date = null;
  73291. this.dateTime = null;
  73292. this.decimal = null;
  73293. this.exData = null;
  73294. this.float = null;
  73295. this.image = null;
  73296. this.integer = null;
  73297. this.line = null;
  73298. this.rectangle = null;
  73299. this.text = null;
  73300. this.time = null;
  73301. }
  73302. [_xfa_object.$setValue](value) {
  73303. const parent = this[_xfa_object.$getParent]();
  73304. if (parent instanceof Field) {
  73305. if (parent.ui && parent.ui.imageEdit) {
  73306. if (!this.image) {
  73307. this.image = new Image({});
  73308. this[_xfa_object.$appendChild](this.image);
  73309. }
  73310. this.image[_xfa_object.$content] = value[_xfa_object.$content];
  73311. return;
  73312. }
  73313. }
  73314. const valueName = value[_xfa_object.$nodeName];
  73315. if (this[valueName] !== null) {
  73316. this[valueName][_xfa_object.$content] =
  73317. value[_xfa_object.$content];
  73318. return;
  73319. }
  73320. for (const name of Object.getOwnPropertyNames(this)) {
  73321. const obj = this[name];
  73322. if (obj instanceof _xfa_object.XFAObject) {
  73323. this[name] = null;
  73324. this[_xfa_object.$removeChild](obj);
  73325. }
  73326. }
  73327. this[value[_xfa_object.$nodeName]] = value;
  73328. this[_xfa_object.$appendChild](value);
  73329. }
  73330. [_xfa_object.$text]() {
  73331. if (this.exData) {
  73332. if (typeof this.exData[_xfa_object.$content] === "string") {
  73333. return this.exData[_xfa_object.$content].trim();
  73334. }
  73335. return this.exData[_xfa_object.$content]
  73336. [_xfa_object.$text]()
  73337. .trim();
  73338. }
  73339. for (const name of Object.getOwnPropertyNames(this)) {
  73340. if (name === "image") {
  73341. continue;
  73342. }
  73343. const obj = this[name];
  73344. if (obj instanceof _xfa_object.XFAObject) {
  73345. return (obj[_xfa_object.$content] || "").toString().trim();
  73346. }
  73347. }
  73348. return null;
  73349. }
  73350. [_xfa_object.$toHTML](availableSpace) {
  73351. for (const name of Object.getOwnPropertyNames(this)) {
  73352. const obj = this[name];
  73353. if (!(obj instanceof _xfa_object.XFAObject)) {
  73354. continue;
  73355. }
  73356. return obj[_xfa_object.$toHTML](availableSpace);
  73357. }
  73358. return _utils.HTMLResult.EMPTY;
  73359. }
  73360. }
  73361. exports.Value = Value;
  73362. class Variables extends _xfa_object.XFAObject {
  73363. constructor(attributes) {
  73364. super(TEMPLATE_NS_ID, "variables", true);
  73365. this.id = attributes.id || "";
  73366. this.use = attributes.use || "";
  73367. this.usehref = attributes.usehref || "";
  73368. this.boolean = new _xfa_object.XFAObjectArray();
  73369. this.date = new _xfa_object.XFAObjectArray();
  73370. this.dateTime = new _xfa_object.XFAObjectArray();
  73371. this.decimal = new _xfa_object.XFAObjectArray();
  73372. this.exData = new _xfa_object.XFAObjectArray();
  73373. this.float = new _xfa_object.XFAObjectArray();
  73374. this.image = new _xfa_object.XFAObjectArray();
  73375. this.integer = new _xfa_object.XFAObjectArray();
  73376. this.manifest = new _xfa_object.XFAObjectArray();
  73377. this.script = new _xfa_object.XFAObjectArray();
  73378. this.text = new _xfa_object.XFAObjectArray();
  73379. this.time = new _xfa_object.XFAObjectArray();
  73380. }
  73381. [_xfa_object.$isTransparent]() {
  73382. return true;
  73383. }
  73384. }
  73385. class TemplateNamespace {
  73386. static [_namespaces.$buildXFAObject](name, attributes) {
  73387. if (TemplateNamespace.hasOwnProperty(name)) {
  73388. const node = TemplateNamespace[name](attributes);
  73389. node[_xfa_object.$setSetAttributes](attributes);
  73390. return node;
  73391. }
  73392. return undefined;
  73393. }
  73394. static appearanceFilter(attrs) {
  73395. return new AppearanceFilter(attrs);
  73396. }
  73397. static arc(attrs) {
  73398. return new Arc(attrs);
  73399. }
  73400. static area(attrs) {
  73401. return new Area(attrs);
  73402. }
  73403. static assist(attrs) {
  73404. return new Assist(attrs);
  73405. }
  73406. static barcode(attrs) {
  73407. return new Barcode(attrs);
  73408. }
  73409. static bind(attrs) {
  73410. return new Bind(attrs);
  73411. }
  73412. static bindItems(attrs) {
  73413. return new BindItems(attrs);
  73414. }
  73415. static bookend(attrs) {
  73416. return new Bookend(attrs);
  73417. }
  73418. static boolean(attrs) {
  73419. return new BooleanElement(attrs);
  73420. }
  73421. static border(attrs) {
  73422. return new Border(attrs);
  73423. }
  73424. static break(attrs) {
  73425. return new Break(attrs);
  73426. }
  73427. static breakAfter(attrs) {
  73428. return new BreakAfter(attrs);
  73429. }
  73430. static breakBefore(attrs) {
  73431. return new BreakBefore(attrs);
  73432. }
  73433. static button(attrs) {
  73434. return new Button(attrs);
  73435. }
  73436. static calculate(attrs) {
  73437. return new Calculate(attrs);
  73438. }
  73439. static caption(attrs) {
  73440. return new Caption(attrs);
  73441. }
  73442. static certificate(attrs) {
  73443. return new Certificate(attrs);
  73444. }
  73445. static certificates(attrs) {
  73446. return new Certificates(attrs);
  73447. }
  73448. static checkButton(attrs) {
  73449. return new CheckButton(attrs);
  73450. }
  73451. static choiceList(attrs) {
  73452. return new ChoiceList(attrs);
  73453. }
  73454. static color(attrs) {
  73455. return new Color(attrs);
  73456. }
  73457. static comb(attrs) {
  73458. return new Comb(attrs);
  73459. }
  73460. static connect(attrs) {
  73461. return new Connect(attrs);
  73462. }
  73463. static contentArea(attrs) {
  73464. return new ContentArea(attrs);
  73465. }
  73466. static corner(attrs) {
  73467. return new Corner(attrs);
  73468. }
  73469. static date(attrs) {
  73470. return new DateElement(attrs);
  73471. }
  73472. static dateTime(attrs) {
  73473. return new DateTime(attrs);
  73474. }
  73475. static dateTimeEdit(attrs) {
  73476. return new DateTimeEdit(attrs);
  73477. }
  73478. static decimal(attrs) {
  73479. return new Decimal(attrs);
  73480. }
  73481. static defaultUi(attrs) {
  73482. return new DefaultUi(attrs);
  73483. }
  73484. static desc(attrs) {
  73485. return new Desc(attrs);
  73486. }
  73487. static digestMethod(attrs) {
  73488. return new DigestMethod(attrs);
  73489. }
  73490. static digestMethods(attrs) {
  73491. return new DigestMethods(attrs);
  73492. }
  73493. static draw(attrs) {
  73494. return new Draw(attrs);
  73495. }
  73496. static edge(attrs) {
  73497. return new Edge(attrs);
  73498. }
  73499. static encoding(attrs) {
  73500. return new Encoding(attrs);
  73501. }
  73502. static encodings(attrs) {
  73503. return new Encodings(attrs);
  73504. }
  73505. static encrypt(attrs) {
  73506. return new Encrypt(attrs);
  73507. }
  73508. static encryptData(attrs) {
  73509. return new EncryptData(attrs);
  73510. }
  73511. static encryption(attrs) {
  73512. return new Encryption(attrs);
  73513. }
  73514. static encryptionMethod(attrs) {
  73515. return new EncryptionMethod(attrs);
  73516. }
  73517. static encryptionMethods(attrs) {
  73518. return new EncryptionMethods(attrs);
  73519. }
  73520. static event(attrs) {
  73521. return new Event(attrs);
  73522. }
  73523. static exData(attrs) {
  73524. return new ExData(attrs);
  73525. }
  73526. static exObject(attrs) {
  73527. return new ExObject(attrs);
  73528. }
  73529. static exclGroup(attrs) {
  73530. return new ExclGroup(attrs);
  73531. }
  73532. static execute(attrs) {
  73533. return new Execute(attrs);
  73534. }
  73535. static extras(attrs) {
  73536. return new Extras(attrs);
  73537. }
  73538. static field(attrs) {
  73539. return new Field(attrs);
  73540. }
  73541. static fill(attrs) {
  73542. return new Fill(attrs);
  73543. }
  73544. static filter(attrs) {
  73545. return new Filter(attrs);
  73546. }
  73547. static float(attrs) {
  73548. return new Float(attrs);
  73549. }
  73550. static font(attrs) {
  73551. return new Font(attrs);
  73552. }
  73553. static format(attrs) {
  73554. return new Format(attrs);
  73555. }
  73556. static handler(attrs) {
  73557. return new Handler(attrs);
  73558. }
  73559. static hyphenation(attrs) {
  73560. return new Hyphenation(attrs);
  73561. }
  73562. static image(attrs) {
  73563. return new Image(attrs);
  73564. }
  73565. static imageEdit(attrs) {
  73566. return new ImageEdit(attrs);
  73567. }
  73568. static integer(attrs) {
  73569. return new Integer(attrs);
  73570. }
  73571. static issuers(attrs) {
  73572. return new Issuers(attrs);
  73573. }
  73574. static items(attrs) {
  73575. return new Items(attrs);
  73576. }
  73577. static keep(attrs) {
  73578. return new Keep(attrs);
  73579. }
  73580. static keyUsage(attrs) {
  73581. return new KeyUsage(attrs);
  73582. }
  73583. static line(attrs) {
  73584. return new Line(attrs);
  73585. }
  73586. static linear(attrs) {
  73587. return new Linear(attrs);
  73588. }
  73589. static lockDocument(attrs) {
  73590. return new LockDocument(attrs);
  73591. }
  73592. static manifest(attrs) {
  73593. return new Manifest(attrs);
  73594. }
  73595. static margin(attrs) {
  73596. return new Margin(attrs);
  73597. }
  73598. static mdp(attrs) {
  73599. return new Mdp(attrs);
  73600. }
  73601. static medium(attrs) {
  73602. return new Medium(attrs);
  73603. }
  73604. static message(attrs) {
  73605. return new Message(attrs);
  73606. }
  73607. static numericEdit(attrs) {
  73608. return new NumericEdit(attrs);
  73609. }
  73610. static occur(attrs) {
  73611. return new Occur(attrs);
  73612. }
  73613. static oid(attrs) {
  73614. return new Oid(attrs);
  73615. }
  73616. static oids(attrs) {
  73617. return new Oids(attrs);
  73618. }
  73619. static overflow(attrs) {
  73620. return new Overflow(attrs);
  73621. }
  73622. static pageArea(attrs) {
  73623. return new PageArea(attrs);
  73624. }
  73625. static pageSet(attrs) {
  73626. return new PageSet(attrs);
  73627. }
  73628. static para(attrs) {
  73629. return new Para(attrs);
  73630. }
  73631. static passwordEdit(attrs) {
  73632. return new PasswordEdit(attrs);
  73633. }
  73634. static pattern(attrs) {
  73635. return new Pattern(attrs);
  73636. }
  73637. static picture(attrs) {
  73638. return new Picture(attrs);
  73639. }
  73640. static proto(attrs) {
  73641. return new Proto(attrs);
  73642. }
  73643. static radial(attrs) {
  73644. return new Radial(attrs);
  73645. }
  73646. static reason(attrs) {
  73647. return new Reason(attrs);
  73648. }
  73649. static reasons(attrs) {
  73650. return new Reasons(attrs);
  73651. }
  73652. static rectangle(attrs) {
  73653. return new Rectangle(attrs);
  73654. }
  73655. static ref(attrs) {
  73656. return new RefElement(attrs);
  73657. }
  73658. static script(attrs) {
  73659. return new Script(attrs);
  73660. }
  73661. static setProperty(attrs) {
  73662. return new SetProperty(attrs);
  73663. }
  73664. static signData(attrs) {
  73665. return new SignData(attrs);
  73666. }
  73667. static signature(attrs) {
  73668. return new Signature(attrs);
  73669. }
  73670. static signing(attrs) {
  73671. return new Signing(attrs);
  73672. }
  73673. static solid(attrs) {
  73674. return new Solid(attrs);
  73675. }
  73676. static speak(attrs) {
  73677. return new Speak(attrs);
  73678. }
  73679. static stipple(attrs) {
  73680. return new Stipple(attrs);
  73681. }
  73682. static subform(attrs) {
  73683. return new Subform(attrs);
  73684. }
  73685. static subformSet(attrs) {
  73686. return new SubformSet(attrs);
  73687. }
  73688. static subjectDN(attrs) {
  73689. return new SubjectDN(attrs);
  73690. }
  73691. static subjectDNs(attrs) {
  73692. return new SubjectDNs(attrs);
  73693. }
  73694. static submit(attrs) {
  73695. return new Submit(attrs);
  73696. }
  73697. static template(attrs) {
  73698. return new Template(attrs);
  73699. }
  73700. static text(attrs) {
  73701. return new Text(attrs);
  73702. }
  73703. static textEdit(attrs) {
  73704. return new TextEdit(attrs);
  73705. }
  73706. static time(attrs) {
  73707. return new Time(attrs);
  73708. }
  73709. static timeStamp(attrs) {
  73710. return new TimeStamp(attrs);
  73711. }
  73712. static toolTip(attrs) {
  73713. return new ToolTip(attrs);
  73714. }
  73715. static traversal(attrs) {
  73716. return new Traversal(attrs);
  73717. }
  73718. static traverse(attrs) {
  73719. return new Traverse(attrs);
  73720. }
  73721. static ui(attrs) {
  73722. return new Ui(attrs);
  73723. }
  73724. static validate(attrs) {
  73725. return new Validate(attrs);
  73726. }
  73727. static value(attrs) {
  73728. return new Value(attrs);
  73729. }
  73730. static variables(attrs) {
  73731. return new Variables(attrs);
  73732. }
  73733. }
  73734. exports.TemplateNamespace = TemplateNamespace;
  73735. /***/
  73736. },
  73737. /* 83 */
  73738. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  73739. Object.defineProperty(exports, "__esModule", {
  73740. value: true,
  73741. });
  73742. exports.addHTML = addHTML;
  73743. exports.checkDimensions = checkDimensions;
  73744. exports.flushHTML = flushHTML;
  73745. exports.getAvailableSpace = getAvailableSpace;
  73746. var _xfa_object = __w_pdfjs_require__(77);
  73747. var _html_utils = __w_pdfjs_require__(84);
  73748. function createLine(node, children) {
  73749. return {
  73750. name: "div",
  73751. attributes: {
  73752. class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"],
  73753. },
  73754. children,
  73755. };
  73756. }
  73757. function flushHTML(node) {
  73758. if (!node[_xfa_object.$extra]) {
  73759. return null;
  73760. }
  73761. const attributes = node[_xfa_object.$extra].attributes;
  73762. const html = {
  73763. name: "div",
  73764. attributes,
  73765. children: node[_xfa_object.$extra].children,
  73766. };
  73767. if (node[_xfa_object.$extra].failingNode) {
  73768. const htmlFromFailing =
  73769. node[_xfa_object.$extra].failingNode[_xfa_object.$flushHTML]();
  73770. if (htmlFromFailing) {
  73771. if (node.layout.endsWith("-tb")) {
  73772. html.children.push(createLine(node, [htmlFromFailing]));
  73773. } else {
  73774. html.children.push(htmlFromFailing);
  73775. }
  73776. }
  73777. }
  73778. if (html.children.length === 0) {
  73779. return null;
  73780. }
  73781. return html;
  73782. }
  73783. function addHTML(node, html, bbox) {
  73784. const extra = node[_xfa_object.$extra];
  73785. const availableSpace = extra.availableSpace;
  73786. const [x, y, w, h] = bbox;
  73787. switch (node.layout) {
  73788. case "position": {
  73789. extra.width = Math.max(extra.width, x + w);
  73790. extra.height = Math.max(extra.height, y + h);
  73791. extra.children.push(html);
  73792. break;
  73793. }
  73794. case "lr-tb":
  73795. case "rl-tb":
  73796. if (!extra.line || extra.attempt === 1) {
  73797. extra.line = createLine(node, []);
  73798. extra.children.push(extra.line);
  73799. extra.numberInLine = 0;
  73800. }
  73801. extra.numberInLine += 1;
  73802. extra.line.children.push(html);
  73803. if (extra.attempt === 0) {
  73804. extra.currentWidth += w;
  73805. extra.height = Math.max(extra.height, extra.prevHeight + h);
  73806. } else {
  73807. extra.currentWidth = w;
  73808. extra.prevHeight = extra.height;
  73809. extra.height += h;
  73810. extra.attempt = 0;
  73811. }
  73812. extra.width = Math.max(extra.width, extra.currentWidth);
  73813. break;
  73814. case "rl-row":
  73815. case "row": {
  73816. extra.children.push(html);
  73817. extra.width += w;
  73818. extra.height = Math.max(extra.height, h);
  73819. const height = (0, _html_utils.measureToString)(extra.height);
  73820. for (const child of extra.children) {
  73821. child.attributes.style.height = height;
  73822. }
  73823. break;
  73824. }
  73825. case "table": {
  73826. extra.width = Math.min(
  73827. availableSpace.width,
  73828. Math.max(extra.width, w)
  73829. );
  73830. extra.height += h;
  73831. extra.children.push(html);
  73832. break;
  73833. }
  73834. case "tb": {
  73835. extra.width = Math.min(
  73836. availableSpace.width,
  73837. Math.max(extra.width, w)
  73838. );
  73839. extra.height += h;
  73840. extra.children.push(html);
  73841. break;
  73842. }
  73843. }
  73844. }
  73845. function getAvailableSpace(node) {
  73846. const availableSpace = node[_xfa_object.$extra].availableSpace;
  73847. const marginV = node.margin
  73848. ? node.margin.topInset + node.margin.bottomInset
  73849. : 0;
  73850. const marginH = node.margin
  73851. ? node.margin.leftInset + node.margin.rightInset
  73852. : 0;
  73853. switch (node.layout) {
  73854. case "lr-tb":
  73855. case "rl-tb":
  73856. if (node[_xfa_object.$extra].attempt === 0) {
  73857. return {
  73858. width:
  73859. availableSpace.width -
  73860. marginH -
  73861. node[_xfa_object.$extra].currentWidth,
  73862. height:
  73863. availableSpace.height -
  73864. marginV -
  73865. node[_xfa_object.$extra].prevHeight,
  73866. };
  73867. }
  73868. return {
  73869. width: availableSpace.width - marginH,
  73870. height:
  73871. availableSpace.height -
  73872. marginV -
  73873. node[_xfa_object.$extra].height,
  73874. };
  73875. case "rl-row":
  73876. case "row":
  73877. const width = node[_xfa_object.$extra].columnWidths
  73878. .slice(node[_xfa_object.$extra].currentColumn)
  73879. .reduce((a, x) => a + x);
  73880. return {
  73881. width,
  73882. height: availableSpace.height - marginH,
  73883. };
  73884. case "table":
  73885. case "tb":
  73886. return {
  73887. width: availableSpace.width - marginH,
  73888. height:
  73889. availableSpace.height -
  73890. marginV -
  73891. node[_xfa_object.$extra].height,
  73892. };
  73893. case "position":
  73894. default:
  73895. return availableSpace;
  73896. }
  73897. }
  73898. function getTransformedBBox(node) {
  73899. let w = node.w === "" ? NaN : node.w;
  73900. let h = node.h === "" ? NaN : node.h;
  73901. let [centerX, centerY] = [0, 0];
  73902. switch (node.anchorType || "") {
  73903. case "bottomCenter":
  73904. [centerX, centerY] = [w / 2, h];
  73905. break;
  73906. case "bottomLeft":
  73907. [centerX, centerY] = [0, h];
  73908. break;
  73909. case "bottomRight":
  73910. [centerX, centerY] = [w, h];
  73911. break;
  73912. case "middleCenter":
  73913. [centerX, centerY] = [w / 2, h / 2];
  73914. break;
  73915. case "middleLeft":
  73916. [centerX, centerY] = [0, h / 2];
  73917. break;
  73918. case "middleRight":
  73919. [centerX, centerY] = [w, h / 2];
  73920. break;
  73921. case "topCenter":
  73922. [centerX, centerY] = [w / 2, 0];
  73923. break;
  73924. case "topRight":
  73925. [centerX, centerY] = [w, 0];
  73926. break;
  73927. }
  73928. let x, y;
  73929. switch (node.rotate || 0) {
  73930. case 0:
  73931. [x, y] = [-centerX, -centerY];
  73932. break;
  73933. case 90:
  73934. [x, y] = [-centerY, centerX];
  73935. [w, h] = [h, -w];
  73936. break;
  73937. case 180:
  73938. [x, y] = [centerX, centerY];
  73939. [w, h] = [-w, -h];
  73940. break;
  73941. case 270:
  73942. [x, y] = [centerY, -centerX];
  73943. [w, h] = [-h, w];
  73944. break;
  73945. }
  73946. return [
  73947. node.x + x + Math.min(0, w),
  73948. node.y + y + Math.min(0, h),
  73949. Math.abs(w),
  73950. Math.abs(h),
  73951. ];
  73952. }
  73953. function checkDimensions(node, space) {
  73954. if (
  73955. node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra]
  73956. .firstUnsplittable === null
  73957. ) {
  73958. return true;
  73959. }
  73960. if (node.w === 0 || node.h === 0) {
  73961. return true;
  73962. }
  73963. const ERROR = 2;
  73964. const parent = node[_xfa_object.$getSubformParent]();
  73965. const attempt =
  73966. (parent[_xfa_object.$extra] &&
  73967. parent[_xfa_object.$extra].attempt) ||
  73968. 0;
  73969. const [, y, w, h] = getTransformedBBox(node);
  73970. switch (parent.layout) {
  73971. case "lr-tb":
  73972. case "rl-tb":
  73973. if (attempt === 0) {
  73974. if (
  73975. !node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra]
  73976. .noLayoutFailure
  73977. ) {
  73978. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  73979. return false;
  73980. }
  73981. if (node.w !== "") {
  73982. if (Math.round(w - space.width) <= ERROR) {
  73983. return true;
  73984. }
  73985. if (parent[_xfa_object.$extra].numberInLine === 0) {
  73986. return space.height > ERROR;
  73987. }
  73988. return false;
  73989. }
  73990. return space.width > ERROR;
  73991. }
  73992. if (node.w !== "") {
  73993. return Math.round(w - space.width) <= ERROR;
  73994. }
  73995. return space.width > ERROR;
  73996. }
  73997. if (
  73998. node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra]
  73999. .noLayoutFailure
  74000. ) {
  74001. return true;
  74002. }
  74003. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  74004. return false;
  74005. }
  74006. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  74007. return space.height > ERROR;
  74008. }
  74009. if (parent[_xfa_object.$isThereMoreWidth]()) {
  74010. return false;
  74011. }
  74012. return space.height > ERROR;
  74013. case "table":
  74014. case "tb":
  74015. if (
  74016. node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra]
  74017. .noLayoutFailure
  74018. ) {
  74019. return true;
  74020. }
  74021. if (node.h !== "" && !node[_xfa_object.$isSplittable]()) {
  74022. return Math.round(h - space.height) <= ERROR;
  74023. }
  74024. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  74025. return space.height > ERROR;
  74026. }
  74027. if (parent[_xfa_object.$isThereMoreWidth]()) {
  74028. return false;
  74029. }
  74030. return space.height > ERROR;
  74031. case "position":
  74032. if (
  74033. node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra]
  74034. .noLayoutFailure
  74035. ) {
  74036. return true;
  74037. }
  74038. if (node.h === "" || Math.round(h + y - space.height) <= ERROR) {
  74039. return true;
  74040. }
  74041. const area =
  74042. node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra]
  74043. .currentContentArea;
  74044. return h + y > area.h;
  74045. case "rl-row":
  74046. case "row":
  74047. if (
  74048. node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra]
  74049. .noLayoutFailure
  74050. ) {
  74051. return true;
  74052. }
  74053. if (node.h !== "") {
  74054. return Math.round(h - space.height) <= ERROR;
  74055. }
  74056. return true;
  74057. default:
  74058. return true;
  74059. }
  74060. }
  74061. /***/
  74062. },
  74063. /* 84 */
  74064. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  74065. Object.defineProperty(exports, "__esModule", {
  74066. value: true,
  74067. });
  74068. exports.computeBbox = computeBbox;
  74069. exports.createWrapper = createWrapper;
  74070. exports.fixDimensions = fixDimensions;
  74071. exports.fixTextIndent = fixTextIndent;
  74072. exports.fixURL = fixURL;
  74073. exports.isPrintOnly = isPrintOnly;
  74074. exports.layoutClass = layoutClass;
  74075. exports.layoutNode = layoutNode;
  74076. exports.measureToString = measureToString;
  74077. exports.setAccess = setAccess;
  74078. exports.setFontFamily = setFontFamily;
  74079. exports.setMinMaxDimensions = setMinMaxDimensions;
  74080. exports.setPara = setPara;
  74081. exports.toStyle = toStyle;
  74082. var _xfa_object = __w_pdfjs_require__(77);
  74083. var _util = __w_pdfjs_require__(2);
  74084. var _utils = __w_pdfjs_require__(78);
  74085. var _fonts = __w_pdfjs_require__(85);
  74086. var _text = __w_pdfjs_require__(86);
  74087. function measureToString(m) {
  74088. if (typeof m === "string") {
  74089. return "0px";
  74090. }
  74091. return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;
  74092. }
  74093. const converters = {
  74094. anchorType(node, style) {
  74095. const parent = node[_xfa_object.$getSubformParent]();
  74096. if (!parent || (parent.layout && parent.layout !== "position")) {
  74097. return;
  74098. }
  74099. if (!("transform" in style)) {
  74100. style.transform = "";
  74101. }
  74102. switch (node.anchorType) {
  74103. case "bottomCenter":
  74104. style.transform += "translate(-50%, -100%)";
  74105. break;
  74106. case "bottomLeft":
  74107. style.transform += "translate(0,-100%)";
  74108. break;
  74109. case "bottomRight":
  74110. style.transform += "translate(-100%,-100%)";
  74111. break;
  74112. case "middleCenter":
  74113. style.transform += "translate(-50%,-50%)";
  74114. break;
  74115. case "middleLeft":
  74116. style.transform += "translate(0,-50%)";
  74117. break;
  74118. case "middleRight":
  74119. style.transform += "translate(-100%,-50%)";
  74120. break;
  74121. case "topCenter":
  74122. style.transform += "translate(-50%,0)";
  74123. break;
  74124. case "topRight":
  74125. style.transform += "translate(-100%,0)";
  74126. break;
  74127. }
  74128. },
  74129. dimensions(node, style) {
  74130. const parent = node[_xfa_object.$getSubformParent]();
  74131. let width = node.w;
  74132. const height = node.h;
  74133. if (parent.layout && parent.layout.includes("row")) {
  74134. const extra = parent[_xfa_object.$extra];
  74135. const colSpan = node.colSpan;
  74136. let w;
  74137. if (colSpan === -1) {
  74138. w = extra.columnWidths
  74139. .slice(extra.currentColumn)
  74140. .reduce((a, x) => a + x, 0);
  74141. extra.currentColumn = 0;
  74142. } else {
  74143. w = extra.columnWidths
  74144. .slice(extra.currentColumn, extra.currentColumn + colSpan)
  74145. .reduce((a, x) => a + x, 0);
  74146. extra.currentColumn =
  74147. (extra.currentColumn + node.colSpan) %
  74148. extra.columnWidths.length;
  74149. }
  74150. if (!isNaN(w)) {
  74151. width = node.w = w;
  74152. }
  74153. }
  74154. if (width !== "") {
  74155. style.width = measureToString(width);
  74156. } else {
  74157. style.width = "auto";
  74158. }
  74159. if (height !== "") {
  74160. style.height = measureToString(height);
  74161. } else {
  74162. style.height = "auto";
  74163. }
  74164. },
  74165. position(node, style) {
  74166. const parent = node[_xfa_object.$getSubformParent]();
  74167. if (parent && parent.layout && parent.layout !== "position") {
  74168. return;
  74169. }
  74170. style.position = "absolute";
  74171. style.left = measureToString(node.x);
  74172. style.top = measureToString(node.y);
  74173. },
  74174. rotate(node, style) {
  74175. if (node.rotate) {
  74176. if (!("transform" in style)) {
  74177. style.transform = "";
  74178. }
  74179. style.transform += `rotate(-${node.rotate}deg)`;
  74180. style.transformOrigin = "top left";
  74181. }
  74182. },
  74183. presence(node, style) {
  74184. switch (node.presence) {
  74185. case "invisible":
  74186. style.visibility = "hidden";
  74187. break;
  74188. case "hidden":
  74189. case "inactive":
  74190. style.display = "none";
  74191. break;
  74192. }
  74193. },
  74194. hAlign(node, style) {
  74195. if (node[_xfa_object.$nodeName] === "para") {
  74196. switch (node.hAlign) {
  74197. case "justifyAll":
  74198. style.textAlign = "justify-all";
  74199. break;
  74200. case "radix":
  74201. style.textAlign = "left";
  74202. break;
  74203. default:
  74204. style.textAlign = node.hAlign;
  74205. }
  74206. } else {
  74207. switch (node.hAlign) {
  74208. case "left":
  74209. style.alignSelf = "start";
  74210. break;
  74211. case "center":
  74212. style.alignSelf = "center";
  74213. break;
  74214. case "right":
  74215. style.alignSelf = "end";
  74216. break;
  74217. }
  74218. }
  74219. },
  74220. margin(node, style) {
  74221. if (node.margin) {
  74222. style.margin = node.margin[_xfa_object.$toStyle]().margin;
  74223. }
  74224. },
  74225. };
  74226. function setMinMaxDimensions(node, style) {
  74227. const parent = node[_xfa_object.$getSubformParent]();
  74228. if (parent.layout === "position") {
  74229. if (node.minW > 0) {
  74230. style.minWidth = measureToString(node.minW);
  74231. }
  74232. if (node.maxW > 0) {
  74233. style.maxWidth = measureToString(node.maxW);
  74234. }
  74235. if (node.minH > 0) {
  74236. style.minHeight = measureToString(node.minH);
  74237. }
  74238. if (node.maxH > 0) {
  74239. style.maxHeight = measureToString(node.maxH);
  74240. }
  74241. }
  74242. }
  74243. function layoutText(
  74244. text,
  74245. xfaFont,
  74246. margin,
  74247. lineHeight,
  74248. fontFinder,
  74249. width
  74250. ) {
  74251. const measure = new _text.TextMeasure(
  74252. xfaFont,
  74253. margin,
  74254. lineHeight,
  74255. fontFinder
  74256. );
  74257. if (typeof text === "string") {
  74258. measure.addString(text);
  74259. } else {
  74260. text[_xfa_object.$pushGlyphs](measure);
  74261. }
  74262. return measure.compute(width);
  74263. }
  74264. function layoutNode(node, availableSpace) {
  74265. let height = null;
  74266. let width = null;
  74267. let isBroken = false;
  74268. if ((!node.w || !node.h) && node.value) {
  74269. let marginH = 0;
  74270. let marginV = 0;
  74271. if (node.margin) {
  74272. marginH = node.margin.leftInset + node.margin.rightInset;
  74273. marginV = node.margin.topInset + node.margin.bottomInset;
  74274. }
  74275. let lineHeight = null;
  74276. let margin = null;
  74277. if (node.para) {
  74278. margin = Object.create(null);
  74279. lineHeight =
  74280. node.para.lineHeight === "" ? null : node.para.lineHeight;
  74281. margin.top =
  74282. node.para.spaceAbove === "" ? 0 : node.para.spaceAbove;
  74283. margin.bottom =
  74284. node.para.spaceBelow === "" ? 0 : node.para.spaceBelow;
  74285. margin.left =
  74286. node.para.marginLeft === "" ? 0 : node.para.marginLeft;
  74287. margin.right =
  74288. node.para.marginRight === "" ? 0 : node.para.marginRight;
  74289. }
  74290. let font = node.font;
  74291. if (!font) {
  74292. const root = node[_xfa_object.$getTemplateRoot]();
  74293. let parent = node[_xfa_object.$getParent]();
  74294. while (parent && parent !== root) {
  74295. if (parent.font) {
  74296. font = parent.font;
  74297. break;
  74298. }
  74299. parent = parent[_xfa_object.$getParent]();
  74300. }
  74301. }
  74302. const maxWidth = (node.w || availableSpace.width) - marginH;
  74303. const fontFinder = node[_xfa_object.$globalData].fontFinder;
  74304. if (
  74305. node.value.exData &&
  74306. node.value.exData[_xfa_object.$content] &&
  74307. node.value.exData.contentType === "text/html"
  74308. ) {
  74309. const res = layoutText(
  74310. node.value.exData[_xfa_object.$content],
  74311. font,
  74312. margin,
  74313. lineHeight,
  74314. fontFinder,
  74315. maxWidth
  74316. );
  74317. width = res.width;
  74318. height = res.height;
  74319. isBroken = res.isBroken;
  74320. } else {
  74321. const text = node.value[_xfa_object.$text]();
  74322. if (text) {
  74323. const res = layoutText(
  74324. text,
  74325. font,
  74326. margin,
  74327. lineHeight,
  74328. fontFinder,
  74329. maxWidth
  74330. );
  74331. width = res.width;
  74332. height = res.height;
  74333. isBroken = res.isBroken;
  74334. }
  74335. }
  74336. if (width !== null && !node.w) {
  74337. width += marginH;
  74338. }
  74339. if (height !== null && !node.h) {
  74340. height += marginV;
  74341. }
  74342. }
  74343. return {
  74344. w: width,
  74345. h: height,
  74346. isBroken,
  74347. };
  74348. }
  74349. function computeBbox(node, html, availableSpace) {
  74350. let bbox;
  74351. if (node.w !== "" && node.h !== "") {
  74352. bbox = [node.x, node.y, node.w, node.h];
  74353. } else {
  74354. if (!availableSpace) {
  74355. return null;
  74356. }
  74357. let width = node.w;
  74358. if (width === "") {
  74359. if (node.maxW === 0) {
  74360. const parent = node[_xfa_object.$getSubformParent]();
  74361. if (parent.layout === "position" && parent.w !== "") {
  74362. width = 0;
  74363. } else {
  74364. width = node.minW;
  74365. }
  74366. } else {
  74367. width = Math.min(node.maxW, availableSpace.width);
  74368. }
  74369. html.attributes.style.width = measureToString(width);
  74370. }
  74371. let height = node.h;
  74372. if (height === "") {
  74373. if (node.maxH === 0) {
  74374. const parent = node[_xfa_object.$getSubformParent]();
  74375. if (parent.layout === "position" && parent.h !== "") {
  74376. height = 0;
  74377. } else {
  74378. height = node.minH;
  74379. }
  74380. } else {
  74381. height = Math.min(node.maxH, availableSpace.height);
  74382. }
  74383. html.attributes.style.height = measureToString(height);
  74384. }
  74385. bbox = [node.x, node.y, width, height];
  74386. }
  74387. return bbox;
  74388. }
  74389. function fixDimensions(node) {
  74390. const parent = node[_xfa_object.$getSubformParent]();
  74391. if (parent.layout && parent.layout.includes("row")) {
  74392. const extra = parent[_xfa_object.$extra];
  74393. const colSpan = node.colSpan;
  74394. let width;
  74395. if (colSpan === -1) {
  74396. width = extra.columnWidths
  74397. .slice(extra.currentColumn)
  74398. .reduce((a, w) => a + w, 0);
  74399. } else {
  74400. width = extra.columnWidths
  74401. .slice(extra.currentColumn, extra.currentColumn + colSpan)
  74402. .reduce((a, w) => a + w, 0);
  74403. }
  74404. if (!isNaN(width)) {
  74405. node.w = width;
  74406. }
  74407. }
  74408. if (parent.layout && parent.layout !== "position") {
  74409. node.x = node.y = 0;
  74410. }
  74411. if (node.layout === "table") {
  74412. if (node.w === "" && Array.isArray(node.columnWidths)) {
  74413. node.w = node.columnWidths.reduce((a, x) => a + x, 0);
  74414. }
  74415. }
  74416. }
  74417. function layoutClass(node) {
  74418. switch (node.layout) {
  74419. case "position":
  74420. return "xfaPosition";
  74421. case "lr-tb":
  74422. return "xfaLrTb";
  74423. case "rl-row":
  74424. return "xfaRlRow";
  74425. case "rl-tb":
  74426. return "xfaRlTb";
  74427. case "row":
  74428. return "xfaRow";
  74429. case "table":
  74430. return "xfaTable";
  74431. case "tb":
  74432. return "xfaTb";
  74433. default:
  74434. return "xfaPosition";
  74435. }
  74436. }
  74437. function toStyle(node, ...names) {
  74438. const style = Object.create(null);
  74439. for (const name of names) {
  74440. const value = node[name];
  74441. if (value === null) {
  74442. continue;
  74443. }
  74444. if (converters.hasOwnProperty(name)) {
  74445. converters[name](node, style);
  74446. continue;
  74447. }
  74448. if (value instanceof _xfa_object.XFAObject) {
  74449. const newStyle = value[_xfa_object.$toStyle]();
  74450. if (newStyle) {
  74451. Object.assign(style, newStyle);
  74452. } else {
  74453. (0, _util.warn)(
  74454. `(DEBUG) - XFA - style for ${name} not implemented yet`
  74455. );
  74456. }
  74457. }
  74458. }
  74459. return style;
  74460. }
  74461. function createWrapper(node, html) {
  74462. const { attributes } = html;
  74463. const { style } = attributes;
  74464. const wrapper = {
  74465. name: "div",
  74466. attributes: {
  74467. class: ["xfaWrapper"],
  74468. style: Object.create(null),
  74469. },
  74470. children: [],
  74471. };
  74472. attributes.class.push("xfaWrapped");
  74473. if (node.border) {
  74474. const { widths, insets } = node.border[_xfa_object.$extra];
  74475. let width, height;
  74476. let top = insets[0];
  74477. let left = insets[3];
  74478. const insetsH = insets[0] + insets[2];
  74479. const insetsW = insets[1] + insets[3];
  74480. switch (node.border.hand) {
  74481. case "even":
  74482. top -= widths[0] / 2;
  74483. left -= widths[3] / 2;
  74484. width = `calc(100% + ${
  74485. (widths[1] + widths[3]) / 2 - insetsW
  74486. }px)`;
  74487. height = `calc(100% + ${
  74488. (widths[0] + widths[2]) / 2 - insetsH
  74489. }px)`;
  74490. break;
  74491. case "left":
  74492. top -= widths[0];
  74493. left -= widths[3];
  74494. width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
  74495. height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
  74496. break;
  74497. case "right":
  74498. width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
  74499. height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
  74500. break;
  74501. }
  74502. const classNames = ["xfaBorder"];
  74503. if (isPrintOnly(node.border)) {
  74504. classNames.push("xfaPrintOnly");
  74505. }
  74506. const border = {
  74507. name: "div",
  74508. attributes: {
  74509. class: classNames,
  74510. style: {
  74511. top: `${top}px`,
  74512. left: `${left}px`,
  74513. width,
  74514. height,
  74515. },
  74516. },
  74517. children: [],
  74518. };
  74519. for (const key of [
  74520. "border",
  74521. "borderWidth",
  74522. "borderColor",
  74523. "borderRadius",
  74524. "borderStyle",
  74525. ]) {
  74526. if (style[key] !== undefined) {
  74527. border.attributes.style[key] = style[key];
  74528. delete style[key];
  74529. }
  74530. }
  74531. wrapper.children.push(border, html);
  74532. } else {
  74533. wrapper.children.push(html);
  74534. }
  74535. for (const key of [
  74536. "background",
  74537. "backgroundClip",
  74538. "top",
  74539. "left",
  74540. "width",
  74541. "height",
  74542. "minWidth",
  74543. "minHeight",
  74544. "maxWidth",
  74545. "maxHeight",
  74546. "transform",
  74547. "transformOrigin",
  74548. "visibility",
  74549. ]) {
  74550. if (style[key] !== undefined) {
  74551. wrapper.attributes.style[key] = style[key];
  74552. delete style[key];
  74553. }
  74554. }
  74555. if (style.position === "absolute") {
  74556. wrapper.attributes.style.position = "absolute";
  74557. } else {
  74558. wrapper.attributes.style.position = "relative";
  74559. }
  74560. delete style.position;
  74561. if (style.alignSelf) {
  74562. wrapper.attributes.style.alignSelf = style.alignSelf;
  74563. delete style.alignSelf;
  74564. }
  74565. return wrapper;
  74566. }
  74567. function fixTextIndent(styles) {
  74568. const indent = (0, _utils.getMeasurement)(styles.textIndent, "0px");
  74569. if (indent >= 0) {
  74570. return;
  74571. }
  74572. const align = styles.textAlign === "right" ? "right" : "left";
  74573. const name = "padding" + (align === "left" ? "Left" : "Right");
  74574. const padding = (0, _utils.getMeasurement)(styles[name], "0px");
  74575. styles[name] = `${padding - indent}px`;
  74576. }
  74577. function setAccess(node, classNames) {
  74578. switch (node.access) {
  74579. case "nonInteractive":
  74580. classNames.push("xfaNonInteractive");
  74581. break;
  74582. case "readOnly":
  74583. classNames.push("xfaReadOnly");
  74584. break;
  74585. case "protected":
  74586. classNames.push("xfaDisabled");
  74587. break;
  74588. }
  74589. }
  74590. function isPrintOnly(node) {
  74591. return (
  74592. node.relevant.length > 0 &&
  74593. !node.relevant[0].excluded &&
  74594. node.relevant[0].viewname === "print"
  74595. );
  74596. }
  74597. function getCurrentPara(node) {
  74598. const stack =
  74599. node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].paraStack;
  74600. return stack.length ? stack.at(-1) : null;
  74601. }
  74602. function setPara(node, nodeStyle, value) {
  74603. if (
  74604. value.attributes.class &&
  74605. value.attributes.class.includes("xfaRich")
  74606. ) {
  74607. if (nodeStyle) {
  74608. if (node.h === "") {
  74609. nodeStyle.height = "auto";
  74610. }
  74611. if (node.w === "") {
  74612. nodeStyle.width = "auto";
  74613. }
  74614. }
  74615. const para = getCurrentPara(node);
  74616. if (para) {
  74617. const valueStyle = value.attributes.style;
  74618. valueStyle.display = "flex";
  74619. valueStyle.flexDirection = "column";
  74620. switch (para.vAlign) {
  74621. case "top":
  74622. valueStyle.justifyContent = "start";
  74623. break;
  74624. case "bottom":
  74625. valueStyle.justifyContent = "end";
  74626. break;
  74627. case "middle":
  74628. valueStyle.justifyContent = "center";
  74629. break;
  74630. }
  74631. const paraStyle = para[_xfa_object.$toStyle]();
  74632. for (const [key, val] of Object.entries(paraStyle)) {
  74633. if (!(key in valueStyle)) {
  74634. valueStyle[key] = val;
  74635. }
  74636. }
  74637. }
  74638. }
  74639. }
  74640. function setFontFamily(xfaFont, node, fontFinder, style) {
  74641. if (!fontFinder) {
  74642. delete style.fontFamily;
  74643. return;
  74644. }
  74645. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  74646. style.fontFamily = `"${name}"`;
  74647. const typeface = fontFinder.find(name);
  74648. if (typeface) {
  74649. const { fontFamily } = typeface.regular.cssFontInfo;
  74650. if (fontFamily !== name) {
  74651. style.fontFamily = `"${fontFamily}"`;
  74652. }
  74653. const para = getCurrentPara(node);
  74654. if (para && para.lineHeight !== "") {
  74655. return;
  74656. }
  74657. if (style.lineHeight) {
  74658. return;
  74659. }
  74660. const pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  74661. if (pdfFont) {
  74662. style.lineHeight = Math.max(1.2, pdfFont.lineHeight);
  74663. }
  74664. }
  74665. }
  74666. function fixURL(str) {
  74667. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(str, null, {
  74668. addDefaultProtocol: true,
  74669. tryConvertEncoding: true,
  74670. });
  74671. return absoluteUrl ? absoluteUrl.href : null;
  74672. }
  74673. /***/
  74674. },
  74675. /* 85 */
  74676. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  74677. Object.defineProperty(exports, "__esModule", {
  74678. value: true,
  74679. });
  74680. exports.FontFinder = void 0;
  74681. exports.getMetrics = getMetrics;
  74682. exports.selectFont = selectFont;
  74683. var _xfa_object = __w_pdfjs_require__(77);
  74684. var _utils = __w_pdfjs_require__(78);
  74685. var _util = __w_pdfjs_require__(2);
  74686. class FontFinder {
  74687. constructor(pdfFonts) {
  74688. this.fonts = new Map();
  74689. this.cache = new Map();
  74690. this.warned = new Set();
  74691. this.defaultFont = null;
  74692. this.add(pdfFonts);
  74693. }
  74694. add(pdfFonts, reallyMissingFonts = null) {
  74695. for (const pdfFont of pdfFonts) {
  74696. this.addPdfFont(pdfFont);
  74697. }
  74698. for (const pdfFont of this.fonts.values()) {
  74699. if (!pdfFont.regular) {
  74700. pdfFont.regular =
  74701. pdfFont.italic || pdfFont.bold || pdfFont.bolditalic;
  74702. }
  74703. }
  74704. if (!reallyMissingFonts || reallyMissingFonts.size === 0) {
  74705. return;
  74706. }
  74707. const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA");
  74708. for (const missing of reallyMissingFonts) {
  74709. this.fonts.set(missing, myriad);
  74710. }
  74711. }
  74712. addPdfFont(pdfFont) {
  74713. const cssFontInfo = pdfFont.cssFontInfo;
  74714. const name = cssFontInfo.fontFamily;
  74715. let font = this.fonts.get(name);
  74716. if (!font) {
  74717. font = Object.create(null);
  74718. this.fonts.set(name, font);
  74719. if (!this.defaultFont) {
  74720. this.defaultFont = font;
  74721. }
  74722. }
  74723. let property = "";
  74724. const fontWeight = parseFloat(cssFontInfo.fontWeight);
  74725. if (parseFloat(cssFontInfo.italicAngle) !== 0) {
  74726. property = fontWeight >= 700 ? "bolditalic" : "italic";
  74727. } else if (fontWeight >= 700) {
  74728. property = "bold";
  74729. }
  74730. if (!property) {
  74731. if (
  74732. pdfFont.name.includes("Bold") ||
  74733. (pdfFont.psName && pdfFont.psName.includes("Bold"))
  74734. ) {
  74735. property = "bold";
  74736. }
  74737. if (
  74738. pdfFont.name.includes("Italic") ||
  74739. pdfFont.name.endsWith("It") ||
  74740. (pdfFont.psName &&
  74741. (pdfFont.psName.includes("Italic") ||
  74742. pdfFont.psName.endsWith("It")))
  74743. ) {
  74744. property += "italic";
  74745. }
  74746. }
  74747. if (!property) {
  74748. property = "regular";
  74749. }
  74750. font[property] = pdfFont;
  74751. }
  74752. getDefault() {
  74753. return this.defaultFont;
  74754. }
  74755. find(fontName, mustWarn = true) {
  74756. let font = this.fonts.get(fontName) || this.cache.get(fontName);
  74757. if (font) {
  74758. return font;
  74759. }
  74760. const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi;
  74761. let name = fontName.replace(pattern, "");
  74762. font = this.fonts.get(name);
  74763. if (font) {
  74764. this.cache.set(fontName, font);
  74765. return font;
  74766. }
  74767. name = name.toLowerCase();
  74768. const maybe = [];
  74769. for (const [family, pdfFont] of this.fonts.entries()) {
  74770. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  74771. maybe.push(pdfFont);
  74772. }
  74773. }
  74774. if (maybe.length === 0) {
  74775. for (const [, pdfFont] of this.fonts.entries()) {
  74776. if (
  74777. pdfFont.regular.name &&
  74778. pdfFont.regular.name
  74779. .replace(pattern, "")
  74780. .toLowerCase()
  74781. .startsWith(name)
  74782. ) {
  74783. maybe.push(pdfFont);
  74784. }
  74785. }
  74786. }
  74787. if (maybe.length === 0) {
  74788. name = name.replace(/psmt|mt/gi, "");
  74789. for (const [family, pdfFont] of this.fonts.entries()) {
  74790. if (
  74791. family.replace(pattern, "").toLowerCase().startsWith(name)
  74792. ) {
  74793. maybe.push(pdfFont);
  74794. }
  74795. }
  74796. }
  74797. if (maybe.length === 0) {
  74798. for (const pdfFont of this.fonts.values()) {
  74799. if (
  74800. pdfFont.regular.name &&
  74801. pdfFont.regular.name
  74802. .replace(pattern, "")
  74803. .toLowerCase()
  74804. .startsWith(name)
  74805. ) {
  74806. maybe.push(pdfFont);
  74807. }
  74808. }
  74809. }
  74810. if (maybe.length >= 1) {
  74811. if (maybe.length !== 1 && mustWarn) {
  74812. (0, _util.warn)(
  74813. `XFA - Too many choices to guess the correct font: ${fontName}`
  74814. );
  74815. }
  74816. this.cache.set(fontName, maybe[0]);
  74817. return maybe[0];
  74818. }
  74819. if (mustWarn && !this.warned.has(fontName)) {
  74820. this.warned.add(fontName);
  74821. (0, _util.warn)(`XFA - Cannot find the font: ${fontName}`);
  74822. }
  74823. return null;
  74824. }
  74825. }
  74826. exports.FontFinder = FontFinder;
  74827. function selectFont(xfaFont, typeface) {
  74828. if (xfaFont.posture === "italic") {
  74829. if (xfaFont.weight === "bold") {
  74830. return typeface.bolditalic;
  74831. }
  74832. return typeface.italic;
  74833. } else if (xfaFont.weight === "bold") {
  74834. return typeface.bold;
  74835. }
  74836. return typeface.regular;
  74837. }
  74838. function getMetrics(xfaFont, real = false) {
  74839. let pdfFont = null;
  74840. if (xfaFont) {
  74841. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  74842. const typeface =
  74843. xfaFont[_xfa_object.$globalData].fontFinder.find(name);
  74844. pdfFont = selectFont(xfaFont, typeface);
  74845. }
  74846. if (!pdfFont) {
  74847. return {
  74848. lineHeight: 12,
  74849. lineGap: 2,
  74850. lineNoGap: 10,
  74851. };
  74852. }
  74853. const size = xfaFont.size || 10;
  74854. const lineHeight = pdfFont.lineHeight
  74855. ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight)
  74856. : 1.2;
  74857. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  74858. return {
  74859. lineHeight: lineHeight * size,
  74860. lineGap: lineGap * size,
  74861. lineNoGap: Math.max(1, lineHeight - lineGap) * size,
  74862. };
  74863. }
  74864. /***/
  74865. },
  74866. /* 86 */
  74867. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  74868. Object.defineProperty(exports, "__esModule", {
  74869. value: true,
  74870. });
  74871. exports.TextMeasure = void 0;
  74872. var _fonts = __w_pdfjs_require__(85);
  74873. const WIDTH_FACTOR = 1.02;
  74874. class FontInfo {
  74875. constructor(xfaFont, margin, lineHeight, fontFinder) {
  74876. this.lineHeight = lineHeight;
  74877. this.paraMargin = margin || {
  74878. top: 0,
  74879. bottom: 0,
  74880. left: 0,
  74881. right: 0,
  74882. };
  74883. if (!xfaFont) {
  74884. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  74885. return;
  74886. }
  74887. this.xfaFont = {
  74888. typeface: xfaFont.typeface,
  74889. posture: xfaFont.posture,
  74890. weight: xfaFont.weight,
  74891. size: xfaFont.size,
  74892. letterSpacing: xfaFont.letterSpacing,
  74893. };
  74894. const typeface = fontFinder.find(xfaFont.typeface);
  74895. if (!typeface) {
  74896. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  74897. return;
  74898. }
  74899. this.pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  74900. if (!this.pdfFont) {
  74901. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  74902. }
  74903. }
  74904. defaultFont(fontFinder) {
  74905. const font =
  74906. fontFinder.find("Helvetica", false) ||
  74907. fontFinder.find("Myriad Pro", false) ||
  74908. fontFinder.find("Arial", false) ||
  74909. fontFinder.getDefault();
  74910. if (font && font.regular) {
  74911. const pdfFont = font.regular;
  74912. const info = pdfFont.cssFontInfo;
  74913. const xfaFont = {
  74914. typeface: info.fontFamily,
  74915. posture: "normal",
  74916. weight: "normal",
  74917. size: 10,
  74918. letterSpacing: 0,
  74919. };
  74920. return [pdfFont, xfaFont];
  74921. }
  74922. const xfaFont = {
  74923. typeface: "Courier",
  74924. posture: "normal",
  74925. weight: "normal",
  74926. size: 10,
  74927. letterSpacing: 0,
  74928. };
  74929. return [null, xfaFont];
  74930. }
  74931. }
  74932. class FontSelector {
  74933. constructor(
  74934. defaultXfaFont,
  74935. defaultParaMargin,
  74936. defaultLineHeight,
  74937. fontFinder
  74938. ) {
  74939. this.fontFinder = fontFinder;
  74940. this.stack = [
  74941. new FontInfo(
  74942. defaultXfaFont,
  74943. defaultParaMargin,
  74944. defaultLineHeight,
  74945. fontFinder
  74946. ),
  74947. ];
  74948. }
  74949. pushData(xfaFont, margin, lineHeight) {
  74950. const lastFont = this.stack.at(-1);
  74951. for (const name of [
  74952. "typeface",
  74953. "posture",
  74954. "weight",
  74955. "size",
  74956. "letterSpacing",
  74957. ]) {
  74958. if (!xfaFont[name]) {
  74959. xfaFont[name] = lastFont.xfaFont[name];
  74960. }
  74961. }
  74962. for (const name of ["top", "bottom", "left", "right"]) {
  74963. if (isNaN(margin[name])) {
  74964. margin[name] = lastFont.paraMargin[name];
  74965. }
  74966. }
  74967. const fontInfo = new FontInfo(
  74968. xfaFont,
  74969. margin,
  74970. lineHeight || lastFont.lineHeight,
  74971. this.fontFinder
  74972. );
  74973. if (!fontInfo.pdfFont) {
  74974. fontInfo.pdfFont = lastFont.pdfFont;
  74975. }
  74976. this.stack.push(fontInfo);
  74977. }
  74978. popFont() {
  74979. this.stack.pop();
  74980. }
  74981. topFont() {
  74982. return this.stack.at(-1);
  74983. }
  74984. }
  74985. class TextMeasure {
  74986. constructor(
  74987. defaultXfaFont,
  74988. defaultParaMargin,
  74989. defaultLineHeight,
  74990. fonts
  74991. ) {
  74992. this.glyphs = [];
  74993. this.fontSelector = new FontSelector(
  74994. defaultXfaFont,
  74995. defaultParaMargin,
  74996. defaultLineHeight,
  74997. fonts
  74998. );
  74999. this.extraHeight = 0;
  75000. }
  75001. pushData(xfaFont, margin, lineHeight) {
  75002. this.fontSelector.pushData(xfaFont, margin, lineHeight);
  75003. }
  75004. popFont(xfaFont) {
  75005. return this.fontSelector.popFont();
  75006. }
  75007. addPara() {
  75008. const lastFont = this.fontSelector.topFont();
  75009. this.extraHeight +=
  75010. lastFont.paraMargin.top + lastFont.paraMargin.bottom;
  75011. }
  75012. addString(str) {
  75013. if (!str) {
  75014. return;
  75015. }
  75016. const lastFont = this.fontSelector.topFont();
  75017. const fontSize = lastFont.xfaFont.size;
  75018. if (lastFont.pdfFont) {
  75019. const letterSpacing = lastFont.xfaFont.letterSpacing;
  75020. const pdfFont = lastFont.pdfFont;
  75021. const fontLineHeight = pdfFont.lineHeight || 1.2;
  75022. const lineHeight =
  75023. lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize;
  75024. const lineGap =
  75025. pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  75026. const noGap = fontLineHeight - lineGap;
  75027. const firstLineHeight = Math.max(1, noGap) * fontSize;
  75028. const scale = fontSize / 1000;
  75029. const fallbackWidth =
  75030. pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width;
  75031. for (const line of str.split(/[\u2029\n]/)) {
  75032. const encodedLine = pdfFont.encodeString(line).join("");
  75033. const glyphs = pdfFont.charsToGlyphs(encodedLine);
  75034. for (const glyph of glyphs) {
  75035. const width = glyph.width || fallbackWidth;
  75036. this.glyphs.push([
  75037. width * scale + letterSpacing,
  75038. lineHeight,
  75039. firstLineHeight,
  75040. glyph.unicode,
  75041. false,
  75042. ]);
  75043. }
  75044. this.glyphs.push([0, 0, 0, "\n", true]);
  75045. }
  75046. this.glyphs.pop();
  75047. return;
  75048. }
  75049. for (const line of str.split(/[\u2029\n]/)) {
  75050. for (const char of line.split("")) {
  75051. this.glyphs.push([
  75052. fontSize,
  75053. 1.2 * fontSize,
  75054. fontSize,
  75055. char,
  75056. false,
  75057. ]);
  75058. }
  75059. this.glyphs.push([0, 0, 0, "\n", true]);
  75060. }
  75061. this.glyphs.pop();
  75062. }
  75063. compute(maxWidth) {
  75064. let lastSpacePos = -1,
  75065. lastSpaceWidth = 0,
  75066. width = 0,
  75067. height = 0,
  75068. currentLineWidth = 0,
  75069. currentLineHeight = 0;
  75070. let isBroken = false;
  75071. let isFirstLine = true;
  75072. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  75073. const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] =
  75074. this.glyphs[i];
  75075. const isSpace = char === " ";
  75076. const glyphHeight = isFirstLine ? firstLineHeight : lineHeight;
  75077. if (isEOL) {
  75078. width = Math.max(width, currentLineWidth);
  75079. currentLineWidth = 0;
  75080. height += currentLineHeight;
  75081. currentLineHeight = glyphHeight;
  75082. lastSpacePos = -1;
  75083. lastSpaceWidth = 0;
  75084. isFirstLine = false;
  75085. continue;
  75086. }
  75087. if (isSpace) {
  75088. if (currentLineWidth + glyphWidth > maxWidth) {
  75089. width = Math.max(width, currentLineWidth);
  75090. currentLineWidth = 0;
  75091. height += currentLineHeight;
  75092. currentLineHeight = glyphHeight;
  75093. lastSpacePos = -1;
  75094. lastSpaceWidth = 0;
  75095. isBroken = true;
  75096. isFirstLine = false;
  75097. } else {
  75098. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  75099. lastSpaceWidth = currentLineWidth;
  75100. currentLineWidth += glyphWidth;
  75101. lastSpacePos = i;
  75102. }
  75103. continue;
  75104. }
  75105. if (currentLineWidth + glyphWidth > maxWidth) {
  75106. height += currentLineHeight;
  75107. currentLineHeight = glyphHeight;
  75108. if (lastSpacePos !== -1) {
  75109. i = lastSpacePos;
  75110. width = Math.max(width, lastSpaceWidth);
  75111. currentLineWidth = 0;
  75112. lastSpacePos = -1;
  75113. lastSpaceWidth = 0;
  75114. } else {
  75115. width = Math.max(width, currentLineWidth);
  75116. currentLineWidth = glyphWidth;
  75117. }
  75118. isBroken = true;
  75119. isFirstLine = false;
  75120. continue;
  75121. }
  75122. currentLineWidth += glyphWidth;
  75123. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  75124. }
  75125. width = Math.max(width, currentLineWidth);
  75126. height += currentLineHeight + this.extraHeight;
  75127. return {
  75128. width: WIDTH_FACTOR * width,
  75129. height,
  75130. isBroken,
  75131. };
  75132. }
  75133. }
  75134. exports.TextMeasure = TextMeasure;
  75135. /***/
  75136. },
  75137. /* 87 */
  75138. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  75139. Object.defineProperty(exports, "__esModule", {
  75140. value: true,
  75141. });
  75142. exports.DataHandler = void 0;
  75143. var _xfa_object = __w_pdfjs_require__(77);
  75144. class DataHandler {
  75145. constructor(root, data) {
  75146. this.data = data;
  75147. this.dataset = root.datasets || null;
  75148. }
  75149. serialize(storage) {
  75150. const stack = [[-1, this.data[_xfa_object.$getChildren]()]];
  75151. while (stack.length > 0) {
  75152. const last = stack.at(-1);
  75153. const [i, children] = last;
  75154. if (i + 1 === children.length) {
  75155. stack.pop();
  75156. continue;
  75157. }
  75158. const child = children[++last[0]];
  75159. const storageEntry = storage.get(child[_xfa_object.$uid]);
  75160. if (storageEntry) {
  75161. child[_xfa_object.$setValue](storageEntry);
  75162. } else {
  75163. const attributes = child[_xfa_object.$getAttributes]();
  75164. for (const value of attributes.values()) {
  75165. const entry = storage.get(value[_xfa_object.$uid]);
  75166. if (entry) {
  75167. value[_xfa_object.$setValue](entry);
  75168. break;
  75169. }
  75170. }
  75171. }
  75172. const nodes = child[_xfa_object.$getChildren]();
  75173. if (nodes.length > 0) {
  75174. stack.push([-1, nodes]);
  75175. }
  75176. }
  75177. const buf = [
  75178. `<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`,
  75179. ];
  75180. if (this.dataset) {
  75181. for (const child of this.dataset[_xfa_object.$getChildren]()) {
  75182. if (child[_xfa_object.$nodeName] !== "data") {
  75183. child[_xfa_object.$toString](buf);
  75184. }
  75185. }
  75186. }
  75187. this.data[_xfa_object.$toString](buf);
  75188. buf.push("</xfa:datasets>");
  75189. return buf.join("");
  75190. }
  75191. }
  75192. exports.DataHandler = DataHandler;
  75193. /***/
  75194. },
  75195. /* 88 */
  75196. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  75197. Object.defineProperty(exports, "__esModule", {
  75198. value: true,
  75199. });
  75200. exports.XFAParser = void 0;
  75201. var _xfa_object = __w_pdfjs_require__(77);
  75202. var _xml_parser = __w_pdfjs_require__(66);
  75203. var _builder = __w_pdfjs_require__(89);
  75204. var _util = __w_pdfjs_require__(2);
  75205. class XFAParser extends _xml_parser.XMLParserBase {
  75206. constructor(rootNameSpace = null, richText = false) {
  75207. super();
  75208. this._builder = new _builder.Builder(rootNameSpace);
  75209. this._stack = [];
  75210. this._globalData = {
  75211. usedTypefaces: new Set(),
  75212. };
  75213. this._ids = new Map();
  75214. this._current = this._builder.buildRoot(this._ids);
  75215. this._errorCode = _xml_parser.XMLParserErrorCode.NoError;
  75216. this._whiteRegex = /^\s+$/;
  75217. this._nbsps = /\xa0+/g;
  75218. this._richText = richText;
  75219. }
  75220. parse(data) {
  75221. this.parseXml(data);
  75222. if (this._errorCode !== _xml_parser.XMLParserErrorCode.NoError) {
  75223. return undefined;
  75224. }
  75225. this._current[_xfa_object.$finalize]();
  75226. return this._current.element;
  75227. }
  75228. onText(text) {
  75229. text = text.replace(this._nbsps, (match) => match.slice(1) + " ");
  75230. if (
  75231. this._richText ||
  75232. this._current[_xfa_object.$acceptWhitespace]()
  75233. ) {
  75234. this._current[_xfa_object.$onText](text, this._richText);
  75235. return;
  75236. }
  75237. if (this._whiteRegex.test(text)) {
  75238. return;
  75239. }
  75240. this._current[_xfa_object.$onText](text.trim());
  75241. }
  75242. onCdata(text) {
  75243. this._current[_xfa_object.$onText](text);
  75244. }
  75245. _mkAttributes(attributes, tagName) {
  75246. let namespace = null;
  75247. let prefixes = null;
  75248. const attributeObj = Object.create({});
  75249. for (const { name, value } of attributes) {
  75250. if (name === "xmlns") {
  75251. if (!namespace) {
  75252. namespace = value;
  75253. } else {
  75254. (0, _util.warn)(
  75255. `XFA - multiple namespace definition in <${tagName}>`
  75256. );
  75257. }
  75258. } else if (name.startsWith("xmlns:")) {
  75259. const prefix = name.substring("xmlns:".length);
  75260. if (!prefixes) {
  75261. prefixes = [];
  75262. }
  75263. prefixes.push({
  75264. prefix,
  75265. value,
  75266. });
  75267. } else {
  75268. const i = name.indexOf(":");
  75269. if (i === -1) {
  75270. attributeObj[name] = value;
  75271. } else {
  75272. let nsAttrs = attributeObj[_xfa_object.$nsAttributes];
  75273. if (!nsAttrs) {
  75274. nsAttrs = attributeObj[_xfa_object.$nsAttributes] =
  75275. Object.create(null);
  75276. }
  75277. const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
  75278. let attrs = nsAttrs[ns];
  75279. if (!attrs) {
  75280. attrs = nsAttrs[ns] = Object.create(null);
  75281. }
  75282. attrs[attrName] = value;
  75283. }
  75284. }
  75285. }
  75286. return [namespace, prefixes, attributeObj];
  75287. }
  75288. _getNameAndPrefix(name, nsAgnostic) {
  75289. const i = name.indexOf(":");
  75290. if (i === -1) {
  75291. return [name, null];
  75292. }
  75293. return [
  75294. name.substring(i + 1),
  75295. nsAgnostic ? "" : name.substring(0, i),
  75296. ];
  75297. }
  75298. onBeginElement(tagName, attributes, isEmpty) {
  75299. const [namespace, prefixes, attributesObj] = this._mkAttributes(
  75300. attributes,
  75301. tagName
  75302. );
  75303. const [name, nsPrefix] = this._getNameAndPrefix(
  75304. tagName,
  75305. this._builder.isNsAgnostic()
  75306. );
  75307. const node = this._builder.build({
  75308. nsPrefix,
  75309. name,
  75310. attributes: attributesObj,
  75311. namespace,
  75312. prefixes,
  75313. });
  75314. node[_xfa_object.$globalData] = this._globalData;
  75315. if (isEmpty) {
  75316. node[_xfa_object.$finalize]();
  75317. if (this._current[_xfa_object.$onChild](node)) {
  75318. node[_xfa_object.$setId](this._ids);
  75319. }
  75320. node[_xfa_object.$clean](this._builder);
  75321. return;
  75322. }
  75323. this._stack.push(this._current);
  75324. this._current = node;
  75325. }
  75326. onEndElement(name) {
  75327. const node = this._current;
  75328. if (
  75329. node[_xfa_object.$isCDATAXml]() &&
  75330. typeof node[_xfa_object.$content] === "string"
  75331. ) {
  75332. const parser = new XFAParser();
  75333. parser._globalData = this._globalData;
  75334. const root = parser.parse(node[_xfa_object.$content]);
  75335. node[_xfa_object.$content] = null;
  75336. node[_xfa_object.$onChild](root);
  75337. }
  75338. node[_xfa_object.$finalize]();
  75339. this._current = this._stack.pop();
  75340. if (this._current[_xfa_object.$onChild](node)) {
  75341. node[_xfa_object.$setId](this._ids);
  75342. }
  75343. node[_xfa_object.$clean](this._builder);
  75344. }
  75345. onError(code) {
  75346. this._errorCode = code;
  75347. }
  75348. }
  75349. exports.XFAParser = XFAParser;
  75350. /***/
  75351. },
  75352. /* 89 */
  75353. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  75354. Object.defineProperty(exports, "__esModule", {
  75355. value: true,
  75356. });
  75357. exports.Builder = void 0;
  75358. var _namespaces = __w_pdfjs_require__(79);
  75359. var _xfa_object = __w_pdfjs_require__(77);
  75360. var _setup = __w_pdfjs_require__(90);
  75361. var _template = __w_pdfjs_require__(82);
  75362. var _unknown = __w_pdfjs_require__(99);
  75363. var _util = __w_pdfjs_require__(2);
  75364. class Root extends _xfa_object.XFAObject {
  75365. constructor(ids) {
  75366. super(-1, "root", Object.create(null));
  75367. this.element = null;
  75368. this[_xfa_object.$ids] = ids;
  75369. }
  75370. [_xfa_object.$onChild](child) {
  75371. this.element = child;
  75372. return true;
  75373. }
  75374. [_xfa_object.$finalize]() {
  75375. super[_xfa_object.$finalize]();
  75376. if (this.element.template instanceof _template.Template) {
  75377. this[_xfa_object.$ids].set(_xfa_object.$root, this.element);
  75378. this.element.template[_xfa_object.$resolvePrototypes](
  75379. this[_xfa_object.$ids]
  75380. );
  75381. this.element.template[_xfa_object.$ids] = this[_xfa_object.$ids];
  75382. }
  75383. }
  75384. }
  75385. class Empty extends _xfa_object.XFAObject {
  75386. constructor() {
  75387. super(-1, "", Object.create(null));
  75388. }
  75389. [_xfa_object.$onChild](_) {
  75390. return false;
  75391. }
  75392. }
  75393. class Builder {
  75394. constructor(rootNameSpace = null) {
  75395. this._namespaceStack = [];
  75396. this._nsAgnosticLevel = 0;
  75397. this._namespacePrefixes = new Map();
  75398. this._namespaces = new Map();
  75399. this._nextNsId = Math.max(
  75400. ...Object.values(_namespaces.NamespaceIds).map(({ id }) => id)
  75401. );
  75402. this._currentNamespace =
  75403. rootNameSpace || new _unknown.UnknownNamespace(++this._nextNsId);
  75404. }
  75405. buildRoot(ids) {
  75406. return new Root(ids);
  75407. }
  75408. build({ nsPrefix, name, attributes, namespace, prefixes }) {
  75409. const hasNamespaceDef = namespace !== null;
  75410. if (hasNamespaceDef) {
  75411. this._namespaceStack.push(this._currentNamespace);
  75412. this._currentNamespace = this._searchNamespace(namespace);
  75413. }
  75414. if (prefixes) {
  75415. this._addNamespacePrefix(prefixes);
  75416. }
  75417. if (attributes.hasOwnProperty(_xfa_object.$nsAttributes)) {
  75418. const dataTemplate = _setup.NamespaceSetUp.datasets;
  75419. const nsAttrs = attributes[_xfa_object.$nsAttributes];
  75420. let xfaAttrs = null;
  75421. for (const [ns, attrs] of Object.entries(nsAttrs)) {
  75422. const nsToUse = this._getNamespaceToUse(ns);
  75423. if (nsToUse === dataTemplate) {
  75424. xfaAttrs = {
  75425. xfa: attrs,
  75426. };
  75427. break;
  75428. }
  75429. }
  75430. if (xfaAttrs) {
  75431. attributes[_xfa_object.$nsAttributes] = xfaAttrs;
  75432. } else {
  75433. delete attributes[_xfa_object.$nsAttributes];
  75434. }
  75435. }
  75436. const namespaceToUse = this._getNamespaceToUse(nsPrefix);
  75437. const node =
  75438. (namespaceToUse &&
  75439. namespaceToUse[_namespaces.$buildXFAObject](
  75440. name,
  75441. attributes
  75442. )) ||
  75443. new Empty();
  75444. if (node[_xfa_object.$isNsAgnostic]()) {
  75445. this._nsAgnosticLevel++;
  75446. }
  75447. if (
  75448. hasNamespaceDef ||
  75449. prefixes ||
  75450. node[_xfa_object.$isNsAgnostic]()
  75451. ) {
  75452. node[_xfa_object.$cleanup] = {
  75453. hasNamespace: hasNamespaceDef,
  75454. prefixes,
  75455. nsAgnostic: node[_xfa_object.$isNsAgnostic](),
  75456. };
  75457. }
  75458. return node;
  75459. }
  75460. isNsAgnostic() {
  75461. return this._nsAgnosticLevel > 0;
  75462. }
  75463. _searchNamespace(nsName) {
  75464. let ns = this._namespaces.get(nsName);
  75465. if (ns) {
  75466. return ns;
  75467. }
  75468. for (const [name, { check }] of Object.entries(
  75469. _namespaces.NamespaceIds
  75470. )) {
  75471. if (check(nsName)) {
  75472. ns = _setup.NamespaceSetUp[name];
  75473. if (ns) {
  75474. this._namespaces.set(nsName, ns);
  75475. return ns;
  75476. }
  75477. break;
  75478. }
  75479. }
  75480. ns = new _unknown.UnknownNamespace(++this._nextNsId);
  75481. this._namespaces.set(nsName, ns);
  75482. return ns;
  75483. }
  75484. _addNamespacePrefix(prefixes) {
  75485. for (const { prefix, value } of prefixes) {
  75486. const namespace = this._searchNamespace(value);
  75487. let prefixStack = this._namespacePrefixes.get(prefix);
  75488. if (!prefixStack) {
  75489. prefixStack = [];
  75490. this._namespacePrefixes.set(prefix, prefixStack);
  75491. }
  75492. prefixStack.push(namespace);
  75493. }
  75494. }
  75495. _getNamespaceToUse(prefix) {
  75496. if (!prefix) {
  75497. return this._currentNamespace;
  75498. }
  75499. const prefixStack = this._namespacePrefixes.get(prefix);
  75500. if (prefixStack && prefixStack.length > 0) {
  75501. return prefixStack.at(-1);
  75502. }
  75503. (0, _util.warn)(`Unknown namespace prefix: ${prefix}.`);
  75504. return null;
  75505. }
  75506. clean(data) {
  75507. const { hasNamespace, prefixes, nsAgnostic } = data;
  75508. if (hasNamespace) {
  75509. this._currentNamespace = this._namespaceStack.pop();
  75510. }
  75511. if (prefixes) {
  75512. prefixes.forEach(({ prefix }) => {
  75513. this._namespacePrefixes.get(prefix).pop();
  75514. });
  75515. }
  75516. if (nsAgnostic) {
  75517. this._nsAgnosticLevel--;
  75518. }
  75519. }
  75520. }
  75521. exports.Builder = Builder;
  75522. /***/
  75523. },
  75524. /* 90 */
  75525. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  75526. Object.defineProperty(exports, "__esModule", {
  75527. value: true,
  75528. });
  75529. exports.NamespaceSetUp = void 0;
  75530. var _config = __w_pdfjs_require__(91);
  75531. var _connection_set = __w_pdfjs_require__(92);
  75532. var _datasets = __w_pdfjs_require__(93);
  75533. var _locale_set = __w_pdfjs_require__(94);
  75534. var _signature = __w_pdfjs_require__(95);
  75535. var _stylesheet = __w_pdfjs_require__(96);
  75536. var _template = __w_pdfjs_require__(82);
  75537. var _xdp = __w_pdfjs_require__(97);
  75538. var _xhtml = __w_pdfjs_require__(98);
  75539. const NamespaceSetUp = {
  75540. config: _config.ConfigNamespace,
  75541. connection: _connection_set.ConnectionSetNamespace,
  75542. datasets: _datasets.DatasetsNamespace,
  75543. localeSet: _locale_set.LocaleSetNamespace,
  75544. signature: _signature.SignatureNamespace,
  75545. stylesheet: _stylesheet.StylesheetNamespace,
  75546. template: _template.TemplateNamespace,
  75547. xdp: _xdp.XdpNamespace,
  75548. xhtml: _xhtml.XhtmlNamespace,
  75549. };
  75550. exports.NamespaceSetUp = NamespaceSetUp;
  75551. /***/
  75552. },
  75553. /* 91 */
  75554. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  75555. Object.defineProperty(exports, "__esModule", {
  75556. value: true,
  75557. });
  75558. exports.ConfigNamespace = void 0;
  75559. var _namespaces = __w_pdfjs_require__(79);
  75560. var _xfa_object = __w_pdfjs_require__(77);
  75561. var _utils = __w_pdfjs_require__(78);
  75562. var _util = __w_pdfjs_require__(2);
  75563. const CONFIG_NS_ID = _namespaces.NamespaceIds.config.id;
  75564. class Acrobat extends _xfa_object.XFAObject {
  75565. constructor(attributes) {
  75566. super(CONFIG_NS_ID, "acrobat", true);
  75567. this.acrobat7 = null;
  75568. this.autoSave = null;
  75569. this.common = null;
  75570. this.validate = null;
  75571. this.validateApprovalSignatures = null;
  75572. this.submitUrl = new _xfa_object.XFAObjectArray();
  75573. }
  75574. }
  75575. class Acrobat7 extends _xfa_object.XFAObject {
  75576. constructor(attributes) {
  75577. super(CONFIG_NS_ID, "acrobat7", true);
  75578. this.dynamicRender = null;
  75579. }
  75580. }
  75581. class ADBE_JSConsole extends _xfa_object.OptionObject {
  75582. constructor(attributes) {
  75583. super(CONFIG_NS_ID, "ADBE_JSConsole", [
  75584. "delegate",
  75585. "Enable",
  75586. "Disable",
  75587. ]);
  75588. }
  75589. }
  75590. class ADBE_JSDebugger extends _xfa_object.OptionObject {
  75591. constructor(attributes) {
  75592. super(CONFIG_NS_ID, "ADBE_JSDebugger", [
  75593. "delegate",
  75594. "Enable",
  75595. "Disable",
  75596. ]);
  75597. }
  75598. }
  75599. class AddSilentPrint extends _xfa_object.Option01 {
  75600. constructor(attributes) {
  75601. super(CONFIG_NS_ID, "addSilentPrint");
  75602. }
  75603. }
  75604. class AddViewerPreferences extends _xfa_object.Option01 {
  75605. constructor(attributes) {
  75606. super(CONFIG_NS_ID, "addViewerPreferences");
  75607. }
  75608. }
  75609. class AdjustData extends _xfa_object.Option10 {
  75610. constructor(attributes) {
  75611. super(CONFIG_NS_ID, "adjustData");
  75612. }
  75613. }
  75614. class AdobeExtensionLevel extends _xfa_object.IntegerObject {
  75615. constructor(attributes) {
  75616. super(
  75617. CONFIG_NS_ID,
  75618. "adobeExtensionLevel",
  75619. 0,
  75620. (n) => n >= 1 && n <= 8
  75621. );
  75622. }
  75623. }
  75624. class Agent extends _xfa_object.XFAObject {
  75625. constructor(attributes) {
  75626. super(CONFIG_NS_ID, "agent", true);
  75627. this.name = attributes.name ? attributes.name.trim() : "";
  75628. this.common = new _xfa_object.XFAObjectArray();
  75629. }
  75630. }
  75631. class AlwaysEmbed extends _xfa_object.ContentObject {
  75632. constructor(attributes) {
  75633. super(CONFIG_NS_ID, "alwaysEmbed");
  75634. }
  75635. }
  75636. class Amd extends _xfa_object.StringObject {
  75637. constructor(attributes) {
  75638. super(CONFIG_NS_ID, "amd");
  75639. }
  75640. }
  75641. class Area extends _xfa_object.XFAObject {
  75642. constructor(attributes) {
  75643. super(CONFIG_NS_ID, "area");
  75644. this.level = (0, _utils.getInteger)({
  75645. data: attributes.level,
  75646. defaultValue: 0,
  75647. validate: (n) => n >= 1 && n <= 3,
  75648. });
  75649. this.name = (0, _utils.getStringOption)(attributes.name, [
  75650. "",
  75651. "barcode",
  75652. "coreinit",
  75653. "deviceDriver",
  75654. "font",
  75655. "general",
  75656. "layout",
  75657. "merge",
  75658. "script",
  75659. "signature",
  75660. "sourceSet",
  75661. "templateCache",
  75662. ]);
  75663. }
  75664. }
  75665. class Attributes extends _xfa_object.OptionObject {
  75666. constructor(attributes) {
  75667. super(CONFIG_NS_ID, "attributes", [
  75668. "preserve",
  75669. "delegate",
  75670. "ignore",
  75671. ]);
  75672. }
  75673. }
  75674. class AutoSave extends _xfa_object.OptionObject {
  75675. constructor(attributes) {
  75676. super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]);
  75677. }
  75678. }
  75679. class Base extends _xfa_object.StringObject {
  75680. constructor(attributes) {
  75681. super(CONFIG_NS_ID, "base");
  75682. }
  75683. }
  75684. class BatchOutput extends _xfa_object.XFAObject {
  75685. constructor(attributes) {
  75686. super(CONFIG_NS_ID, "batchOutput");
  75687. this.format = (0, _utils.getStringOption)(attributes.format, [
  75688. "none",
  75689. "concat",
  75690. "zip",
  75691. "zipCompress",
  75692. ]);
  75693. }
  75694. }
  75695. class BehaviorOverride extends _xfa_object.ContentObject {
  75696. constructor(attributes) {
  75697. super(CONFIG_NS_ID, "behaviorOverride");
  75698. }
  75699. [_xfa_object.$finalize]() {
  75700. this[_xfa_object.$content] = new Map(
  75701. this[_xfa_object.$content]
  75702. .trim()
  75703. .split(/\s+/)
  75704. .filter((x) => x.includes(":"))
  75705. .map((x) => x.split(":", 2))
  75706. );
  75707. }
  75708. }
  75709. class Cache extends _xfa_object.XFAObject {
  75710. constructor(attributes) {
  75711. super(CONFIG_NS_ID, "cache", true);
  75712. this.templateCache = null;
  75713. }
  75714. }
  75715. class Change extends _xfa_object.Option01 {
  75716. constructor(attributes) {
  75717. super(CONFIG_NS_ID, "change");
  75718. }
  75719. }
  75720. class Common extends _xfa_object.XFAObject {
  75721. constructor(attributes) {
  75722. super(CONFIG_NS_ID, "common", true);
  75723. this.data = null;
  75724. this.locale = null;
  75725. this.localeSet = null;
  75726. this.messaging = null;
  75727. this.suppressBanner = null;
  75728. this.template = null;
  75729. this.validationMessaging = null;
  75730. this.versionControl = null;
  75731. this.log = new _xfa_object.XFAObjectArray();
  75732. }
  75733. }
  75734. class Compress extends _xfa_object.XFAObject {
  75735. constructor(attributes) {
  75736. super(CONFIG_NS_ID, "compress");
  75737. this.scope = (0, _utils.getStringOption)(attributes.scope, [
  75738. "imageOnly",
  75739. "document",
  75740. ]);
  75741. }
  75742. }
  75743. class CompressLogicalStructure extends _xfa_object.Option01 {
  75744. constructor(attributes) {
  75745. super(CONFIG_NS_ID, "compressLogicalStructure");
  75746. }
  75747. }
  75748. class CompressObjectStream extends _xfa_object.Option10 {
  75749. constructor(attributes) {
  75750. super(CONFIG_NS_ID, "compressObjectStream");
  75751. }
  75752. }
  75753. class Compression extends _xfa_object.XFAObject {
  75754. constructor(attributes) {
  75755. super(CONFIG_NS_ID, "compression", true);
  75756. this.compressLogicalStructure = null;
  75757. this.compressObjectStream = null;
  75758. this.level = null;
  75759. this.type = null;
  75760. }
  75761. }
  75762. class Config extends _xfa_object.XFAObject {
  75763. constructor(attributes) {
  75764. super(CONFIG_NS_ID, "config", true);
  75765. this.acrobat = null;
  75766. this.present = null;
  75767. this.trace = null;
  75768. this.agent = new _xfa_object.XFAObjectArray();
  75769. }
  75770. }
  75771. class Conformance extends _xfa_object.OptionObject {
  75772. constructor(attributes) {
  75773. super(CONFIG_NS_ID, "conformance", ["A", "B"]);
  75774. }
  75775. }
  75776. class ContentCopy extends _xfa_object.Option01 {
  75777. constructor(attributes) {
  75778. super(CONFIG_NS_ID, "contentCopy");
  75779. }
  75780. }
  75781. class Copies extends _xfa_object.IntegerObject {
  75782. constructor(attributes) {
  75783. super(CONFIG_NS_ID, "copies", 1, (n) => n >= 1);
  75784. }
  75785. }
  75786. class Creator extends _xfa_object.StringObject {
  75787. constructor(attributes) {
  75788. super(CONFIG_NS_ID, "creator");
  75789. }
  75790. }
  75791. class CurrentPage extends _xfa_object.IntegerObject {
  75792. constructor(attributes) {
  75793. super(CONFIG_NS_ID, "currentPage", 0, (n) => n >= 0);
  75794. }
  75795. }
  75796. class Data extends _xfa_object.XFAObject {
  75797. constructor(attributes) {
  75798. super(CONFIG_NS_ID, "data", true);
  75799. this.adjustData = null;
  75800. this.attributes = null;
  75801. this.incrementalLoad = null;
  75802. this.outputXSL = null;
  75803. this.range = null;
  75804. this.record = null;
  75805. this.startNode = null;
  75806. this.uri = null;
  75807. this.window = null;
  75808. this.xsl = null;
  75809. this.excludeNS = new _xfa_object.XFAObjectArray();
  75810. this.transform = new _xfa_object.XFAObjectArray();
  75811. }
  75812. }
  75813. class Debug extends _xfa_object.XFAObject {
  75814. constructor(attributes) {
  75815. super(CONFIG_NS_ID, "debug", true);
  75816. this.uri = null;
  75817. }
  75818. }
  75819. class DefaultTypeface extends _xfa_object.ContentObject {
  75820. constructor(attributes) {
  75821. super(CONFIG_NS_ID, "defaultTypeface");
  75822. this.writingScript = (0, _utils.getStringOption)(
  75823. attributes.writingScript,
  75824. [
  75825. "*",
  75826. "Arabic",
  75827. "Cyrillic",
  75828. "EastEuropeanRoman",
  75829. "Greek",
  75830. "Hebrew",
  75831. "Japanese",
  75832. "Korean",
  75833. "Roman",
  75834. "SimplifiedChinese",
  75835. "Thai",
  75836. "TraditionalChinese",
  75837. "Vietnamese",
  75838. ]
  75839. );
  75840. }
  75841. }
  75842. class Destination extends _xfa_object.OptionObject {
  75843. constructor(attributes) {
  75844. super(CONFIG_NS_ID, "destination", [
  75845. "pdf",
  75846. "pcl",
  75847. "ps",
  75848. "webClient",
  75849. "zpl",
  75850. ]);
  75851. }
  75852. }
  75853. class DocumentAssembly extends _xfa_object.Option01 {
  75854. constructor(attributes) {
  75855. super(CONFIG_NS_ID, "documentAssembly");
  75856. }
  75857. }
  75858. class Driver extends _xfa_object.XFAObject {
  75859. constructor(attributes) {
  75860. super(CONFIG_NS_ID, "driver", true);
  75861. this.name = attributes.name ? attributes.name.trim() : "";
  75862. this.fontInfo = null;
  75863. this.xdc = null;
  75864. }
  75865. }
  75866. class DuplexOption extends _xfa_object.OptionObject {
  75867. constructor(attributes) {
  75868. super(CONFIG_NS_ID, "duplexOption", [
  75869. "simplex",
  75870. "duplexFlipLongEdge",
  75871. "duplexFlipShortEdge",
  75872. ]);
  75873. }
  75874. }
  75875. class DynamicRender extends _xfa_object.OptionObject {
  75876. constructor(attributes) {
  75877. super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]);
  75878. }
  75879. }
  75880. class Embed extends _xfa_object.Option01 {
  75881. constructor(attributes) {
  75882. super(CONFIG_NS_ID, "embed");
  75883. }
  75884. }
  75885. class Encrypt extends _xfa_object.Option01 {
  75886. constructor(attributes) {
  75887. super(CONFIG_NS_ID, "encrypt");
  75888. }
  75889. }
  75890. class Encryption extends _xfa_object.XFAObject {
  75891. constructor(attributes) {
  75892. super(CONFIG_NS_ID, "encryption", true);
  75893. this.encrypt = null;
  75894. this.encryptionLevel = null;
  75895. this.permissions = null;
  75896. }
  75897. }
  75898. class EncryptionLevel extends _xfa_object.OptionObject {
  75899. constructor(attributes) {
  75900. super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]);
  75901. }
  75902. }
  75903. class Enforce extends _xfa_object.StringObject {
  75904. constructor(attributes) {
  75905. super(CONFIG_NS_ID, "enforce");
  75906. }
  75907. }
  75908. class Equate extends _xfa_object.XFAObject {
  75909. constructor(attributes) {
  75910. super(CONFIG_NS_ID, "equate");
  75911. this.force = (0, _utils.getInteger)({
  75912. data: attributes.force,
  75913. defaultValue: 1,
  75914. validate: (n) => n === 0,
  75915. });
  75916. this.from = attributes.from || "";
  75917. this.to = attributes.to || "";
  75918. }
  75919. }
  75920. class EquateRange extends _xfa_object.XFAObject {
  75921. constructor(attributes) {
  75922. super(CONFIG_NS_ID, "equateRange");
  75923. this.from = attributes.from || "";
  75924. this.to = attributes.to || "";
  75925. this._unicodeRange = attributes.unicodeRange || "";
  75926. }
  75927. get unicodeRange() {
  75928. const ranges = [];
  75929. const unicodeRegex = /U\+([0-9a-fA-F]+)/;
  75930. const unicodeRange = this._unicodeRange;
  75931. for (let range of unicodeRange
  75932. .split(",")
  75933. .map((x) => x.trim())
  75934. .filter((x) => !!x)) {
  75935. range = range.split("-", 2).map((x) => {
  75936. const found = x.match(unicodeRegex);
  75937. if (!found) {
  75938. return 0;
  75939. }
  75940. return parseInt(found[1], 16);
  75941. });
  75942. if (range.length === 1) {
  75943. range.push(range[0]);
  75944. }
  75945. ranges.push(range);
  75946. }
  75947. return (0, _util.shadow)(this, "unicodeRange", ranges);
  75948. }
  75949. }
  75950. class Exclude extends _xfa_object.ContentObject {
  75951. constructor(attributes) {
  75952. super(CONFIG_NS_ID, "exclude");
  75953. }
  75954. [_xfa_object.$finalize]() {
  75955. this[_xfa_object.$content] = this[_xfa_object.$content]
  75956. .trim()
  75957. .split(/\s+/)
  75958. .filter(
  75959. (x) =>
  75960. x &&
  75961. [
  75962. "calculate",
  75963. "close",
  75964. "enter",
  75965. "exit",
  75966. "initialize",
  75967. "ready",
  75968. "validate",
  75969. ].includes(x)
  75970. );
  75971. }
  75972. }
  75973. class ExcludeNS extends _xfa_object.StringObject {
  75974. constructor(attributes) {
  75975. super(CONFIG_NS_ID, "excludeNS");
  75976. }
  75977. }
  75978. class FlipLabel extends _xfa_object.OptionObject {
  75979. constructor(attributes) {
  75980. super(CONFIG_NS_ID, "flipLabel", [
  75981. "usePrinterSetting",
  75982. "on",
  75983. "off",
  75984. ]);
  75985. }
  75986. }
  75987. class FontInfo extends _xfa_object.XFAObject {
  75988. constructor(attributes) {
  75989. super(CONFIG_NS_ID, "fontInfo", true);
  75990. this.embed = null;
  75991. this.map = null;
  75992. this.subsetBelow = null;
  75993. this.alwaysEmbed = new _xfa_object.XFAObjectArray();
  75994. this.defaultTypeface = new _xfa_object.XFAObjectArray();
  75995. this.neverEmbed = new _xfa_object.XFAObjectArray();
  75996. }
  75997. }
  75998. class FormFieldFilling extends _xfa_object.Option01 {
  75999. constructor(attributes) {
  76000. super(CONFIG_NS_ID, "formFieldFilling");
  76001. }
  76002. }
  76003. class GroupParent extends _xfa_object.StringObject {
  76004. constructor(attributes) {
  76005. super(CONFIG_NS_ID, "groupParent");
  76006. }
  76007. }
  76008. class IfEmpty extends _xfa_object.OptionObject {
  76009. constructor(attributes) {
  76010. super(CONFIG_NS_ID, "ifEmpty", [
  76011. "dataValue",
  76012. "dataGroup",
  76013. "ignore",
  76014. "remove",
  76015. ]);
  76016. }
  76017. }
  76018. class IncludeXDPContent extends _xfa_object.StringObject {
  76019. constructor(attributes) {
  76020. super(CONFIG_NS_ID, "includeXDPContent");
  76021. }
  76022. }
  76023. class IncrementalLoad extends _xfa_object.OptionObject {
  76024. constructor(attributes) {
  76025. super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]);
  76026. }
  76027. }
  76028. class IncrementalMerge extends _xfa_object.Option01 {
  76029. constructor(attributes) {
  76030. super(CONFIG_NS_ID, "incrementalMerge");
  76031. }
  76032. }
  76033. class Interactive extends _xfa_object.Option01 {
  76034. constructor(attributes) {
  76035. super(CONFIG_NS_ID, "interactive");
  76036. }
  76037. }
  76038. class Jog extends _xfa_object.OptionObject {
  76039. constructor(attributes) {
  76040. super(CONFIG_NS_ID, "jog", [
  76041. "usePrinterSetting",
  76042. "none",
  76043. "pageSet",
  76044. ]);
  76045. }
  76046. }
  76047. class LabelPrinter extends _xfa_object.XFAObject {
  76048. constructor(attributes) {
  76049. super(CONFIG_NS_ID, "labelPrinter", true);
  76050. this.name = (0, _utils.getStringOption)(attributes.name, [
  76051. "zpl",
  76052. "dpl",
  76053. "ipl",
  76054. "tcpl",
  76055. ]);
  76056. this.batchOutput = null;
  76057. this.flipLabel = null;
  76058. this.fontInfo = null;
  76059. this.xdc = null;
  76060. }
  76061. }
  76062. class Layout extends _xfa_object.OptionObject {
  76063. constructor(attributes) {
  76064. super(CONFIG_NS_ID, "layout", ["paginate", "panel"]);
  76065. }
  76066. }
  76067. class Level extends _xfa_object.IntegerObject {
  76068. constructor(attributes) {
  76069. super(CONFIG_NS_ID, "level", 0, (n) => n > 0);
  76070. }
  76071. }
  76072. class Linearized extends _xfa_object.Option01 {
  76073. constructor(attributes) {
  76074. super(CONFIG_NS_ID, "linearized");
  76075. }
  76076. }
  76077. class Locale extends _xfa_object.StringObject {
  76078. constructor(attributes) {
  76079. super(CONFIG_NS_ID, "locale");
  76080. }
  76081. }
  76082. class LocaleSet extends _xfa_object.StringObject {
  76083. constructor(attributes) {
  76084. super(CONFIG_NS_ID, "localeSet");
  76085. }
  76086. }
  76087. class Log extends _xfa_object.XFAObject {
  76088. constructor(attributes) {
  76089. super(CONFIG_NS_ID, "log", true);
  76090. this.mode = null;
  76091. this.threshold = null;
  76092. this.to = null;
  76093. this.uri = null;
  76094. }
  76095. }
  76096. class MapElement extends _xfa_object.XFAObject {
  76097. constructor(attributes) {
  76098. super(CONFIG_NS_ID, "map", true);
  76099. this.equate = new _xfa_object.XFAObjectArray();
  76100. this.equateRange = new _xfa_object.XFAObjectArray();
  76101. }
  76102. }
  76103. class MediumInfo extends _xfa_object.XFAObject {
  76104. constructor(attributes) {
  76105. super(CONFIG_NS_ID, "mediumInfo", true);
  76106. this.map = null;
  76107. }
  76108. }
  76109. class Message extends _xfa_object.XFAObject {
  76110. constructor(attributes) {
  76111. super(CONFIG_NS_ID, "message", true);
  76112. this.msgId = null;
  76113. this.severity = null;
  76114. }
  76115. }
  76116. class Messaging extends _xfa_object.XFAObject {
  76117. constructor(attributes) {
  76118. super(CONFIG_NS_ID, "messaging", true);
  76119. this.message = new _xfa_object.XFAObjectArray();
  76120. }
  76121. }
  76122. class Mode extends _xfa_object.OptionObject {
  76123. constructor(attributes) {
  76124. super(CONFIG_NS_ID, "mode", ["append", "overwrite"]);
  76125. }
  76126. }
  76127. class ModifyAnnots extends _xfa_object.Option01 {
  76128. constructor(attributes) {
  76129. super(CONFIG_NS_ID, "modifyAnnots");
  76130. }
  76131. }
  76132. class MsgId extends _xfa_object.IntegerObject {
  76133. constructor(attributes) {
  76134. super(CONFIG_NS_ID, "msgId", 1, (n) => n >= 1);
  76135. }
  76136. }
  76137. class NameAttr extends _xfa_object.StringObject {
  76138. constructor(attributes) {
  76139. super(CONFIG_NS_ID, "nameAttr");
  76140. }
  76141. }
  76142. class NeverEmbed extends _xfa_object.ContentObject {
  76143. constructor(attributes) {
  76144. super(CONFIG_NS_ID, "neverEmbed");
  76145. }
  76146. }
  76147. class NumberOfCopies extends _xfa_object.IntegerObject {
  76148. constructor(attributes) {
  76149. super(
  76150. CONFIG_NS_ID,
  76151. "numberOfCopies",
  76152. null,
  76153. (n) => n >= 2 && n <= 5
  76154. );
  76155. }
  76156. }
  76157. class OpenAction extends _xfa_object.XFAObject {
  76158. constructor(attributes) {
  76159. super(CONFIG_NS_ID, "openAction", true);
  76160. this.destination = null;
  76161. }
  76162. }
  76163. class Output extends _xfa_object.XFAObject {
  76164. constructor(attributes) {
  76165. super(CONFIG_NS_ID, "output", true);
  76166. this.to = null;
  76167. this.type = null;
  76168. this.uri = null;
  76169. }
  76170. }
  76171. class OutputBin extends _xfa_object.StringObject {
  76172. constructor(attributes) {
  76173. super(CONFIG_NS_ID, "outputBin");
  76174. }
  76175. }
  76176. class OutputXSL extends _xfa_object.XFAObject {
  76177. constructor(attributes) {
  76178. super(CONFIG_NS_ID, "outputXSL", true);
  76179. this.uri = null;
  76180. }
  76181. }
  76182. class Overprint extends _xfa_object.OptionObject {
  76183. constructor(attributes) {
  76184. super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]);
  76185. }
  76186. }
  76187. class Packets extends _xfa_object.StringObject {
  76188. constructor(attributes) {
  76189. super(CONFIG_NS_ID, "packets");
  76190. }
  76191. [_xfa_object.$finalize]() {
  76192. if (this[_xfa_object.$content] === "*") {
  76193. return;
  76194. }
  76195. this[_xfa_object.$content] = this[_xfa_object.$content]
  76196. .trim()
  76197. .split(/\s+/)
  76198. .filter((x) =>
  76199. ["config", "datasets", "template", "xfdf", "xslt"].includes(x)
  76200. );
  76201. }
  76202. }
  76203. class PageOffset extends _xfa_object.XFAObject {
  76204. constructor(attributes) {
  76205. super(CONFIG_NS_ID, "pageOffset");
  76206. this.x = (0, _utils.getInteger)({
  76207. data: attributes.x,
  76208. defaultValue: "useXDCSetting",
  76209. validate: (n) => true,
  76210. });
  76211. this.y = (0, _utils.getInteger)({
  76212. data: attributes.y,
  76213. defaultValue: "useXDCSetting",
  76214. validate: (n) => true,
  76215. });
  76216. }
  76217. }
  76218. class PageRange extends _xfa_object.StringObject {
  76219. constructor(attributes) {
  76220. super(CONFIG_NS_ID, "pageRange");
  76221. }
  76222. [_xfa_object.$finalize]() {
  76223. const numbers = this[_xfa_object.$content]
  76224. .trim()
  76225. .split(/\s+/)
  76226. .map((x) => parseInt(x, 10));
  76227. const ranges = [];
  76228. for (let i = 0, ii = numbers.length; i < ii; i += 2) {
  76229. ranges.push(numbers.slice(i, i + 2));
  76230. }
  76231. this[_xfa_object.$content] = ranges;
  76232. }
  76233. }
  76234. class Pagination extends _xfa_object.OptionObject {
  76235. constructor(attributes) {
  76236. super(CONFIG_NS_ID, "pagination", [
  76237. "simplex",
  76238. "duplexShortEdge",
  76239. "duplexLongEdge",
  76240. ]);
  76241. }
  76242. }
  76243. class PaginationOverride extends _xfa_object.OptionObject {
  76244. constructor(attributes) {
  76245. super(CONFIG_NS_ID, "paginationOverride", [
  76246. "none",
  76247. "forceDuplex",
  76248. "forceDuplexLongEdge",
  76249. "forceDuplexShortEdge",
  76250. "forceSimplex",
  76251. ]);
  76252. }
  76253. }
  76254. class Part extends _xfa_object.IntegerObject {
  76255. constructor(attributes) {
  76256. super(CONFIG_NS_ID, "part", 1, (n) => false);
  76257. }
  76258. }
  76259. class Pcl extends _xfa_object.XFAObject {
  76260. constructor(attributes) {
  76261. super(CONFIG_NS_ID, "pcl", true);
  76262. this.name = attributes.name || "";
  76263. this.batchOutput = null;
  76264. this.fontInfo = null;
  76265. this.jog = null;
  76266. this.mediumInfo = null;
  76267. this.outputBin = null;
  76268. this.pageOffset = null;
  76269. this.staple = null;
  76270. this.xdc = null;
  76271. }
  76272. }
  76273. class Pdf extends _xfa_object.XFAObject {
  76274. constructor(attributes) {
  76275. super(CONFIG_NS_ID, "pdf", true);
  76276. this.name = attributes.name || "";
  76277. this.adobeExtensionLevel = null;
  76278. this.batchOutput = null;
  76279. this.compression = null;
  76280. this.creator = null;
  76281. this.encryption = null;
  76282. this.fontInfo = null;
  76283. this.interactive = null;
  76284. this.linearized = null;
  76285. this.openAction = null;
  76286. this.pdfa = null;
  76287. this.producer = null;
  76288. this.renderPolicy = null;
  76289. this.scriptModel = null;
  76290. this.silentPrint = null;
  76291. this.submitFormat = null;
  76292. this.tagged = null;
  76293. this.version = null;
  76294. this.viewerPreferences = null;
  76295. this.xdc = null;
  76296. }
  76297. }
  76298. class Pdfa extends _xfa_object.XFAObject {
  76299. constructor(attributes) {
  76300. super(CONFIG_NS_ID, "pdfa", true);
  76301. this.amd = null;
  76302. this.conformance = null;
  76303. this.includeXDPContent = null;
  76304. this.part = null;
  76305. }
  76306. }
  76307. class Permissions extends _xfa_object.XFAObject {
  76308. constructor(attributes) {
  76309. super(CONFIG_NS_ID, "permissions", true);
  76310. this.accessibleContent = null;
  76311. this.change = null;
  76312. this.contentCopy = null;
  76313. this.documentAssembly = null;
  76314. this.formFieldFilling = null;
  76315. this.modifyAnnots = null;
  76316. this.plaintextMetadata = null;
  76317. this.print = null;
  76318. this.printHighQuality = null;
  76319. }
  76320. }
  76321. class PickTrayByPDFSize extends _xfa_object.Option01 {
  76322. constructor(attributes) {
  76323. super(CONFIG_NS_ID, "pickTrayByPDFSize");
  76324. }
  76325. }
  76326. class Picture extends _xfa_object.StringObject {
  76327. constructor(attributes) {
  76328. super(CONFIG_NS_ID, "picture");
  76329. }
  76330. }
  76331. class PlaintextMetadata extends _xfa_object.Option01 {
  76332. constructor(attributes) {
  76333. super(CONFIG_NS_ID, "plaintextMetadata");
  76334. }
  76335. }
  76336. class Presence extends _xfa_object.OptionObject {
  76337. constructor(attributes) {
  76338. super(CONFIG_NS_ID, "presence", [
  76339. "preserve",
  76340. "dissolve",
  76341. "dissolveStructure",
  76342. "ignore",
  76343. "remove",
  76344. ]);
  76345. }
  76346. }
  76347. class Present extends _xfa_object.XFAObject {
  76348. constructor(attributes) {
  76349. super(CONFIG_NS_ID, "present", true);
  76350. this.behaviorOverride = null;
  76351. this.cache = null;
  76352. this.common = null;
  76353. this.copies = null;
  76354. this.destination = null;
  76355. this.incrementalMerge = null;
  76356. this.layout = null;
  76357. this.output = null;
  76358. this.overprint = null;
  76359. this.pagination = null;
  76360. this.paginationOverride = null;
  76361. this.script = null;
  76362. this.validate = null;
  76363. this.xdp = null;
  76364. this.driver = new _xfa_object.XFAObjectArray();
  76365. this.labelPrinter = new _xfa_object.XFAObjectArray();
  76366. this.pcl = new _xfa_object.XFAObjectArray();
  76367. this.pdf = new _xfa_object.XFAObjectArray();
  76368. this.ps = new _xfa_object.XFAObjectArray();
  76369. this.submitUrl = new _xfa_object.XFAObjectArray();
  76370. this.webClient = new _xfa_object.XFAObjectArray();
  76371. this.zpl = new _xfa_object.XFAObjectArray();
  76372. }
  76373. }
  76374. class Print extends _xfa_object.Option01 {
  76375. constructor(attributes) {
  76376. super(CONFIG_NS_ID, "print");
  76377. }
  76378. }
  76379. class PrintHighQuality extends _xfa_object.Option01 {
  76380. constructor(attributes) {
  76381. super(CONFIG_NS_ID, "printHighQuality");
  76382. }
  76383. }
  76384. class PrintScaling extends _xfa_object.OptionObject {
  76385. constructor(attributes) {
  76386. super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]);
  76387. }
  76388. }
  76389. class PrinterName extends _xfa_object.StringObject {
  76390. constructor(attributes) {
  76391. super(CONFIG_NS_ID, "printerName");
  76392. }
  76393. }
  76394. class Producer extends _xfa_object.StringObject {
  76395. constructor(attributes) {
  76396. super(CONFIG_NS_ID, "producer");
  76397. }
  76398. }
  76399. class Ps extends _xfa_object.XFAObject {
  76400. constructor(attributes) {
  76401. super(CONFIG_NS_ID, "ps", true);
  76402. this.name = attributes.name || "";
  76403. this.batchOutput = null;
  76404. this.fontInfo = null;
  76405. this.jog = null;
  76406. this.mediumInfo = null;
  76407. this.outputBin = null;
  76408. this.staple = null;
  76409. this.xdc = null;
  76410. }
  76411. }
  76412. class Range extends _xfa_object.ContentObject {
  76413. constructor(attributes) {
  76414. super(CONFIG_NS_ID, "range");
  76415. }
  76416. [_xfa_object.$finalize]() {
  76417. this[_xfa_object.$content] = this[_xfa_object.$content]
  76418. .trim()
  76419. .split(/\s*,\s*/, 2)
  76420. .map((range) =>
  76421. range.split("-").map((x) => parseInt(x.trim(), 10))
  76422. )
  76423. .filter((range) => range.every((x) => !isNaN(x)))
  76424. .map((range) => {
  76425. if (range.length === 1) {
  76426. range.push(range[0]);
  76427. }
  76428. return range;
  76429. });
  76430. }
  76431. }
  76432. class Record extends _xfa_object.ContentObject {
  76433. constructor(attributes) {
  76434. super(CONFIG_NS_ID, "record");
  76435. }
  76436. [_xfa_object.$finalize]() {
  76437. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  76438. const n = parseInt(this[_xfa_object.$content], 10);
  76439. if (!isNaN(n) && n >= 0) {
  76440. this[_xfa_object.$content] = n;
  76441. }
  76442. }
  76443. }
  76444. class Relevant extends _xfa_object.ContentObject {
  76445. constructor(attributes) {
  76446. super(CONFIG_NS_ID, "relevant");
  76447. }
  76448. [_xfa_object.$finalize]() {
  76449. this[_xfa_object.$content] = this[_xfa_object.$content]
  76450. .trim()
  76451. .split(/\s+/);
  76452. }
  76453. }
  76454. class Rename extends _xfa_object.ContentObject {
  76455. constructor(attributes) {
  76456. super(CONFIG_NS_ID, "rename");
  76457. }
  76458. [_xfa_object.$finalize]() {
  76459. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  76460. if (
  76461. this[_xfa_object.$content].toLowerCase().startsWith("xml") ||
  76462. this[_xfa_object.$content].match(
  76463. new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u")
  76464. )
  76465. ) {
  76466. (0, _util.warn)("XFA - Rename: invalid XFA name");
  76467. }
  76468. }
  76469. }
  76470. class RenderPolicy extends _xfa_object.OptionObject {
  76471. constructor(attributes) {
  76472. super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]);
  76473. }
  76474. }
  76475. class RunScripts extends _xfa_object.OptionObject {
  76476. constructor(attributes) {
  76477. super(CONFIG_NS_ID, "runScripts", [
  76478. "both",
  76479. "client",
  76480. "none",
  76481. "server",
  76482. ]);
  76483. }
  76484. }
  76485. class Script extends _xfa_object.XFAObject {
  76486. constructor(attributes) {
  76487. super(CONFIG_NS_ID, "script", true);
  76488. this.currentPage = null;
  76489. this.exclude = null;
  76490. this.runScripts = null;
  76491. }
  76492. }
  76493. class ScriptModel extends _xfa_object.OptionObject {
  76494. constructor(attributes) {
  76495. super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]);
  76496. }
  76497. }
  76498. class Severity extends _xfa_object.OptionObject {
  76499. constructor(attributes) {
  76500. super(CONFIG_NS_ID, "severity", [
  76501. "ignore",
  76502. "error",
  76503. "information",
  76504. "trace",
  76505. "warning",
  76506. ]);
  76507. }
  76508. }
  76509. class SilentPrint extends _xfa_object.XFAObject {
  76510. constructor(attributes) {
  76511. super(CONFIG_NS_ID, "silentPrint", true);
  76512. this.addSilentPrint = null;
  76513. this.printerName = null;
  76514. }
  76515. }
  76516. class Staple extends _xfa_object.XFAObject {
  76517. constructor(attributes) {
  76518. super(CONFIG_NS_ID, "staple");
  76519. this.mode = (0, _utils.getStringOption)(attributes.mode, [
  76520. "usePrinterSetting",
  76521. "on",
  76522. "off",
  76523. ]);
  76524. }
  76525. }
  76526. class StartNode extends _xfa_object.StringObject {
  76527. constructor(attributes) {
  76528. super(CONFIG_NS_ID, "startNode");
  76529. }
  76530. }
  76531. class StartPage extends _xfa_object.IntegerObject {
  76532. constructor(attributes) {
  76533. super(CONFIG_NS_ID, "startPage", 0, (n) => true);
  76534. }
  76535. }
  76536. class SubmitFormat extends _xfa_object.OptionObject {
  76537. constructor(attributes) {
  76538. super(CONFIG_NS_ID, "submitFormat", [
  76539. "html",
  76540. "delegate",
  76541. "fdf",
  76542. "xml",
  76543. "pdf",
  76544. ]);
  76545. }
  76546. }
  76547. class SubmitUrl extends _xfa_object.StringObject {
  76548. constructor(attributes) {
  76549. super(CONFIG_NS_ID, "submitUrl");
  76550. }
  76551. }
  76552. class SubsetBelow extends _xfa_object.IntegerObject {
  76553. constructor(attributes) {
  76554. super(CONFIG_NS_ID, "subsetBelow", 100, (n) => n >= 0 && n <= 100);
  76555. }
  76556. }
  76557. class SuppressBanner extends _xfa_object.Option01 {
  76558. constructor(attributes) {
  76559. super(CONFIG_NS_ID, "suppressBanner");
  76560. }
  76561. }
  76562. class Tagged extends _xfa_object.Option01 {
  76563. constructor(attributes) {
  76564. super(CONFIG_NS_ID, "tagged");
  76565. }
  76566. }
  76567. class Template extends _xfa_object.XFAObject {
  76568. constructor(attributes) {
  76569. super(CONFIG_NS_ID, "template", true);
  76570. this.base = null;
  76571. this.relevant = null;
  76572. this.startPage = null;
  76573. this.uri = null;
  76574. this.xsl = null;
  76575. }
  76576. }
  76577. class Threshold extends _xfa_object.OptionObject {
  76578. constructor(attributes) {
  76579. super(CONFIG_NS_ID, "threshold", [
  76580. "trace",
  76581. "error",
  76582. "information",
  76583. "warning",
  76584. ]);
  76585. }
  76586. }
  76587. class To extends _xfa_object.OptionObject {
  76588. constructor(attributes) {
  76589. super(CONFIG_NS_ID, "to", [
  76590. "null",
  76591. "memory",
  76592. "stderr",
  76593. "stdout",
  76594. "system",
  76595. "uri",
  76596. ]);
  76597. }
  76598. }
  76599. class TemplateCache extends _xfa_object.XFAObject {
  76600. constructor(attributes) {
  76601. super(CONFIG_NS_ID, "templateCache");
  76602. this.maxEntries = (0, _utils.getInteger)({
  76603. data: attributes.maxEntries,
  76604. defaultValue: 5,
  76605. validate: (n) => n >= 0,
  76606. });
  76607. }
  76608. }
  76609. class Trace extends _xfa_object.XFAObject {
  76610. constructor(attributes) {
  76611. super(CONFIG_NS_ID, "trace", true);
  76612. this.area = new _xfa_object.XFAObjectArray();
  76613. }
  76614. }
  76615. class Transform extends _xfa_object.XFAObject {
  76616. constructor(attributes) {
  76617. super(CONFIG_NS_ID, "transform", true);
  76618. this.groupParent = null;
  76619. this.ifEmpty = null;
  76620. this.nameAttr = null;
  76621. this.picture = null;
  76622. this.presence = null;
  76623. this.rename = null;
  76624. this.whitespace = null;
  76625. }
  76626. }
  76627. class Type extends _xfa_object.OptionObject {
  76628. constructor(attributes) {
  76629. super(CONFIG_NS_ID, "type", [
  76630. "none",
  76631. "ascii85",
  76632. "asciiHex",
  76633. "ccittfax",
  76634. "flate",
  76635. "lzw",
  76636. "runLength",
  76637. "native",
  76638. "xdp",
  76639. "mergedXDP",
  76640. ]);
  76641. }
  76642. }
  76643. class Uri extends _xfa_object.StringObject {
  76644. constructor(attributes) {
  76645. super(CONFIG_NS_ID, "uri");
  76646. }
  76647. }
  76648. class Validate extends _xfa_object.OptionObject {
  76649. constructor(attributes) {
  76650. super(CONFIG_NS_ID, "validate", [
  76651. "preSubmit",
  76652. "prePrint",
  76653. "preExecute",
  76654. "preSave",
  76655. ]);
  76656. }
  76657. }
  76658. class ValidateApprovalSignatures extends _xfa_object.ContentObject {
  76659. constructor(attributes) {
  76660. super(CONFIG_NS_ID, "validateApprovalSignatures");
  76661. }
  76662. [_xfa_object.$finalize]() {
  76663. this[_xfa_object.$content] = this[_xfa_object.$content]
  76664. .trim()
  76665. .split(/\s+/)
  76666. .filter((x) => ["docReady", "postSign"].includes(x));
  76667. }
  76668. }
  76669. class ValidationMessaging extends _xfa_object.OptionObject {
  76670. constructor(attributes) {
  76671. super(CONFIG_NS_ID, "validationMessaging", [
  76672. "allMessagesIndividually",
  76673. "allMessagesTogether",
  76674. "firstMessageOnly",
  76675. "noMessages",
  76676. ]);
  76677. }
  76678. }
  76679. class Version extends _xfa_object.OptionObject {
  76680. constructor(attributes) {
  76681. super(CONFIG_NS_ID, "version", [
  76682. "1.7",
  76683. "1.6",
  76684. "1.5",
  76685. "1.4",
  76686. "1.3",
  76687. "1.2",
  76688. ]);
  76689. }
  76690. }
  76691. class VersionControl extends _xfa_object.XFAObject {
  76692. constructor(attributes) {
  76693. super(CONFIG_NS_ID, "VersionControl");
  76694. this.outputBelow = (0, _utils.getStringOption)(
  76695. attributes.outputBelow,
  76696. ["warn", "error", "update"]
  76697. );
  76698. this.sourceAbove = (0, _utils.getStringOption)(
  76699. attributes.sourceAbove,
  76700. ["warn", "error"]
  76701. );
  76702. this.sourceBelow = (0, _utils.getStringOption)(
  76703. attributes.sourceBelow,
  76704. ["update", "maintain"]
  76705. );
  76706. }
  76707. }
  76708. class ViewerPreferences extends _xfa_object.XFAObject {
  76709. constructor(attributes) {
  76710. super(CONFIG_NS_ID, "viewerPreferences", true);
  76711. this.ADBE_JSConsole = null;
  76712. this.ADBE_JSDebugger = null;
  76713. this.addViewerPreferences = null;
  76714. this.duplexOption = null;
  76715. this.enforce = null;
  76716. this.numberOfCopies = null;
  76717. this.pageRange = null;
  76718. this.pickTrayByPDFSize = null;
  76719. this.printScaling = null;
  76720. }
  76721. }
  76722. class WebClient extends _xfa_object.XFAObject {
  76723. constructor(attributes) {
  76724. super(CONFIG_NS_ID, "webClient", true);
  76725. this.name = attributes.name ? attributes.name.trim() : "";
  76726. this.fontInfo = null;
  76727. this.xdc = null;
  76728. }
  76729. }
  76730. class Whitespace extends _xfa_object.OptionObject {
  76731. constructor(attributes) {
  76732. super(CONFIG_NS_ID, "whitespace", [
  76733. "preserve",
  76734. "ltrim",
  76735. "normalize",
  76736. "rtrim",
  76737. "trim",
  76738. ]);
  76739. }
  76740. }
  76741. class Window extends _xfa_object.ContentObject {
  76742. constructor(attributes) {
  76743. super(CONFIG_NS_ID, "window");
  76744. }
  76745. [_xfa_object.$finalize]() {
  76746. const pair = this[_xfa_object.$content]
  76747. .trim()
  76748. .split(/\s*,\s*/, 2)
  76749. .map((x) => parseInt(x, 10));
  76750. if (pair.some((x) => isNaN(x))) {
  76751. this[_xfa_object.$content] = [0, 0];
  76752. return;
  76753. }
  76754. if (pair.length === 1) {
  76755. pair.push(pair[0]);
  76756. }
  76757. this[_xfa_object.$content] = pair;
  76758. }
  76759. }
  76760. class Xdc extends _xfa_object.XFAObject {
  76761. constructor(attributes) {
  76762. super(CONFIG_NS_ID, "xdc", true);
  76763. this.uri = new _xfa_object.XFAObjectArray();
  76764. this.xsl = new _xfa_object.XFAObjectArray();
  76765. }
  76766. }
  76767. class Xdp extends _xfa_object.XFAObject {
  76768. constructor(attributes) {
  76769. super(CONFIG_NS_ID, "xdp", true);
  76770. this.packets = null;
  76771. }
  76772. }
  76773. class Xsl extends _xfa_object.XFAObject {
  76774. constructor(attributes) {
  76775. super(CONFIG_NS_ID, "xsl", true);
  76776. this.debug = null;
  76777. this.uri = null;
  76778. }
  76779. }
  76780. class Zpl extends _xfa_object.XFAObject {
  76781. constructor(attributes) {
  76782. super(CONFIG_NS_ID, "zpl", true);
  76783. this.name = attributes.name ? attributes.name.trim() : "";
  76784. this.batchOutput = null;
  76785. this.flipLabel = null;
  76786. this.fontInfo = null;
  76787. this.xdc = null;
  76788. }
  76789. }
  76790. class ConfigNamespace {
  76791. static [_namespaces.$buildXFAObject](name, attributes) {
  76792. if (ConfigNamespace.hasOwnProperty(name)) {
  76793. return ConfigNamespace[name](attributes);
  76794. }
  76795. return undefined;
  76796. }
  76797. static acrobat(attrs) {
  76798. return new Acrobat(attrs);
  76799. }
  76800. static acrobat7(attrs) {
  76801. return new Acrobat7(attrs);
  76802. }
  76803. static ADBE_JSConsole(attrs) {
  76804. return new ADBE_JSConsole(attrs);
  76805. }
  76806. static ADBE_JSDebugger(attrs) {
  76807. return new ADBE_JSDebugger(attrs);
  76808. }
  76809. static addSilentPrint(attrs) {
  76810. return new AddSilentPrint(attrs);
  76811. }
  76812. static addViewerPreferences(attrs) {
  76813. return new AddViewerPreferences(attrs);
  76814. }
  76815. static adjustData(attrs) {
  76816. return new AdjustData(attrs);
  76817. }
  76818. static adobeExtensionLevel(attrs) {
  76819. return new AdobeExtensionLevel(attrs);
  76820. }
  76821. static agent(attrs) {
  76822. return new Agent(attrs);
  76823. }
  76824. static alwaysEmbed(attrs) {
  76825. return new AlwaysEmbed(attrs);
  76826. }
  76827. static amd(attrs) {
  76828. return new Amd(attrs);
  76829. }
  76830. static area(attrs) {
  76831. return new Area(attrs);
  76832. }
  76833. static attributes(attrs) {
  76834. return new Attributes(attrs);
  76835. }
  76836. static autoSave(attrs) {
  76837. return new AutoSave(attrs);
  76838. }
  76839. static base(attrs) {
  76840. return new Base(attrs);
  76841. }
  76842. static batchOutput(attrs) {
  76843. return new BatchOutput(attrs);
  76844. }
  76845. static behaviorOverride(attrs) {
  76846. return new BehaviorOverride(attrs);
  76847. }
  76848. static cache(attrs) {
  76849. return new Cache(attrs);
  76850. }
  76851. static change(attrs) {
  76852. return new Change(attrs);
  76853. }
  76854. static common(attrs) {
  76855. return new Common(attrs);
  76856. }
  76857. static compress(attrs) {
  76858. return new Compress(attrs);
  76859. }
  76860. static compressLogicalStructure(attrs) {
  76861. return new CompressLogicalStructure(attrs);
  76862. }
  76863. static compressObjectStream(attrs) {
  76864. return new CompressObjectStream(attrs);
  76865. }
  76866. static compression(attrs) {
  76867. return new Compression(attrs);
  76868. }
  76869. static config(attrs) {
  76870. return new Config(attrs);
  76871. }
  76872. static conformance(attrs) {
  76873. return new Conformance(attrs);
  76874. }
  76875. static contentCopy(attrs) {
  76876. return new ContentCopy(attrs);
  76877. }
  76878. static copies(attrs) {
  76879. return new Copies(attrs);
  76880. }
  76881. static creator(attrs) {
  76882. return new Creator(attrs);
  76883. }
  76884. static currentPage(attrs) {
  76885. return new CurrentPage(attrs);
  76886. }
  76887. static data(attrs) {
  76888. return new Data(attrs);
  76889. }
  76890. static debug(attrs) {
  76891. return new Debug(attrs);
  76892. }
  76893. static defaultTypeface(attrs) {
  76894. return new DefaultTypeface(attrs);
  76895. }
  76896. static destination(attrs) {
  76897. return new Destination(attrs);
  76898. }
  76899. static documentAssembly(attrs) {
  76900. return new DocumentAssembly(attrs);
  76901. }
  76902. static driver(attrs) {
  76903. return new Driver(attrs);
  76904. }
  76905. static duplexOption(attrs) {
  76906. return new DuplexOption(attrs);
  76907. }
  76908. static dynamicRender(attrs) {
  76909. return new DynamicRender(attrs);
  76910. }
  76911. static embed(attrs) {
  76912. return new Embed(attrs);
  76913. }
  76914. static encrypt(attrs) {
  76915. return new Encrypt(attrs);
  76916. }
  76917. static encryption(attrs) {
  76918. return new Encryption(attrs);
  76919. }
  76920. static encryptionLevel(attrs) {
  76921. return new EncryptionLevel(attrs);
  76922. }
  76923. static enforce(attrs) {
  76924. return new Enforce(attrs);
  76925. }
  76926. static equate(attrs) {
  76927. return new Equate(attrs);
  76928. }
  76929. static equateRange(attrs) {
  76930. return new EquateRange(attrs);
  76931. }
  76932. static exclude(attrs) {
  76933. return new Exclude(attrs);
  76934. }
  76935. static excludeNS(attrs) {
  76936. return new ExcludeNS(attrs);
  76937. }
  76938. static flipLabel(attrs) {
  76939. return new FlipLabel(attrs);
  76940. }
  76941. static fontInfo(attrs) {
  76942. return new FontInfo(attrs);
  76943. }
  76944. static formFieldFilling(attrs) {
  76945. return new FormFieldFilling(attrs);
  76946. }
  76947. static groupParent(attrs) {
  76948. return new GroupParent(attrs);
  76949. }
  76950. static ifEmpty(attrs) {
  76951. return new IfEmpty(attrs);
  76952. }
  76953. static includeXDPContent(attrs) {
  76954. return new IncludeXDPContent(attrs);
  76955. }
  76956. static incrementalLoad(attrs) {
  76957. return new IncrementalLoad(attrs);
  76958. }
  76959. static incrementalMerge(attrs) {
  76960. return new IncrementalMerge(attrs);
  76961. }
  76962. static interactive(attrs) {
  76963. return new Interactive(attrs);
  76964. }
  76965. static jog(attrs) {
  76966. return new Jog(attrs);
  76967. }
  76968. static labelPrinter(attrs) {
  76969. return new LabelPrinter(attrs);
  76970. }
  76971. static layout(attrs) {
  76972. return new Layout(attrs);
  76973. }
  76974. static level(attrs) {
  76975. return new Level(attrs);
  76976. }
  76977. static linearized(attrs) {
  76978. return new Linearized(attrs);
  76979. }
  76980. static locale(attrs) {
  76981. return new Locale(attrs);
  76982. }
  76983. static localeSet(attrs) {
  76984. return new LocaleSet(attrs);
  76985. }
  76986. static log(attrs) {
  76987. return new Log(attrs);
  76988. }
  76989. static map(attrs) {
  76990. return new MapElement(attrs);
  76991. }
  76992. static mediumInfo(attrs) {
  76993. return new MediumInfo(attrs);
  76994. }
  76995. static message(attrs) {
  76996. return new Message(attrs);
  76997. }
  76998. static messaging(attrs) {
  76999. return new Messaging(attrs);
  77000. }
  77001. static mode(attrs) {
  77002. return new Mode(attrs);
  77003. }
  77004. static modifyAnnots(attrs) {
  77005. return new ModifyAnnots(attrs);
  77006. }
  77007. static msgId(attrs) {
  77008. return new MsgId(attrs);
  77009. }
  77010. static nameAttr(attrs) {
  77011. return new NameAttr(attrs);
  77012. }
  77013. static neverEmbed(attrs) {
  77014. return new NeverEmbed(attrs);
  77015. }
  77016. static numberOfCopies(attrs) {
  77017. return new NumberOfCopies(attrs);
  77018. }
  77019. static openAction(attrs) {
  77020. return new OpenAction(attrs);
  77021. }
  77022. static output(attrs) {
  77023. return new Output(attrs);
  77024. }
  77025. static outputBin(attrs) {
  77026. return new OutputBin(attrs);
  77027. }
  77028. static outputXSL(attrs) {
  77029. return new OutputXSL(attrs);
  77030. }
  77031. static overprint(attrs) {
  77032. return new Overprint(attrs);
  77033. }
  77034. static packets(attrs) {
  77035. return new Packets(attrs);
  77036. }
  77037. static pageOffset(attrs) {
  77038. return new PageOffset(attrs);
  77039. }
  77040. static pageRange(attrs) {
  77041. return new PageRange(attrs);
  77042. }
  77043. static pagination(attrs) {
  77044. return new Pagination(attrs);
  77045. }
  77046. static paginationOverride(attrs) {
  77047. return new PaginationOverride(attrs);
  77048. }
  77049. static part(attrs) {
  77050. return new Part(attrs);
  77051. }
  77052. static pcl(attrs) {
  77053. return new Pcl(attrs);
  77054. }
  77055. static pdf(attrs) {
  77056. return new Pdf(attrs);
  77057. }
  77058. static pdfa(attrs) {
  77059. return new Pdfa(attrs);
  77060. }
  77061. static permissions(attrs) {
  77062. return new Permissions(attrs);
  77063. }
  77064. static pickTrayByPDFSize(attrs) {
  77065. return new PickTrayByPDFSize(attrs);
  77066. }
  77067. static picture(attrs) {
  77068. return new Picture(attrs);
  77069. }
  77070. static plaintextMetadata(attrs) {
  77071. return new PlaintextMetadata(attrs);
  77072. }
  77073. static presence(attrs) {
  77074. return new Presence(attrs);
  77075. }
  77076. static present(attrs) {
  77077. return new Present(attrs);
  77078. }
  77079. static print(attrs) {
  77080. return new Print(attrs);
  77081. }
  77082. static printHighQuality(attrs) {
  77083. return new PrintHighQuality(attrs);
  77084. }
  77085. static printScaling(attrs) {
  77086. return new PrintScaling(attrs);
  77087. }
  77088. static printerName(attrs) {
  77089. return new PrinterName(attrs);
  77090. }
  77091. static producer(attrs) {
  77092. return new Producer(attrs);
  77093. }
  77094. static ps(attrs) {
  77095. return new Ps(attrs);
  77096. }
  77097. static range(attrs) {
  77098. return new Range(attrs);
  77099. }
  77100. static record(attrs) {
  77101. return new Record(attrs);
  77102. }
  77103. static relevant(attrs) {
  77104. return new Relevant(attrs);
  77105. }
  77106. static rename(attrs) {
  77107. return new Rename(attrs);
  77108. }
  77109. static renderPolicy(attrs) {
  77110. return new RenderPolicy(attrs);
  77111. }
  77112. static runScripts(attrs) {
  77113. return new RunScripts(attrs);
  77114. }
  77115. static script(attrs) {
  77116. return new Script(attrs);
  77117. }
  77118. static scriptModel(attrs) {
  77119. return new ScriptModel(attrs);
  77120. }
  77121. static severity(attrs) {
  77122. return new Severity(attrs);
  77123. }
  77124. static silentPrint(attrs) {
  77125. return new SilentPrint(attrs);
  77126. }
  77127. static staple(attrs) {
  77128. return new Staple(attrs);
  77129. }
  77130. static startNode(attrs) {
  77131. return new StartNode(attrs);
  77132. }
  77133. static startPage(attrs) {
  77134. return new StartPage(attrs);
  77135. }
  77136. static submitFormat(attrs) {
  77137. return new SubmitFormat(attrs);
  77138. }
  77139. static submitUrl(attrs) {
  77140. return new SubmitUrl(attrs);
  77141. }
  77142. static subsetBelow(attrs) {
  77143. return new SubsetBelow(attrs);
  77144. }
  77145. static suppressBanner(attrs) {
  77146. return new SuppressBanner(attrs);
  77147. }
  77148. static tagged(attrs) {
  77149. return new Tagged(attrs);
  77150. }
  77151. static template(attrs) {
  77152. return new Template(attrs);
  77153. }
  77154. static templateCache(attrs) {
  77155. return new TemplateCache(attrs);
  77156. }
  77157. static threshold(attrs) {
  77158. return new Threshold(attrs);
  77159. }
  77160. static to(attrs) {
  77161. return new To(attrs);
  77162. }
  77163. static trace(attrs) {
  77164. return new Trace(attrs);
  77165. }
  77166. static transform(attrs) {
  77167. return new Transform(attrs);
  77168. }
  77169. static type(attrs) {
  77170. return new Type(attrs);
  77171. }
  77172. static uri(attrs) {
  77173. return new Uri(attrs);
  77174. }
  77175. static validate(attrs) {
  77176. return new Validate(attrs);
  77177. }
  77178. static validateApprovalSignatures(attrs) {
  77179. return new ValidateApprovalSignatures(attrs);
  77180. }
  77181. static validationMessaging(attrs) {
  77182. return new ValidationMessaging(attrs);
  77183. }
  77184. static version(attrs) {
  77185. return new Version(attrs);
  77186. }
  77187. static versionControl(attrs) {
  77188. return new VersionControl(attrs);
  77189. }
  77190. static viewerPreferences(attrs) {
  77191. return new ViewerPreferences(attrs);
  77192. }
  77193. static webClient(attrs) {
  77194. return new WebClient(attrs);
  77195. }
  77196. static whitespace(attrs) {
  77197. return new Whitespace(attrs);
  77198. }
  77199. static window(attrs) {
  77200. return new Window(attrs);
  77201. }
  77202. static xdc(attrs) {
  77203. return new Xdc(attrs);
  77204. }
  77205. static xdp(attrs) {
  77206. return new Xdp(attrs);
  77207. }
  77208. static xsl(attrs) {
  77209. return new Xsl(attrs);
  77210. }
  77211. static zpl(attrs) {
  77212. return new Zpl(attrs);
  77213. }
  77214. }
  77215. exports.ConfigNamespace = ConfigNamespace;
  77216. /***/
  77217. },
  77218. /* 92 */
  77219. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  77220. Object.defineProperty(exports, "__esModule", {
  77221. value: true,
  77222. });
  77223. exports.ConnectionSetNamespace = void 0;
  77224. var _namespaces = __w_pdfjs_require__(79);
  77225. var _xfa_object = __w_pdfjs_require__(77);
  77226. const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id;
  77227. class ConnectionSet extends _xfa_object.XFAObject {
  77228. constructor(attributes) {
  77229. super(CONNECTION_SET_NS_ID, "connectionSet", true);
  77230. this.wsdlConnection = new _xfa_object.XFAObjectArray();
  77231. this.xmlConnection = new _xfa_object.XFAObjectArray();
  77232. this.xsdConnection = new _xfa_object.XFAObjectArray();
  77233. }
  77234. }
  77235. class EffectiveInputPolicy extends _xfa_object.XFAObject {
  77236. constructor(attributes) {
  77237. super(CONNECTION_SET_NS_ID, "effectiveInputPolicy");
  77238. this.id = attributes.id || "";
  77239. this.name = attributes.name || "";
  77240. this.use = attributes.use || "";
  77241. this.usehref = attributes.usehref || "";
  77242. }
  77243. }
  77244. class EffectiveOutputPolicy extends _xfa_object.XFAObject {
  77245. constructor(attributes) {
  77246. super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy");
  77247. this.id = attributes.id || "";
  77248. this.name = attributes.name || "";
  77249. this.use = attributes.use || "";
  77250. this.usehref = attributes.usehref || "";
  77251. }
  77252. }
  77253. class Operation extends _xfa_object.StringObject {
  77254. constructor(attributes) {
  77255. super(CONNECTION_SET_NS_ID, "operation");
  77256. this.id = attributes.id || "";
  77257. this.input = attributes.input || "";
  77258. this.name = attributes.name || "";
  77259. this.output = attributes.output || "";
  77260. this.use = attributes.use || "";
  77261. this.usehref = attributes.usehref || "";
  77262. }
  77263. }
  77264. class RootElement extends _xfa_object.StringObject {
  77265. constructor(attributes) {
  77266. super(CONNECTION_SET_NS_ID, "rootElement");
  77267. this.id = attributes.id || "";
  77268. this.name = attributes.name || "";
  77269. this.use = attributes.use || "";
  77270. this.usehref = attributes.usehref || "";
  77271. }
  77272. }
  77273. class SoapAction extends _xfa_object.StringObject {
  77274. constructor(attributes) {
  77275. super(CONNECTION_SET_NS_ID, "soapAction");
  77276. this.id = attributes.id || "";
  77277. this.name = attributes.name || "";
  77278. this.use = attributes.use || "";
  77279. this.usehref = attributes.usehref || "";
  77280. }
  77281. }
  77282. class SoapAddress extends _xfa_object.StringObject {
  77283. constructor(attributes) {
  77284. super(CONNECTION_SET_NS_ID, "soapAddress");
  77285. this.id = attributes.id || "";
  77286. this.name = attributes.name || "";
  77287. this.use = attributes.use || "";
  77288. this.usehref = attributes.usehref || "";
  77289. }
  77290. }
  77291. class Uri extends _xfa_object.StringObject {
  77292. constructor(attributes) {
  77293. super(CONNECTION_SET_NS_ID, "uri");
  77294. this.id = attributes.id || "";
  77295. this.name = attributes.name || "";
  77296. this.use = attributes.use || "";
  77297. this.usehref = attributes.usehref || "";
  77298. }
  77299. }
  77300. class WsdlAddress extends _xfa_object.StringObject {
  77301. constructor(attributes) {
  77302. super(CONNECTION_SET_NS_ID, "wsdlAddress");
  77303. this.id = attributes.id || "";
  77304. this.name = attributes.name || "";
  77305. this.use = attributes.use || "";
  77306. this.usehref = attributes.usehref || "";
  77307. }
  77308. }
  77309. class WsdlConnection extends _xfa_object.XFAObject {
  77310. constructor(attributes) {
  77311. super(CONNECTION_SET_NS_ID, "wsdlConnection", true);
  77312. this.dataDescription = attributes.dataDescription || "";
  77313. this.name = attributes.name || "";
  77314. this.effectiveInputPolicy = null;
  77315. this.effectiveOutputPolicy = null;
  77316. this.operation = null;
  77317. this.soapAction = null;
  77318. this.soapAddress = null;
  77319. this.wsdlAddress = null;
  77320. }
  77321. }
  77322. class XmlConnection extends _xfa_object.XFAObject {
  77323. constructor(attributes) {
  77324. super(CONNECTION_SET_NS_ID, "xmlConnection", true);
  77325. this.dataDescription = attributes.dataDescription || "";
  77326. this.name = attributes.name || "";
  77327. this.uri = null;
  77328. }
  77329. }
  77330. class XsdConnection extends _xfa_object.XFAObject {
  77331. constructor(attributes) {
  77332. super(CONNECTION_SET_NS_ID, "xsdConnection", true);
  77333. this.dataDescription = attributes.dataDescription || "";
  77334. this.name = attributes.name || "";
  77335. this.rootElement = null;
  77336. this.uri = null;
  77337. }
  77338. }
  77339. class ConnectionSetNamespace {
  77340. static [_namespaces.$buildXFAObject](name, attributes) {
  77341. if (ConnectionSetNamespace.hasOwnProperty(name)) {
  77342. return ConnectionSetNamespace[name](attributes);
  77343. }
  77344. return undefined;
  77345. }
  77346. static connectionSet(attrs) {
  77347. return new ConnectionSet(attrs);
  77348. }
  77349. static effectiveInputPolicy(attrs) {
  77350. return new EffectiveInputPolicy(attrs);
  77351. }
  77352. static effectiveOutputPolicy(attrs) {
  77353. return new EffectiveOutputPolicy(attrs);
  77354. }
  77355. static operation(attrs) {
  77356. return new Operation(attrs);
  77357. }
  77358. static rootElement(attrs) {
  77359. return new RootElement(attrs);
  77360. }
  77361. static soapAction(attrs) {
  77362. return new SoapAction(attrs);
  77363. }
  77364. static soapAddress(attrs) {
  77365. return new SoapAddress(attrs);
  77366. }
  77367. static uri(attrs) {
  77368. return new Uri(attrs);
  77369. }
  77370. static wsdlAddress(attrs) {
  77371. return new WsdlAddress(attrs);
  77372. }
  77373. static wsdlConnection(attrs) {
  77374. return new WsdlConnection(attrs);
  77375. }
  77376. static xmlConnection(attrs) {
  77377. return new XmlConnection(attrs);
  77378. }
  77379. static xsdConnection(attrs) {
  77380. return new XsdConnection(attrs);
  77381. }
  77382. }
  77383. exports.ConnectionSetNamespace = ConnectionSetNamespace;
  77384. /***/
  77385. },
  77386. /* 93 */
  77387. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  77388. Object.defineProperty(exports, "__esModule", {
  77389. value: true,
  77390. });
  77391. exports.DatasetsNamespace = void 0;
  77392. var _xfa_object = __w_pdfjs_require__(77);
  77393. var _namespaces = __w_pdfjs_require__(79);
  77394. const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id;
  77395. class Data extends _xfa_object.XmlObject {
  77396. constructor(attributes) {
  77397. super(DATASETS_NS_ID, "data", attributes);
  77398. }
  77399. [_xfa_object.$isNsAgnostic]() {
  77400. return true;
  77401. }
  77402. }
  77403. class Datasets extends _xfa_object.XFAObject {
  77404. constructor(attributes) {
  77405. super(DATASETS_NS_ID, "datasets", true);
  77406. this.data = null;
  77407. this.Signature = null;
  77408. }
  77409. [_xfa_object.$onChild](child) {
  77410. const name = child[_xfa_object.$nodeName];
  77411. if (
  77412. (name === "data" &&
  77413. child[_xfa_object.$namespaceId] === DATASETS_NS_ID) ||
  77414. (name === "Signature" &&
  77415. child[_xfa_object.$namespaceId] ===
  77416. _namespaces.NamespaceIds.signature.id)
  77417. ) {
  77418. this[name] = child;
  77419. }
  77420. this[_xfa_object.$appendChild](child);
  77421. }
  77422. }
  77423. class DatasetsNamespace {
  77424. static [_namespaces.$buildXFAObject](name, attributes) {
  77425. if (DatasetsNamespace.hasOwnProperty(name)) {
  77426. return DatasetsNamespace[name](attributes);
  77427. }
  77428. return undefined;
  77429. }
  77430. static datasets(attributes) {
  77431. return new Datasets(attributes);
  77432. }
  77433. static data(attributes) {
  77434. return new Data(attributes);
  77435. }
  77436. }
  77437. exports.DatasetsNamespace = DatasetsNamespace;
  77438. /***/
  77439. },
  77440. /* 94 */
  77441. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  77442. Object.defineProperty(exports, "__esModule", {
  77443. value: true,
  77444. });
  77445. exports.LocaleSetNamespace = void 0;
  77446. var _namespaces = __w_pdfjs_require__(79);
  77447. var _xfa_object = __w_pdfjs_require__(77);
  77448. var _utils = __w_pdfjs_require__(78);
  77449. const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id;
  77450. class CalendarSymbols extends _xfa_object.XFAObject {
  77451. constructor(attributes) {
  77452. super(LOCALE_SET_NS_ID, "calendarSymbols", true);
  77453. this.name = "gregorian";
  77454. this.dayNames = new _xfa_object.XFAObjectArray(2);
  77455. this.eraNames = null;
  77456. this.meridiemNames = null;
  77457. this.monthNames = new _xfa_object.XFAObjectArray(2);
  77458. }
  77459. }
  77460. class CurrencySymbol extends _xfa_object.StringObject {
  77461. constructor(attributes) {
  77462. super(LOCALE_SET_NS_ID, "currencySymbol");
  77463. this.name = (0, _utils.getStringOption)(attributes.name, [
  77464. "symbol",
  77465. "isoname",
  77466. "decimal",
  77467. ]);
  77468. }
  77469. }
  77470. class CurrencySymbols extends _xfa_object.XFAObject {
  77471. constructor(attributes) {
  77472. super(LOCALE_SET_NS_ID, "currencySymbols", true);
  77473. this.currencySymbol = new _xfa_object.XFAObjectArray(3);
  77474. }
  77475. }
  77476. class DatePattern extends _xfa_object.StringObject {
  77477. constructor(attributes) {
  77478. super(LOCALE_SET_NS_ID, "datePattern");
  77479. this.name = (0, _utils.getStringOption)(attributes.name, [
  77480. "full",
  77481. "long",
  77482. "med",
  77483. "short",
  77484. ]);
  77485. }
  77486. }
  77487. class DatePatterns extends _xfa_object.XFAObject {
  77488. constructor(attributes) {
  77489. super(LOCALE_SET_NS_ID, "datePatterns", true);
  77490. this.datePattern = new _xfa_object.XFAObjectArray(4);
  77491. }
  77492. }
  77493. class DateTimeSymbols extends _xfa_object.ContentObject {
  77494. constructor(attributes) {
  77495. super(LOCALE_SET_NS_ID, "dateTimeSymbols");
  77496. }
  77497. }
  77498. class Day extends _xfa_object.StringObject {
  77499. constructor(attributes) {
  77500. super(LOCALE_SET_NS_ID, "day");
  77501. }
  77502. }
  77503. class DayNames extends _xfa_object.XFAObject {
  77504. constructor(attributes) {
  77505. super(LOCALE_SET_NS_ID, "dayNames", true);
  77506. this.abbr = (0, _utils.getInteger)({
  77507. data: attributes.abbr,
  77508. defaultValue: 0,
  77509. validate: (x) => x === 1,
  77510. });
  77511. this.day = new _xfa_object.XFAObjectArray(7);
  77512. }
  77513. }
  77514. class Era extends _xfa_object.StringObject {
  77515. constructor(attributes) {
  77516. super(LOCALE_SET_NS_ID, "era");
  77517. }
  77518. }
  77519. class EraNames extends _xfa_object.XFAObject {
  77520. constructor(attributes) {
  77521. super(LOCALE_SET_NS_ID, "eraNames", true);
  77522. this.era = new _xfa_object.XFAObjectArray(2);
  77523. }
  77524. }
  77525. class Locale extends _xfa_object.XFAObject {
  77526. constructor(attributes) {
  77527. super(LOCALE_SET_NS_ID, "locale", true);
  77528. this.desc = attributes.desc || "";
  77529. this.name = "isoname";
  77530. this.calendarSymbols = null;
  77531. this.currencySymbols = null;
  77532. this.datePatterns = null;
  77533. this.dateTimeSymbols = null;
  77534. this.numberPatterns = null;
  77535. this.numberSymbols = null;
  77536. this.timePatterns = null;
  77537. this.typeFaces = null;
  77538. }
  77539. }
  77540. class LocaleSet extends _xfa_object.XFAObject {
  77541. constructor(attributes) {
  77542. super(LOCALE_SET_NS_ID, "localeSet", true);
  77543. this.locale = new _xfa_object.XFAObjectArray();
  77544. }
  77545. }
  77546. class Meridiem extends _xfa_object.StringObject {
  77547. constructor(attributes) {
  77548. super(LOCALE_SET_NS_ID, "meridiem");
  77549. }
  77550. }
  77551. class MeridiemNames extends _xfa_object.XFAObject {
  77552. constructor(attributes) {
  77553. super(LOCALE_SET_NS_ID, "meridiemNames", true);
  77554. this.meridiem = new _xfa_object.XFAObjectArray(2);
  77555. }
  77556. }
  77557. class Month extends _xfa_object.StringObject {
  77558. constructor(attributes) {
  77559. super(LOCALE_SET_NS_ID, "month");
  77560. }
  77561. }
  77562. class MonthNames extends _xfa_object.XFAObject {
  77563. constructor(attributes) {
  77564. super(LOCALE_SET_NS_ID, "monthNames", true);
  77565. this.abbr = (0, _utils.getInteger)({
  77566. data: attributes.abbr,
  77567. defaultValue: 0,
  77568. validate: (x) => x === 1,
  77569. });
  77570. this.month = new _xfa_object.XFAObjectArray(12);
  77571. }
  77572. }
  77573. class NumberPattern extends _xfa_object.StringObject {
  77574. constructor(attributes) {
  77575. super(LOCALE_SET_NS_ID, "numberPattern");
  77576. this.name = (0, _utils.getStringOption)(attributes.name, [
  77577. "full",
  77578. "long",
  77579. "med",
  77580. "short",
  77581. ]);
  77582. }
  77583. }
  77584. class NumberPatterns extends _xfa_object.XFAObject {
  77585. constructor(attributes) {
  77586. super(LOCALE_SET_NS_ID, "numberPatterns", true);
  77587. this.numberPattern = new _xfa_object.XFAObjectArray(4);
  77588. }
  77589. }
  77590. class NumberSymbol extends _xfa_object.StringObject {
  77591. constructor(attributes) {
  77592. super(LOCALE_SET_NS_ID, "numberSymbol");
  77593. this.name = (0, _utils.getStringOption)(attributes.name, [
  77594. "decimal",
  77595. "grouping",
  77596. "percent",
  77597. "minus",
  77598. "zero",
  77599. ]);
  77600. }
  77601. }
  77602. class NumberSymbols extends _xfa_object.XFAObject {
  77603. constructor(attributes) {
  77604. super(LOCALE_SET_NS_ID, "numberSymbols", true);
  77605. this.numberSymbol = new _xfa_object.XFAObjectArray(5);
  77606. }
  77607. }
  77608. class TimePattern extends _xfa_object.StringObject {
  77609. constructor(attributes) {
  77610. super(LOCALE_SET_NS_ID, "timePattern");
  77611. this.name = (0, _utils.getStringOption)(attributes.name, [
  77612. "full",
  77613. "long",
  77614. "med",
  77615. "short",
  77616. ]);
  77617. }
  77618. }
  77619. class TimePatterns extends _xfa_object.XFAObject {
  77620. constructor(attributes) {
  77621. super(LOCALE_SET_NS_ID, "timePatterns", true);
  77622. this.timePattern = new _xfa_object.XFAObjectArray(4);
  77623. }
  77624. }
  77625. class TypeFace extends _xfa_object.XFAObject {
  77626. constructor(attributes) {
  77627. super(LOCALE_SET_NS_ID, "typeFace", true);
  77628. this.name = attributes.name | "";
  77629. }
  77630. }
  77631. class TypeFaces extends _xfa_object.XFAObject {
  77632. constructor(attributes) {
  77633. super(LOCALE_SET_NS_ID, "typeFaces", true);
  77634. this.typeFace = new _xfa_object.XFAObjectArray();
  77635. }
  77636. }
  77637. class LocaleSetNamespace {
  77638. static [_namespaces.$buildXFAObject](name, attributes) {
  77639. if (LocaleSetNamespace.hasOwnProperty(name)) {
  77640. return LocaleSetNamespace[name](attributes);
  77641. }
  77642. return undefined;
  77643. }
  77644. static calendarSymbols(attrs) {
  77645. return new CalendarSymbols(attrs);
  77646. }
  77647. static currencySymbol(attrs) {
  77648. return new CurrencySymbol(attrs);
  77649. }
  77650. static currencySymbols(attrs) {
  77651. return new CurrencySymbols(attrs);
  77652. }
  77653. static datePattern(attrs) {
  77654. return new DatePattern(attrs);
  77655. }
  77656. static datePatterns(attrs) {
  77657. return new DatePatterns(attrs);
  77658. }
  77659. static dateTimeSymbols(attrs) {
  77660. return new DateTimeSymbols(attrs);
  77661. }
  77662. static day(attrs) {
  77663. return new Day(attrs);
  77664. }
  77665. static dayNames(attrs) {
  77666. return new DayNames(attrs);
  77667. }
  77668. static era(attrs) {
  77669. return new Era(attrs);
  77670. }
  77671. static eraNames(attrs) {
  77672. return new EraNames(attrs);
  77673. }
  77674. static locale(attrs) {
  77675. return new Locale(attrs);
  77676. }
  77677. static localeSet(attrs) {
  77678. return new LocaleSet(attrs);
  77679. }
  77680. static meridiem(attrs) {
  77681. return new Meridiem(attrs);
  77682. }
  77683. static meridiemNames(attrs) {
  77684. return new MeridiemNames(attrs);
  77685. }
  77686. static month(attrs) {
  77687. return new Month(attrs);
  77688. }
  77689. static monthNames(attrs) {
  77690. return new MonthNames(attrs);
  77691. }
  77692. static numberPattern(attrs) {
  77693. return new NumberPattern(attrs);
  77694. }
  77695. static numberPatterns(attrs) {
  77696. return new NumberPatterns(attrs);
  77697. }
  77698. static numberSymbol(attrs) {
  77699. return new NumberSymbol(attrs);
  77700. }
  77701. static numberSymbols(attrs) {
  77702. return new NumberSymbols(attrs);
  77703. }
  77704. static timePattern(attrs) {
  77705. return new TimePattern(attrs);
  77706. }
  77707. static timePatterns(attrs) {
  77708. return new TimePatterns(attrs);
  77709. }
  77710. static typeFace(attrs) {
  77711. return new TypeFace(attrs);
  77712. }
  77713. static typeFaces(attrs) {
  77714. return new TypeFaces(attrs);
  77715. }
  77716. }
  77717. exports.LocaleSetNamespace = LocaleSetNamespace;
  77718. /***/
  77719. },
  77720. /* 95 */
  77721. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  77722. Object.defineProperty(exports, "__esModule", {
  77723. value: true,
  77724. });
  77725. exports.SignatureNamespace = void 0;
  77726. var _namespaces = __w_pdfjs_require__(79);
  77727. var _xfa_object = __w_pdfjs_require__(77);
  77728. const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id;
  77729. class Signature extends _xfa_object.XFAObject {
  77730. constructor(attributes) {
  77731. super(SIGNATURE_NS_ID, "signature", true);
  77732. }
  77733. }
  77734. class SignatureNamespace {
  77735. static [_namespaces.$buildXFAObject](name, attributes) {
  77736. if (SignatureNamespace.hasOwnProperty(name)) {
  77737. return SignatureNamespace[name](attributes);
  77738. }
  77739. return undefined;
  77740. }
  77741. static signature(attributes) {
  77742. return new Signature(attributes);
  77743. }
  77744. }
  77745. exports.SignatureNamespace = SignatureNamespace;
  77746. /***/
  77747. },
  77748. /* 96 */
  77749. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  77750. Object.defineProperty(exports, "__esModule", {
  77751. value: true,
  77752. });
  77753. exports.StylesheetNamespace = void 0;
  77754. var _namespaces = __w_pdfjs_require__(79);
  77755. var _xfa_object = __w_pdfjs_require__(77);
  77756. const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id;
  77757. class Stylesheet extends _xfa_object.XFAObject {
  77758. constructor(attributes) {
  77759. super(STYLESHEET_NS_ID, "stylesheet", true);
  77760. }
  77761. }
  77762. class StylesheetNamespace {
  77763. static [_namespaces.$buildXFAObject](name, attributes) {
  77764. if (StylesheetNamespace.hasOwnProperty(name)) {
  77765. return StylesheetNamespace[name](attributes);
  77766. }
  77767. return undefined;
  77768. }
  77769. static stylesheet(attributes) {
  77770. return new Stylesheet(attributes);
  77771. }
  77772. }
  77773. exports.StylesheetNamespace = StylesheetNamespace;
  77774. /***/
  77775. },
  77776. /* 97 */
  77777. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  77778. Object.defineProperty(exports, "__esModule", {
  77779. value: true,
  77780. });
  77781. exports.XdpNamespace = void 0;
  77782. var _namespaces = __w_pdfjs_require__(79);
  77783. var _xfa_object = __w_pdfjs_require__(77);
  77784. const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id;
  77785. class Xdp extends _xfa_object.XFAObject {
  77786. constructor(attributes) {
  77787. super(XDP_NS_ID, "xdp", true);
  77788. this.uuid = attributes.uuid || "";
  77789. this.timeStamp = attributes.timeStamp || "";
  77790. this.config = null;
  77791. this.connectionSet = null;
  77792. this.datasets = null;
  77793. this.localeSet = null;
  77794. this.stylesheet = new _xfa_object.XFAObjectArray();
  77795. this.template = null;
  77796. }
  77797. [_xfa_object.$onChildCheck](child) {
  77798. const ns = _namespaces.NamespaceIds[child[_xfa_object.$nodeName]];
  77799. return ns && child[_xfa_object.$namespaceId] === ns.id;
  77800. }
  77801. }
  77802. class XdpNamespace {
  77803. static [_namespaces.$buildXFAObject](name, attributes) {
  77804. if (XdpNamespace.hasOwnProperty(name)) {
  77805. return XdpNamespace[name](attributes);
  77806. }
  77807. return undefined;
  77808. }
  77809. static xdp(attributes) {
  77810. return new Xdp(attributes);
  77811. }
  77812. }
  77813. exports.XdpNamespace = XdpNamespace;
  77814. /***/
  77815. },
  77816. /* 98 */
  77817. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  77818. Object.defineProperty(exports, "__esModule", {
  77819. value: true,
  77820. });
  77821. exports.XhtmlNamespace = void 0;
  77822. var _xfa_object = __w_pdfjs_require__(77);
  77823. var _namespaces = __w_pdfjs_require__(79);
  77824. var _html_utils = __w_pdfjs_require__(84);
  77825. var _utils = __w_pdfjs_require__(78);
  77826. const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id;
  77827. const $richText = Symbol();
  77828. const VALID_STYLES = new Set([
  77829. "color",
  77830. "font",
  77831. "font-family",
  77832. "font-size",
  77833. "font-stretch",
  77834. "font-style",
  77835. "font-weight",
  77836. "margin",
  77837. "margin-bottom",
  77838. "margin-left",
  77839. "margin-right",
  77840. "margin-top",
  77841. "letter-spacing",
  77842. "line-height",
  77843. "orphans",
  77844. "page-break-after",
  77845. "page-break-before",
  77846. "page-break-inside",
  77847. "tab-interval",
  77848. "tab-stop",
  77849. "text-align",
  77850. "text-decoration",
  77851. "text-indent",
  77852. "vertical-align",
  77853. "widows",
  77854. "kerning-mode",
  77855. "xfa-font-horizontal-scale",
  77856. "xfa-font-vertical-scale",
  77857. "xfa-spacerun",
  77858. "xfa-tab-stops",
  77859. ]);
  77860. const StyleMapping = new Map([
  77861. ["page-break-after", "breakAfter"],
  77862. ["page-break-before", "breakBefore"],
  77863. ["page-break-inside", "breakInside"],
  77864. ["kerning-mode", (value) => (value === "none" ? "none" : "normal")],
  77865. [
  77866. "xfa-font-horizontal-scale",
  77867. (value) =>
  77868. `scaleX(${Math.max(0, Math.min(parseInt(value) / 100)).toFixed(
  77869. 2
  77870. )})`,
  77871. ],
  77872. [
  77873. "xfa-font-vertical-scale",
  77874. (value) =>
  77875. `scaleY(${Math.max(0, Math.min(parseInt(value) / 100)).toFixed(
  77876. 2
  77877. )})`,
  77878. ],
  77879. ["xfa-spacerun", ""],
  77880. ["xfa-tab-stops", ""],
  77881. [
  77882. "font-size",
  77883. (value, original) => {
  77884. value = original.fontSize = (0, _utils.getMeasurement)(value);
  77885. return (0, _html_utils.measureToString)(0.99 * value);
  77886. },
  77887. ],
  77888. [
  77889. "letter-spacing",
  77890. (value) =>
  77891. (0, _html_utils.measureToString)(
  77892. (0, _utils.getMeasurement)(value)
  77893. ),
  77894. ],
  77895. [
  77896. "line-height",
  77897. (value) =>
  77898. (0, _html_utils.measureToString)(
  77899. (0, _utils.getMeasurement)(value)
  77900. ),
  77901. ],
  77902. [
  77903. "margin",
  77904. (value) =>
  77905. (0, _html_utils.measureToString)(
  77906. (0, _utils.getMeasurement)(value)
  77907. ),
  77908. ],
  77909. [
  77910. "margin-bottom",
  77911. (value) =>
  77912. (0, _html_utils.measureToString)(
  77913. (0, _utils.getMeasurement)(value)
  77914. ),
  77915. ],
  77916. [
  77917. "margin-left",
  77918. (value) =>
  77919. (0, _html_utils.measureToString)(
  77920. (0, _utils.getMeasurement)(value)
  77921. ),
  77922. ],
  77923. [
  77924. "margin-right",
  77925. (value) =>
  77926. (0, _html_utils.measureToString)(
  77927. (0, _utils.getMeasurement)(value)
  77928. ),
  77929. ],
  77930. [
  77931. "margin-top",
  77932. (value) =>
  77933. (0, _html_utils.measureToString)(
  77934. (0, _utils.getMeasurement)(value)
  77935. ),
  77936. ],
  77937. [
  77938. "text-indent",
  77939. (value) =>
  77940. (0, _html_utils.measureToString)(
  77941. (0, _utils.getMeasurement)(value)
  77942. ),
  77943. ],
  77944. ["font-family", (value) => value],
  77945. [
  77946. "vertical-align",
  77947. (value) =>
  77948. (0, _html_utils.measureToString)(
  77949. (0, _utils.getMeasurement)(value)
  77950. ),
  77951. ],
  77952. ]);
  77953. const spacesRegExp = /\s+/g;
  77954. const crlfRegExp = /[\r\n]+/g;
  77955. const crlfForRichTextRegExp = /\r\n?/g;
  77956. function mapStyle(styleStr, node, richText) {
  77957. const style = Object.create(null);
  77958. if (!styleStr) {
  77959. return style;
  77960. }
  77961. const original = Object.create(null);
  77962. for (const [key, value] of styleStr
  77963. .split(";")
  77964. .map((s) => s.split(":", 2))) {
  77965. const mapping = StyleMapping.get(key);
  77966. if (mapping === "") {
  77967. continue;
  77968. }
  77969. let newValue = value;
  77970. if (mapping) {
  77971. if (typeof mapping === "string") {
  77972. newValue = mapping;
  77973. } else {
  77974. newValue = mapping(value, original);
  77975. }
  77976. }
  77977. if (key.endsWith("scale")) {
  77978. if (style.transform) {
  77979. style.transform = `${style[key]} ${newValue}`;
  77980. } else {
  77981. style.transform = newValue;
  77982. }
  77983. } else {
  77984. style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] =
  77985. newValue;
  77986. }
  77987. }
  77988. if (style.fontFamily) {
  77989. (0, _html_utils.setFontFamily)(
  77990. {
  77991. typeface: style.fontFamily,
  77992. weight: style.fontWeight || "normal",
  77993. posture: style.fontStyle || "normal",
  77994. size: original.fontSize || 0,
  77995. },
  77996. node,
  77997. node[_xfa_object.$globalData].fontFinder,
  77998. style
  77999. );
  78000. }
  78001. if (
  78002. richText &&
  78003. style.verticalAlign &&
  78004. style.verticalAlign !== "0px" &&
  78005. style.fontSize
  78006. ) {
  78007. const SUB_SUPER_SCRIPT_FACTOR = 0.583;
  78008. const VERTICAL_FACTOR = 0.333;
  78009. const fontSize = (0, _utils.getMeasurement)(style.fontSize);
  78010. style.fontSize = (0, _html_utils.measureToString)(
  78011. fontSize * SUB_SUPER_SCRIPT_FACTOR
  78012. );
  78013. style.verticalAlign = (0, _html_utils.measureToString)(
  78014. Math.sign((0, _utils.getMeasurement)(style.verticalAlign)) *
  78015. fontSize *
  78016. VERTICAL_FACTOR
  78017. );
  78018. }
  78019. if (richText && style.fontSize) {
  78020. style.fontSize = `calc(${style.fontSize} * var(--scale-factor))`;
  78021. }
  78022. (0, _html_utils.fixTextIndent)(style);
  78023. return style;
  78024. }
  78025. function checkStyle(node) {
  78026. if (!node.style) {
  78027. return "";
  78028. }
  78029. return node.style
  78030. .trim()
  78031. .split(/\s*;\s*/)
  78032. .filter((s) => !!s)
  78033. .map((s) => s.split(/\s*:\s*/, 2))
  78034. .filter(([key, value]) => {
  78035. if (key === "font-family") {
  78036. node[_xfa_object.$globalData].usedTypefaces.add(value);
  78037. }
  78038. return VALID_STYLES.has(key);
  78039. })
  78040. .map((kv) => kv.join(":"))
  78041. .join(";");
  78042. }
  78043. const NoWhites = new Set(["body", "html"]);
  78044. class XhtmlObject extends _xfa_object.XmlObject {
  78045. constructor(attributes, name) {
  78046. super(XHTML_NS_ID, name);
  78047. this[$richText] = false;
  78048. this.style = attributes.style || "";
  78049. }
  78050. [_xfa_object.$clean](builder) {
  78051. super[_xfa_object.$clean](builder);
  78052. this.style = checkStyle(this);
  78053. }
  78054. [_xfa_object.$acceptWhitespace]() {
  78055. return !NoWhites.has(this[_xfa_object.$nodeName]);
  78056. }
  78057. [_xfa_object.$onText](str, richText = false) {
  78058. if (!richText) {
  78059. str = str.replace(crlfRegExp, "");
  78060. if (!this.style.includes("xfa-spacerun:yes")) {
  78061. str = str.replace(spacesRegExp, " ");
  78062. }
  78063. } else {
  78064. this[$richText] = true;
  78065. }
  78066. if (str) {
  78067. this[_xfa_object.$content] += str;
  78068. }
  78069. }
  78070. [_xfa_object.$pushGlyphs](measure, mustPop = true) {
  78071. const xfaFont = Object.create(null);
  78072. const margin = {
  78073. top: NaN,
  78074. bottom: NaN,
  78075. left: NaN,
  78076. right: NaN,
  78077. };
  78078. let lineHeight = null;
  78079. for (const [key, value] of this.style
  78080. .split(";")
  78081. .map((s) => s.split(":", 2))) {
  78082. switch (key) {
  78083. case "font-family":
  78084. xfaFont.typeface = (0, _utils.stripQuotes)(value);
  78085. break;
  78086. case "font-size":
  78087. xfaFont.size = (0, _utils.getMeasurement)(value);
  78088. break;
  78089. case "font-weight":
  78090. xfaFont.weight = value;
  78091. break;
  78092. case "font-style":
  78093. xfaFont.posture = value;
  78094. break;
  78095. case "letter-spacing":
  78096. xfaFont.letterSpacing = (0, _utils.getMeasurement)(value);
  78097. break;
  78098. case "margin":
  78099. const values = value
  78100. .split(/ \t/)
  78101. .map((x) => (0, _utils.getMeasurement)(x));
  78102. switch (values.length) {
  78103. case 1:
  78104. margin.top =
  78105. margin.bottom =
  78106. margin.left =
  78107. margin.right =
  78108. values[0];
  78109. break;
  78110. case 2:
  78111. margin.top = margin.bottom = values[0];
  78112. margin.left = margin.right = values[1];
  78113. break;
  78114. case 3:
  78115. margin.top = values[0];
  78116. margin.bottom = values[2];
  78117. margin.left = margin.right = values[1];
  78118. break;
  78119. case 4:
  78120. margin.top = values[0];
  78121. margin.left = values[1];
  78122. margin.bottom = values[2];
  78123. margin.right = values[3];
  78124. break;
  78125. }
  78126. break;
  78127. case "margin-top":
  78128. margin.top = (0, _utils.getMeasurement)(value);
  78129. break;
  78130. case "margin-bottom":
  78131. margin.bottom = (0, _utils.getMeasurement)(value);
  78132. break;
  78133. case "margin-left":
  78134. margin.left = (0, _utils.getMeasurement)(value);
  78135. break;
  78136. case "margin-right":
  78137. margin.right = (0, _utils.getMeasurement)(value);
  78138. break;
  78139. case "line-height":
  78140. lineHeight = (0, _utils.getMeasurement)(value);
  78141. break;
  78142. }
  78143. }
  78144. measure.pushData(xfaFont, margin, lineHeight);
  78145. if (this[_xfa_object.$content]) {
  78146. measure.addString(this[_xfa_object.$content]);
  78147. } else {
  78148. for (const child of this[_xfa_object.$getChildren]()) {
  78149. if (child[_xfa_object.$nodeName] === "#text") {
  78150. measure.addString(child[_xfa_object.$content]);
  78151. continue;
  78152. }
  78153. child[_xfa_object.$pushGlyphs](measure);
  78154. }
  78155. }
  78156. if (mustPop) {
  78157. measure.popFont();
  78158. }
  78159. }
  78160. [_xfa_object.$toHTML](availableSpace) {
  78161. const children = [];
  78162. this[_xfa_object.$extra] = {
  78163. children,
  78164. };
  78165. this[_xfa_object.$childrenToHTML]({});
  78166. if (children.length === 0 && !this[_xfa_object.$content]) {
  78167. return _utils.HTMLResult.EMPTY;
  78168. }
  78169. let value;
  78170. if (this[$richText]) {
  78171. value = this[_xfa_object.$content]
  78172. ? this[_xfa_object.$content].replace(
  78173. crlfForRichTextRegExp,
  78174. "\n"
  78175. )
  78176. : undefined;
  78177. } else {
  78178. value = this[_xfa_object.$content] || undefined;
  78179. }
  78180. return _utils.HTMLResult.success({
  78181. name: this[_xfa_object.$nodeName],
  78182. attributes: {
  78183. href: this.href,
  78184. style: mapStyle(this.style, this, this[$richText]),
  78185. },
  78186. children,
  78187. value,
  78188. });
  78189. }
  78190. }
  78191. class A extends XhtmlObject {
  78192. constructor(attributes) {
  78193. super(attributes, "a");
  78194. this.href = (0, _html_utils.fixURL)(attributes.href) || "";
  78195. }
  78196. }
  78197. class B extends XhtmlObject {
  78198. constructor(attributes) {
  78199. super(attributes, "b");
  78200. }
  78201. [_xfa_object.$pushGlyphs](measure) {
  78202. measure.pushFont({
  78203. weight: "bold",
  78204. });
  78205. super[_xfa_object.$pushGlyphs](measure);
  78206. measure.popFont();
  78207. }
  78208. }
  78209. class Body extends XhtmlObject {
  78210. constructor(attributes) {
  78211. super(attributes, "body");
  78212. }
  78213. [_xfa_object.$toHTML](availableSpace) {
  78214. const res = super[_xfa_object.$toHTML](availableSpace);
  78215. const { html } = res;
  78216. if (!html) {
  78217. return _utils.HTMLResult.EMPTY;
  78218. }
  78219. html.name = "div";
  78220. html.attributes.class = ["xfaRich"];
  78221. return res;
  78222. }
  78223. }
  78224. class Br extends XhtmlObject {
  78225. constructor(attributes) {
  78226. super(attributes, "br");
  78227. }
  78228. [_xfa_object.$text]() {
  78229. return "\n";
  78230. }
  78231. [_xfa_object.$pushGlyphs](measure) {
  78232. measure.addString("\n");
  78233. }
  78234. [_xfa_object.$toHTML](availableSpace) {
  78235. return _utils.HTMLResult.success({
  78236. name: "br",
  78237. });
  78238. }
  78239. }
  78240. class Html extends XhtmlObject {
  78241. constructor(attributes) {
  78242. super(attributes, "html");
  78243. }
  78244. [_xfa_object.$toHTML](availableSpace) {
  78245. const children = [];
  78246. this[_xfa_object.$extra] = {
  78247. children,
  78248. };
  78249. this[_xfa_object.$childrenToHTML]({});
  78250. if (children.length === 0) {
  78251. return _utils.HTMLResult.success({
  78252. name: "div",
  78253. attributes: {
  78254. class: ["xfaRich"],
  78255. style: {},
  78256. },
  78257. value: this[_xfa_object.$content] || "",
  78258. });
  78259. }
  78260. if (children.length === 1) {
  78261. const child = children[0];
  78262. if (
  78263. child.attributes &&
  78264. child.attributes.class.includes("xfaRich")
  78265. ) {
  78266. return _utils.HTMLResult.success(child);
  78267. }
  78268. }
  78269. return _utils.HTMLResult.success({
  78270. name: "div",
  78271. attributes: {
  78272. class: ["xfaRich"],
  78273. style: {},
  78274. },
  78275. children,
  78276. });
  78277. }
  78278. }
  78279. class I extends XhtmlObject {
  78280. constructor(attributes) {
  78281. super(attributes, "i");
  78282. }
  78283. [_xfa_object.$pushGlyphs](measure) {
  78284. measure.pushFont({
  78285. posture: "italic",
  78286. });
  78287. super[_xfa_object.$pushGlyphs](measure);
  78288. measure.popFont();
  78289. }
  78290. }
  78291. class Li extends XhtmlObject {
  78292. constructor(attributes) {
  78293. super(attributes, "li");
  78294. }
  78295. }
  78296. class Ol extends XhtmlObject {
  78297. constructor(attributes) {
  78298. super(attributes, "ol");
  78299. }
  78300. }
  78301. class P extends XhtmlObject {
  78302. constructor(attributes) {
  78303. super(attributes, "p");
  78304. }
  78305. [_xfa_object.$pushGlyphs](measure) {
  78306. super[_xfa_object.$pushGlyphs](measure, false);
  78307. measure.addString("\n");
  78308. measure.addPara();
  78309. measure.popFont();
  78310. }
  78311. [_xfa_object.$text]() {
  78312. const siblings =
  78313. this[_xfa_object.$getParent]()[_xfa_object.$getChildren]();
  78314. if (siblings.at(-1) === this) {
  78315. return super[_xfa_object.$text]();
  78316. }
  78317. return super[_xfa_object.$text]() + "\n";
  78318. }
  78319. }
  78320. class Span extends XhtmlObject {
  78321. constructor(attributes) {
  78322. super(attributes, "span");
  78323. }
  78324. }
  78325. class Sub extends XhtmlObject {
  78326. constructor(attributes) {
  78327. super(attributes, "sub");
  78328. }
  78329. }
  78330. class Sup extends XhtmlObject {
  78331. constructor(attributes) {
  78332. super(attributes, "sup");
  78333. }
  78334. }
  78335. class Ul extends XhtmlObject {
  78336. constructor(attributes) {
  78337. super(attributes, "ul");
  78338. }
  78339. }
  78340. class XhtmlNamespace {
  78341. static [_namespaces.$buildXFAObject](name, attributes) {
  78342. if (XhtmlNamespace.hasOwnProperty(name)) {
  78343. return XhtmlNamespace[name](attributes);
  78344. }
  78345. return undefined;
  78346. }
  78347. static a(attributes) {
  78348. return new A(attributes);
  78349. }
  78350. static b(attributes) {
  78351. return new B(attributes);
  78352. }
  78353. static body(attributes) {
  78354. return new Body(attributes);
  78355. }
  78356. static br(attributes) {
  78357. return new Br(attributes);
  78358. }
  78359. static html(attributes) {
  78360. return new Html(attributes);
  78361. }
  78362. static i(attributes) {
  78363. return new I(attributes);
  78364. }
  78365. static li(attributes) {
  78366. return new Li(attributes);
  78367. }
  78368. static ol(attributes) {
  78369. return new Ol(attributes);
  78370. }
  78371. static p(attributes) {
  78372. return new P(attributes);
  78373. }
  78374. static span(attributes) {
  78375. return new Span(attributes);
  78376. }
  78377. static sub(attributes) {
  78378. return new Sub(attributes);
  78379. }
  78380. static sup(attributes) {
  78381. return new Sup(attributes);
  78382. }
  78383. static ul(attributes) {
  78384. return new Ul(attributes);
  78385. }
  78386. }
  78387. exports.XhtmlNamespace = XhtmlNamespace;
  78388. /***/
  78389. },
  78390. /* 99 */
  78391. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  78392. Object.defineProperty(exports, "__esModule", {
  78393. value: true,
  78394. });
  78395. exports.UnknownNamespace = void 0;
  78396. var _namespaces = __w_pdfjs_require__(79);
  78397. var _xfa_object = __w_pdfjs_require__(77);
  78398. class UnknownNamespace {
  78399. constructor(nsId) {
  78400. this.namespaceId = nsId;
  78401. }
  78402. [_namespaces.$buildXFAObject](name, attributes) {
  78403. return new _xfa_object.XmlObject(
  78404. this.namespaceId,
  78405. name,
  78406. attributes
  78407. );
  78408. }
  78409. }
  78410. exports.UnknownNamespace = UnknownNamespace;
  78411. /***/
  78412. },
  78413. /* 100 */
  78414. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  78415. Object.defineProperty(exports, "__esModule", {
  78416. value: true,
  78417. });
  78418. exports.DatasetReader = void 0;
  78419. var _util = __w_pdfjs_require__(2);
  78420. var _core_utils = __w_pdfjs_require__(6);
  78421. var _xml_parser = __w_pdfjs_require__(66);
  78422. function decodeString(str) {
  78423. try {
  78424. return (0, _util.stringToUTF8String)(str);
  78425. } catch (ex) {
  78426. (0, _util.warn)(`UTF-8 decoding failed: "${ex}".`);
  78427. return str;
  78428. }
  78429. }
  78430. class DatasetXMLParser extends _xml_parser.SimpleXMLParser {
  78431. constructor(options) {
  78432. super(options);
  78433. this.node = null;
  78434. }
  78435. onEndElement(name) {
  78436. const node = super.onEndElement(name);
  78437. if (node && name === "xfa:datasets") {
  78438. this.node = node;
  78439. throw new Error("Aborting DatasetXMLParser.");
  78440. }
  78441. }
  78442. }
  78443. class DatasetReader {
  78444. constructor(data) {
  78445. if (data.datasets) {
  78446. this.node = new _xml_parser.SimpleXMLParser({
  78447. hasAttributes: true,
  78448. }).parseFromString(data.datasets).documentElement;
  78449. } else {
  78450. const parser = new DatasetXMLParser({
  78451. hasAttributes: true,
  78452. });
  78453. try {
  78454. parser.parseFromString(data["xdp:xdp"]);
  78455. } catch (_) {}
  78456. this.node = parser.node;
  78457. }
  78458. }
  78459. getValue(path) {
  78460. if (!this.node || !path) {
  78461. return "";
  78462. }
  78463. const node = this.node.searchNode(
  78464. (0, _core_utils.parseXFAPath)(path),
  78465. 0
  78466. );
  78467. if (!node) {
  78468. return "";
  78469. }
  78470. const first = node.firstChild;
  78471. if (first && first.nodeName === "value") {
  78472. return node.children.map((child) =>
  78473. decodeString(child.textContent)
  78474. );
  78475. }
  78476. return decodeString(node.textContent);
  78477. }
  78478. }
  78479. exports.DatasetReader = DatasetReader;
  78480. /***/
  78481. },
  78482. /* 101 */
  78483. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  78484. Object.defineProperty(exports, "__esModule", {
  78485. value: true,
  78486. });
  78487. exports.XRef = void 0;
  78488. var _util = __w_pdfjs_require__(2);
  78489. var _primitives = __w_pdfjs_require__(5);
  78490. var _core_utils = __w_pdfjs_require__(6);
  78491. var _parser = __w_pdfjs_require__(17);
  78492. var _base_stream = __w_pdfjs_require__(7);
  78493. var _crypto = __w_pdfjs_require__(67);
  78494. class XRef {
  78495. constructor(stream, pdfManager) {
  78496. this.stream = stream;
  78497. this.pdfManager = pdfManager;
  78498. this.entries = [];
  78499. this.xrefstms = Object.create(null);
  78500. this._cacheMap = new Map();
  78501. this._pendingRefs = new _primitives.RefSet();
  78502. this.stats = new _core_utils.DocStats(pdfManager.msgHandler);
  78503. this._newRefNum = null;
  78504. }
  78505. getNewRef() {
  78506. if (this._newRefNum === null) {
  78507. this._newRefNum = this.entries.length || 1;
  78508. }
  78509. return _primitives.Ref.get(this._newRefNum++, 0);
  78510. }
  78511. resetNewRef() {
  78512. this._newRefNum = null;
  78513. }
  78514. setStartXRef(startXRef) {
  78515. this.startXRefQueue = [startXRef];
  78516. }
  78517. parse(recoveryMode = false) {
  78518. let trailerDict;
  78519. if (!recoveryMode) {
  78520. trailerDict = this.readXRef();
  78521. } else {
  78522. (0, _util.warn)("Indexing all PDF objects");
  78523. trailerDict = this.indexObjects();
  78524. }
  78525. trailerDict.assignXref(this);
  78526. this.trailer = trailerDict;
  78527. let encrypt;
  78528. try {
  78529. encrypt = trailerDict.get("Encrypt");
  78530. } catch (ex) {
  78531. if (ex instanceof _core_utils.MissingDataException) {
  78532. throw ex;
  78533. }
  78534. (0, _util.warn)(
  78535. `XRef.parse - Invalid "Encrypt" reference: "${ex}".`
  78536. );
  78537. }
  78538. if (encrypt instanceof _primitives.Dict) {
  78539. const ids = trailerDict.get("ID");
  78540. const fileId = ids && ids.length ? ids[0] : "";
  78541. encrypt.suppressEncryption = true;
  78542. this.encrypt = new _crypto.CipherTransformFactory(
  78543. encrypt,
  78544. fileId,
  78545. this.pdfManager.password
  78546. );
  78547. }
  78548. let root;
  78549. try {
  78550. root = trailerDict.get("Root");
  78551. } catch (ex) {
  78552. if (ex instanceof _core_utils.MissingDataException) {
  78553. throw ex;
  78554. }
  78555. (0, _util.warn)(
  78556. `XRef.parse - Invalid "Root" reference: "${ex}".`
  78557. );
  78558. }
  78559. if (root instanceof _primitives.Dict) {
  78560. try {
  78561. const pages = root.get("Pages");
  78562. if (pages instanceof _primitives.Dict) {
  78563. this.root = root;
  78564. return;
  78565. }
  78566. } catch (ex) {
  78567. if (ex instanceof _core_utils.MissingDataException) {
  78568. throw ex;
  78569. }
  78570. (0, _util.warn)(
  78571. `XRef.parse - Invalid "Pages" reference: "${ex}".`
  78572. );
  78573. }
  78574. }
  78575. if (!recoveryMode) {
  78576. throw new _core_utils.XRefParseException();
  78577. }
  78578. throw new _util.InvalidPDFException("Invalid Root reference.");
  78579. }
  78580. processXRefTable(parser) {
  78581. if (!("tableState" in this)) {
  78582. this.tableState = {
  78583. entryNum: 0,
  78584. streamPos: parser.lexer.stream.pos,
  78585. parserBuf1: parser.buf1,
  78586. parserBuf2: parser.buf2,
  78587. };
  78588. }
  78589. const obj = this.readXRefTable(parser);
  78590. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  78591. throw new _util.FormatError(
  78592. "Invalid XRef table: could not find trailer dictionary"
  78593. );
  78594. }
  78595. let dict = parser.getObj();
  78596. if (!(dict instanceof _primitives.Dict) && dict.dict) {
  78597. dict = dict.dict;
  78598. }
  78599. if (!(dict instanceof _primitives.Dict)) {
  78600. throw new _util.FormatError(
  78601. "Invalid XRef table: could not parse trailer dictionary"
  78602. );
  78603. }
  78604. delete this.tableState;
  78605. return dict;
  78606. }
  78607. readXRefTable(parser) {
  78608. const stream = parser.lexer.stream;
  78609. const tableState = this.tableState;
  78610. stream.pos = tableState.streamPos;
  78611. parser.buf1 = tableState.parserBuf1;
  78612. parser.buf2 = tableState.parserBuf2;
  78613. let obj;
  78614. while (true) {
  78615. if (
  78616. !("firstEntryNum" in tableState) ||
  78617. !("entryCount" in tableState)
  78618. ) {
  78619. if (
  78620. (0, _primitives.isCmd)((obj = parser.getObj()), "trailer")
  78621. ) {
  78622. break;
  78623. }
  78624. tableState.firstEntryNum = obj;
  78625. tableState.entryCount = parser.getObj();
  78626. }
  78627. let first = tableState.firstEntryNum;
  78628. const count = tableState.entryCount;
  78629. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  78630. throw new _util.FormatError(
  78631. "Invalid XRef table: wrong types in subsection header"
  78632. );
  78633. }
  78634. for (let i = tableState.entryNum; i < count; i++) {
  78635. tableState.streamPos = stream.pos;
  78636. tableState.entryNum = i;
  78637. tableState.parserBuf1 = parser.buf1;
  78638. tableState.parserBuf2 = parser.buf2;
  78639. const entry = {};
  78640. entry.offset = parser.getObj();
  78641. entry.gen = parser.getObj();
  78642. const type = parser.getObj();
  78643. if (type instanceof _primitives.Cmd) {
  78644. switch (type.cmd) {
  78645. case "f":
  78646. entry.free = true;
  78647. break;
  78648. case "n":
  78649. entry.uncompressed = true;
  78650. break;
  78651. }
  78652. }
  78653. if (
  78654. !Number.isInteger(entry.offset) ||
  78655. !Number.isInteger(entry.gen) ||
  78656. !(entry.free || entry.uncompressed)
  78657. ) {
  78658. throw new _util.FormatError(
  78659. `Invalid entry in XRef subsection: ${first}, ${count}`
  78660. );
  78661. }
  78662. if (i === 0 && entry.free && first === 1) {
  78663. first = 0;
  78664. }
  78665. if (!this.entries[i + first]) {
  78666. this.entries[i + first] = entry;
  78667. }
  78668. }
  78669. tableState.entryNum = 0;
  78670. tableState.streamPos = stream.pos;
  78671. tableState.parserBuf1 = parser.buf1;
  78672. tableState.parserBuf2 = parser.buf2;
  78673. delete tableState.firstEntryNum;
  78674. delete tableState.entryCount;
  78675. }
  78676. if (this.entries[0] && !this.entries[0].free) {
  78677. throw new _util.FormatError(
  78678. "Invalid XRef table: unexpected first object"
  78679. );
  78680. }
  78681. return obj;
  78682. }
  78683. processXRefStream(stream) {
  78684. if (!("streamState" in this)) {
  78685. const streamParameters = stream.dict;
  78686. const byteWidths = streamParameters.get("W");
  78687. let range = streamParameters.get("Index");
  78688. if (!range) {
  78689. range = [0, streamParameters.get("Size")];
  78690. }
  78691. this.streamState = {
  78692. entryRanges: range,
  78693. byteWidths,
  78694. entryNum: 0,
  78695. streamPos: stream.pos,
  78696. };
  78697. }
  78698. this.readXRefStream(stream);
  78699. delete this.streamState;
  78700. return stream.dict;
  78701. }
  78702. readXRefStream(stream) {
  78703. const streamState = this.streamState;
  78704. stream.pos = streamState.streamPos;
  78705. const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] =
  78706. streamState.byteWidths;
  78707. const entryRanges = streamState.entryRanges;
  78708. while (entryRanges.length > 0) {
  78709. const [first, n] = entryRanges;
  78710. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  78711. throw new _util.FormatError(
  78712. `Invalid XRef range fields: ${first}, ${n}`
  78713. );
  78714. }
  78715. if (
  78716. !Number.isInteger(typeFieldWidth) ||
  78717. !Number.isInteger(offsetFieldWidth) ||
  78718. !Number.isInteger(generationFieldWidth)
  78719. ) {
  78720. throw new _util.FormatError(
  78721. `Invalid XRef entry fields length: ${first}, ${n}`
  78722. );
  78723. }
  78724. for (let i = streamState.entryNum; i < n; ++i) {
  78725. streamState.entryNum = i;
  78726. streamState.streamPos = stream.pos;
  78727. let type = 0,
  78728. offset = 0,
  78729. generation = 0;
  78730. for (let j = 0; j < typeFieldWidth; ++j) {
  78731. const typeByte = stream.getByte();
  78732. if (typeByte === -1) {
  78733. throw new _util.FormatError(
  78734. "Invalid XRef byteWidths 'type'."
  78735. );
  78736. }
  78737. type = (type << 8) | typeByte;
  78738. }
  78739. if (typeFieldWidth === 0) {
  78740. type = 1;
  78741. }
  78742. for (let j = 0; j < offsetFieldWidth; ++j) {
  78743. const offsetByte = stream.getByte();
  78744. if (offsetByte === -1) {
  78745. throw new _util.FormatError(
  78746. "Invalid XRef byteWidths 'offset'."
  78747. );
  78748. }
  78749. offset = (offset << 8) | offsetByte;
  78750. }
  78751. for (let j = 0; j < generationFieldWidth; ++j) {
  78752. const generationByte = stream.getByte();
  78753. if (generationByte === -1) {
  78754. throw new _util.FormatError(
  78755. "Invalid XRef byteWidths 'generation'."
  78756. );
  78757. }
  78758. generation = (generation << 8) | generationByte;
  78759. }
  78760. const entry = {};
  78761. entry.offset = offset;
  78762. entry.gen = generation;
  78763. switch (type) {
  78764. case 0:
  78765. entry.free = true;
  78766. break;
  78767. case 1:
  78768. entry.uncompressed = true;
  78769. break;
  78770. case 2:
  78771. break;
  78772. default:
  78773. throw new _util.FormatError(
  78774. `Invalid XRef entry type: ${type}`
  78775. );
  78776. }
  78777. if (!this.entries[first + i]) {
  78778. this.entries[first + i] = entry;
  78779. }
  78780. }
  78781. streamState.entryNum = 0;
  78782. streamState.streamPos = stream.pos;
  78783. entryRanges.splice(0, 2);
  78784. }
  78785. }
  78786. indexObjects() {
  78787. const TAB = 0x9,
  78788. LF = 0xa,
  78789. CR = 0xd,
  78790. SPACE = 0x20;
  78791. const PERCENT = 0x25,
  78792. LT = 0x3c;
  78793. function readToken(data, offset) {
  78794. let token = "",
  78795. ch = data[offset];
  78796. while (ch !== LF && ch !== CR && ch !== LT) {
  78797. if (++offset >= data.length) {
  78798. break;
  78799. }
  78800. token += String.fromCharCode(ch);
  78801. ch = data[offset];
  78802. }
  78803. return token;
  78804. }
  78805. function skipUntil(data, offset, what) {
  78806. const length = what.length,
  78807. dataLength = data.length;
  78808. let skipped = 0;
  78809. while (offset < dataLength) {
  78810. let i = 0;
  78811. while (i < length && data[offset + i] === what[i]) {
  78812. ++i;
  78813. }
  78814. if (i >= length) {
  78815. break;
  78816. }
  78817. offset++;
  78818. skipped++;
  78819. }
  78820. return skipped;
  78821. }
  78822. const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  78823. const endobjRegExp = /\bendobj[\b\s]$/;
  78824. const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/;
  78825. const CHECK_CONTENT_LENGTH = 25;
  78826. const trailerBytes = new Uint8Array([
  78827. 116, 114, 97, 105, 108, 101, 114,
  78828. ]);
  78829. const startxrefBytes = new Uint8Array([
  78830. 115, 116, 97, 114, 116, 120, 114, 101, 102,
  78831. ]);
  78832. const objBytes = new Uint8Array([111, 98, 106]);
  78833. const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  78834. this.entries.length = 0;
  78835. this._cacheMap.clear();
  78836. const stream = this.stream;
  78837. stream.pos = 0;
  78838. const buffer = stream.getBytes(),
  78839. length = buffer.length;
  78840. let position = stream.start;
  78841. const trailers = [],
  78842. xrefStms = [];
  78843. while (position < length) {
  78844. let ch = buffer[position];
  78845. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  78846. ++position;
  78847. continue;
  78848. }
  78849. if (ch === PERCENT) {
  78850. do {
  78851. ++position;
  78852. if (position >= length) {
  78853. break;
  78854. }
  78855. ch = buffer[position];
  78856. } while (ch !== LF && ch !== CR);
  78857. continue;
  78858. }
  78859. const token = readToken(buffer, position);
  78860. let m;
  78861. if (
  78862. token.startsWith("xref") &&
  78863. (token.length === 4 || /\s/.test(token[4]))
  78864. ) {
  78865. position += skipUntil(buffer, position, trailerBytes);
  78866. trailers.push(position);
  78867. position += skipUntil(buffer, position, startxrefBytes);
  78868. } else if ((m = objRegExp.exec(token))) {
  78869. const num = m[1] | 0,
  78870. gen = m[2] | 0;
  78871. let contentLength,
  78872. startPos = position + token.length,
  78873. updateEntries = false;
  78874. if (!this.entries[num]) {
  78875. updateEntries = true;
  78876. } else if (this.entries[num].gen === gen) {
  78877. try {
  78878. const parser = new _parser.Parser({
  78879. lexer: new _parser.Lexer(stream.makeSubStream(startPos)),
  78880. });
  78881. parser.getObj();
  78882. updateEntries = true;
  78883. } catch (ex) {
  78884. if (ex instanceof _core_utils.ParserEOFException) {
  78885. (0, _util.warn)(
  78886. `indexObjects -- checking object (${token}): "${ex}".`
  78887. );
  78888. } else {
  78889. updateEntries = true;
  78890. }
  78891. }
  78892. }
  78893. if (updateEntries) {
  78894. this.entries[num] = {
  78895. offset: position - stream.start,
  78896. gen,
  78897. uncompressed: true,
  78898. };
  78899. }
  78900. while (startPos < buffer.length) {
  78901. const endPos =
  78902. startPos + skipUntil(buffer, startPos, objBytes) + 4;
  78903. contentLength = endPos - position;
  78904. const checkPos = Math.max(
  78905. endPos - CHECK_CONTENT_LENGTH,
  78906. startPos
  78907. );
  78908. const tokenStr = (0, _util.bytesToString)(
  78909. buffer.subarray(checkPos, endPos)
  78910. );
  78911. if (endobjRegExp.test(tokenStr)) {
  78912. break;
  78913. } else {
  78914. const objToken = nestedObjRegExp.exec(tokenStr);
  78915. if (objToken && objToken[1]) {
  78916. (0, _util.warn)(
  78917. 'indexObjects: Found new "obj" inside of another "obj", ' +
  78918. 'caused by missing "endobj" -- trying to recover.'
  78919. );
  78920. contentLength -= objToken[1].length;
  78921. break;
  78922. }
  78923. }
  78924. startPos = endPos;
  78925. }
  78926. const content = buffer.subarray(
  78927. position,
  78928. position + contentLength
  78929. );
  78930. const xrefTagOffset = skipUntil(content, 0, xrefBytes);
  78931. if (
  78932. xrefTagOffset < contentLength &&
  78933. content[xrefTagOffset + 5] < 64
  78934. ) {
  78935. xrefStms.push(position - stream.start);
  78936. this.xrefstms[position - stream.start] = 1;
  78937. }
  78938. position += contentLength;
  78939. } else if (
  78940. token.startsWith("trailer") &&
  78941. (token.length === 7 || /\s/.test(token[7]))
  78942. ) {
  78943. trailers.push(position);
  78944. position += skipUntil(buffer, position, startxrefBytes);
  78945. } else {
  78946. position += token.length + 1;
  78947. }
  78948. }
  78949. for (let i = 0, ii = xrefStms.length; i < ii; ++i) {
  78950. this.startXRefQueue.push(xrefStms[i]);
  78951. this.readXRef(true);
  78952. }
  78953. let trailerDict;
  78954. for (let i = 0, ii = trailers.length; i < ii; ++i) {
  78955. stream.pos = trailers[i];
  78956. const parser = new _parser.Parser({
  78957. lexer: new _parser.Lexer(stream),
  78958. xref: this,
  78959. allowStreams: true,
  78960. recoveryMode: true,
  78961. });
  78962. const obj = parser.getObj();
  78963. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  78964. continue;
  78965. }
  78966. const dict = parser.getObj();
  78967. if (!(dict instanceof _primitives.Dict)) {
  78968. continue;
  78969. }
  78970. try {
  78971. const rootDict = dict.get("Root");
  78972. if (!(rootDict instanceof _primitives.Dict)) {
  78973. continue;
  78974. }
  78975. const pagesDict = rootDict.get("Pages");
  78976. if (!(pagesDict instanceof _primitives.Dict)) {
  78977. continue;
  78978. }
  78979. const pagesCount = pagesDict.get("Count");
  78980. if (!Number.isInteger(pagesCount)) {
  78981. continue;
  78982. }
  78983. } catch (ex) {
  78984. continue;
  78985. }
  78986. if (dict.has("ID")) {
  78987. return dict;
  78988. }
  78989. trailerDict = dict;
  78990. }
  78991. if (trailerDict) {
  78992. return trailerDict;
  78993. }
  78994. if (this.topDict) {
  78995. return this.topDict;
  78996. }
  78997. throw new _util.InvalidPDFException("Invalid PDF structure.");
  78998. }
  78999. readXRef(recoveryMode = false) {
  79000. const stream = this.stream;
  79001. const startXRefParsedCache = new Set();
  79002. try {
  79003. while (this.startXRefQueue.length) {
  79004. const startXRef = this.startXRefQueue[0];
  79005. if (startXRefParsedCache.has(startXRef)) {
  79006. (0, _util.warn)(
  79007. "readXRef - skipping XRef table since it was already parsed."
  79008. );
  79009. this.startXRefQueue.shift();
  79010. continue;
  79011. }
  79012. startXRefParsedCache.add(startXRef);
  79013. stream.pos = startXRef + stream.start;
  79014. const parser = new _parser.Parser({
  79015. lexer: new _parser.Lexer(stream),
  79016. xref: this,
  79017. allowStreams: true,
  79018. });
  79019. let obj = parser.getObj();
  79020. let dict;
  79021. if ((0, _primitives.isCmd)(obj, "xref")) {
  79022. dict = this.processXRefTable(parser);
  79023. if (!this.topDict) {
  79024. this.topDict = dict;
  79025. }
  79026. obj = dict.get("XRefStm");
  79027. if (Number.isInteger(obj)) {
  79028. const pos = obj;
  79029. if (!(pos in this.xrefstms)) {
  79030. this.xrefstms[pos] = 1;
  79031. this.startXRefQueue.push(pos);
  79032. }
  79033. }
  79034. } else if (Number.isInteger(obj)) {
  79035. if (
  79036. !Number.isInteger(parser.getObj()) ||
  79037. !(0, _primitives.isCmd)(parser.getObj(), "obj") ||
  79038. !(
  79039. (obj = parser.getObj()) instanceof _base_stream.BaseStream
  79040. )
  79041. ) {
  79042. throw new _util.FormatError("Invalid XRef stream");
  79043. }
  79044. dict = this.processXRefStream(obj);
  79045. if (!this.topDict) {
  79046. this.topDict = dict;
  79047. }
  79048. if (!dict) {
  79049. throw new _util.FormatError("Failed to read XRef stream");
  79050. }
  79051. } else {
  79052. throw new _util.FormatError("Invalid XRef stream header");
  79053. }
  79054. obj = dict.get("Prev");
  79055. if (Number.isInteger(obj)) {
  79056. this.startXRefQueue.push(obj);
  79057. } else if (obj instanceof _primitives.Ref) {
  79058. this.startXRefQueue.push(obj.num);
  79059. }
  79060. this.startXRefQueue.shift();
  79061. }
  79062. return this.topDict;
  79063. } catch (e) {
  79064. if (e instanceof _core_utils.MissingDataException) {
  79065. throw e;
  79066. }
  79067. (0, _util.info)("(while reading XRef): " + e);
  79068. this.startXRefQueue.shift();
  79069. }
  79070. if (recoveryMode) {
  79071. return undefined;
  79072. }
  79073. throw new _core_utils.XRefParseException();
  79074. }
  79075. getEntry(i) {
  79076. const xrefEntry = this.entries[i];
  79077. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  79078. return xrefEntry;
  79079. }
  79080. return null;
  79081. }
  79082. fetchIfRef(obj, suppressEncryption = false) {
  79083. if (obj instanceof _primitives.Ref) {
  79084. return this.fetch(obj, suppressEncryption);
  79085. }
  79086. return obj;
  79087. }
  79088. fetch(ref, suppressEncryption = false) {
  79089. if (!(ref instanceof _primitives.Ref)) {
  79090. throw new Error("ref object is not a reference");
  79091. }
  79092. const num = ref.num;
  79093. const cacheEntry = this._cacheMap.get(num);
  79094. if (cacheEntry !== undefined) {
  79095. if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
  79096. cacheEntry.objId = ref.toString();
  79097. }
  79098. return cacheEntry;
  79099. }
  79100. let xrefEntry = this.getEntry(num);
  79101. if (xrefEntry === null) {
  79102. this._cacheMap.set(num, xrefEntry);
  79103. return xrefEntry;
  79104. }
  79105. if (this._pendingRefs.has(ref)) {
  79106. this._pendingRefs.remove(ref);
  79107. (0, _util.warn)(`Ignoring circular reference: ${ref}.`);
  79108. return _primitives.CIRCULAR_REF;
  79109. }
  79110. this._pendingRefs.put(ref);
  79111. try {
  79112. if (xrefEntry.uncompressed) {
  79113. xrefEntry = this.fetchUncompressed(
  79114. ref,
  79115. xrefEntry,
  79116. suppressEncryption
  79117. );
  79118. } else {
  79119. xrefEntry = this.fetchCompressed(
  79120. ref,
  79121. xrefEntry,
  79122. suppressEncryption
  79123. );
  79124. }
  79125. this._pendingRefs.remove(ref);
  79126. } catch (ex) {
  79127. this._pendingRefs.remove(ref);
  79128. throw ex;
  79129. }
  79130. if (xrefEntry instanceof _primitives.Dict) {
  79131. xrefEntry.objId = ref.toString();
  79132. } else if (xrefEntry instanceof _base_stream.BaseStream) {
  79133. xrefEntry.dict.objId = ref.toString();
  79134. }
  79135. return xrefEntry;
  79136. }
  79137. fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {
  79138. const gen = ref.gen;
  79139. let num = ref.num;
  79140. if (xrefEntry.gen !== gen) {
  79141. throw new _core_utils.XRefEntryException(
  79142. `Inconsistent generation in XRef: ${ref}`
  79143. );
  79144. }
  79145. const stream = this.stream.makeSubStream(
  79146. xrefEntry.offset + this.stream.start
  79147. );
  79148. const parser = new _parser.Parser({
  79149. lexer: new _parser.Lexer(stream),
  79150. xref: this,
  79151. allowStreams: true,
  79152. });
  79153. const obj1 = parser.getObj();
  79154. const obj2 = parser.getObj();
  79155. const obj3 = parser.getObj();
  79156. if (
  79157. obj1 !== num ||
  79158. obj2 !== gen ||
  79159. !(obj3 instanceof _primitives.Cmd)
  79160. ) {
  79161. throw new _core_utils.XRefEntryException(
  79162. `Bad (uncompressed) XRef entry: ${ref}`
  79163. );
  79164. }
  79165. if (obj3.cmd !== "obj") {
  79166. if (obj3.cmd.startsWith("obj")) {
  79167. num = parseInt(obj3.cmd.substring(3), 10);
  79168. if (!Number.isNaN(num)) {
  79169. return num;
  79170. }
  79171. }
  79172. throw new _core_utils.XRefEntryException(
  79173. `Bad (uncompressed) XRef entry: ${ref}`
  79174. );
  79175. }
  79176. if (this.encrypt && !suppressEncryption) {
  79177. xrefEntry = parser.getObj(
  79178. this.encrypt.createCipherTransform(num, gen)
  79179. );
  79180. } else {
  79181. xrefEntry = parser.getObj();
  79182. }
  79183. if (!(xrefEntry instanceof _base_stream.BaseStream)) {
  79184. this._cacheMap.set(num, xrefEntry);
  79185. }
  79186. return xrefEntry;
  79187. }
  79188. fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
  79189. const tableOffset = xrefEntry.offset;
  79190. const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
  79191. if (!(stream instanceof _base_stream.BaseStream)) {
  79192. throw new _util.FormatError("bad ObjStm stream");
  79193. }
  79194. const first = stream.dict.get("First");
  79195. const n = stream.dict.get("N");
  79196. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  79197. throw new _util.FormatError(
  79198. "invalid first and n parameters for ObjStm stream"
  79199. );
  79200. }
  79201. let parser = new _parser.Parser({
  79202. lexer: new _parser.Lexer(stream),
  79203. xref: this,
  79204. allowStreams: true,
  79205. });
  79206. const nums = new Array(n);
  79207. const offsets = new Array(n);
  79208. for (let i = 0; i < n; ++i) {
  79209. const num = parser.getObj();
  79210. if (!Number.isInteger(num)) {
  79211. throw new _util.FormatError(
  79212. `invalid object number in the ObjStm stream: ${num}`
  79213. );
  79214. }
  79215. const offset = parser.getObj();
  79216. if (!Number.isInteger(offset)) {
  79217. throw new _util.FormatError(
  79218. `invalid object offset in the ObjStm stream: ${offset}`
  79219. );
  79220. }
  79221. nums[i] = num;
  79222. offsets[i] = offset;
  79223. }
  79224. const start = (stream.start || 0) + first;
  79225. const entries = new Array(n);
  79226. for (let i = 0; i < n; ++i) {
  79227. const length =
  79228. i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;
  79229. if (length < 0) {
  79230. throw new _util.FormatError(
  79231. "Invalid offset in the ObjStm stream."
  79232. );
  79233. }
  79234. parser = new _parser.Parser({
  79235. lexer: new _parser.Lexer(
  79236. stream.makeSubStream(start + offsets[i], length, stream.dict)
  79237. ),
  79238. xref: this,
  79239. allowStreams: true,
  79240. });
  79241. const obj = parser.getObj();
  79242. entries[i] = obj;
  79243. if (obj instanceof _base_stream.BaseStream) {
  79244. continue;
  79245. }
  79246. const num = nums[i],
  79247. entry = this.entries[num];
  79248. if (entry && entry.offset === tableOffset && entry.gen === i) {
  79249. this._cacheMap.set(num, obj);
  79250. }
  79251. }
  79252. xrefEntry = entries[xrefEntry.gen];
  79253. if (xrefEntry === undefined) {
  79254. throw new _core_utils.XRefEntryException(
  79255. `Bad (compressed) XRef entry: ${ref}`
  79256. );
  79257. }
  79258. return xrefEntry;
  79259. }
  79260. async fetchIfRefAsync(obj, suppressEncryption) {
  79261. if (obj instanceof _primitives.Ref) {
  79262. return this.fetchAsync(obj, suppressEncryption);
  79263. }
  79264. return obj;
  79265. }
  79266. async fetchAsync(ref, suppressEncryption) {
  79267. try {
  79268. return this.fetch(ref, suppressEncryption);
  79269. } catch (ex) {
  79270. if (!(ex instanceof _core_utils.MissingDataException)) {
  79271. throw ex;
  79272. }
  79273. await this.pdfManager.requestRange(ex.begin, ex.end);
  79274. return this.fetchAsync(ref, suppressEncryption);
  79275. }
  79276. }
  79277. getCatalogObj() {
  79278. return this.root;
  79279. }
  79280. }
  79281. exports.XRef = XRef;
  79282. /***/
  79283. },
  79284. /* 102 */
  79285. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  79286. Object.defineProperty(exports, "__esModule", {
  79287. value: true,
  79288. });
  79289. exports.MessageHandler = void 0;
  79290. var _util = __w_pdfjs_require__(2);
  79291. const CallbackKind = {
  79292. UNKNOWN: 0,
  79293. DATA: 1,
  79294. ERROR: 2,
  79295. };
  79296. const StreamKind = {
  79297. UNKNOWN: 0,
  79298. CANCEL: 1,
  79299. CANCEL_COMPLETE: 2,
  79300. CLOSE: 3,
  79301. ENQUEUE: 4,
  79302. ERROR: 5,
  79303. PULL: 6,
  79304. PULL_COMPLETE: 7,
  79305. START_COMPLETE: 8,
  79306. };
  79307. function wrapReason(reason) {
  79308. if (
  79309. !(
  79310. reason instanceof Error ||
  79311. (typeof reason === "object" && reason !== null)
  79312. )
  79313. ) {
  79314. (0, _util.unreachable)(
  79315. 'wrapReason: Expected "reason" to be a (possibly cloned) Error.'
  79316. );
  79317. }
  79318. switch (reason.name) {
  79319. case "AbortException":
  79320. return new _util.AbortException(reason.message);
  79321. case "MissingPDFException":
  79322. return new _util.MissingPDFException(reason.message);
  79323. case "PasswordException":
  79324. return new _util.PasswordException(reason.message, reason.code);
  79325. case "UnexpectedResponseException":
  79326. return new _util.UnexpectedResponseException(
  79327. reason.message,
  79328. reason.status
  79329. );
  79330. case "UnknownErrorException":
  79331. return new _util.UnknownErrorException(
  79332. reason.message,
  79333. reason.details
  79334. );
  79335. default:
  79336. return new _util.UnknownErrorException(
  79337. reason.message,
  79338. reason.toString()
  79339. );
  79340. }
  79341. }
  79342. class MessageHandler {
  79343. constructor(sourceName, targetName, comObj) {
  79344. this.sourceName = sourceName;
  79345. this.targetName = targetName;
  79346. this.comObj = comObj;
  79347. this.callbackId = 1;
  79348. this.streamId = 1;
  79349. this.streamSinks = Object.create(null);
  79350. this.streamControllers = Object.create(null);
  79351. this.callbackCapabilities = Object.create(null);
  79352. this.actionHandler = Object.create(null);
  79353. this._onComObjOnMessage = (event) => {
  79354. const data = event.data;
  79355. if (data.targetName !== this.sourceName) {
  79356. return;
  79357. }
  79358. if (data.stream) {
  79359. this._processStreamMessage(data);
  79360. return;
  79361. }
  79362. if (data.callback) {
  79363. const callbackId = data.callbackId;
  79364. const capability = this.callbackCapabilities[callbackId];
  79365. if (!capability) {
  79366. throw new Error(`Cannot resolve callback ${callbackId}`);
  79367. }
  79368. delete this.callbackCapabilities[callbackId];
  79369. if (data.callback === CallbackKind.DATA) {
  79370. capability.resolve(data.data);
  79371. } else if (data.callback === CallbackKind.ERROR) {
  79372. capability.reject(wrapReason(data.reason));
  79373. } else {
  79374. throw new Error("Unexpected callback case");
  79375. }
  79376. return;
  79377. }
  79378. const action = this.actionHandler[data.action];
  79379. if (!action) {
  79380. throw new Error(`Unknown action from worker: ${data.action}`);
  79381. }
  79382. if (data.callbackId) {
  79383. const cbSourceName = this.sourceName;
  79384. const cbTargetName = data.sourceName;
  79385. new Promise(function (resolve) {
  79386. resolve(action(data.data));
  79387. }).then(
  79388. function (result) {
  79389. comObj.postMessage({
  79390. sourceName: cbSourceName,
  79391. targetName: cbTargetName,
  79392. callback: CallbackKind.DATA,
  79393. callbackId: data.callbackId,
  79394. data: result,
  79395. });
  79396. },
  79397. function (reason) {
  79398. comObj.postMessage({
  79399. sourceName: cbSourceName,
  79400. targetName: cbTargetName,
  79401. callback: CallbackKind.ERROR,
  79402. callbackId: data.callbackId,
  79403. reason: wrapReason(reason),
  79404. });
  79405. }
  79406. );
  79407. return;
  79408. }
  79409. if (data.streamId) {
  79410. this._createStreamSink(data);
  79411. return;
  79412. }
  79413. action(data.data);
  79414. };
  79415. comObj.addEventListener("message", this._onComObjOnMessage);
  79416. }
  79417. on(actionName, handler) {
  79418. const ah = this.actionHandler;
  79419. if (ah[actionName]) {
  79420. throw new Error(
  79421. `There is already an actionName called "${actionName}"`
  79422. );
  79423. }
  79424. ah[actionName] = handler;
  79425. }
  79426. send(actionName, data, transfers) {
  79427. this.comObj.postMessage(
  79428. {
  79429. sourceName: this.sourceName,
  79430. targetName: this.targetName,
  79431. action: actionName,
  79432. data,
  79433. },
  79434. transfers
  79435. );
  79436. }
  79437. sendWithPromise(actionName, data, transfers) {
  79438. const callbackId = this.callbackId++;
  79439. const capability = (0, _util.createPromiseCapability)();
  79440. this.callbackCapabilities[callbackId] = capability;
  79441. try {
  79442. this.comObj.postMessage(
  79443. {
  79444. sourceName: this.sourceName,
  79445. targetName: this.targetName,
  79446. action: actionName,
  79447. callbackId,
  79448. data,
  79449. },
  79450. transfers
  79451. );
  79452. } catch (ex) {
  79453. capability.reject(ex);
  79454. }
  79455. return capability.promise;
  79456. }
  79457. sendWithStream(actionName, data, queueingStrategy, transfers) {
  79458. const streamId = this.streamId++,
  79459. sourceName = this.sourceName,
  79460. targetName = this.targetName,
  79461. comObj = this.comObj;
  79462. return new ReadableStream(
  79463. {
  79464. start: (controller) => {
  79465. const startCapability = (0, _util.createPromiseCapability)();
  79466. this.streamControllers[streamId] = {
  79467. controller,
  79468. startCall: startCapability,
  79469. pullCall: null,
  79470. cancelCall: null,
  79471. isClosed: false,
  79472. };
  79473. comObj.postMessage(
  79474. {
  79475. sourceName,
  79476. targetName,
  79477. action: actionName,
  79478. streamId,
  79479. data,
  79480. desiredSize: controller.desiredSize,
  79481. },
  79482. transfers
  79483. );
  79484. return startCapability.promise;
  79485. },
  79486. pull: (controller) => {
  79487. const pullCapability = (0, _util.createPromiseCapability)();
  79488. this.streamControllers[streamId].pullCall = pullCapability;
  79489. comObj.postMessage({
  79490. sourceName,
  79491. targetName,
  79492. stream: StreamKind.PULL,
  79493. streamId,
  79494. desiredSize: controller.desiredSize,
  79495. });
  79496. return pullCapability.promise;
  79497. },
  79498. cancel: (reason) => {
  79499. (0, _util.assert)(
  79500. reason instanceof Error,
  79501. "cancel must have a valid reason"
  79502. );
  79503. const cancelCapability = (0, _util.createPromiseCapability)();
  79504. this.streamControllers[streamId].cancelCall =
  79505. cancelCapability;
  79506. this.streamControllers[streamId].isClosed = true;
  79507. comObj.postMessage({
  79508. sourceName,
  79509. targetName,
  79510. stream: StreamKind.CANCEL,
  79511. streamId,
  79512. reason: wrapReason(reason),
  79513. });
  79514. return cancelCapability.promise;
  79515. },
  79516. },
  79517. queueingStrategy
  79518. );
  79519. }
  79520. _createStreamSink(data) {
  79521. const streamId = data.streamId,
  79522. sourceName = this.sourceName,
  79523. targetName = data.sourceName,
  79524. comObj = this.comObj;
  79525. const self = this,
  79526. action = this.actionHandler[data.action];
  79527. const streamSink = {
  79528. enqueue(chunk, size = 1, transfers) {
  79529. if (this.isCancelled) {
  79530. return;
  79531. }
  79532. const lastDesiredSize = this.desiredSize;
  79533. this.desiredSize -= size;
  79534. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  79535. this.sinkCapability = (0, _util.createPromiseCapability)();
  79536. this.ready = this.sinkCapability.promise;
  79537. }
  79538. comObj.postMessage(
  79539. {
  79540. sourceName,
  79541. targetName,
  79542. stream: StreamKind.ENQUEUE,
  79543. streamId,
  79544. chunk,
  79545. },
  79546. transfers
  79547. );
  79548. },
  79549. close() {
  79550. if (this.isCancelled) {
  79551. return;
  79552. }
  79553. this.isCancelled = true;
  79554. comObj.postMessage({
  79555. sourceName,
  79556. targetName,
  79557. stream: StreamKind.CLOSE,
  79558. streamId,
  79559. });
  79560. delete self.streamSinks[streamId];
  79561. },
  79562. error(reason) {
  79563. (0, _util.assert)(
  79564. reason instanceof Error,
  79565. "error must have a valid reason"
  79566. );
  79567. if (this.isCancelled) {
  79568. return;
  79569. }
  79570. this.isCancelled = true;
  79571. comObj.postMessage({
  79572. sourceName,
  79573. targetName,
  79574. stream: StreamKind.ERROR,
  79575. streamId,
  79576. reason: wrapReason(reason),
  79577. });
  79578. },
  79579. sinkCapability: (0, _util.createPromiseCapability)(),
  79580. onPull: null,
  79581. onCancel: null,
  79582. isCancelled: false,
  79583. desiredSize: data.desiredSize,
  79584. ready: null,
  79585. };
  79586. streamSink.sinkCapability.resolve();
  79587. streamSink.ready = streamSink.sinkCapability.promise;
  79588. this.streamSinks[streamId] = streamSink;
  79589. new Promise(function (resolve) {
  79590. resolve(action(data.data, streamSink));
  79591. }).then(
  79592. function () {
  79593. comObj.postMessage({
  79594. sourceName,
  79595. targetName,
  79596. stream: StreamKind.START_COMPLETE,
  79597. streamId,
  79598. success: true,
  79599. });
  79600. },
  79601. function (reason) {
  79602. comObj.postMessage({
  79603. sourceName,
  79604. targetName,
  79605. stream: StreamKind.START_COMPLETE,
  79606. streamId,
  79607. reason: wrapReason(reason),
  79608. });
  79609. }
  79610. );
  79611. }
  79612. _processStreamMessage(data) {
  79613. const streamId = data.streamId,
  79614. sourceName = this.sourceName,
  79615. targetName = data.sourceName,
  79616. comObj = this.comObj;
  79617. const streamController = this.streamControllers[streamId],
  79618. streamSink = this.streamSinks[streamId];
  79619. switch (data.stream) {
  79620. case StreamKind.START_COMPLETE:
  79621. if (data.success) {
  79622. streamController.startCall.resolve();
  79623. } else {
  79624. streamController.startCall.reject(wrapReason(data.reason));
  79625. }
  79626. break;
  79627. case StreamKind.PULL_COMPLETE:
  79628. if (data.success) {
  79629. streamController.pullCall.resolve();
  79630. } else {
  79631. streamController.pullCall.reject(wrapReason(data.reason));
  79632. }
  79633. break;
  79634. case StreamKind.PULL:
  79635. if (!streamSink) {
  79636. comObj.postMessage({
  79637. sourceName,
  79638. targetName,
  79639. stream: StreamKind.PULL_COMPLETE,
  79640. streamId,
  79641. success: true,
  79642. });
  79643. break;
  79644. }
  79645. if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
  79646. streamSink.sinkCapability.resolve();
  79647. }
  79648. streamSink.desiredSize = data.desiredSize;
  79649. new Promise(function (resolve) {
  79650. resolve(streamSink.onPull && streamSink.onPull());
  79651. }).then(
  79652. function () {
  79653. comObj.postMessage({
  79654. sourceName,
  79655. targetName,
  79656. stream: StreamKind.PULL_COMPLETE,
  79657. streamId,
  79658. success: true,
  79659. });
  79660. },
  79661. function (reason) {
  79662. comObj.postMessage({
  79663. sourceName,
  79664. targetName,
  79665. stream: StreamKind.PULL_COMPLETE,
  79666. streamId,
  79667. reason: wrapReason(reason),
  79668. });
  79669. }
  79670. );
  79671. break;
  79672. case StreamKind.ENQUEUE:
  79673. (0, _util.assert)(
  79674. streamController,
  79675. "enqueue should have stream controller"
  79676. );
  79677. if (streamController.isClosed) {
  79678. break;
  79679. }
  79680. streamController.controller.enqueue(data.chunk);
  79681. break;
  79682. case StreamKind.CLOSE:
  79683. (0, _util.assert)(
  79684. streamController,
  79685. "close should have stream controller"
  79686. );
  79687. if (streamController.isClosed) {
  79688. break;
  79689. }
  79690. streamController.isClosed = true;
  79691. streamController.controller.close();
  79692. this._deleteStreamController(streamController, streamId);
  79693. break;
  79694. case StreamKind.ERROR:
  79695. (0, _util.assert)(
  79696. streamController,
  79697. "error should have stream controller"
  79698. );
  79699. streamController.controller.error(wrapReason(data.reason));
  79700. this._deleteStreamController(streamController, streamId);
  79701. break;
  79702. case StreamKind.CANCEL_COMPLETE:
  79703. if (data.success) {
  79704. streamController.cancelCall.resolve();
  79705. } else {
  79706. streamController.cancelCall.reject(wrapReason(data.reason));
  79707. }
  79708. this._deleteStreamController(streamController, streamId);
  79709. break;
  79710. case StreamKind.CANCEL:
  79711. if (!streamSink) {
  79712. break;
  79713. }
  79714. new Promise(function (resolve) {
  79715. resolve(
  79716. streamSink.onCancel &&
  79717. streamSink.onCancel(wrapReason(data.reason))
  79718. );
  79719. }).then(
  79720. function () {
  79721. comObj.postMessage({
  79722. sourceName,
  79723. targetName,
  79724. stream: StreamKind.CANCEL_COMPLETE,
  79725. streamId,
  79726. success: true,
  79727. });
  79728. },
  79729. function (reason) {
  79730. comObj.postMessage({
  79731. sourceName,
  79732. targetName,
  79733. stream: StreamKind.CANCEL_COMPLETE,
  79734. streamId,
  79735. reason: wrapReason(reason),
  79736. });
  79737. }
  79738. );
  79739. streamSink.sinkCapability.reject(wrapReason(data.reason));
  79740. streamSink.isCancelled = true;
  79741. delete this.streamSinks[streamId];
  79742. break;
  79743. default:
  79744. throw new Error("Unexpected stream case");
  79745. }
  79746. }
  79747. async _deleteStreamController(streamController, streamId) {
  79748. await Promise.allSettled([
  79749. streamController.startCall && streamController.startCall.promise,
  79750. streamController.pullCall && streamController.pullCall.promise,
  79751. streamController.cancelCall &&
  79752. streamController.cancelCall.promise,
  79753. ]);
  79754. delete this.streamControllers[streamId];
  79755. }
  79756. destroy() {
  79757. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  79758. }
  79759. }
  79760. exports.MessageHandler = MessageHandler;
  79761. /***/
  79762. },
  79763. /* 103 */
  79764. /***/ (__unused_webpack_module, exports, __w_pdfjs_require__) => {
  79765. Object.defineProperty(exports, "__esModule", {
  79766. value: true,
  79767. });
  79768. exports.PDFWorkerStream = void 0;
  79769. var _util = __w_pdfjs_require__(2);
  79770. class PDFWorkerStream {
  79771. constructor(msgHandler) {
  79772. this._msgHandler = msgHandler;
  79773. this._contentLength = null;
  79774. this._fullRequestReader = null;
  79775. this._rangeRequestReaders = [];
  79776. }
  79777. getFullReader() {
  79778. (0, _util.assert)(
  79779. !this._fullRequestReader,
  79780. "PDFWorkerStream.getFullReader can only be called once."
  79781. );
  79782. this._fullRequestReader = new PDFWorkerStreamReader(
  79783. this._msgHandler
  79784. );
  79785. return this._fullRequestReader;
  79786. }
  79787. getRangeReader(begin, end) {
  79788. const reader = new PDFWorkerStreamRangeReader(
  79789. begin,
  79790. end,
  79791. this._msgHandler
  79792. );
  79793. this._rangeRequestReaders.push(reader);
  79794. return reader;
  79795. }
  79796. cancelAllRequests(reason) {
  79797. if (this._fullRequestReader) {
  79798. this._fullRequestReader.cancel(reason);
  79799. }
  79800. for (const reader of this._rangeRequestReaders.slice(0)) {
  79801. reader.cancel(reason);
  79802. }
  79803. }
  79804. }
  79805. exports.PDFWorkerStream = PDFWorkerStream;
  79806. class PDFWorkerStreamReader {
  79807. constructor(msgHandler) {
  79808. this._msgHandler = msgHandler;
  79809. this.onProgress = null;
  79810. this._contentLength = null;
  79811. this._isRangeSupported = false;
  79812. this._isStreamingSupported = false;
  79813. const readableStream = this._msgHandler.sendWithStream("GetReader");
  79814. this._reader = readableStream.getReader();
  79815. this._headersReady = this._msgHandler
  79816. .sendWithPromise("ReaderHeadersReady")
  79817. .then((data) => {
  79818. this._isStreamingSupported = data.isStreamingSupported;
  79819. this._isRangeSupported = data.isRangeSupported;
  79820. this._contentLength = data.contentLength;
  79821. });
  79822. }
  79823. get headersReady() {
  79824. return this._headersReady;
  79825. }
  79826. get contentLength() {
  79827. return this._contentLength;
  79828. }
  79829. get isStreamingSupported() {
  79830. return this._isStreamingSupported;
  79831. }
  79832. get isRangeSupported() {
  79833. return this._isRangeSupported;
  79834. }
  79835. async read() {
  79836. const { value, done } = await this._reader.read();
  79837. if (done) {
  79838. return {
  79839. value: undefined,
  79840. done: true,
  79841. };
  79842. }
  79843. return {
  79844. value: value.buffer,
  79845. done: false,
  79846. };
  79847. }
  79848. cancel(reason) {
  79849. this._reader.cancel(reason);
  79850. }
  79851. }
  79852. class PDFWorkerStreamRangeReader {
  79853. constructor(begin, end, msgHandler) {
  79854. this._msgHandler = msgHandler;
  79855. this.onProgress = null;
  79856. const readableStream = this._msgHandler.sendWithStream(
  79857. "GetRangeReader",
  79858. {
  79859. begin,
  79860. end,
  79861. }
  79862. );
  79863. this._reader = readableStream.getReader();
  79864. }
  79865. get isStreamingSupported() {
  79866. return false;
  79867. }
  79868. async read() {
  79869. const { value, done } = await this._reader.read();
  79870. if (done) {
  79871. return {
  79872. value: undefined,
  79873. done: true,
  79874. };
  79875. }
  79876. return {
  79877. value: value.buffer,
  79878. done: false,
  79879. };
  79880. }
  79881. cancel(reason) {
  79882. this._reader.cancel(reason);
  79883. }
  79884. }
  79885. /***/
  79886. },
  79887. /******/
  79888. ];
  79889. /************************************************************************/
  79890. /******/ // The module cache
  79891. /******/ var __webpack_module_cache__ = {};
  79892. /******/
  79893. /******/ // The require function
  79894. /******/ function __w_pdfjs_require__(moduleId) {
  79895. /******/ // Check if module is in cache
  79896. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  79897. /******/ if (cachedModule !== undefined) {
  79898. /******/ return cachedModule.exports;
  79899. /******/
  79900. }
  79901. /******/ // Create a new module (and put it into the cache)
  79902. /******/ var module = (__webpack_module_cache__[moduleId] = {
  79903. /******/ // no module.id needed
  79904. /******/ // no module.loaded needed
  79905. /******/ exports: {},
  79906. /******/
  79907. });
  79908. /******/
  79909. /******/ // Execute the module function
  79910. /******/ __webpack_modules__[moduleId](
  79911. module,
  79912. module.exports,
  79913. __w_pdfjs_require__
  79914. );
  79915. /******/
  79916. /******/ // Return the exports of the module
  79917. /******/ return module.exports;
  79918. /******/
  79919. }
  79920. /******/
  79921. /************************************************************************/
  79922. /******/ /* webpack/runtime/define property getters */
  79923. /******/ (() => {
  79924. /******/ // define getter functions for harmony exports
  79925. /******/ __w_pdfjs_require__.d = (exports, definition) => {
  79926. /******/ for (var key in definition) {
  79927. /******/ if (
  79928. __w_pdfjs_require__.o(definition, key) &&
  79929. !__w_pdfjs_require__.o(exports, key)
  79930. ) {
  79931. /******/ Object.defineProperty(exports, key, {
  79932. enumerable: true,
  79933. get: definition[key],
  79934. });
  79935. /******/
  79936. }
  79937. /******/
  79938. }
  79939. /******/
  79940. };
  79941. /******/
  79942. })();
  79943. /******/
  79944. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  79945. /******/ (() => {
  79946. /******/ __w_pdfjs_require__.o = (obj, prop) =>
  79947. Object.prototype.hasOwnProperty.call(obj, prop);
  79948. /******/
  79949. })();
  79950. /******/
  79951. /******/ /* webpack/runtime/make namespace object */
  79952. /******/ (() => {
  79953. /******/ // define __esModule on exports
  79954. /******/ __w_pdfjs_require__.r = (exports) => {
  79955. /******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
  79956. /******/ Object.defineProperty(exports, Symbol.toStringTag, {
  79957. value: "Module",
  79958. });
  79959. /******/
  79960. }
  79961. /******/ Object.defineProperty(exports, "__esModule", { value: true });
  79962. /******/
  79963. };
  79964. /******/
  79965. })();
  79966. /******/
  79967. /************************************************************************/
  79968. var __webpack_exports__ = {};
  79969. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  79970. (() => {
  79971. var exports = __webpack_exports__;
  79972. Object.defineProperty(exports, "__esModule", {
  79973. value: true,
  79974. });
  79975. Object.defineProperty(exports, "WorkerMessageHandler", {
  79976. enumerable: true,
  79977. get: function () {
  79978. return _worker.WorkerMessageHandler;
  79979. },
  79980. });
  79981. var _worker = __w_pdfjs_require__(1);
  79982. const pdfjsVersion = "2.16.105";
  79983. const pdfjsBuild = "172ccdbe5";
  79984. })();
  79985. /******/ return __webpack_exports__;
  79986. /******/
  79987. })();
  79988. });
  79989. //# sourceMappingURL=pdf.worker.js.map